diff --git a/.eslintignore b/.eslintignore index 1e3abd9ff..a82960313 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,8 @@ # Needs to be ignored because it uses ESM export/import apps/gipy/pkg/gps.js +apps/gipy/pkg/gps.d.ts +apps/gipy/pkg/gps_bg.wasm.d.ts # Needs to be ignored because it includes broken JS apps/health/chart.min.js diff --git a/.eslintrc.js b/.eslintrc.js index e79f87a5d..b7590a77e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -112,6 +112,7 @@ module.exports = { "getSerial": "readonly", "getTime": "readonly", "global": "readonly", + "globalThis": "readonly", "HIGH": "readonly", "I2C1": "readonly", "Infinity": "readonly", diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e2fbf5609..a20c7ed7c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,5 @@ updates: directory: "/" schedule: interval: "daily" + reviewers: + - "gfwilliams" diff --git a/README.md b/README.md index d595c7df1..0bc511450 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ and which gives information about the app for the Launcher. "src":"-myappid", // source file "type":"widget/clock/app/bootloader/...", // optional, default "app" // see 'type' in 'metadata.json format' below for more options/info - "version":"1.23", + "version":"0.01", // added by BangleApps loader on upload based on metadata.json "files:"file1,file2,file3", // added by BangleApps loader on upload - lists all files @@ -249,7 +249,7 @@ and which gives information about the app for the Launcher. { "id": "appid", // 7 character app id "name": "Readable name", // readable name "shortName": "Short name", // short name for launcher - "version": "0v01", // the version of this app + "version": "0.01", // the version of this app "description": "...", // long description (can contain markdown) "icon": "icon.png", // icon in apps/ "screenshots" : [ { "url":"screenshot.png" } ], // optional screenshot for app @@ -270,7 +270,8 @@ and which gives information about the app for the Launcher. // 'notify' - provides 'notify' library for showing notifications // 'locale' - provides 'locale' library for language-specific date/distance/etc // (a version of 'locale' is included in the firmware) - "tags": "", // comma separated tag list for searching + // 'defaultconfig' - a set of apps that will can be installed and will wipe out all previously installed apps + "tags": "", // comma separated tag list for searching (don't include uppercase or spaces) // common types are: // 'clock' - it's a clock // 'widget' - it is (or provides) a widget @@ -289,6 +290,7 @@ and which gives information about the app for the Launcher. "dependencies" : { "message":"widget" } // optional, depend on a specific type of widget - see provides_widgets "provides_modules" : ["messageicons"] // optional, this app provides a module that can be used with 'require' "provides_widgets" : ["battery"] // optional, this app provides a type of widget - 'alarm/battery/bluetooth/pedometer/message' + "provides_features" : ["welcome"] // optional, this app provides some feature, used to ensure two aren't installed at once. Currently just 'welcome' "default" : true, // set if an app is the default implementer of something (a widget/module/etc) "readme": "README.md", // if supplied, a link to a markdown-style text file // that contains more information about this app (usage, etc) diff --git a/android.html b/android.html index a0bc6075a..1dc015468 100644 --- a/android.html +++ b/android.html @@ -85,6 +85,7 @@ + - + @@ -416,7 +425,7 @@ if (el) el.addEventListener("click", event=>{ if (webrtc) showWebRTCID(webrtc.peerId); else { webrtc = webrtcInit({ - bridge:true, + bridge:true, onStatus : function(s) { showToast(s); }, @@ -432,7 +441,7 @@ if (el) el.addEventListener("click", event=>{ onPortDisconnect : function(serialPort) { }, onPortWrite : function(data, cb) { - Puck.write(data, cb); + Puck.write(data, cb); } }); connection.on("data", function(d) { diff --git a/apps/93dub/ChangeLog b/apps/93dub/ChangeLog index 712a52a37..9a07b38ad 100644 --- a/apps/93dub/ChangeLog +++ b/apps/93dub/ChangeLog @@ -5,3 +5,4 @@ 0.05: Display time, even on Thursday 0.06: Fix light theme issue, where widgets would end up on a light strip 0.07: Minor code improvements +0.08: Support Fast Loading diff --git a/apps/93dub/app.js b/apps/93dub/app.js index c9f670993..dbf8ec907 100644 --- a/apps/93dub/app.js +++ b/apps/93dub/app.js @@ -1,146 +1,162 @@ -// get 12 hour status, code from barclock -const is12Hour = (require("Storage").readJSON("setting.json", 1) || {})["12hour"]; +{ + // get 12 hour status, code from barclock + const is12Hour = (require("Storage").readJSON("setting.json", 1) || {})["12hour"]; -// define background -var imgBg = require("heatshrink").decompress(atob("2GwgJC/AH4A/AH4A/AH4A/AH4A/ACcGAhAV/Cp3gvdug+Gj0AgeABYMBAQMIggVEg/w/9/h/Gn8As3ACpk559zznmseAs0B13nq/Rie+uodCIIUZw9hzFmv+AgcCmco7MRilow1ACpN8gFhwMilFRCoMowgVEIIVhIINhwFg4GiCpfw/dhx/mn4uBCoXRhWktAVFTIVhw9mj8YseDkUnqPEoeuugVEAAlgSgICBACAVC8AUQCQQVSAEsD/4ASeYgA/ACkHNiK5Cj4VR/AVBng+RCQVwCqMOAQPhIKOHgEB44VR8YVBx4VR+eAgOfCqPxwEDCqX5CoKvS/PAgc/YqQVU/gV/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/CsMfCqP4CoOfCqP54EBx4VR+OAgPPCqPzwEA44VR4cAgHhCqMHCoNwAQIAPjwCBngVRvgCBV6XwCoMHCqPAHyIA/AEigEf4IAOkAEDoAPJWAtA+PHv+Al6uPCofAGAgALoHz51/8AVT+IVS+4VPpMR73woH27n/8Eh8+ZmadIqsoyGICofAkMUktJFZAVBzgVBv34YgMhi8RkIVJnGQIIN8/H34FB8kJiIVIkVEyGQkF8/Pj4GBkhBKCoOexEQvHx8fBgMXzMxTJkICoXCVx8AggDGABsD/4AB/AVQAH4APA")); + // define background + const imgBg = require("heatshrink").decompress(atob("2GwgJC/AH4A/AH4A/AH4A/AH4A/ACcGAhAV/Cp3gvdug+Gj0AgeABYMBAQMIggVEg/w/9/h/Gn8As3ACpk559zznmseAs0B13nq/Rie+uodCIIUZw9hzFmv+AgcCmco7MRilow1ACpN8gFhwMilFRCoMowgVEIIVhIINhwFg4GiCpfw/dhx/mn4uBCoXRhWktAVFTIVhw9mj8YseDkUnqPEoeuugVEAAlgSgICBACAVC8AUQCQQVSAEsD/4ASeYgA/ACkHNiK5Cj4VR/AVBng+RCQVwCqMOAQPhIKOHgEB44VR8YVBx4VR+eAgOfCqPxwEDCqX5CoKvS/PAgc/YqQVU/gV/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/Cv4V/CsMfCqP4CoOfCqP54EBx4VR+OAgPPCqPzwEA44VR4cAgHhCqMHCoNwAQIAPjwCBngVRvgCBV6XwCoMHCqPAHyIA/AEigEf4IAOkAEDoAPJWAtA+PHv+Al6uPCofAGAgALoHz51/8AVT+IVS+4VPpMR73woH27n/8Eh8+ZmadIqsoyGICofAkMUktJFZAVBzgVBv34YgMhi8RkIVJnGQIIN8/H34FB8kJiIVIkVEyGQkF8/Pj4GBkhBKCoOexEQvHx8fBgMXzMxTJkICoXCVx8AggDGABsD/4AB/AVQAH4APA")); -// define fonts -// reg number first char 48 28 by 41 -var fontNum = atob("AAAAAAAAAAAAAA//8D//g//8P/+I//8//44//w//j4//A/+P4/8A/4/4AAAAD/4AAAAP/wAAAAf/gAAAA//AAAAB/+AAAAD/8AAAAH/4AAAAP/wAAAAf/gAAAA//AAAAB/+AAAAD/8AAAAH/wAAAAH/H/gH/H8f/gf/Hx//h//HH//n//Ef/+H//B//4H//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wB/4AP/4H/4A//4f/4D//5//4P//h//4//+B//4AAAAAAAAAAAAAAAAAf/+AAAB//4gAAD//jgAAD/+PgABj/4/gAHj/j/gAfgAP/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/AA/AAf8f88AAfx/8wAAfH/8AAAcf/8AAAR//4AAAH//gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAA4AAAAAD4AAYAAP4AD8AA/4AH4AD/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/wAHgAH/H/GH/H8f/gf/Hx//h//HH//n//Ef/+H//B//4H//AAAAAAAAAAAAAAP//AAAAP//AAAAP//AAAAP/8AAAAP/2AAAAP/eAAAAAB+AAAAAD8AAAAAH4AAAAAPwAAAAAfgAAAAA/AAAAAB+AAAAAD8AAAAAH4AAAAAPwAAAAAfgAAAAA/AAAAAB+AAAAAD8AAAB/7x/4AH/7H/4Af/4f/4B//5//4H//h//4f/+B//4AAAAAAAAAAAAAD//wAAAD//wAAAj//gAADj/+AAAPj/5gAA/j/ngAD/gAfgAP/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/AA/AAf8AA8f8fwAAx/8fAAAH/8cAAAf/8QAAA//8AAAA//8AAAAAAAAAAAAAA//8D//g//8P/+I//8//44//0//j4//Y/+P4/94/4/4AH4AD/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/wAPwAH/AAPH/H8AAMf/HwAAB//HAAAH//EAAAH//AAAAH//AAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAGAAAAAAOAAAAAAeAAAAAA+AAAAAB+AAAAAD8AAAAAH4AAAAAPwAAAAAfgAAAAA/AAAAAB+AAAAAD8AAAAAH4AAAAAPwAAAAAfgAAAAA/AAAAAB8AAAAADx/4B/4HH/4H/4Mf/4f/4R//5//4H//h//4f/+B//4AAAAAAAAAAAAAD//wP/+D//w//4j//z//jj//T/+Pj/9j/4/j/3j/j/gAfgAP/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/AA/AAf8f+8f8fx/+x/8fH/+H/8cf/+f/8R//4f/8H//gf/8AAAAAAAAAAAAAA//8AAAA//8AAAI//8AAA4//0AAD4//YAAP4/94AA/4AH4AD/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/wAPwAH/H/vH/H8f/sf/Hx//h//HH//n//Ef/+H//B//4H//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); -// tiny font for percentage first char 48 6 by 8 -//var fontTiny = atob("AH6BgYF+ACFB/wEBAGGDhYlxAEKBkZFuAAx0hP8EAPqRkZGOAH6RkZFOAICHmKDAAG6RkZFuAHKJiYl+AAAAAAAAAAAAAAAA"); -// date font first char 48 12 by 15 -var fontDate = atob("AAAAAfv149wAeADwAeADwAeADvHr9+AAAAAAAAAAAAAAAAAAAAAAAAAPHn9/AAAAAAP0A9wweGDwweGDwweGDvAL8AAAAAAAAAAAgwOGDwweGDwweGDvHp98AAAAA/gB6AAwAGAAwAGAAwAGAPHj9/AAAAAfgF6BwweGDwweGDwweGDgHoB+AAAAAfv169wweGDwweGDwweGDgHoB+AAAAAAAAAAgAGAAwAGAAwAGAAvHh9/AAAAAfv169wweGDwweGDwweGDvHr9+AAAAAfgF6BwweGDwweGDwweGDvHr9+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); + // define fonts + // reg number first char 48 28 by 41 + const fontNum = atob("AAAAAAAAAAAAAA//8D//g//8P/+I//8//44//w//j4//A/+P4/8A/4/4AAAAD/4AAAAP/wAAAAf/gAAAA//AAAAB/+AAAAD/8AAAAH/4AAAAP/wAAAAf/gAAAA//AAAAB/+AAAAD/8AAAAH/wAAAAH/H/gH/H8f/gf/Hx//h//HH//n//Ef/+H//B//4H//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wB/4AP/4H/4A//4f/4D//5//4P//h//4//+B//4AAAAAAAAAAAAAAAAAf/+AAAB//4gAAD//jgAAD/+PgABj/4/gAHj/j/gAfgAP/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/AA/AAf8f88AAfx/8wAAfH/8AAAcf/8AAAR//4AAAH//gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAA4AAAAAD4AAYAAP4AD8AA/4AH4AD/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/wAHgAH/H/GH/H8f/gf/Hx//h//HH//n//Ef/+H//B//4H//AAAAAAAAAAAAAAP//AAAAP//AAAAP//AAAAP/8AAAAP/2AAAAP/eAAAAAB+AAAAAD8AAAAAH4AAAAAPwAAAAAfgAAAAA/AAAAAB+AAAAAD8AAAAAH4AAAAAPwAAAAAfgAAAAA/AAAAAB+AAAAAD8AAAB/7x/4AH/7H/4Af/4f/4B//5//4H//h//4f/+B//4AAAAAAAAAAAAAD//wAAAD//wAAAj//gAADj/+AAAPj/5gAA/j/ngAD/gAfgAP/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/AA/AAf8AA8f8fwAAx/8fAAAH/8cAAAf/8QAAA//8AAAA//8AAAAAAAAAAAAAA//8D//g//8P/+I//8//44//0//j4//Y/+P4/94/4/4AH4AD/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/wAPwAH/AAPH/H8AAMf/HwAAB//HAAAH//EAAAH//AAAAH//AAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAGAAAAAAOAAAAAAeAAAAAA+AAAAAB+AAAAAD8AAAAAH4AAAAAPwAAAAAfgAAAAA/AAAAAB+AAAAAD8AAAAAH4AAAAAPwAAAAAfgAAAAA/AAAAAB8AAAAADx/4B/4HH/4H/4Mf/4f/4R//5//4H//h//4f/+B//4AAAAAAAAAAAAAD//wP/+D//w//4j//z//jj//T/+Pj/9j/4/j/3j/j/gAfgAP/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/AA/AAf8f+8f8fx/+x/8fH/+H/8cf/+f/8R//4f/8H//gf/8AAAAAAAAAAAAAA//8AAAA//8AAAI//8AAA4//0AAD4//YAAP4/94AA/4AH4AD/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/4APwAP/wAfgAf/gA/AA//AB+AB/+AD8AD/8AH4AH/wAPwAH/H/vH/H8f/sf/Hx//h//HH//n//Ef/+H//B//4H//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); + // tiny font for percentage first char 48 6 by 8 + //var fontTiny = atob("AH6BgYF+ACFB/wEBAGGDhYlxAEKBkZFuAAx0hP8EAPqRkZGOAH6RkZFOAICHmKDAAG6RkZFuAHKJiYl+AAAAAAAAAAAAAAAA"); + // date font first char 48 12 by 15 + const fontDate = atob("AAAAAfv149wAeADwAeADwAeADvHr9+AAAAAAAAAAAAAAAAAAAAAAAAAPHn9/AAAAAAP0A9wweGDwweGDwweGDvAL8AAAAAAAAAAAgwOGDwweGDwweGDvHp98AAAAA/gB6AAwAGAAwAGAAwAGAPHj9/AAAAAfgF6BwweGDwweGDwweGDgHoB+AAAAAfv169wweGDwweGDwweGDgHoB+AAAAAAAAAAgAGAAwAGAAwAGAAvHh9/AAAAAfv169wweGDwweGDwweGDvHr9+AAAAAfgF6BwweGDwweGDwweGDvHr9+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); -// define days of the week images -var imgMon = E.toArrayBuffer(atob("Ig8BgHwfD5AvB8HD8z8wMPzPzMQzM/M/DMz8z8c7f7f7z////3Oz+3+PzPzPw/M/M/D8z8z8PzPzPw/vB8/n/8H3/A==")); -var imgTue = E.toArrayBuffer(atob("Ig8BwDv9wDAOfmgf/5+Z///n5n/5+fmf/n5+Z//fv9oH////Af37/b/+fn5n/5+fmf/n5+Z/+fn5n/5/g+gfn+D8AA==")); -var imgWed = E.toArrayBuffer(atob("Ig8Bf7gHgM/NA9Az8z/z8PzP/Pw/M/8/D8z/z8c7QPf7z+A//3O3/3+MzP/PwzM/8/D8z/z8PzP/PxAtA9A4B4B4DA==")); -var imgThu = E.toArrayBuffer(atob("Ig8BgHf7f6Ac/M/P/z8z8//PzPzz8/M/PPz8z8+/QLf7/+A///v3+3+8/PzPzz8/M/PPz8z88/PzPzz8/vB/P3/8HA==")); -var imgFri = E.toArrayBuffer(atob("Ig8B/wDwP7+geg/P5/5+c/n/n5z+f+fnP5/5+c/oHoF7/AfAf/7/7/+/n/k/z+f+R/P5/5j8/n/nHz+/++PP7//8+A==")); -var imgSat = E.toArrayBuffer(atob("Ig8B4DwDwDgOgXAJ/5+f/n/n5/+f+fn55/5+fnoHoF/fAfAf//+b/f3/5n5+f/mfn5/+Z+fn//n5+eAef358B7//nA==")); -var imgSun = E.toArrayBuffer(atob("Ig8BwHf7D7Ac/MHD/z8wMP/PzMQ/8/M/D/z8z8QPf7f6A/////83+3+/zPzPz/M/M/P8z8z8//PzPwA/B8/oD8H3/A==")); + // define days of the week images + const imgMon = E.toArrayBuffer(atob("Ig8BgHwfD5AvB8HD8z8wMPzPzMQzM/M/DMz8z8c7f7f7z////3Oz+3+PzPzPw/M/M/D8z8z8PzPzPw/vB8/n/8H3/A==")); + const imgTue = E.toArrayBuffer(atob("Ig8BwDv9wDAOfmgf/5+Z///n5n/5+fmf/n5+Z//fv9oH////Af37/b/+fn5n/5+fmf/n5+Z/+fn5n/5/g+gfn+D8AA==")); + const imgWed = E.toArrayBuffer(atob("Ig8Bf7gHgM/NA9Az8z/z8PzP/Pw/M/8/D8z/z8c7QPf7z+A//3O3/3+MzP/PwzM/8/D8z/z8PzP/PxAtA9A4B4B4DA==")); + const imgThu = E.toArrayBuffer(atob("Ig8BgHf7f6Ac/M/P/z8z8//PzPzz8/M/PPz8z8+/QLf7/+A///v3+3+8/PzPzz8/M/PPz8z88/PzPzz8/vB/P3/8HA==")); + const imgFri = E.toArrayBuffer(atob("Ig8B/wDwP7+geg/P5/5+c/n/n5z+f+fnP5/5+c/oHoF7/AfAf/7/7/+/n/k/z+f+R/P5/5j8/n/nHz+/++PP7//8+A==")); + const imgSat = E.toArrayBuffer(atob("Ig8B4DwDwDgOgXAJ/5+f/n/n5/+f+fn55/5+fnoHoF/fAfAf//+b/f3/5n5+f/mfn5/+Z+fn//n5+eAef358B7//nA==")); + const imgSun = E.toArrayBuffer(atob("Ig8BwHf7D7Ac/MHD/z8wMP/PzMQ/8/M/D/z8z8QPf7f6A/////83+3+/zPzPz/M/M/P8z8z8//PzPwA/B8/oD8H3/A==")); -// define icons -var imgSep = E.toArrayBuffer(atob("BhsBAAAAAA///////////////AAAAAAA")); -//var imgPercent = E.toArrayBuffer(atob("BwcBuq7ffbqugA==")); -var img24hr = E.toArrayBuffer(atob("EwgBj7vO53na73tcDtu9uDev7vA93g==")); -var imgPM = E.toArrayBuffer(atob("EwgB+HOfdnPu1X3ar4dV9+q+/bfftg==")); + // define icons + const imgSep = E.toArrayBuffer(atob("BhsBAAAAAA///////////////AAAAAAA")); + //var imgPercent = E.toArrayBuffer(atob("BwcBuq7ffbqugA==")); + const img24hr = E.toArrayBuffer(atob("EwgBj7vO53na73tcDtu9uDev7vA93g==")); + const imgPM = E.toArrayBuffer(atob("EwgB+HOfdnPu1X3ar4dV9+q+/bfftg==")); -//vars -var separator = true; -var is24hr = !is12Hour; -var leadingZero = true; + //vars + let separator = true; + let is24hr = !is12Hour; + let leadingZero = true; -//the following 2 sections are used from waveclk to schedule minutely updates -// timeout used to update every minute -var drawTimeout; + //the following 2 sections are used from waveclk to schedule minutely updates + // timeout used to update every minute + let drawTimeout; -// schedule a draw for the next minute -function queueDraw() { - if (drawTimeout) clearTimeout(drawTimeout); - drawTimeout = setTimeout(function() { - drawTimeout = undefined; - draw(); - }, 60000 - (Date.now() % 60000)); -} - -function drawBackground() { - g.setBgColor(0,0,0); - g.setColor(1,1,1); - g.clear(); - g.drawImage(imgBg,0,0); - g.reset(); -} - -function draw(){ - drawBackground(); - var date = new Date(); - var h = date.getHours(), m = date.getMinutes(); - var d = date.getDate(), w = date.getDay(); - g.reset(); - g.setBgColor(0,0,0); - g.setColor(1,1,1); - - //draw 24 hr indicator and 12 hr specific behavior - if (is24hr){ - g.drawImage(img24hr,32, 65); - if (leadingZero){ - h = ("0"+h).substr(-2); - } - } else if (h > 12) { - g.drawImage(imgPM,40, 70); - h = h - 12; - if (leadingZero){ - h = ("0"+h).substr(-2); - } else { - h = " " + h; - } - } else if (h === 0) { - // display 12:00 instead of 00:00 for 12 hr mode - h = "12"; - } - - //draw separator - if (separator){ - g.drawImage(imgSep, 85,98);} - - //draw day of week - var imgW = null; - if (w == 0) {imgW = imgSun;} - if (w == 1) {imgW = imgMon;} - if (w == 2) {imgW = imgTue;} - if (w == 3) {imgW = imgWed;} - if (w == 4) {imgW = imgThu;} - if (w == 5) {imgW = imgFri;} - if (w == 6) {imgW = imgSat;} - g.drawImage(imgW, 85, 63); - - - // draw nums - // draw time - g.setColor(0,0,0); - g.setBgColor(1,1,1); - g.setFontCustom(fontNum, 48, 28, 41); - if (h<10) { - if (leadingZero) { - h = ("0"+h).substr(-2); - } else { - h = " " + h; - } - } - g.drawString(h, 25, 90, true); - g.drawString(("0"+m).substr(-2), 92, 90, true); - // draw date - g.setFontCustom(fontDate, 48, 12, 15); - g.drawString(("0"+d).substr(-2), 123,63, true); - - // widget redraw - Bangle.drawWidgets(); - queueDraw(); -} - -/** - * This watch is mostly dark, it does not make sense to respect the - * light theme as you end up with a white strip at the top for the - * widgets and black watch. So set the colours to the dark theme. - * - */ -g.setTheme({bg:"#000",fg:"#fff",dark:true}).clear(); -draw(); - -//the following section is also from waveclk -Bangle.on('lcdPower',on=>{ - if (on) { - draw(); // draw immediately, queue redraw - } else { // stop draw timer + // schedule a draw for the next minute + let queueDraw = function() { if (drawTimeout) clearTimeout(drawTimeout); - drawTimeout = undefined; - } -}); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); + }; -Bangle.setUI("clock"); -Bangle.loadWidgets(); -Bangle.drawWidgets(); + let drawBackground = function() { + g.setBgColor(0, 0, 0); + g.setColor(1, 1, 1); + g.clear(); + g.drawImage(imgBg, 0, 0); + g.reset(); + }; + + let draw = function() { + drawBackground(); + let date = new Date(); + let h = date.getHours(), + m = date.getMinutes(); + let d = date.getDate(), + w = date.getDay(); + g.reset(); + g.setBgColor(0, 0, 0); + g.setColor(1, 1, 1); + + //draw 24 hr indicator and 12 hr specific behavior + if (is24hr){ + g.drawImage(img24hr,32, 65); + if (leadingZero){ + h = ("0"+h).substr(-2); + } + } else if (h > 12) { + g.drawImage(imgPM,40, 70); + h = h - 12; + if (leadingZero){ + h = ("0"+h).substr(-2); + } else { + h = " " + h; + } + } else if (h === 0) { + // display 12:00 instead of 00:00 for 12 hr mode + h = "12"; + } + + //draw separator + if (separator) { + g.drawImage(imgSep, 85, 98); + } + + //draw day of week + let imgW = null; + if (w == 0) {imgW = imgSun;} + if (w == 1) {imgW = imgMon;} + if (w == 2) {imgW = imgTue;} + if (w == 3) {imgW = imgWed;} + if (w == 4) {imgW = imgThu;} + if (w == 5) {imgW = imgFri;} + if (w == 6) {imgW = imgSat;} + g.drawImage(imgW, 85, 63); + + + // draw nums + // draw time + g.setColor(0, 0, 0); + g.setBgColor(1, 1, 1); + g.setFontCustom(fontNum, 48, 28, 41); + if (h < 10) { + if (leadingZero) { + h = ("0" + h).substr(-2); + } else { + h = " " + h; + } + } + g.drawString(h, 25, 90, true); + g.drawString(("0" + m).substr(-2), 92, 90, true); + // draw date + g.setFontCustom(fontDate, 48, 12, 15); + g.drawString(("0" + d).substr(-2), 123, 63, true); + + // widget redraw + Bangle.drawWidgets(); + queueDraw(); + }; + + /** + * This watch is mostly dark, it does not make sense to respect the + * light theme as you end up with a white strip at the top for the + * widgets and black watch. So set the colours to the dark theme. + * + */ + g.setTheme({ + bg: "#000", + fg: "#fff", + dark: true + }).clear(); + draw(); + + //the following section is also from waveclk + let onLCDPower = on => { + if (on) { + draw(); // draw immediately, queue redraw + } else { // stop draw timer + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } + }; + Bangle.on('lcdPower', onLCDPower); + + Bangle.setUI({ + mode: "clock", + remove: function() { + if (drawTimeout) clearTimeout(drawTimeout); + Bangle.removeListener('lcdPower', onLCDPower); + } + }); + Bangle.loadWidgets(); + Bangle.drawWidgets(); +} diff --git a/apps/93dub/metadata.json b/apps/93dub/metadata.json index 4b0b7bd21..97b771902 100644 --- a/apps/93dub/metadata.json +++ b/apps/93dub/metadata.json @@ -3,7 +3,7 @@ "shortName":"93 Dub", "icon": "93dub.png", "screenshots": [{"url":"screenshot.png"}], - "version": "0.07", + "version": "0.08", "description": "Fan recreation of orviwan's 91 Dub app for the Pebble smartwatch. Uses assets from his 91-Dub-v2.0 repo", "tags": "clock", "type": "clock", diff --git a/apps/UI4swatch/metadata.json b/apps/UI4swatch/metadata.json index bcb0e6c51..5b4abf406 100644 --- a/apps/UI4swatch/metadata.json +++ b/apps/UI4swatch/metadata.json @@ -5,7 +5,7 @@ "version": "0.02", "description": "A UI/UX for espruino smartwatches, displays dinamically calc. x,y coordinates.", "icon": "app.png", - "tags": "Color,input,buttons,touch,UI", + "tags": "color,input,buttons,touch,ui", "supports": ["BANGLEJS"], "readme": "README.md", "screenshots": [{"url":"UI4swatch_icon.png"},{"url":"UI4swatch_s1.png"}], diff --git a/apps/Uke/metadata.json b/apps/Uke/metadata.json index 5a3f17639..1185c7202 100644 --- a/apps/Uke/metadata.json +++ b/apps/Uke/metadata.json @@ -4,8 +4,8 @@ "version": "0.04", "description": "Wrist mounted ukulele chords", "icon": "app.png", - "tags": "uke, chords", - "supports" : ["BANGLEJS2"], + "tags": "uke,chords", + "supports" : ["BANGLEJS2"], "readme": "README.md", "storage": [ {"name":"Uke.app.js","url":"app.js"}, diff --git a/apps/_example_clock/app.js b/apps/_example_clock/app.js index d1f997136..a5d114b3a 100644 --- a/apps/_example_clock/app.js +++ b/apps/_example_clock/app.js @@ -24,10 +24,10 @@ var dateStr = require("locale").date(date); // draw time g.setFontAlign(0,0).setFont("Vector",48); - g.clearRect(0,y-15,g.getWidth(),y+25); // clear the background + g.clearRect(0,y-20,g.getWidth(),y+25); // clear the background g.drawString(timeStr,x,y); // draw date - y += 35; + y += 30; g.setFontAlign(0,0).setFont("6x8"); g.clearRect(0,y-4,g.getWidth(),y+4); // clear the background g.drawString(dateStr,x,y); @@ -41,6 +41,8 @@ // Show launcher when middle button pressed Bangle.setUI({mode:"clock", remove:function() { // free any memory we allocated to allow fast loading + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; }}); // Load widgets Bangle.loadWidgets(); diff --git a/apps/a_dndtoggle/settings.js b/apps/a_dndtoggle/settings.js index 5316525b3..483af8c97 100644 --- a/apps/a_dndtoggle/settings.js +++ b/apps/a_dndtoggle/settings.js @@ -29,5 +29,4 @@ } E.showMenu(buildMainMenu()); - }); - \ No newline at end of file + }) diff --git a/apps/activepedom/settings.js b/apps/activepedom/settings.js index 3b64d8735..16799f0db 100644 --- a/apps/activepedom/settings.js +++ b/apps/activepedom/settings.js @@ -109,4 +109,4 @@ }, }; E.showMenu(menu); -}); +}) diff --git a/apps/agenda/ChangeLog b/apps/agenda/ChangeLog index d1b95a702..4d2e28096 100644 --- a/apps/agenda/ChangeLog +++ b/apps/agenda/ChangeLog @@ -15,3 +15,7 @@ 0.13: Show day of the week in date 0.14: Fixed "Today" and "Yesterday" wrongly displayed for allDay events on some time zones 0.15: Minor code improvements +0.16: Correct date for all day events in negative timezones, improve locale display +0.17: Fixed "Today" and "Tomorrow" labels displaying in non-current weeks +0.18: Correct date in clockinfo for all-day events in negative timezones +0.19: Change clockinfo title truncation to preserve images diff --git a/apps/agenda/agenda.clkinfo.js b/apps/agenda/agenda.clkinfo.js index f9ea6a35d..07c48e751 100644 --- a/apps/agenda/agenda.clkinfo.js +++ b/apps/agenda/agenda.clkinfo.js @@ -64,8 +64,12 @@ agenda.forEach((entry, i) => { - var title = entry.title.slice(0,12); - var date = new Date(entry.timestamp*1000); + var title = g.setFont("6x8").wrapString(entry.title,100)[0]; + // All day events are always in UTC and always start at 00:00:00, so we + // need to "undo" the timezone offsetting to make sure that the day is + // correct. + var offset = entry.allDay ? new Date().getTimezoneOffset() * 60 : 0 + var date = new Date((entry.timestamp+offset)*1000); var dateStr = locale.date(date).replace(/\d\d\d\d/,""); var shortStr = ((date-now) > 86400000 || entry.allDay) ? dateStr : locale.time(date,1); var color = "#"+(0x1000000+Number(entry.color)).toString(16).padStart(6,"0"); diff --git a/apps/agenda/agenda.js b/apps/agenda/agenda.js index 4f3a91537..f8fffc643 100644 --- a/apps/agenda/agenda.js +++ b/apps/agenda/agenda.js @@ -30,20 +30,26 @@ var settings = require("Storage").readJSON("agenda.settings.json",true)||{}; CALENDAR=CALENDAR.sort((a,b)=>a.timestamp - b.timestamp); -function getDate(timestamp) { - return new Date(timestamp*1000); +function getDate(timestamp, allDay) { + // All day events are always in UTC and always start at 00:00:00, so we + // need to "undo" the timezone offsetting to make sure that the day is + // correct. + var offset = allDay ? new Date().getTimezoneOffset() * 60 : 0 + return new Date((timestamp+offset)*1000); } + function formatDay(date) { - let formattedDate = Locale.dow(date,1) + " " + Locale.date(date).replace(/\d\d\d\d/,""); + let formattedDate = Locale.dow(date,1) + " " + Locale.date(date).replace(/,*\s*\d\d\d\d/,""); if (!settings.useToday) { return formattedDate; } const today = new Date(Date.now()); - if (date.getDay() == today.getDay() && date.getMonth() == today.getMonth()) + if (date.getDate() == today.getDate()) return /*LANG*/"Today "; else { - const tomorrow = new Date(Date.now() + 86400 * 1000); - if (date.getDay() == tomorrow.getDay() && date.getMonth() == tomorrow.getMonth()) { + var tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); + if (date.getDate() == tomorrow.getDate()) { return /*LANG*/"Tomorrow "; } return formattedDate; @@ -57,8 +63,9 @@ function formatDateLong(date, includeDay, allDay) { } return shortTime; } + function formatDateShort(date, allDay) { - return formatDay(date)+(allDay?"":Locale.time(date,1)+Locale.meridian(date)); + return formatDay(date)+(allDay?"":" "+Locale.time(date,1)+Locale.meridian(date)); } var lines = []; @@ -69,16 +76,19 @@ function showEvent(ev) { //var lines = []; if (ev.title) lines = g.wrapString(ev.title, g.getWidth()-10); var titleCnt = lines.length; - var start = getDate(ev.timestamp); - var end = getDate((+ev.timestamp) + (+ev.durationInSeconds)); + var start = getDate(ev.timestamp, ev.allDay); + // All day events end at the midnight boundary of the following day. Here, we + // subtract one second for all day events so the days display correctly. + const allDayEndCorrection = ev.allDay ? 1 : 0; + var end = getDate((+ev.timestamp) + (+ev.durationInSeconds) - allDayEndCorrection, ev.allDay); var includeDay = true; if (titleCnt) lines.push(""); // add blank line after title if(start.getDay() == end.getDay() && start.getMonth() == end.getMonth()) includeDay = false; - if(includeDay && ev.allDay) { - //single day all day (average to avoid getting previous day) + if(!includeDay && ev.allDay) { + //single day all day lines = lines.concat( - g.wrapString(formatDateLong(new Date((start+end)/2), includeDay, ev.allDay), g.getWidth()-10)); + g.wrapString(formatDateLong(start, includeDay, ev.allDay), g.getWidth()-10)); } else if(includeDay || ev.allDay) { lines = lines.concat( /*LANG*/"Start"+":", @@ -137,7 +147,7 @@ function showList() { if (!ev) return; var isPast = false; var x = r.x+2, title = ev.title; - var body = formatDateShort(getDate(ev.timestamp),ev.allDay)+"\n"+(ev.location?ev.location:/*LANG*/"No location"); + var body = formatDateShort(getDate(ev.timestamp, ev.allDay),ev.allDay)+"\n"+(ev.location?ev.location:/*LANG*/"No location"); if(settings.pastEvents) isPast = ev.timestamp + ev.durationInSeconds < (new Date())/1000; if (title) g.setFontAlign(-1,-1).setFont(fontBig) .setColor(isPast ? "#888" : g.theme.fg).drawString(title, x+4,r.y+2); diff --git a/apps/agenda/metadata.json b/apps/agenda/metadata.json index 41b7ed893..bfe9531be 100644 --- a/apps/agenda/metadata.json +++ b/apps/agenda/metadata.json @@ -1,7 +1,7 @@ { "id": "agenda", "name": "Agenda", - "version": "0.15", + "version": "0.19", "description": "Simple agenda", "icon": "agenda.png", "screenshots": [{"url":"screenshot_agenda_overview.png"}, {"url":"screenshot_agenda_event1.png"}, {"url":"screenshot_agenda_event2.png"}], diff --git a/apps/agpsdata/settings.js b/apps/agpsdata/settings.js index 64fa25330..95b06fe55 100644 --- a/apps/agpsdata/settings.js +++ b/apps/agpsdata/settings.js @@ -68,4 +68,4 @@ function buildMainMenu() { } E.showMenu(buildMainMenu()); -}); +}) diff --git a/apps/alarm/ChangeLog b/apps/alarm/ChangeLog index a3a5dfc1c..d2a1dd107 100644 --- a/apps/alarm/ChangeLog +++ b/apps/alarm/ChangeLog @@ -51,3 +51,9 @@ 0.46: Show alarm groups if the Show Group setting is ON. Scroll alarms menu back to previous position when getting back to it. 0.47: Fix wrap around when snoozed through midnight 0.48: Use datetimeinput for Events, if available. Scroll back when getting out of group. Menu date format setting for shorter dates on current year. +0.49: fix uncaught error if no scroller (Bangle 1). Would happen when trying + to select an alarm in the main menu. +0.50: Bangle.js 2: Long touch of alarm in main menu toggle it on/off. Touching the icon on + the right will do the same. +0.51: Fix long-touch to enable alarm/timer not updating time (fix #3804) +0.52: Allow deletion of alarms once they sound (like timers and events) diff --git a/apps/alarm/README.md b/apps/alarm/README.md index 77aa61d2c..d7b64b3c2 100644 --- a/apps/alarm/README.md +++ b/apps/alarm/README.md @@ -20,6 +20,8 @@ It uses the [`sched` library](https://github.com/espruino/BangleApps/blob/master - `Disable All` → Disable _all_ enabled alarms & timers - `Delete All` → Delete _all_ alarms & timers +On Bangle.js 2 it's possible to toggle alarms, timers and events from the main menu. This is done by clicking the indicator icons of corresponding entries. Or long pressing anywhere on them. + ## Creator - [Gordon Williams](https://github.com/gfwilliams) @@ -29,6 +31,7 @@ It uses the [`sched` library](https://github.com/espruino/BangleApps/blob/master - [Alessandro Cocco](https://github.com/alessandrococco) - New UI, full rewrite, new features - [Sabin Iacob](https://github.com/m0n5t3r) - Auto snooze support - [storm64](https://github.com/storm64) - Fix redrawing in submenus +- [thyttan](https://github.com/thyttan) - Toggle alarms directly from main menu. ## Attributions diff --git a/apps/alarm/app.js b/apps/alarm/app.js index 053505187..74e6ad6b7 100644 --- a/apps/alarm/app.js +++ b/apps/alarm/app.js @@ -87,14 +87,24 @@ function showMainMenu(scroll, group, scrollback) { }; const getGroups = settings.showGroup && !group; const groups = getGroups ? {} : undefined; - var showAlarm; + const getIcon = (e)=>{return e.on ? (e.timer ? iconTimerOn : iconAlarmOn) : (e.timer ? iconTimerOff : iconAlarmOff);}; alarms.forEach((e, index) => { - showAlarm = !settings.showGroup || (group ? e.group === group : !e.group); + const showAlarm = !settings.showGroup || (group ? e.group === group : !e.group); if(showAlarm) { - menu[trimLabel(getLabel(e),40)] = { - value: e.on ? (e.timer ? iconTimerOn : iconAlarmOn) : (e.timer ? iconTimerOff : iconAlarmOff), - onchange: () => setTimeout(e.timer ? showEditTimerMenu : showEditAlarmMenu, 10, e, index, undefined, scroller.scroll, group) + const label = trimLabel(getLabel(e),40); + menu[label] = { + value: e.on, + onchange: (v, touch) => { + if (touch && (2==touch.type || 145getIcon(e) }; } else if (getGroups) { groups[e.group] = undefined; @@ -102,7 +112,7 @@ function showMainMenu(scroll, group, scrollback) { }); if (!group) { - Object.keys(groups).sort().forEach(g => menu[g] = () => showMainMenu(null, g, scroller.scroll)); + Object.keys(groups).sort().forEach(g => menu[g] = () => showMainMenu(null, g, scroller?scroller.scroll:undefined)); menu[/*LANG*/"Advanced"] = () => showAdvancedMenu(); } @@ -283,7 +293,6 @@ function showEditAlarmMenu(selectedAlarm, alarmIndex, withDate, scroll, group) { delete menu[/*LANG*/"Day"]; delete menu[/*LANG*/"Month"]; delete menu[/*LANG*/"Year"]; - delete menu[/*LANG*/"Delete After Expiration"]; } if (!isNew) { @@ -318,6 +327,14 @@ function prepareAlarmForSave(alarm, alarmIndex, time, date, temp) { } } +function prepareForSave(alarm, alarmIndex) { + if (alarm.timer) { + prepareTimerForSave(alarm, alarmIndex, require("time_utils").decodeTime(alarm.timer)); + } else { + prepareAlarmForSave(alarm, alarmIndex, require("time_utils").decodeTime(alarm.t)); + } +} + function saveAndReload() { // Before saving revert the dow to the standard format (alarms only!) alarms.filter(e => e.timer === undefined).forEach(a => a.dow = handleFirstDayOfWeek(a.dow)); @@ -564,13 +581,7 @@ function enableAll(on) { if (confirm) { alarms.forEach((alarm, i) => { alarm.on = on; - if (on) { - if (alarm.timer) { - prepareTimerForSave(alarm, i, require("time_utils").decodeTime(alarm.timer)); - } else { - prepareAlarmForSave(alarm, i, require("time_utils").decodeTime(alarm.t)); - } - } + if (on) prepareForSave(alarm, i); }); saveAndReload(); showMainMenu(); diff --git a/apps/alarm/metadata.json b/apps/alarm/metadata.json index 78cd4bd4e..ae87be6b2 100644 --- a/apps/alarm/metadata.json +++ b/apps/alarm/metadata.json @@ -2,7 +2,7 @@ "id": "alarm", "name": "Alarms & Timers", "shortName": "Alarms", - "version": "0.48", + "version": "0.52", "description": "Set alarms and timers on your Bangle", "icon": "app.png", "tags": "tool,alarm", diff --git a/apps/alarm/settings.js b/apps/alarm/settings.js index 765e5a5fa..2843fbdb1 100644 --- a/apps/alarm/settings.js +++ b/apps/alarm/settings.js @@ -48,4 +48,4 @@ }; E.showMenu(appMenu); -}); +}) diff --git a/apps/alpinenav/README.md b/apps/alpinenav/README.md index d18cdfd6d..823d6c9f8 100644 --- a/apps/alpinenav/README.md +++ b/apps/alpinenav/README.md @@ -2,13 +2,26 @@ Alpine Navigator ================ App that performs GPS monitoring to track and display position relative to a given origin in realtime. -![screenshot](./sample.png) +![screenshot](./sample.png) + + [compass 5] + + altitude +[start 1] [current 2] + + distance +[from start 3] [track 4] + + +[btn1 -- screen lock] +[btn2 -- remove points] +[btn3 -- pause] Functions --------- -Note if you've not used GPS yet I suggest using one of the GPS apps to get your first fix and confirm as I've found that helps initially. +Note if you've not used GPS yet, I suggest using one of the GPS apps to get your first fix and confirm, as I've found that helps initially. -The GPS and magnetometer will be turned on and after a few moments, when the watch buzzes and the dot turns from red to pink, that means the GPS is fixed. all your movements now will be displayed with a line drawn back to show your position relative to the start. New waypoints will be added based on checking every 10 seconds for at least 5 meters of movement. The map will scale to your distance travelled so the route will always remain within the window, the accelerometer/pedometer is not used - this is a purely GPS and compass solution so can be used for driving/cycling etc. A log file will be recorded that tracks upto 1000 waypoints, this isn't a big file and you could remove the limit but I've kept it fairly conservative here as it's not intended as a main feature, there's already good GPS recorders for the Bangle. The following other items are displayed: +The GPS and magnetometer will be turned on and after a few moments, when the watch buzzes and the dot turns from red to pink, that means the GPS is fixed. All your movements now will be displayed with a line drawn back to show your position relative to the start. New waypoints will be added based on checking every 10 seconds for at least 5 meters of movement. The map will scale to your distance travelled so the route will always remain within the window, the accelerometer/pedometer is not used - this is a purely GPS and compass solution so can be used for driving/cycling etc. A log file will be recorded that tracks upto 1000 waypoints, this isn't a big file and you could remove the limit, but I've kept it fairly conservative here, as it's not intended as a main feature, there's already good GPS recorders for the Bangle. The following other items are displayed: 1. altitude at origin, this is displayed left of the centre. 2. current altitude, displayed centre right @@ -16,12 +29,12 @@ The GPS and magnetometer will be turned on and after a few moments, when the wat 4. distance travelled, bottom right (meters) 5. compass heading, at the top -For the display, the route is kept at a set resolution, so there's no risk of running into memory problems if you run this for long periods or any length of time because the waypoints will be reduced when it reaches a set threshold so you may see the path smooth out slightly at intervals. +For the display, the route is kept at a set resolution, so there's no risk of running into memory problems if you run this for long periods or any length of time, because the waypoints will be reduced when it reaches a set threshold, so you may see the path smooth out slightly at intervals. -If you get strange values or dashes for the compass, it just needs calibration so you need to move the watch around briefly for this each time, ideally 360 degrees around itself, which involves taking the watch off. If you don't want to do that you can also just wave your hand around for a few seconds like you're at a rave or Dr Strange making a Sling Ring but often just moving your wrist a bit is enough. +If you get strange values or dashes for the compass, it just needs calibration so you need to move the watch around briefly for this each time, ideally 360 degrees around itself, which involves taking the watch off. If you don't want to do that you can also just wave your hand around for a few seconds like you're at a rave or Dr Strange making a Sling Ring, but often just moving your wrist a bit is enough. The buttons do the following: -BTN1: this will display an 'X' in the bottom of the screen and lock all the buttons, this is to prevent you accidentally pressing either of the below. Remember to press this again to unlock it! soft and hard reset will both still work. +BTN1: this will display an 'X' in the bottom of the screen and lock all the buttons, this is to prevent you accidentally pressing either of the below. Remember to press this again to unlock it! Soft and hard reset will both still work. BTN2: this removes all waypoints aside from the origin and your current location; sometimes during smaller journeys and walks, the GPS can give sporadic differences in locations because of the error margins of GPS and this can add noise to your route. BTN3: this will pause the GPS and magnetometer, useful for saving power for situations where you don't necessarily need to track parts of your route e.g. you're going indoors/shelter for some time. You'll know it's paused because the compass won't update it's reading and all the metrics will be blacked out on the screen. diff --git a/apps/altimeter/ChangeLog b/apps/altimeter/ChangeLog index 905152382..77f64d029 100644 --- a/apps/altimeter/ChangeLog +++ b/apps/altimeter/ChangeLog @@ -2,3 +2,4 @@ 0.02: Actually upload correct code 0.03: Display sea-level pressure, too, and allow calibration 0.04: Switch to using system code for pressure calibration +0.05: Prompt before resetting calibration (stops long-press of button resetting calibration) \ No newline at end of file diff --git a/apps/altimeter/app.js b/apps/altimeter/app.js index 6e44161da..222ed2d21 100644 --- a/apps/altimeter/app.js +++ b/apps/altimeter/app.js @@ -7,6 +7,7 @@ var R = Bangle.appRect; var y = R.y + R.h/2; var MEDIANLENGTH = 20; var avr = []; +var updateDisplay = true; function fmt(t) { if ((t > -100) && (t < 1000)) @@ -19,48 +20,57 @@ function fmt(t) { Bangle.on('pressure', function(e) { while (avr.length>MEDIANLENGTH) avr.pop(); avr.unshift(e.altitude); - let median = avr.slice().sort(); + if (!updateDisplay) return; + let median = avr.slice().sort(), value; g.reset().clearRect(0,y-30,g.getWidth()-10,R.h); if (median.length>10) { var mid = median.length>>1; - var value = E.sum(median.slice(mid-4,mid+5)) / 9; + value = E.sum(median.slice(mid-4,mid+5)) / 9; } else { - var value = median[median.length>>1]; + value = median[median.length>>1]; } - t = fmt(value); + var t = fmt(value); g.setFont("Vector",50).setFontAlign(0,0).drawString(t, g.getWidth()/2, y); let o = Bangle.getOptions(); let sea = o.seaLevelPressure; t = sea.toFixed(1) + " " + e.temperature.toFixed(1); - if (0) { + /*if (0) { print("alt raw:", value.toFixed(1)); print("temperature:", e.temperature); print("pressure:", e.pressure); print("sea pressure:", sea); - } + }*/ g.setFont("Vector",25).setFontAlign(-1,0).drawString(t, 10, R.y+R.h - 35); }); function setPressure(m, a) { - o = Bangle.getOptions(); - print(o); + var o = Bangle.getOptions(); + //print(o); o.seaLevelPressure = o.seaLevelPressure * m + a; Bangle.setOptions(o); avr = []; } -print(g.getFonts()); -g.reset(); -g.setFont("Vector:15"); -g.setFontAlign(0,0); -g.drawString(/*LANG*/"ALTITUDE (m)", g.getWidth()/2, y-40); -g.drawString(/*LANG*/"SEA L (hPa) TEMP (C)", g.getWidth()/2, y+62); -g.flip(); -g.setFont("6x8").setFontAlign(0,0,3).drawString(/*LANG*/"STD", g.getWidth()-5, g.getHeight()/2); -Bangle.setUI("updown", btn=> { - if (!btn) setPressure(0, 1013.25); - if (btn<0) setPressure(1, 1); - if (btn>0) setPressure(1, -1); -}); +function start() { + g.reset(); + g.setFont("Vector:15"); + g.setFontAlign(0,0); + g.drawString(/*LANG*/"ALTITUDE (m)", g.getWidth()/2, y-40); + g.drawString(/*LANG*/"SEA L (hPa) TEMP (C)", g.getWidth()/2, y+62); + g.setFont("6x8").setFontAlign(0,0,3).drawString(/*LANG*/"STD", g.getWidth()-5, g.getHeight()/2); + updateDisplay = true; + Bangle.setUI("updown", btn => { + if (!btn) { + updateDisplay = false; + E.showPrompt(/*LANG*/"Set calibration to default?",{title:/*LANG*/"Altitude"}).then(function(reset) { + start(); + if (reset) setPressure(0, 1013.25); + }); + } + if (btn<0) setPressure(1, 1); + if (btn>0) setPressure(1, -1); + }); +} +start(); \ No newline at end of file diff --git a/apps/altimeter/metadata.json b/apps/altimeter/metadata.json index ff5eb9935..2c8bf06ec 100644 --- a/apps/altimeter/metadata.json +++ b/apps/altimeter/metadata.json @@ -1,6 +1,6 @@ { "id": "altimeter", "name": "Altimeter", - "version":"0.04", + "version":"0.05", "description": "Simple altimeter that can display height changed using Bangle.js 2's built in pressure sensor.", "icon": "app.png", "tags": "tool,outdoors", diff --git a/apps/andark/ChangeLog b/apps/andark/ChangeLog index 7d7f9567b..5541288e8 100644 --- a/apps/andark/ChangeLog +++ b/apps/andark/ChangeLog @@ -5,3 +5,7 @@ 0.05: Fix support for dark theme + support widgets + add settings for widgets, order of drawing and hour hand length 0.06: Fix issue showing widgets when app is fast-loaded into from launcher with widgets disabled +0.07: Enable fast loading and queue updates to the second +0.08: Restore redraw on charging event + fixup for safer fast-loading +0.09: Add setting to show the weekday and not the year + add setting to hide the battery + + changed to follow system them with setting for dark theme diff --git a/apps/andark/README.md b/apps/andark/README.md index 9034677c2..04737a7a2 100644 --- a/apps/andark/README.md +++ b/apps/andark/README.md @@ -7,10 +7,19 @@ * battery percentage (showing charge status with color) * turned off or swipeable widgets (choose in settings) -![logo](andark_screen.png) +![Screenshot of Dark Analog Clock with default settings](andark_screen.png) + +*Default settings* + +![Screenshot of Dark Analog Clock with default settings](andark_screen_light_weekday_nobatt.png) + +*Following system theme, with weekday shown and battery hidden* ## Settings * whether to load widgets, or not; if widgets are loaded, they are swipeable from the top; if not, NO ACTIONS of widgets are available * date and battery can be printed both below hands (as if hands were physical) and above (more readable) * hour hand can be made slighly shorter to improve readability when minute hand is behind a number +* show the weekday and not the year +* hide the battery percentage; the font for the date is increased since there is more space +* dark theme (enabled by default); disable to follow system theme diff --git a/apps/andark/andark_screen_light_weekday_nobatt.png b/apps/andark/andark_screen_light_weekday_nobatt.png new file mode 100644 index 000000000..72fa233b7 Binary files /dev/null and b/apps/andark/andark_screen_light_weekday_nobatt.png differ diff --git a/apps/andark/app.js b/apps/andark/app.js index e6b5204f0..12c836182 100644 --- a/apps/andark/app.js +++ b/apps/andark/app.js @@ -1,19 +1,29 @@ +{ const defaultSettings = { loadWidgets : false, textAboveHands : false, - shortHrHand : false + shortHrHand : false, + weekdayNoYear : false, + noBattery : false, + darkTheme : true }; const settings = Object.assign(defaultSettings, require('Storage').readJSON('andark.json',1)||{}); +const origTheme = g.theme; +if (settings.darkTheme) { + g.setTheme({bg: "#000"}); + g.setTheme({fg: "#FFF"}); +} + const c={"x":g.getWidth()/2,"y":g.getHeight()/2}; const zahlpos=(function() { let z=[]; let sk=1; for(let i=-10;i<50;i+=5){ - let win=i*2*Math.PI/60; - let xsk =c.x+2+Math.cos(win)*(c.x-10), - ysk =c.y+2+Math.sin(win)*(c.x-10); + let win=i*2*Math.PI/60; + let xsk =c.x+2+Math.cos(win)*(c.x-10), + ysk =c.y+2+Math.sin(win)*(c.x-10); if(sk==3){xsk-=10;} if(sk==6){ysk-=10;} if(sk==9){xsk+=10;} @@ -25,20 +35,17 @@ const zahlpos=(function() { return z; })(); -let unlock = false; - -function zeiger(len,dia,tim){ +const zeiger = function(len,dia,tim) { const x=c.x+ Math.cos(tim)*len/2, y=c.y + Math.sin(tim)*len/2, d={"d":3,"x":dia/2*Math.cos(tim+Math.PI/2),"y":dia/2*Math.sin(tim+Math.PI/2)}, pol=[c.x-d.x,c.y-d.y,c.x+d.x,c.y+d.y,x+d.x,y+d.y,x-d.x,y-d.y]; return pol; +}; -} - -function drawHands(d) { +const drawHands = function(d) { let m=d.getMinutes(), h=d.getHours(), s=d.getSeconds(); - g.setColor(1,1,1); + g.setColor(g.theme.fg); if(h>12){ h=h-12; @@ -61,34 +68,70 @@ function drawHands(d) { g.fillPoly(sekz,true); } g.fillCircle(c.x,c.y,4); -} +}; -function drawText(d) { - g.setFont("Vector",10); - g.setBgColor(0,0,0); - g.setColor(1,1,1); - let dateStr = require("locale").date(d); - g.drawString(dateStr, c.x, c.y+20, true); - let batStr = Math.round(E.getBattery()/5)*5+"%"; - if (Bangle.isCharging()) { - g.setBgColor(1,0,0); +const drawText = function(d) { +//g.setFont("Vector",10); + g.setBgColor(g.theme.bg); + g.setColor(g.theme.fg); + const dateStr = settings.weekdayNoYear + ? require("locale").dow(d, 1)+" "+d.getDate()+" "+require("locale").month(d, 1) + : require("locale").date(d); + const batStr = Math.round(E.getBattery()/5)*5+"%"; + if (settings.noBattery) { + g.setFont("Vector",13); + g.drawString(dateStr, c.x, c.y+25, true); + } else { + g.setFont("Vector",10); + g.drawString(dateStr, c.x, c.y+20, true); + if (Bangle.isCharging()) { + g.setBgColor(1,0,0); + } + g.drawString(batStr, c.x, c.y+40, true); } - g.drawString(batStr, c.x, c.y+40, true); -} +}; -function drawNumbers() { +const drawNumbers = function() { //draws the numbers on the screen g.setFont("Vector",20); - g.setColor(1,1,1); - g.setBgColor(0,0,0); + g.setColor(g.theme.fg); + g.setBgColor(g.theme.bg); for(let i = 0;i<12;i++){ - g.drawString(zahlpos[i][0],zahlpos[i][1],zahlpos[i][2],true); + g.drawString(zahlpos[i][0],zahlpos[i][1],zahlpos[i][2],true); } -} +}; -function draw(){ +let drawTimeout; +let queueMillis = 1000; +let unlock = true; + +const updateState = function() { + if (Bangle.isLCDOn()) { + if (!Bangle.isLocked()) { + queueMillis = 1000; + unlock = true; + } else { + queueMillis = 60000; + unlock = false; + } + draw(); + } else { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } +}; + +const queueDraw = function() { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, queueMillis - (Date.now() % queueMillis)); +}; + +const draw = function() { // draw black rectangle in the middle to clear screen from scale and hands - g.setColor(0,0,0); + g.setColor(g.theme.bg); g.fillRect(10,10,2*c.x-10,2*c.x-10); // prepare for drawing the text g.setFontAlign(0,0); @@ -100,12 +143,13 @@ function draw(){ } else { drawText(d); drawHands(d); } -} + queueDraw(); +}; //draws the scale once the app is startet -function drawScale(){ +const drawScale = function() { // clear the screen - g.setBgColor(0,0,0); + g.setBgColor(g.theme.bg); g.clear(); // draw the ticks of the scale for(let i=-14;i<47;i++){ @@ -113,40 +157,40 @@ function drawScale(){ let d=2; if(i%5==0){d=5;} g.fillPoly(zeiger(300,d,win),true); - g.setColor(0,0,0); + g.setColor(g.theme.bg); g.fillRect(10,10,2*c.x-10,2*c.x-10); - g.setColor(1,1,1); + g.setColor(g.theme.fg); } -} +}; //// main running sequence //// // Show launcher when middle button pressed, and widgets that we're clock -Bangle.setUI("clock"); +Bangle.setUI({ + mode: "clock", + remove: function() { + if (settings.darkTheme) g.setTheme(origTheme); + Bangle.removeListener('lcdPower', updateState); + Bangle.removeListener('lock', updateState); + Bangle.removeListener('charging', draw); + // We clear drawTimout after removing all listeners, because they can add one again + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + require("widget_utils").show(); + } +}); // Load widgets if needed, and make them show swipeable if (settings.loadWidgets) { Bangle.loadWidgets(); require("widget_utils").swipeOn(); } else if (global.WIDGETS) require("widget_utils").hide(); -// Clear the screen once, at startup -drawScale(); -draw(); - -let secondInterval = setInterval(draw, 1000); // Stop updates when LCD is off, restart when on -Bangle.on('lcdPower',on=>{ - if (secondInterval) clearInterval(secondInterval); - secondInterval = undefined; - if (on) { - secondInterval = setInterval(draw, 1000); - draw(); // draw immediately - } -}); -Bangle.on('lock',on=>{ - unlock = !on; - if (secondInterval) clearInterval(secondInterval); - secondInterval = setInterval(draw, unlock ? 1000 : 60000); - draw(); // draw immediately -}); -Bangle.on('charging',on=>{draw();}); +Bangle.on('lcdPower', updateState); +Bangle.on('lock', updateState); +Bangle.on('charging', draw); // Immediately redraw when charger (dis)connected + +updateState(); +drawScale(); +draw(); +} diff --git a/apps/andark/metadata.json b/apps/andark/metadata.json index fc8872f4b..66b22b2aa 100644 --- a/apps/andark/metadata.json +++ b/apps/andark/metadata.json @@ -1,13 +1,14 @@ { "id": "andark", "name": "Analog Dark", "shortName":"AnDark", - "version":"0.06", + "version":"0.09", "description": "analog clock face without disturbing widgets", "icon": "andark_icon.png", "type": "clock", "tags": "clock", + "allow_emulator": true, "supports" : ["BANGLEJS2"], - "screenshots": [{"url":"andark_screen.png"}], + "screenshots": [{"url":"andark_screen.png"},{"url":"andark_screen_light_weekday_nobatt.png"}], "readme": "README.md", "storage": [ {"name":"andark.app.js","url":"app.js"}, diff --git a/apps/andark/settings.js b/apps/andark/settings.js index 708913705..d1cba0e30 100644 --- a/apps/andark/settings.js +++ b/apps/andark/settings.js @@ -2,7 +2,10 @@ const defaultSettings = { loadWidgets : false, textAboveHands : false, - shortHrHand : false + shortHrHand : false, + weekdayNoYear : false, + noBattery : false, + darkTheme : true } let settings = Object.assign(defaultSettings, require('Storage').readJSON('andark.json',1)||{}); @@ -22,7 +25,19 @@ value : !!settings.shortHrHand, onchange : v => { settings.shortHrHand=v; save();} }, + /*LANG*/'Show weekday not year': { + value : !!settings.weekdayNoYear, + onchange : v => { settings.weekdayNoYear=v; save();} + }, + /*LANG*/'Hide the battery': { + value : !!settings.noBattery, + onchange : v => { settings.noBattery=v; save();} + }, + /*LANG*/'Dark theme': { + value : !!settings.darkTheme, + onchange : v => { settings.darkTheme=v; save();} + }, }; E.showMenu(appMenu); -}); +}) diff --git a/apps/android/ChangeLog b/apps/android/ChangeLog index 11c78588a..84d917a8c 100644 --- a/apps/android/ChangeLog +++ b/apps/android/ChangeLog @@ -36,4 +36,14 @@ 0.34: Implement API for activity tracks fetching (Recorder app logs). 0.35: Implement API to enable/disable acceleration data tracking. 0.36: Move from wrapper function to {} and let - faster execution at boot - Allow `calendar-` to take an array of items to remove \ No newline at end of file + Allow `calendar-` to take an array of items to remove +0.37: Support Gadgetbridge canned responses +0.38: Don't rewrite settings file on every boot! +0.39: Move GB message handling into a library to reduce boot time from 40ms->13ms +0.40: Ensure we send health 'activity' message to gadgetbridge (added 2v26) +0.41: When using `actfetch`, fetch historical activity type too +0.42: Add handling for android STREAM_MUSIC volume level info, emitting on + arrival. (Needs Gadgetbridge nightly (either flavour) for now, or stable + version 85 when it's out) +0.43: Ensure listRecs doesn't list old-style recorded tracks (Otherwise Gadgetbridge fails parsing the filename) +0.44: Pass HTTP request timeout to Gadgetbridge diff --git a/apps/android/README.md b/apps/android/README.md index f322e6a4e..a7a539e38 100644 --- a/apps/android/README.md +++ b/apps/android/README.md @@ -49,11 +49,21 @@ The boot code also provides some useful functions: * `body` the body of the HTTP request * `headers` an object of headers, eg `{HeaderOne : "headercontents"}` +`Bangle.http` returns a promise which contains: + +```JS +{ + t:"http", + id: // the ID of this HTTP request + resp: "...." // a string containing the response +} +``` + eg: -``` +```JS Bangle.http("https://pur3.co.uk/hello.txt").then(data=>{ - console.log("Got ",data); + console.log("Got ",data.resp); }); ``` diff --git a/apps/android/boot.js b/apps/android/boot.js index 729ed2b47..37550cdd0 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -1,350 +1,24 @@ /* global GB */ { - let gbSend = function(message) { - Bluetooth.println(""); - Bluetooth.println(JSON.stringify(message)); - } - let lastMsg; // for music messages - may not be needed now... - let actInterval; // Realtime activity reporting interval when `act` is true - let actHRMHandler; // For Realtime activity reporting - let gpsState = {}; // keep information on GPS via Gadgetbridge - - // this settings var is deleted after this executes to save memory - let settings = require("Storage").readJSON("android.settings.json",1)||{}; - //default alarm settings - if (settings.rp == undefined) settings.rp = true; - if (settings.as == undefined) settings.as = true; - if (settings.vibrate == undefined) settings.vibrate = ".."; - require('Storage').writeJSON("android.settings.json", settings); + // settings var is deleted after this executes to save memory + let settings = Object.assign({rp:true,as:true,vibrate:".."}, + require("Storage").readJSON("android.settings.json",1)||{} + ); let _GB = global.GB; - let fetchRecInterval; - global.GB = (event) => { + global.GB = e => { // feed a copy to other handlers if there were any - if (_GB) setTimeout(_GB,0,Object.assign({},event)); - - - /* TODO: Call handling, fitness */ - var HANDLERS = { - // {t:"notify",id:int, src,title,subject,body,sender,tel:string} add - "notify" : function() { - Object.assign(event,{t:"add",positive:true, negative:true}); - // Detect a weird GadgetBridge bug and fix it - // For some reason SMS messages send two GB notifications, with different sets of info - if (lastMsg && event.body == lastMsg.body && lastMsg.src == undefined && event.src == "Messages") { - // Mutate the other message - event.id = lastMsg.id; - } - lastMsg = event; - require("messages").pushMessage(event); - }, - // {t:"notify~",id:int, title:string} // modified - "notify~" : function() { event.t="modify";require("messages").pushMessage(event); }, - // {t:"notify-",id:int} // remove - "notify-" : function() { event.t="remove";require("messages").pushMessage(event); }, - // {t:"find", n:bool} // find my phone - "find" : function() { - if (Bangle.findDeviceInterval) { - clearInterval(Bangle.findDeviceInterval); - delete Bangle.findDeviceInterval; - } - if (event.n) // Ignore quiet mode: we always want to find our watch - Bangle.findDeviceInterval = setInterval(_=>Bangle.buzz(),1000); - }, - // {t:"musicstate", state:"play/pause",position,shuffle,repeat} - "musicstate" : function() { - require("messages").pushMessage({t:"modify",id:"music",title:"Music",state:event.state}); - }, - // {t:"musicinfo", artist,album,track,dur,c(track count),n(track num} - "musicinfo" : function() { - require("messages").pushMessage(Object.assign(event, {t:"modify",id:"music",title:"Music"})); - }, - // {"t":"call","cmd":"incoming/end","name":"Bob","number":"12421312"}) - "call" : function() { - Object.assign(event, { - t:event.cmd=="incoming"?"add":"remove", - id:"call", src:"Phone", - positive:true, negative:true, - title:event.name||/*LANG*/"Call", body:/*LANG*/"Incoming call\n"+event.number}); - require("messages").pushMessage(event); - }, - // {"t":"alarm", "d":[{h:int,m:int,rep:int},... } - "alarm" : function() { - //wipe existing GB alarms - var sched; - try { sched = require("sched"); } catch (e) {} - if (!sched) return; // alarms may not be installed - var gbalarms = sched.getAlarms().filter(a=>a.appid=="gbalarms"); - for (var i = 0; i < gbalarms.length; i++) - sched.setAlarm(gbalarms[i].id, undefined); - var alarms = sched.getAlarms(); - var time = new Date(); - var currentTime = time.getHours() * 3600000 + - time.getMinutes() * 60000 + - time.getSeconds() * 1000; - for (var j = 0; j < event.d.length; j++) { - // prevents all alarms from going off at once?? - var dow = event.d[j].rep; - var rp = false; - if (!dow) { - dow = 127; //if no DOW selected, set alarm to all DOW - } else { - rp = true; - } - var last = (event.d[j].h * 3600000 + event.d[j].m * 60000 < currentTime) ? (new Date()).getDate() : 0; - var a = require("sched").newDefaultAlarm(); - a.id = "gb"+j; - a.appid = "gbalarms"; - a.on = event.d[j].on !== undefined ? event.d[j].on : true; - a.t = event.d[j].h * 3600000 + event.d[j].m * 60000; - a.dow = ((dow&63)<<1) | (dow>>6); // Gadgetbridge sends DOW in a different format - a.rp = rp; - a.last = last; - alarms.push(a); - } - sched.setAlarms(alarms); - sched.reload(); - }, - //TODO perhaps move those in a library (like messages), used also for viewing events? - //add and remove events based on activity on phone (pebble-like) - // {t:"calendar", id:int, type:int, timestamp:seconds, durationInSeconds, title:string, description:string,location:string,calName:string.color:int,allDay:bool - "calendar" : function() { - var cal = require("Storage").readJSON("android.calendar.json",true); - if (!cal || !Array.isArray(cal)) cal = []; - var i = cal.findIndex(e=>e.id==event.id); - if(i<0) - cal.push(event); - else - cal[i] = event; - require("Storage").writeJSON("android.calendar.json", cal); - }, - // {t:"calendar-", id:int} - "calendar-" : function() { - var cal = require("Storage").readJSON("android.calendar.json",true); - //if any of those happen we are out of sync! - if (!cal || !Array.isArray(cal)) cal = []; - if (Array.isArray(event.id)) - cal = cal.filter(e=>!event.id.includes(e.id)); - else - cal = cal.filter(e=>e.id!=event.id); - require("Storage").writeJSON("android.calendar.json", cal); - }, - //triggered by GB, send all ids - // { t:"force_calendar_sync_start" } - "force_calendar_sync_start" : function() { - var cal = require("Storage").readJSON("android.calendar.json",true); - if (!cal || !Array.isArray(cal)) cal = []; - gbSend({t:"force_calendar_sync", ids: cal.map(e=>e.id)}); - }, - // {t:"http",resp:"......",[id:"..."]} - "http":function() { - //get the promise and call the promise resolve - if (Bangle.httpRequest === undefined) return; - var request=Bangle.httpRequest[event.id]; - if (request === undefined) return; //already timedout or wrong id - delete Bangle.httpRequest[event.id]; - clearTimeout(request.t); //t = timeout variable - if(event.err!==undefined) //if is error - request.j(event.err); //r = reJect function - else - request.r(event); //r = resolve function - }, - // {t:"gps", lat, lon, alt, speed, course, time, satellites, hdop, externalSource:true } - "gps": function() { - if (!settings.overwriteGps) return; - // modify event for using it as Bangle GPS event - delete event.t; - if (!isFinite(event.satellites)) event.satellites = NaN; - if (!isFinite(event.course)) event.course = NaN; - event.fix = 1; - if (event.long!==undefined) { // for earlier Gadgetbridge implementations - event.lon = event.long; - delete event.long; - } - if (event.time){ - event.time = new Date(event.time); - } - - if (!gpsState.lastGPSEvent) { - // this is the first event, save time of arrival and deactivate internal GPS - Bangle.moveGPSPower(0); - } else { - // this is the second event, store the intervall for expecting the next GPS event - gpsState.interval = Date.now() - gpsState.lastGPSEvent; - } - gpsState.lastGPSEvent = Date.now(); - // in any case, cleanup the GPS state in case no new events arrive - if (gpsState.timeoutGPS) clearTimeout(gpsState.timeoutGPS); - gpsState.timeoutGPS = setTimeout(()=>{ - // reset state - gpsState.lastGPSEvent = undefined; - gpsState.timeoutGPS = undefined; - gpsState.interval = undefined; - // did not get an expected GPS event but have GPS clients, switch back to internal GPS - if (Bangle.isGPSOn()) Bangle.moveGPSPower(1); - }, (gpsState.interval || 10000) + 1000); - Bangle.emit('GPS', event); - }, - // {t:"is_gps_active"} - "is_gps_active": function() { - gbSend({ t: "gps_power", status: Bangle.isGPSOn() }); - }, - // {t:"act", hrm:bool, stp:bool, int:int} - "act": function() { - if (actInterval) clearInterval(actInterval); - actInterval = undefined; - if (actHRMHandler) - actHRMHandler = undefined; - Bangle.setHRMPower(event.hrm,"androidact"); - if (!(event.hrm || event.stp)) return; - if (!isFinite(event.int)) event.int=1; - var lastSteps = Bangle.getStepCount(); - var lastBPM = 0; - actHRMHandler = function(e) { - lastBPM = e.bpm; - }; - Bangle.on('HRM',actHRMHandler); - actInterval = setInterval(function() { - var steps = Bangle.getStepCount(); - gbSend({ t: "act", stp: steps-lastSteps, hrm: lastBPM, rt:1 }); - lastSteps = steps; - }, event.int*1000); - }, - // {t:"actfetch", ts:long} - "actfetch": function() { - gbSend({t: "actfetch", state: "start"}); - var actCount = 0; - var actCb = function(r) { - // The health lib saves the samples at the start of the 10-minute block - // However, GB expects them at the end of the block, so let's offset them - // here to keep a consistent API in the health lib - var sampleTs = r.date.getTime() + 600000; - if (sampleTs >= event.ts) { - gbSend({ - t: "act", - ts: sampleTs, - stp: r.steps, - hrm: r.bpm, - mov: r.movement - }); - actCount++; - } - } - if (event.ts != 0) { - require("health").readAllRecordsSince(new Date(event.ts - 600000), actCb); - } else { - require("health").readFullDatabase(actCb); - } - gbSend({t: "actfetch", state: "end", count: actCount}); - }, - //{t:"listRecs", id:"20230616a"} - "listRecs": function() { - let recs = require("Storage").list(/^recorder\.log.*\.csv$/,{sf:true}).map(s => s.slice(12, 21)); - if (event.id.length > 2) { // Handle if there was no id supplied. Then we send a list all available recorder logs back. - let firstNonsyncedIdx = recs.findIndex((logId) => logId > event.id); - if (-1 == firstNonsyncedIdx) { - recs = [] - } else { - recs = recs.slice(firstNonsyncedIdx); - } - } - gbSend({t:"actTrksList", list: recs}); // TODO: split up in multiple transmissions? - }, - //{t:"fetchRec", id:"20230616a"} - "fetchRec": function() { - // TODO: Decide on what names keys should have. - if (fetchRecInterval) { - clearInterval(fetchRecInterval); - fetchRecInterval = undefined; - } - if (event.id=="stop") { - return - } else { - let log = require("Storage").open("recorder.log"+event.id+".csv","r"); - let lines = "init";// = log.readLine(); - let pkgcnt = 0; - gbSend({t:"actTrk", log:event.id, lines:"erase", cnt:pkgcnt}); // "erase" will prompt Gadgetbridge to erase the contents of a already fetched log so we can rewrite it without keeping lines from the previous (probably failed) fetch. - let sendlines = ()=>{ - lines = log.readLine(); - for (var i = 0; i < 3; i++) { - let line = log.readLine(); - if (line) lines += line; - } - pkgcnt++; - gbSend({t:"actTrk", log:event.id, lines:lines, cnt:pkgcnt}); - if (!lines && fetchRecInterval) { - clearInterval(fetchRecInterval); - fetchRecInterval = undefined; - } - } - fetchRecInterval = setInterval(sendlines, 50) - } - }, - "nav": function() { - event.id="nav"; - if (event.instr) { - event.t="add"; - event.src="maps"; // for the icon - event.title="Navigation"; - if (require("messages").getMessages().find(m=>m.id=="nav")) - event.t = "modify"; - } else { - event.t="remove"; - } - require("messages").pushMessage(event); - }, - "cards" : function() { - // we receive all, just override what we have - if (Array.isArray(event.d)) - require("Storage").writeJSON("android.cards.json", event.d); - }, - "accelsender": function () { - require("Storage").writeJSON("accelsender.json", {enabled: event.enable, interval: event.interval}); - load(); - } - }; - var h = HANDLERS[event.t]; - if (h) h(); else console.log("GB Unknown",event); + if (_GB) setTimeout(_GB,0,Object.assign({},e)); + Bangle.emit("GB",e); + require("android").gbHandler(e); }; // HTTP request handling - see the readme - // options = {id,timeout,xpath} - Bangle.http = (url,options)=>{ - options = options||{}; - if (!NRF.getSecurityStatus().connected) - return Promise.reject(/*LANG*/"Not connected to Bluetooth"); - if (Bangle.httpRequest === undefined) - Bangle.httpRequest={}; - if (options.id === undefined) { - // try and create a unique ID - do { - options.id = Math.random().toString().substr(2); - } while( Bangle.httpRequest[options.id]!==undefined); - } - //send the request - var req = {t: "http", url:url, id:options.id}; - if (options.xpath) req.xpath = options.xpath; - if (options.return) req.return = options.return; // for xpath - if (options.method) req.method = options.method; - if (options.body) req.body = options.body; - if (options.headers) req.headers = options.headers; - gbSend(req); - //create the promise - var promise = new Promise(function(resolve,reject) { - //save the resolve function in the dictionary and create a timeout (30 seconds default) - Bangle.httpRequest[options.id]={r:resolve,j:reject,t:setTimeout(()=>{ - //if after "timeoutMillisec" it still hasn't answered -> reject - delete Bangle.httpRequest[options.id]; - reject("Timeout"); - },options.timeout||30000)}; - }); - return promise; - }; - + Bangle.http = (url,options)=>require("android").httpHandler(url,options); // Battery monitor - let sendBattery = function() { gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 }); } + let sendBattery = function() { require("android").gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 }); } Bangle.on("charging", sendBattery); NRF.on("connect", () => setTimeout(function() { sendBattery(); - gbSend({t: "ver", fw: process.env.VERSION, hw: process.env.HWVERSION}); + require("android").gbSend({t: "ver", fw: process.env.VERSION, hw: process.env.HWVERSION}); GB({t:"force_calendar_sync_start"}); // send a list of our calendar entries to start off the sync process }, 2000)); NRF.on("disconnect", () => { @@ -358,81 +32,24 @@ setInterval(sendBattery, 10*60*1000); // Health tracking - if 'realtime' data is sent with 'rt:1', but let's still send our activity log every 10 mins Bangle.on('health', h=>{ - gbSend({ t: "act", stp: h.steps, hrm: h.bpm, mov: h.movement }); + require("android").gbSend({ t: "act", stp: h.steps, hrm: h.bpm, mov: h.movement, act: h.activity }); // h.activity added in 2v26 }); // Music control Bangle.musicControl = cmd => { // play/pause/next/previous/volumeup/volumedown - gbSend({ t: "music", n:cmd }); + require("android").gbSend({ t: "music", n:cmd }); }; // Message response Bangle.messageResponse = (msg,response) => { - if (msg.id=="call") return gbSend({ t: "call", n:response?"ACCEPT":"REJECT" }); - if (isFinite(msg.id)) return gbSend({ t: "notify", n:response?"OPEN":"DISMISS", id: msg.id }); + if (msg.id=="call") return require("android").gbSend({ t: "call", n:response?"ACCEPT":"REJECT" }); + if (isFinite(msg.id)) return require("android").gbSend({ t: "notify", n:response?"OPEN":"DISMISS", id: msg.id }); // error/warn here? }; Bangle.messageIgnore = msg => { - if (isFinite(msg.id)) return gbSend({ t: "notify", n:"MUTE", id: msg.id }); + if (isFinite(msg.id)) return require("android").gbSend({ t: "notify", n:"MUTE", id: msg.id }); }; // GPS overwrite logic - if (settings.overwriteGps) { // if the overwrite option is set.. - const origSetGPSPower = Bangle.setGPSPower; - Bangle.moveGPSPower = (state) => { - if (Bangle.isGPSOn()){ - let orig = Bangle._PWR.GPS; - delete Bangle._PWR.GPS; - origSetGPSPower(state); - Bangle._PWR.GPS = orig; - } - }; - - // work around Serial1 for GPS not working when connected to something - let serialTimeout; - let wrap = function(f){ - return (s)=>{ - if (serialTimeout) clearTimeout(serialTimeout); - origSetGPSPower(1, "androidgpsserial"); - f(s); - serialTimeout = setTimeout(()=>{ - serialTimeout = undefined; - origSetGPSPower(0, "androidgpsserial"); - }, 10000); - }; - }; - Serial1.println = wrap(Serial1.println); - Serial1.write = wrap(Serial1.write); - - // replace set GPS power logic to suppress activation of gps (and instead request it from the phone) - Bangle.setGPSPower = ((isOn, appID) => { - let pwr; - if (!this.lastGPSEvent){ - // use internal GPS power function if no gps event has arrived from GadgetBridge - pwr = origSetGPSPower(isOn, appID); - } else { - // we are currently expecting the next GPS event from GadgetBridge, keep track of GPS state per app - if (!Bangle._PWR) Bangle._PWR={}; - if (!Bangle._PWR.GPS) Bangle._PWR.GPS=[]; - if (!appID) appID="?"; - if (isOn && !Bangle._PWR.GPS.includes(appID)) Bangle._PWR.GPS.push(appID); - if (!isOn && Bangle._PWR.GPS.includes(appID)) Bangle._PWR.GPS.splice(Bangle._PWR.GPS.indexOf(appID),1); - pwr = Bangle._PWR.GPS.length>0; - // stop internal GPS, no clients left - if (!pwr) origSetGPSPower(0); - } - // always update Gadgetbridge on current power state - gbSend({ t: "gps_power", status: pwr }); - return pwr; - }).bind(gpsState); - // allow checking for GPS via GadgetBridge - Bangle.isGPSOn = () => { - return !!(Bangle._PWR && Bangle._PWR.GPS && Bangle._PWR.GPS.length>0); - }; - // stop GPS on boot if not activated - setTimeout(()=>{ - if (!Bangle.isGPSOn()) gbSend({ t: "gps_power", status: false }); - },3000); - } - + if (settings.overwriteGps) require("android").overwriteGPS(); // remove settings object so it's not taking up RAM delete settings; } diff --git a/apps/android/lib.js b/apps/android/lib.js new file mode 100644 index 000000000..157c00544 --- /dev/null +++ b/apps/android/lib.js @@ -0,0 +1,394 @@ +exports.gbSend = function(message) { + Bluetooth.println(""); + Bluetooth.println(JSON.stringify(message)); +} +let lastMsg, // for music messages - may not be needed now... + gpsState = {}, // keep information on GPS via Gadgetbridge + settings = Object.assign({rp:true,as:true,vibrate:".."}, + require("Storage").readJSON("android.settings.json",1)||{} + ); + +exports.gbHandler = (event) => { + var HANDLERS = { + // {t:"notify",id:int, src,title,subject,body,sender,tel:string} add + "notify" : function() { + print("notify",event); + Object.assign(event,{t:"add",positive:true, negative:true}); + // Detect a weird GadgetBridge bug and fix it + // For some reason SMS messages send two GB notifications, with different sets of info + if (lastMsg && event.body == lastMsg.body && lastMsg.src == undefined && event.src == "Messages") { + // Mutate the other message + event.id = lastMsg.id; + } + lastMsg = event; + require("messages").pushMessage(event); + }, + // {t:"notify~",id:int, title:string} // modified + "notify~" : function() { event.t="modify";require("messages").pushMessage(event); }, + // {t:"notify-",id:int} // remove + "notify-" : function() { event.t="remove";require("messages").pushMessage(event); }, + // {t:"find", n:bool} // find my phone + "find" : function() { + if (Bangle.findDeviceInterval) { + clearInterval(Bangle.findDeviceInterval); + delete Bangle.findDeviceInterval; + } + if (event.n) // Ignore quiet mode: we always want to find our watch + Bangle.findDeviceInterval = setInterval(_=>Bangle.buzz(),1000); + }, + // {t:"musicstate", state:"play/pause",position,shuffle,repeat} + "musicstate" : function() { + require("messages").pushMessage({t:"modify",id:"music",title:"Music",state:event.state}); + }, + // {t:"musicinfo", artist,album,track,dur,c(track count),n(track num} + "musicinfo" : function() { + require("messages").pushMessage(Object.assign(event, {t:"modify",id:"music",title:"Music"})); + }, + // {t:"audio", v:(percentage of max volume for android STREAM_MUSIC)} + "audio" : function() { + Bangle.emit("musicVolume", event.v); + }, + // {"t":"call","cmd":"incoming/end/start/outgoing","name":"Bob","number":"12421312"}) + "call" : function() { + Object.assign(event, { + t:event.cmd=="incoming"?"add":"remove", + id:"call", src:"Phone", + positive:true, negative:true, + title:event.name||/*LANG*/"Call", body:/*LANG*/"Incoming call\n"+event.number}); + require("messages").pushMessage(event); + }, + "canned_responses_sync" : function() { + require("Storage").writeJSON("replies.json", event.d); + }, + // {"t":"alarm", "d":[{h:int,m:int,rep:int},... } + "alarm" : function() { + //wipe existing GB alarms + var sched; + try { sched = require("sched"); } catch (e) {} + if (!sched) return; // alarms may not be installed + var gbalarms = sched.getAlarms().filter(a=>a.appid=="gbalarms"); + for (var i = 0; i < gbalarms.length; i++) + sched.setAlarm(gbalarms[i].id, undefined); + var alarms = sched.getAlarms(); + var time = new Date(); + var currentTime = time.getHours() * 3600000 + + time.getMinutes() * 60000 + + time.getSeconds() * 1000; + for (var j = 0; j < event.d.length; j++) { + // prevents all alarms from going off at once?? + var dow = event.d[j].rep; + var rp = false; + if (!dow) { + dow = 127; //if no DOW selected, set alarm to all DOW + } else { + rp = true; + } + var last = (event.d[j].h * 3600000 + event.d[j].m * 60000 < currentTime) ? (new Date()).getDate() : 0; + var a = require("sched").newDefaultAlarm(); + a.id = "gb"+j; + a.appid = "gbalarms"; + a.on = event.d[j].on !== undefined ? event.d[j].on : true; + a.t = event.d[j].h * 3600000 + event.d[j].m * 60000; + a.dow = ((dow&63)<<1) | (dow>>6); // Gadgetbridge sends DOW in a different format + a.rp = rp; + a.last = last; + alarms.push(a); + } + sched.setAlarms(alarms); + sched.reload(); + }, + //TODO perhaps move those in a library (like messages), used also for viewing events? + //add and remove events based on activity on phone (pebble-like) + // {t:"calendar", id:int, type:int, timestamp:seconds, durationInSeconds, title:string, description:string,location:string,calName:string.color:int,allDay:bool + "calendar" : function() { + var cal = require("Storage").readJSON("android.calendar.json",true); + if (!cal || !Array.isArray(cal)) cal = []; + var i = cal.findIndex(e=>e.id==event.id); + if(i<0) + cal.push(event); + else + cal[i] = event; + require("Storage").writeJSON("android.calendar.json", cal); + }, + // {t:"calendar-", id:int} + "calendar-" : function() { + var cal = require("Storage").readJSON("android.calendar.json",true); + //if any of those happen we are out of sync! + if (!cal || !Array.isArray(cal)) cal = []; + if (Array.isArray(event.id)) + cal = cal.filter(e=>!event.id.includes(e.id)); + else + cal = cal.filter(e=>e.id!=event.id); + require("Storage").writeJSON("android.calendar.json", cal); + }, + //triggered by GB, send all ids + // { t:"force_calendar_sync_start" } + "force_calendar_sync_start" : function() { + var cal = require("Storage").readJSON("android.calendar.json",true); + if (!cal || !Array.isArray(cal)) cal = []; + exports.gbSend({t:"force_calendar_sync", ids: cal.map(e=>e.id)}); + }, + // {t:"http",resp:"......",[id:"..."]} + "http":function() { + //get the promise and call the promise resolve + if (Bangle.httpRequest === undefined) return; + var request=Bangle.httpRequest[event.id]; + if (request === undefined) return; //already timedout or wrong id + delete Bangle.httpRequest[event.id]; + clearTimeout(request.t); //t = timeout variable + if(event.err!==undefined) //if is error + request.j(event.err); //r = reJect function + else + request.r(event); //r = resolve function + }, + // {t:"gps", lat, lon, alt, speed, course, time, satellites, hdop, externalSource:true } + "gps": function() { + if (!settings.overwriteGps) return; + // modify event for using it as Bangle GPS event + delete event.t; + if (!isFinite(event.satellites)) event.satellites = NaN; + if (!isFinite(event.course)) event.course = NaN; + event.fix = 1; + if (event.long!==undefined) { // for earlier Gadgetbridge implementations + event.lon = event.long; + delete event.long; + } + if (event.time){ + event.time = new Date(event.time); + } + + if (!gpsState.lastGPSEvent) { + // this is the first event, save time of arrival and deactivate internal GPS + Bangle.moveGPSPower(0); + } else { + // this is the second event, store the intervall for expecting the next GPS event + gpsState.interval = Date.now() - gpsState.lastGPSEvent; + } + gpsState.lastGPSEvent = Date.now(); + // in any case, cleanup the GPS state in case no new events arrive + if (gpsState.timeoutGPS) clearTimeout(gpsState.timeoutGPS); + gpsState.timeoutGPS = setTimeout(()=>{ + // reset state + gpsState.lastGPSEvent = undefined; + gpsState.timeoutGPS = undefined; + gpsState.interval = undefined; + // did not get an expected GPS event but have GPS clients, switch back to internal GPS + if (Bangle.isGPSOn()) Bangle.moveGPSPower(1); + }, (gpsState.interval || 10000) + 1000); + Bangle.emit('GPS', event); + }, + // {t:"is_gps_active"} + "is_gps_active": function() { + exports.gbSend({ t: "gps_power", status: Bangle.isGPSOn() }); + }, + // {t:"act", hrm:bool, stp:bool, int:int} + "act": function() { + if (exports.actInterval) clearInterval(exports.actInterval); + exports.actInterval = undefined; + if (exports.actHRMHandler) + exports.actHRMHandler = undefined; + Bangle.setHRMPower(event.hrm,"androidact"); + if (!(event.hrm || event.stp)) return; + if (!isFinite(event.int)) event.int=1; + var lastSteps = Bangle.getStepCount(); + var lastBPM = 0; + exports.actHRMHandler = function(e) { + lastBPM = e.bpm; + }; + Bangle.on('HRM',exports.actHRMHandler); + exports.actInterval = setInterval(function() { + var steps = Bangle.getStepCount(); + exports.gbSend({ t: "act", stp: steps-lastSteps, hrm: lastBPM, rt:1 }); + lastSteps = steps; + }, event.int*1000); + }, + // {t:"actfetch", ts:long} + "actfetch": function() { + exports.gbSend({t: "actfetch", state: "start"}); + var actCount = 0; + var actCb = function(r) { + // The health lib saves the samples at the start of the 10-minute block + // However, GB expects them at the end of the block, so let's offset them + // here to keep a consistent API in the health lib + var sampleTs = r.date.getTime() + 600000; + if (sampleTs >= event.ts) { + exports.gbSend({ + t: "act", + ts: sampleTs, + stp: r.steps, + hrm: r.bpm, + mov: r.movement, + act: r.activity + }); + actCount++; + } + } + if (event.ts != 0) { + require("health").readAllRecordsSince(new Date(event.ts - 600000), actCb); + } else { + require("health").readFullDatabase(actCb); + } + exports.gbSend({t: "actfetch", state: "end", count: actCount}); + }, + //{t:"listRecs", id:"20230616a"} + "listRecs": function() { + let recs = require("Storage").list(/^recorder\.log.*\.csv$/,{sf:true}).map(s => s.slice(12, 21)).filter(s => s.length>7 /*ignore 'old' tracks without date*/); + if (event.id && event.id.length > 2) { // Handle if there was no id supplied. Then we send a list all available recorder logs back. + let firstNonsyncedIdx = recs.findIndex((logId) => logId > event.id); + if (-1 == firstNonsyncedIdx) { + recs = [] + } else { + recs = recs.slice(firstNonsyncedIdx); + } + } + exports.gbSend({t:"actTrksList", list: recs}); // TODO: split up in multiple transmissions? + }, + //{t:"fetchRec", id:"20230616a"} + "fetchRec": function() { + // TODO: Decide on what names keys should have. + if (exports.fetchRecInterval) { + clearInterval(exports.fetchRecInterval); + exports.fetchRecInterval = undefined; + } + if (event.id=="stop") { + return; + } else { + let log = require("Storage").open("recorder.log"+event.id+".csv","r"); + let lines = "init";// = log.readLine(); + let pkgcnt = 0; + exports.gbSend({t:"actTrk", log:event.id, lines:"erase", cnt:pkgcnt}); // "erase" will prompt Gadgetbridge to erase the contents of a already fetched log so we can rewrite it without keeping lines from the previous (probably failed) fetch. + let sendlines = ()=>{ + lines = log.readLine(); + for (var i = 0; i < 3; i++) { + let line = log.readLine(); + if (line) lines += line; + } + pkgcnt++; + exports.gbSend({t:"actTrk", log:event.id, lines:lines, cnt:pkgcnt}); + if (!lines && exports.fetchRecInterval) { + clearInterval(exports.fetchRecInterval); + exports.fetchRecInterval = undefined; + } + }; + exports.fetchRecInterval = setInterval(sendlines, 50); + } + }, + "nav": function() { + event.id="nav"; + if (event.instr) { + event.t="add"; + event.src="maps"; // for the icon + event.title="Navigation"; + if (require("messages").getMessages().find(m=>m.id=="nav")) + event.t = "modify"; + } else { + event.t="remove"; + } + require("messages").pushMessage(event); + }, + "cards" : function() { + // we receive all, just override what we have + if (Array.isArray(event.d)) + require("Storage").writeJSON("android.cards.json", event.d); + }, + "accelsender": function () { + require("Storage").writeJSON("accelsender.json", {enabled: event.enable, interval: event.interval}); + load(); + } + }; + var h = HANDLERS[event.t]; + if (h) h(); else console.log("GB Unknown",event); +}; + +// HTTP request handling - see the readme +// options = {id,timeout,xpath} +exports.httpHandler = (url,options) => { + options = options||{}; + if (!NRF.getSecurityStatus().connected) + return Promise.reject(/*LANG*/"Not connected to Bluetooth"); + if (Bangle.httpRequest === undefined) + Bangle.httpRequest={}; + if (options.id === undefined) { + // try and create a unique ID + do { + options.id = Math.random().toString().substr(2); + } while( Bangle.httpRequest[options.id]!==undefined); + } + //send the request + var req = {t: "http", url:url, id:options.id}; + if (options.xpath) req.xpath = options.xpath; + if (options.return) req.return = options.return; // for xpath + if (options.method) req.method = options.method; + if (options.body) req.body = options.body; + if (options.headers) req.headers = options.headers; + req.timeout = options.timeout || 30000; + exports.gbSend(req); + //create the promise + var promise = new Promise(function(resolve,reject) { + //save the resolve function in the dictionary and create a timeout (30 seconds default) + Bangle.httpRequest[options.id]={r:resolve,j:reject,t:setTimeout(()=>{ + //if after "timeoutMillisec" it still hasn't answered -> reject + delete Bangle.httpRequest[options.id]; + reject("Timeout"); + },req.timeout+500)}; + }); + return promise; +}; + +exports.overwriteGPS = () => { // if the overwrite option is set, call this on init.. + const origSetGPSPower = Bangle.setGPSPower; + Bangle.moveGPSPower = (state) => { + if (Bangle.isGPSOn()){ + let orig = Bangle._PWR.GPS; + delete Bangle._PWR.GPS; + origSetGPSPower(state); + Bangle._PWR.GPS = orig; + } + }; + + // work around Serial1 for GPS not working when connected to something + let serialTimeout; + let wrap = function(f){ + return (s)=>{ + if (serialTimeout) clearTimeout(serialTimeout); + origSetGPSPower(1, "androidgpsserial"); + f(s); + serialTimeout = setTimeout(()=>{ + serialTimeout = undefined; + origSetGPSPower(0, "androidgpsserial"); + }, 10000); + }; + }; + Serial1.println = wrap(Serial1.println); + Serial1.write = wrap(Serial1.write); + + // replace set GPS power logic to suppress activation of gps (and instead request it from the phone) + Bangle.setGPSPower = ((isOn, appID) => { + let pwr; + if (!this.lastGPSEvent){ + // use internal GPS power function if no gps event has arrived from GadgetBridge + pwr = origSetGPSPower(isOn, appID); + } else { + // we are currently expecting the next GPS event from GadgetBridge, keep track of GPS state per app + if (!Bangle._PWR) Bangle._PWR={}; + if (!Bangle._PWR.GPS) Bangle._PWR.GPS=[]; + if (!appID) appID="?"; + if (isOn && !Bangle._PWR.GPS.includes(appID)) Bangle._PWR.GPS.push(appID); + if (!isOn && Bangle._PWR.GPS.includes(appID)) Bangle._PWR.GPS.splice(Bangle._PWR.GPS.indexOf(appID),1); + pwr = Bangle._PWR.GPS.length>0; + // stop internal GPS, no clients left + if (!pwr) origSetGPSPower(0); + } + // always update Gadgetbridge on current power state + require("android").gbSend({ t: "gps_power", status: pwr }); + return pwr; + }).bind(gpsState); + // allow checking for GPS via GadgetBridge + Bangle.isGPSOn = () => { + return !!(Bangle._PWR && Bangle._PWR.GPS && Bangle._PWR.GPS.length>0); + }; + // stop GPS on boot if not activated + setTimeout(()=>{ + if (!Bangle.isGPSOn()) require("android").gbSend({ t: "gps_power", status: false }); + },3000); +}; diff --git a/apps/android/metadata.json b/apps/android/metadata.json index 7768efb6c..c92678e23 100644 --- a/apps/android/metadata.json +++ b/apps/android/metadata.json @@ -2,7 +2,7 @@ "id": "android", "name": "Android Integration", "shortName": "Android", - "version": "0.36", + "version": "0.44", "description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.", "icon": "app.png", "tags": "tool,system,messages,notifications,gadgetbridge", @@ -13,7 +13,8 @@ {"name":"android.app.js","url":"app.js"}, {"name":"android.settings.js","url":"settings.js"}, {"name":"android.img","url":"app-icon.js","evaluate":true}, - {"name":"android.boot.js","url":"boot.js"} + {"name":"android.boot.js","url":"boot.js"}, + {"name":"android","url":"lib.js"} ], "data": [{"name":"android.settings.json"}, {"name":"android.calendar.json"}, {"name":"android.cards.json"}], "sortorder": -8 diff --git a/apps/antonclkplus/settings.js b/apps/antonclkplus/settings.js index 4448c00ed..70851e983 100644 --- a/apps/antonclkplus/settings.js +++ b/apps/antonclkplus/settings.js @@ -94,4 +94,4 @@ E.showMenu(mainmenu); -}); +}) diff --git a/apps/assistedgps/ChangeLog b/apps/assistedgps/ChangeLog index 13f928f18..89b1c80f8 100644 --- a/apps/assistedgps/ChangeLog +++ b/apps/assistedgps/ChangeLog @@ -3,4 +3,5 @@ 0.03: Select GNSS systems to use for Bangle.js 2 0.04: Now turns GPS off after upload 0.05: Fix regression in 0.04 that caused AGPS data not to get loaded -0.06: Auto-set GPS output sentences - newer Bangle.js 2 don't include RMC (GPS direction + time) by default \ No newline at end of file +0.06: Auto-set GPS output sentences - newer Bangle.js 2 don't include RMC (GPS direction + time) by default +0.07: Bangle.js 2 now gets estimated time + lat/lon from the browser (~3x faster fix) \ No newline at end of file diff --git a/apps/assistedgps/custom.html b/apps/assistedgps/custom.html index 994f6d053..39290c2e6 100644 --- a/apps/assistedgps/custom.html +++ b/apps/assistedgps/custom.html @@ -49,7 +49,7 @@ BDS+GLONASS @@ -60,6 +60,7 @@ diff --git a/apps/assistedgps/metadata.json b/apps/assistedgps/metadata.json index 8d4e07fa3..73f775a72 100644 --- a/apps/assistedgps/metadata.json +++ b/apps/assistedgps/metadata.json @@ -2,7 +2,7 @@ "id": "assistedgps", "name": "Assisted GPS Updater (AGPS)", "shortName": "AGPS", - "version": "0.06", + "version": "0.07", "description": "Downloads assisted GPS (AGPS) data to Bangle.js for faster GPS startup and more accurate fixes. **No app will be installed**, this just uploads new data to the GPS chip.", "sortorder": -1, "icon": "app.png", diff --git a/apps/ateatimer/ChangeLog b/apps/ateatimer/ChangeLog new file mode 100644 index 000000000..81da9fdce --- /dev/null +++ b/apps/ateatimer/ChangeLog @@ -0,0 +1,2 @@ +0.01: First release +0.02: Fix icon, utilize sched, show running timer on app relaunch \ No newline at end of file diff --git a/apps/ateatimer/app-icon.js b/apps/ateatimer/app-icon.js new file mode 100644 index 000000000..f80208ead --- /dev/null +++ b/apps/ateatimer/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwgIKHgwFKo0gAofmsALEGR0H/+f//+gEP/4ACAoXAn4FDAQn8g0DAoX4g0BAoXx4E4AoXhAoN/8EP4AzBn/4h/IC4M//kPzgjBz/+h+MAoMfj0PNYUfh4FDh8HAo0wg/454RBmBDBAoRnBCIIjCAAMPF4IFDHYOIgEBj5HBzkAIIPAIIIFBn4hBLIU+AoPgwEQvwFBOIX8CgP5w0RAoSJC/AsB/0EJwIgB/+Aj/wAoN/VgPgQwQFBwBKCXAQWBAAfgAoocCAoQcCAAPAj7XEcYIABcYLIBAAJBBA==")) \ No newline at end of file diff --git a/apps/ateatimer/app.js b/apps/ateatimer/app.js new file mode 100644 index 000000000..9322d4e46 --- /dev/null +++ b/apps/ateatimer/app.js @@ -0,0 +1,156 @@ +// Tea Timer Application for Bangle.js 2 using sched library + +let timerDuration = (() => { + let file = require("Storage").open("ateatimer.data", "r"); + let data = file.read(4); // Assuming 4 bytes for storage + return data ? parseInt(data, 10) : 4 * 60; // Default to 4 minutes +})(); +let timeRemaining = timerDuration; +let timerRunning = false; + +function saveDefaultDuration() { + let file = require("Storage").open("ateatimer.data", "w"); + file.write(timerDuration.toString()); +} + +function drawTime() { + g.clear(); + g.setFont("Vector", 40); + g.setFontAlign(0, 0); // Center align + + const minutes = Math.floor(Math.abs(timeRemaining) / 60); + const seconds = Math.abs(timeRemaining) % 60; + const sign = timeRemaining < 0 ? "-" : ""; + const timeStr = `${sign}${minutes}:${seconds.toString().padStart(2, '0')}`; + + g.drawString(timeStr, g.getWidth() / 2, g.getHeight() / 2); + + // Draw Increase button (triangle pointing up) + g.fillPoly([ + g.getWidth() / 2, g.getHeight() / 2 - 80, // Top vertex + g.getWidth() / 2 - 20, g.getHeight() / 2 - 60, // Bottom-left vertex + g.getWidth() / 2 + 20, g.getHeight() / 2 - 60 // Bottom-right vertex + ]); + + // Draw Decrease button (triangle pointing down) + g.fillPoly([ + g.getWidth() / 2, g.getHeight() / 2 + 80, // Bottom vertex + g.getWidth() / 2 - 20, g.getHeight() / 2 + 60, // Top-left vertex + g.getWidth() / 2 + 20, g.getHeight() / 2 + 60 // Top-right vertex + ]); + + g.flip(); +} + +function startTimer() { + if (timerRunning) return; + if (timeRemaining == 0) return; + timerRunning = true; + + // Save the default duration on timer start + timerDuration = timeRemaining; + saveDefaultDuration(); + scheduleTimer(); + + // Start the secondary timer to update the display + setInterval(updateDisplay, 1000); +} + +function scheduleTimer() { + // Schedule a new timer using the sched library + require("sched").setAlarm("ateatimer", { + msg: "Tea is ready!", + timer: timeRemaining * 1000, // Convert to milliseconds + vibrate: ".." // Default vibration pattern + }); + + // Ensure the scheduler updates + require("sched").reload(); +} + +function resetTimer() { + // Cancel the existing timer + require("sched").setAlarm("ateatimer", undefined); + require("sched").reload(); + + timerRunning = false; + timeRemaining = timerDuration; + drawTime(); +} + +function adjustTime(amount) { + if (-amount > timeRemaining) { + // Return if result will be negative + return; + } + timeRemaining += amount; + timeRemaining = Math.max(0, timeRemaining); // Ensure time doesn't go negative + if (timerRunning) { + // Update the existing timer with the new remaining time + let alarm = require("sched").getAlarm("ateatimer"); + if (alarm) { + // Cancel the current alarm + require("sched").setAlarm("ateatimer", undefined); + + // Set a new alarm with the updated time + scheduleTimer(); + } + } + + drawTime(); +} + +function handleTouch(x, y) { + const centerY = g.getHeight() / 2; + + if (y < centerY - 40) { + // Increase button area + adjustTime(60); + } else if (y > centerY + 40) { + // Decrease button area + adjustTime(-60); + } else { + // Center area + if (!timerRunning) { + startTimer(); + } + } +} + +// Function to update the display every second +function updateDisplay() { + if (timerRunning) { + let alarm = require("sched").getAlarm("ateatimer"); + timeRemaining = Math.floor(require("sched").getTimeToAlarm(alarm) / 1000); + drawTime(); + if (timeRemaining <= 0) { + timeRemaining = 0; + clearInterval(updateDisplay); + timerRunning = false; + } + } +} + +// Handle physical button press for resetting timer +setWatch(() => { + if (timerRunning) { + resetTimer(); + } else { + startTimer(); + } +}, BTN1, { repeat: true, edge: "falling" }); + +// Handle touch +Bangle.on("touch", (zone, xy) => { + handleTouch(xy.x, xy.y, false); +}); + +let isRunning = require("sched").getAlarm("ateatimer"); +if (isRunning) { + timerRunning = true; + // Start the timer to update the display + setInterval(updateDisplay, 1000); +} else { + // Draw the initial timer display + drawTime(); +} \ No newline at end of file diff --git a/apps/ateatimer/app.json b/apps/ateatimer/app.json new file mode 100644 index 000000000..7304a3d42 --- /dev/null +++ b/apps/ateatimer/app.json @@ -0,0 +1 @@ +{ "duration": 240 } \ No newline at end of file diff --git a/apps/ateatimer/app.png b/apps/ateatimer/app.png new file mode 100644 index 000000000..4c25f7d33 Binary files /dev/null and b/apps/ateatimer/app.png differ diff --git a/apps/ateatimer/metadata.json b/apps/ateatimer/metadata.json new file mode 100644 index 000000000..c4b8a1458 --- /dev/null +++ b/apps/ateatimer/metadata.json @@ -0,0 +1,14 @@ +{ "id": "ateatimer", + "name": "A Tea Timer", + "shortName":"A Tea Timer", + "icon": "app.png", + "version":"0.02", + "description": "Simple app for setting timers for tea. Touch up and down to change time, and time or button to start counting. When timer is running, button will stop timer and reset counter to last used value.", + "tags": "timer", + "supports": ["BANGLEJS2"], + "storage": [ + {"name":"ateatimer.app.js","url":"app.js"}, + {"name":"ateatimer.img","url":"app-icon.js","evaluate":true} + ], + "dependencies": {"scheduler":"type"} +} diff --git a/apps/aviatorclk/ChangeLog b/apps/aviatorclk/ChangeLog index 929ee8387..c086f765a 100644 --- a/apps/aviatorclk/ChangeLog +++ b/apps/aviatorclk/ChangeLog @@ -1,2 +1,7 @@ 1.00: initial release 1.01: added tap event to scroll METAR and toggle seconds display +1.02: continue showing METAR during AVWX updates (show update status next to time) + re-try GPS fix if it takes too long + bug fix + don't attempt to update METAR if Bluetooth is NOT connected + toggle seconds display on front double-taps (if un-locked) to avoid accidential enabling diff --git a/apps/aviatorclk/aviatorclk.app.js b/apps/aviatorclk/aviatorclk.app.js index 33d671bc7..cee83813f 100644 --- a/apps/aviatorclk/aviatorclk.app.js +++ b/apps/aviatorclk/aviatorclk.app.js @@ -19,6 +19,7 @@ const APP_NAME = 'aviatorclk'; const horizontalCenter = g.getWidth()/2; const mainTimeHeight = 38; const secondaryFontHeight = 22; +require("Font8x16").add(Graphics); // tertiary font const dateColour = ( g.theme.dark ? COLOUR_YELLOW : COLOUR_BLUE ); const UTCColour = ( g.theme.dark ? COLOUR_LIGHT_CYAN : COLOUR_DARK_CYAN ); const separatorColour = ( g.theme.dark ? COLOUR_LIGHT_GREY : COLOUR_DARK_GREY ); @@ -37,6 +38,7 @@ var settings = Object.assign({ var drawTimeout; var secondsInterval; var avwxTimeout; +var gpsTimeout; var AVWXrequest; var METAR = ''; @@ -92,16 +94,51 @@ function drawAVWX() { if (! avwxTimeout) { avwxTimeout = setTimeout(updateAVWX, 5 * 60000); } } +// show AVWX update status +function showUpdateAVWXstatus(status) { + let y = Bangle.appRect.y + 10; + g.setBgColor(g.theme.bg); + g.clearRect(0, y, horizontalCenter - 54, y + 16); + if (status) { + g.setFontAlign(0, -1).setFont("8x16").setColor( g.theme.dark ? COLOUR_ORANGE : COLOUR_DARK_YELLOW ); + g.drawString(status, horizontalCenter - 71, y, true); + } +} + +// re-try if the GPS doesn't return a fix in time +function GPStookTooLong() { + Bangle.setGPSPower(false, APP_NAME); + if (gpsTimeout) clearTimeout(gpsTimeout); + gpsTimeout = undefined; + + showUpdateAVWXstatus('X'); + + if (! avwxTimeout) { avwxTimeout = setTimeout(updateAVWX, 5 * 60000); } +} + // update the METAR info function updateAVWX() { if (avwxTimeout) clearTimeout(avwxTimeout); avwxTimeout = undefined; + if (gpsTimeout) clearTimeout(gpsTimeout); + gpsTimeout = undefined; - METAR = '\nGetting GPS fix'; - METARlinesCount = 0; METARscollLines = 0; - METARts = undefined; + if (! NRF.getSecurityStatus().connected) { + // if Bluetooth is NOT connected, try again in 5min + showUpdateAVWXstatus('X'); + avwxTimeout = setTimeout(updateAVWX, 5 * 60000); + return; + } + + showUpdateAVWXstatus('GPS'); + if (! METAR) { + METAR = '\nUpdating METAR'; + METARlinesCount = 0; METARscollLines = 0; + METARts = undefined; + } drawAVWX(); + gpsTimeout = setTimeout(GPStookTooLong, 30 * 60000); Bangle.setGPSPower(true, APP_NAME); Bangle.on('GPS', fix => { // prevent multiple, simultaneous requests @@ -109,12 +146,18 @@ function updateAVWX() { if ('fix' in fix && fix.fix != 0 && fix.satellites >= 4) { Bangle.setGPSPower(false, APP_NAME); + if (gpsTimeout) clearTimeout(gpsTimeout); + gpsTimeout = undefined; + let lat = fix.lat; let lon = fix.lon; - METAR = '\nRequesting METAR'; - METARlinesCount = 0; METARscollLines = 0; - METARts = undefined; + showUpdateAVWXstatus('AVWX'); + if (! METAR) { + METAR = '\nUpdating METAR'; + METARlinesCount = 0; METARscollLines = 0; + METARts = undefined; + } drawAVWX(); // get latest METAR from nearest airport (via AVWX API) @@ -146,6 +189,7 @@ function updateAVWX() { METARts = undefined; } + showUpdateAVWXstatus(''); drawAVWX(); AVWXrequest = undefined; @@ -155,6 +199,7 @@ function updateAVWX() { METAR = 'ERR: ' + error; METARlinesCount = 0; METARscollLines = 0; METARts = undefined; + showUpdateAVWXstatus(''); drawAVWX(); AVWXrequest = undefined; }); @@ -268,10 +313,10 @@ Bangle.on('tap', data => { case 'bottom': scrollAVWX(1); break; - case 'left': - case 'right': - // toggle seconds display on double taps left or right - if (data.double) { + case 'front': + // toggle seconds display on double tap on front/watch-face + // (if watch is un-locked) + if (data.double && ! Bangle.isLocked()) { if (settings.showSeconds) { clearInterval(secondsInterval); let y = Bangle.appRect.y + mainTimeHeight - 3; @@ -295,7 +340,7 @@ Bangle.loadWidgets(); Bangle.drawWidgets(); // draw static separator line -y = Bangle.appRect.y + mainTimeHeight + secondaryFontHeight; +let y = Bangle.appRect.y + mainTimeHeight + secondaryFontHeight; g.setColor(separatorColour); g.drawLine(0, y, g.getWidth(), y); diff --git a/apps/aviatorclk/metadata.json b/apps/aviatorclk/metadata.json index 9d2b0beef..54f539c1e 100644 --- a/apps/aviatorclk/metadata.json +++ b/apps/aviatorclk/metadata.json @@ -2,7 +2,7 @@ "id": "aviatorclk", "name": "Aviator Clock", "shortName":"AV8R Clock", - "version":"1.01", + "version":"1.02", "description": "A clock for aviators, with local time and UTC - and the latest METAR for the nearest airport", "icon": "aviatorclk.png", "screenshots": [{ "url": "screenshot.png" }, { "url": "screenshot2.png" }], diff --git a/apps/backlite/ChangeLog b/apps/backlite/ChangeLog new file mode 100644 index 000000000..64d8663b0 --- /dev/null +++ b/apps/backlite/ChangeLog @@ -0,0 +1,2 @@ +0.01: New app! (settings, boot.js). +0.02: Fix settings defaulting brightness to 0 diff --git a/apps/backlite/README.md b/apps/backlite/README.md new file mode 100644 index 000000000..c76f08de7 --- /dev/null +++ b/apps/backlite/README.md @@ -0,0 +1,20 @@ +# BackLite +### This app needs the latest settings app update (v 0.80), to ensure that setting the brightness to `0` does not default to `1`. + +BackLite is an app which greatly conserves battery life by only turning the backlight on when you long press the button from a locked state. + +Modern watches have a dedicated button to turn the backlight on, so as not to waste battery in an already light environment. This app recreates that functionality for the Bangle.js, which only has one button. + +#### Warning: This app overwrites the LCD brightness setting in `Bangle.js LCD settings`. If it is changed, the app will basically lose functionality. It auto-fixes itself every boot, so if you change the brightness, just reboot :) +# Usage +When you unlock with a press of the button, or any other way you unlock the watch, the backlight will not turn on, as most of the time you are able to read it, due to the transreflective display on the Bangle.js 2. + +If you press and hold the button to unlock the watch (for around half a second), the backlight will turn on for 5 seconds - just enough to see what you need to see. After that, it will turn off again. + +Some apps like `Light Switch Widget` will prevent this app from working properly. +# Settings +`Brightness` - The LCD brightness when unlocked with a long press. +# Creator +RKBoss6 + +TODO: Add a setting for long press time, or light duration diff --git a/apps/backlite/boot.js b/apps/backlite/boot.js new file mode 100644 index 000000000..9f01b4676 --- /dev/null +++ b/apps/backlite/boot.js @@ -0,0 +1,36 @@ +{ + let getSettings = function(){ + return Object.assign({ + // default values + brightness: 0.3, + + }, require('Storage').readJSON("BackLite.settings.json", true) || {}); + }; + + + //Set LCD to zero every reboot + let s = require("Storage").readJSON("setting.json", 1) || {}; + s.brightness = 0; + require("Storage").writeJSON("setting.json", s); + //remove large settings object from memory + delete s; + const longPressTime=400; //(ms) + + Bangle.on('lock', function(isLocked) { + Bangle.setLCDBrightness(0); + + if (!isLocked) { + // Just unlocked — give a short delay and check if BTN1 is still pressed + setTimeout(() => { + if (digitalRead(BTN1)) { + //set brightness until. locked. + Bangle.setLCDBrightness(getSettings().brightness); + } else { + Bangle.setLCDBrightness(0); + } + }, longPressTime); // Slight delay to allow unlock to settle + } + }); + +} + diff --git a/apps/backlite/icon.png b/apps/backlite/icon.png new file mode 100644 index 000000000..1337ef8ac Binary files /dev/null and b/apps/backlite/icon.png differ diff --git a/apps/backlite/metadata.json b/apps/backlite/metadata.json new file mode 100644 index 000000000..22d40d498 --- /dev/null +++ b/apps/backlite/metadata.json @@ -0,0 +1,17 @@ +{ + "id": "backlite", + "name": "BackLite", + "version": "0.02", + "description": "Conserves battery life by turning the backlight on only on a long press of the button from a locked state. **Requires the latest settings update (v0.80)**", + "icon": "icon.png", + "type": "bootloader", + "tags": "system", + "readme": "README.md", + "supports": ["BANGLEJS2"], + "storage": [ + {"name":"backlite.boot.js","url":"boot.js"}, + {"name":"backlite.settings.js","url":"settings.js"} + + ], + "data": [{"name":"BackLite.settings.json"}] +} diff --git a/apps/backlite/settings.js b/apps/backlite/settings.js new file mode 100644 index 000000000..a966d27f3 --- /dev/null +++ b/apps/backlite/settings.js @@ -0,0 +1,25 @@ +(function(back) { + var FILE = "BackLite.settings.json"; + + var settings = require("Storage").readJSON(FILE, 1) || {}; + + if (!isFinite(settings.brightness)) settings.brightness = 0.3; + + function writeSettings() { + require("Storage").writeJSON(FILE, settings); + } + + E.showMenu({ + "" : { "title" : "BackLite" }, + "< Back": back, // fallback if run standalone + "Brightness": { + value: settings.brightness, + min: 0.1, max: 1, + step: 0.1, + onchange: v => { + settings.brightness = v; + writeSettings(); + } + }, + }); +}) diff --git a/apps/backswipe/ChangeLog b/apps/backswipe/ChangeLog index 4e81269fe..c67453a09 100644 --- a/apps/backswipe/ChangeLog +++ b/apps/backswipe/ChangeLog @@ -1,6 +1,5 @@ 0.01: New App! 0.02: Don't fire if the app uses swipes already. 0.03: Only count defined handlers in the handler array. -0.04: Fix messages auto opened by `messagegui` could not be blacklisted. Needs - a refresh by deselecting and reselecting the "Messages" app throught Back Swipe - settings. +0.04: Fix messages auto opened by `messagegui` could not be blacklisted. Needs a refresh by deselecting and reselecting the "Messages" app throught Back Swipe settings. +0.05: React on swipes before the active app (for the most part) by using `prependListener`. diff --git a/apps/backswipe/boot.js b/apps/backswipe/boot.js index 8ff277634..cbc0f2563 100644 --- a/apps/backswipe/boot.js +++ b/apps/backswipe/boot.js @@ -38,6 +38,7 @@ // if we're in an app that has a back button, run the callback for it if (global.BACK && countHandlers("swipe")<=settings.standardNumSwipeHandlers && countHandlers("drag")<=settings.standardNumDragHandlers) { global.BACK(); + E.stopEventPropagation(); } } } @@ -56,5 +57,5 @@ } // Listen to left to right swipe - Bangle.on("swipe", goBack); + Bangle.prependListener("swipe", goBack); })(); diff --git a/apps/backswipe/metadata.json b/apps/backswipe/metadata.json index 4324286b5..78cd4dbe5 100644 --- a/apps/backswipe/metadata.json +++ b/apps/backswipe/metadata.json @@ -1,7 +1,7 @@ { "id": "backswipe", "name": "Back Swipe", "shortName":"BackSwipe", - "version":"0.04", + "version":"0.05", "description": "Service that allows you to use an app's back button using left to right swipe gesture", "icon": "app.png", "tags": "back,gesture,swipe", diff --git a/apps/banglebridge/ChangeLog b/apps/banglebridge/ChangeLog index 62542be60..a4b22db22 100644 --- a/apps/banglebridge/ChangeLog +++ b/apps/banglebridge/ChangeLog @@ -1,2 +1,3 @@ 0.01: New app! 0.02: Minor code improvements +0.03: Remove clearing of the screen (will break running apps) and fix lint errors \ No newline at end of file diff --git a/apps/banglebridge/metadata.json b/apps/banglebridge/metadata.json index 86e1face0..1dbb2e1de 100644 --- a/apps/banglebridge/metadata.json +++ b/apps/banglebridge/metadata.json @@ -2,8 +2,8 @@ "id": "banglebridge", "name": "BangleBridge", "shortName": "BangleBridge", - "version": "0.02", - "description": "Widget that allows Bangle Js to record pair and end data using Bluetooth Low Energy in combination with the BangleBridge Android App", + "version": "0.03", + "description": "Widget that allows Bangle.js to record pair and end data using Bluetooth Low Energy in combination with the BangleBridge Android App (**Note:** this has nothing to do with Gadgetbridge)", "icon": "widget.png", "type": "widget", "tags": "widget", diff --git a/apps/banglebridge/widget.js b/apps/banglebridge/widget.js index 692822b39..c805b0f39 100644 --- a/apps/banglebridge/widget.js +++ b/apps/banglebridge/widget.js @@ -1,10 +1,10 @@ (() => { /** * Widget measurements - * Description: + * Description: * name: connection.wid.js *icon: conectionIcon.icon - * + * */ //Font @@ -24,7 +24,7 @@ //Sensors code /** - * + * * @author Jorge */ function accel() { @@ -35,8 +35,7 @@ }); setInterval(function () { - - acclS = accelN.x + "##" + accelN.y + "##" + accelN.z + "\n" + accelN.diff + "##" + accelN.mag; + //acclS = accelN.x + "##" + accelN.y + "##" + accelN.z + "\n" + accelN.diff + "##" + accelN.mag; data[3] = accelN; }, 2 * 1000); @@ -45,8 +44,7 @@ function btt() { setInterval(function () { - - bttS = E.getBattery(); //return String + //bttS = E.getBattery(); //return String data[2] = E.getBattery(); }, 15 * 1000); @@ -65,9 +63,9 @@ setInterval(function () { - compssS = "A: " + compssN.x + " ## " + compssN.y + " ## " + compssN.z + "\n" + + /*compssS = "A: " + compssN.x + " ## " + compssN.y + " ## " + compssN.z + "\n" + "B: " + compssN.dx + " ## " + compssN.dy + " ## " + compssN.dz + " ## " + "\n" + - "C: " + compssN.heading; //return String + "C: " + compssN.heading; *///return String data[4] = compssN; }, 2 * 1000); @@ -86,8 +84,8 @@ setInterval(function () { - gpsS = "A: " + gpsN.lat + " ## " + gpsN.lon + " ## " + gpsN.alt + "\n" + "B: " + gpsN.speed + " ## " + gpsN.course + " ## " + gpsN.time + "\n" + - "C: " + gpsN.satellites + " ## " + gpsN.fix; //return String + /*gpsS = "A: " + gpsN.lat + " ## " + gpsN.lon + " ## " + gpsN.alt + "\n" + "B: " + gpsN.speed + " ## " + gpsN.course + " ## " + gpsN.time + "\n" + + "C: " + gpsN.satellites + " ## " + gpsN.fix; *///return String // work out how to display the current time var d = new Date(); var year = d.getFullYear(); @@ -150,7 +148,7 @@ //console.log("Index ==> "+ index); msr[indexFinal] = nueva; - item = nueva; + //item = nueva; lastInsert = indexFinal; } @@ -180,7 +178,7 @@ hrmN = normalize(hrmN); var roundedRate = parseFloat(hrmN).toFixed(2); - hrmS = String.valueOf(roundedRate); //return String + //hrmS = String.valueOf(roundedRate); //return String //console.log("array----->" + msr); data[0] = roundedRate; @@ -205,7 +203,7 @@ setInterval(function () { - stepS = String.valueOf(stepN); //return String + //stepS = String.valueOf(stepN); //return String data[1] = stepN; }, 2 * 1000); @@ -240,12 +238,11 @@ g.setFont("Vector", 45); g.drawString(prueba,100,200);*/ if (flip == 1) { //when off - + flip = 0; //Bangle.buzz(1000); - g.clear(); } else { //when on - + flip = 1; g.setFont("Vector", 30); g.drawString(data[0], 65, 180); @@ -283,7 +280,7 @@ com: data[4], gps: data[5] }; - /* g.clear(); + /* g.drawString(compssS,100,200); */ @@ -293,7 +290,7 @@ //draw(); }, 5 * 1000); - + WIDGETS["banglebridge"]={ area: "tl", width: 10, diff --git a/apps/banglexercise/ChangeLog b/apps/banglexercise/ChangeLog index 06c4adf1b..da89bdb08 100644 --- a/apps/banglexercise/ChangeLog +++ b/apps/banglexercise/ChangeLog @@ -5,3 +5,4 @@ 0.03: Add software back button on main menu 0.04: Minor code improvements 0.05: Minor code improvements +0.06: Fix grammar, add international language support diff --git a/apps/banglexercise/app.js b/apps/banglexercise/app.js index f4addc05a..c088c7e3e 100644 --- a/apps/banglexercise/app.js +++ b/apps/banglexercise/app.js @@ -24,7 +24,7 @@ let exerciseType = { // add new exercises here: const exerciseTypes = [{ "id": "pushup", - "name": "push ups", + "name": /*LANG*/"Push-ups", "useYaxis": true, "useZaxis": false, "threshold": 2500, @@ -34,7 +34,7 @@ const exerciseTypes = [{ }, { "id": "curl", - "name": "curls", + "name": /*LANG*/"Curls", "useYaxis": true, "useZaxis": false, "threshold": 2500, @@ -44,7 +44,7 @@ const exerciseTypes = [{ }, { "id": "situp", - "name": "sit ups", + "name": /*LANG*/"Sit-ups", "useYaxis": false, "useZaxis": true, "threshold": 3500, @@ -88,7 +88,7 @@ function showMainMenu() { menu["--------"] = { value: "" }; - menu["Last:"] = { + menu[/*LANG*/"Last:"] = { value: exerciseCounter + " " + exerciseType.name }; } @@ -189,10 +189,10 @@ function isValidExercise(slope, t) { if (p1 > 0 && p2 < 0) { if (lastZeroPassCameFromPositive == false) { lastExerciseHalfCompletionTime = t; - console.log(t, exerciseName + " half complete..."); + console.log(t, exerciseName + /*LANG*/" half complete..."); layout.progress.label = "½"; - layout.recording.label = "TRAINING"; + layout.recording.label = /*LANG*/"TRAINING"; g.clear(); layout.render(); } @@ -204,7 +204,7 @@ function isValidExercise(slope, t) { if (lastZeroPassCameFromPositive == true) { const tDiffLastExercise = t - lastExerciseCompletionTime; const tDiffStart = t - tStart; - console.log(t, exerciseName + " maybe complete?", Math.round(tDiffLastExercise), Math.round(tDiffStart)); + console.log(t, exerciseName + /*LANG*/" maybe complete?", Math.round(tDiffLastExercise), Math.round(tDiffStart)); // check minimal time between exercises: if ((lastExerciseCompletionTime <= 0 && tDiffStart >= thresholdMinTime) || tDiffLastExercise >= thresholdMinTime) { @@ -222,7 +222,7 @@ function isValidExercise(slope, t) { layout.count.label = exerciseCounter; layout.progress.label = ""; - layout.recording.label = "Good!"; + layout.recording.label =/*LANG*/"Good!"; g.clear(); layout.render(); @@ -230,26 +230,26 @@ function isValidExercise(slope, t) { if (settings.buzz) Bangle.buzz(200, 0.5); } else { - console.log(t, exerciseName + " too quick for duration time threshold!"); // thresholdMinDurationTime + console.log(t, exerciseName + /*LANG*/" too quick for duration time threshold!"); // thresholdMinDurationTime lastExerciseCompletionTime = t; - layout.recording.label = "Go slower!"; + layout.recording.label = /*LANG*/"Go slower!"; g.clear(); layout.render(); } } else { - console.log(t, exerciseName + " top slow for time threshold!"); // thresholdMaxTime + console.log(t, exerciseName + /*LANG*/" top slow for time threshold!"); // thresholdMaxTime lastExerciseCompletionTime = t; - layout.recording.label = "Go faster!"; + layout.recording.label = /*LANG*/"Go faster!"; g.clear(); layout.render(); } } else { - console.log(t, exerciseName + " too quick for time threshold!"); // thresholdMinTime + console.log(t, exerciseName + /*LANG*/" too quick for time threshold!"); // thresholdMinTime lastExerciseCompletionTime = t; - layout.recording.label = "Go slower!"; + layout.recording.label = /*LANG*/"Go slower!"; g.clear(); layout.render(); } @@ -337,7 +337,7 @@ function startTraining() { type: "txt", id: "recording", font: "6x8:2", - label: "TRAINING", + label: /*LANG*/"TRAINING", bgCol: "#f00", pad: 5, fillx: 1 @@ -345,7 +345,7 @@ function startTraining() { ] }, { btns: [{ - label: "STOP", + label: /*LANG*/"STOP", cb: () => { stopTraining(); } diff --git a/apps/banglexercise/metadata.json b/apps/banglexercise/metadata.json index b2f8e39ea..9598e7a71 100644 --- a/apps/banglexercise/metadata.json +++ b/apps/banglexercise/metadata.json @@ -1,12 +1,12 @@ { "id": "banglexercise", "name": "BanglExercise", "shortName":"BanglExercise", - "version": "0.05", - "description": "Can automatically track exercises while wearing the Bangle.js watch.", + "version": "0.06", + "description": "Automatically tracks exercises while wearing the Bangle.js watch.", "icon": "app.png", "screenshots": [{"url":"screenshot.png"}], "type": "app", - "tags": "sport", + "tags": "health", "supports" : ["BANGLEJS2"], "allow_emulator":true, "readme": "README.md", diff --git a/apps/banglexercise/settings.js b/apps/banglexercise/settings.js index 0b52acd72..a52634faf 100644 --- a/apps/banglexercise/settings.js +++ b/apps/banglexercise/settings.js @@ -17,4 +17,4 @@ } } }); -}); +}) diff --git a/apps/barclock/settings.js b/apps/barclock/settings.js index 04f0a38ba..bc292ef6f 100644 --- a/apps/barclock/settings.js +++ b/apps/barclock/settings.js @@ -32,4 +32,4 @@ } require("ClockFace_menu").addItems(menu, save, items); E.showMenu(menu); -}); +}) diff --git a/apps/batterybooster/ChangeLog b/apps/batterybooster/ChangeLog new file mode 100644 index 000000000..6eedfa435 --- /dev/null +++ b/apps/batterybooster/ChangeLog @@ -0,0 +1 @@ +0.01: New app introduced to the app loader! diff --git a/apps/batterybooster/README.md b/apps/batterybooster/README.md new file mode 100644 index 000000000..d6da4942d --- /dev/null +++ b/apps/batterybooster/README.md @@ -0,0 +1,30 @@ +# Battery Booster + +A Bangle.js app designed to optimize battery life through smart screen and power management features. + +## Features + +### 1. Auto Soft-Off +- Automatically puts the watch into soft-off mode after 3 hours (10,800,000 ms) of being locked +- This feature is activated when the watch is locked and cancelled when unlocked + +### 2. Dynamic Screen Timeout +- Sets LCD timeout to 2 seconds when the watch is locked +- Extends LCD timeout to 10 seconds when the screen is touched +- Helps preserve battery life while maintaining usability + +### 3. Adaptive Brightness Control +- Automatically adjusts screen brightness based on the time of day +- Uses a sinusoidal pattern that follows natural daylight: + - Peak brightness at noon + - Lowest brightness at midnight + - Gradual transitions in between +- Updates brightness every hour + +## How It Works +The app runs in the background and manages three main aspects of power consumption: +1. Screen timeout duration +2. Automatic soft-off functionality +3. Time-based brightness adjustment + +This combination of features helps extend battery life while maintaining a good user experience. \ No newline at end of file diff --git a/apps/batterybooster/app.png b/apps/batterybooster/app.png new file mode 100644 index 000000000..3580b4895 Binary files /dev/null and b/apps/batterybooster/app.png differ diff --git a/apps/batterybooster/boot.js b/apps/batterybooster/boot.js new file mode 100644 index 000000000..22dbda316 --- /dev/null +++ b/apps/batterybooster/boot.js @@ -0,0 +1,26 @@ +{ + let softOffTimeout; + Bangle.on("lock", (on) => { + if (on) { + softOffTimeout = setTimeout(() => Bangle.softOff(), 10800000); + Bangle.setLCDTimeout(2); + } + else { + if (softOffTimeout) clearTimeout(softOffTimeout); + } + }); + Bangle.on("touch", () => { + Bangle.setLCDTimeout(10); + }); + setInterval(() => { + let getBrightness = (hour) => { + let radians = (Math.PI / 12) * (hour - 6); + let brightness = Math.sin(radians) / 2 + 0.5; + return brightness; + }; + + const d = new Date(); + let hour = d.getHours(); + Bangle.setLCDBrightness(getBrightness(hour)); + }, 3600000); +} \ No newline at end of file diff --git a/apps/batterybooster/metadata.json b/apps/batterybooster/metadata.json new file mode 100644 index 000000000..bd78e22d6 --- /dev/null +++ b/apps/batterybooster/metadata.json @@ -0,0 +1,19 @@ +{ + "id": "batterybooster", + "name": "Battery Booster", + "icon": "app.png", + "version": "0.01", + "description": "A bootloader app which adds scripts to boost battery life of your Bangle.js 2", + "type": "bootloader", + "tags": "tools,system", + "readme": "README.md", + "supports": [ + "BANGLEJS2" + ], + "storage": [ + { + "name": "batterybooster.boot.js", + "url": "boot.js" + } + ] +} diff --git a/apps/bblobface/metadata.json b/apps/bblobface/metadata.json index 6af247c91..8393755b0 100644 --- a/apps/bblobface/metadata.json +++ b/apps/bblobface/metadata.json @@ -6,7 +6,7 @@ "description": "A fully featured watch face with a playable game on the side.", "readme":"README.md", "type": "clock", - "tags": "clock, game", + "tags": "clock,game", "supports" : ["BANGLEJS2"], "storage": [ {"name":"bblobface.app.js","url":"app.js"}, diff --git a/apps/bbreaker/ChangeLog b/apps/bbreaker/ChangeLog new file mode 100644 index 000000000..6556ff80c --- /dev/null +++ b/apps/bbreaker/ChangeLog @@ -0,0 +1,4 @@ +0.01: It works somehow, early version for testers and feedback :) +0.02: Changed almost all code with Frederic version of Pong and adjusted to be a BrickBreaker!, still Alpha +0.03: Rewrote the whole thing to have less code and better graphics, now it works. +0.04: Rewrote part of the code to coupe with the flickering and added better logic to handle the graphics. \ No newline at end of file diff --git a/apps/bbreaker/README.md b/apps/bbreaker/README.md new file mode 100644 index 000000000..56175463a --- /dev/null +++ b/apps/bbreaker/README.md @@ -0,0 +1,28 @@ +# BrickBreaker + +A simple BreakOut clone for the Banglejs + +![Screenshot](bbreaker.png) + +## Usage + +![Screenshot](playing.png) + +Buttons 1 and 3 to move the BrickBreaker! + +Button 2 to pause and start the game again. + +## Disclaimer + +This game was created to learn JS and how to interact with Banglejs, meaning that it may not be perfect :). + +Built with love with base on the tutorial: 2D breakout game using pure JavaScript +https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript + +Started on 2020 but rewrote all in 2025 and this is the version I got without having issues with Memory Exhaustion. + +And yes, for Bangle 1, old school! + +## Creator + +Israel Ochoa \ No newline at end of file diff --git a/apps/bbreaker/app-icon.js b/apps/bbreaker/app-icon.js new file mode 100644 index 000000000..8e74af7ba --- /dev/null +++ b/apps/bbreaker/app-icon.js @@ -0,0 +1 @@ +atob("MDCCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFQAAAAAAAAAAAAAAVQAAAAAAAAAAAAAFWUAAAAAAAAAAAABVuUAAAAAAAAAAAAVa/lAAAAAAAAAAABWv/lQAAAAAAAAAAVb/+VAAAAAAAAAABW//lUAAAAAAAAAABX/6VAAAAAAAAAAAAW/lUAAAAAAAAAAAAFpVAAAAAAAAAAAAAFVQAAAAAAAAAAAAABUAAAFVVVVQVVQAAAQAAAFVVVVQVVQAAAAAAAFv//5QW5QAAAAAAAG///9QW9QAAAAAAAG///9QW9QAAAAAAAFqqqpQWpQAAAAAAAFVVVVQVVQAAAAAAAFVVVVQVVQAAAAAAAAAAAAAAAAAAAABVVVVQFVVVVQAAAAFVVVVUVVVVVQAAAAFqqqqUWqqqpQAAAAFv//+UW///9QAAAAFv//+UW///9QAAAAFv//+UWv//5QAAAAFVVVVUVVVVVQAAAABVVVVUFVVVVQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVVVVUFVVVVQVVQABaqqqUFqqqpQWpQABv//+UF///9QW5QABv//+UG///9QW5QABv//+UG///9QW5QABaqqqUFqqqpQWlQABVVVVUFVVVVQVVQAAVVVVABVVVVABUAAAAAAAAAAAAAAAAAA==") \ No newline at end of file diff --git a/apps/bbreaker/app.js b/apps/bbreaker/app.js new file mode 100644 index 000000000..6d6ef9401 --- /dev/null +++ b/apps/bbreaker/app.js @@ -0,0 +1,293 @@ + +(function () { + var BALL_RADIUS = 3; + var PADDLE_WIDTH = 26; + var PADDLE_HEIGHT = 6; + var BRICK_ROWS = 2; + var BRICK_HEIGHT = 8; + var BRICK_PADDING = 4; + var BRICK_OFFSET_TOP = 60; + var BRICK_OFFSET_LEFT = 2; + var SPEED_MULTIPLIER = 1.1; + var PADDLE_SPEED = 12; + + var ball, paddle, interval; + var bricks = []; + var BRICK_WIDTH, BRICK_COLS; + var score = 0; + var level = 1; + var highScore = 0; + var paused = false; + var gameOver = false; + var lives = 3; + var paddleMove = 0; + + var storage = require("Storage"); + + function loadHighScore() { + var saved = storage.readJSON("breakout_highscore.json", 1); + highScore = saved && saved.highScore ? saved.highScore : 0; + } + + function saveHighScore() { + if (score > highScore) { + highScore = score; + storage.writeJSON("breakout_highscore.json", { highScore }); + } + } + + function initBricks() { + bricks = []; + for (var i = 0; i < BRICK_ROWS * BRICK_COLS; i++) { + bricks.push(1); + } + } + + function initGame() { + var screenWidth = g.getWidth(); + BRICK_COLS = Math.min(5, Math.floor((screenWidth - BRICK_OFFSET_LEFT + BRICK_PADDING) / (15 + BRICK_PADDING))); + BRICK_WIDTH = Math.floor((screenWidth - BRICK_OFFSET_LEFT - (BRICK_COLS - 1) * BRICK_PADDING) / BRICK_COLS); + + ball = { + x: screenWidth / 2, + y: g.getHeight() - 40, + dx: (Math.random() > 0.5 ? 1 : -1) * 3, + dy: -3, + radius: BALL_RADIUS, + prevPos: null + }; + + paddle = { + x: screenWidth / 2 - PADDLE_WIDTH / 2, + y: g.getHeight() - 20, + width: PADDLE_WIDTH, + height: PADDLE_HEIGHT, + prevPos: null + }; + lives = 3; + score = 0; + level = 1; + gameOver = false; + paused = false; + loadHighScore(); + initBricks(); + } + + function drawLives() { + var heartSize = 6; + var spacing = 2; + var startX = g.getWidth() - (lives * (heartSize + spacing)) - 2; + var y = 32; + g.setColor(1, 0, 0); + for (var i = 0; i < lives; i++) { + var x = startX + i * (heartSize + spacing); + g.fillPoly([x + 3, y, x + 6, y + 3, x + 3, y + 6, x, y + 3], true); + } + } + + function drawBricks() { + g.setColor(0, 1, 0); + for (var i = 0; i < bricks.length; i++) { + if (bricks[i]) { + var c = i % BRICK_COLS; + var r = Math.floor(i / BRICK_COLS); + var brickX = BRICK_OFFSET_LEFT + c * (BRICK_WIDTH + BRICK_PADDING); + var brickY = BRICK_OFFSET_TOP + r * (BRICK_HEIGHT + BRICK_PADDING); + g.fillRect(brickX, brickY, brickX + BRICK_WIDTH - 1, brickY + BRICK_HEIGHT - 1); + } + } + } + + function drawBall() { + g.setColor(1, 1, 1); + g.fillCircle(ball.x, ball.y, ball.radius); + g.setColor(0.7, 0.7, 0.7); + g.fillCircle(ball.x - 0.5, ball.y - 0.5, ball.radius - 1); + } + + function drawPaddle() { + g.setColor(0, 1, 1); + g.fillRect(paddle.x, paddle.y, paddle.x + paddle.width - 1, paddle.y + paddle.height - 1); + } + + function drawHUD() { + g.setColor(0, 0, 0).fillRect(0, 0, g.getWidth(), BRICK_OFFSET_TOP - 1); + g.setColor(1, 1, 1); + g.setFont("6x8", 1); + g.setFontAlign(-1, -1); + g.drawString("Score: " + score, 2, 22); + g.setFontAlign(0, -1); + g.drawString("High: " + highScore, g.getWidth() / 2, 22); + g.setFontAlign(1, -1); + g.drawString("Lvl: " + level, g.getWidth() - 2, 22); + drawLives(); + if (paused) { + g.setFontAlign(0, 0); + g.drawString("PAUSED", g.getWidth() / 2, g.getHeight() / 2); + } + } + + function draw() { + if (paddle.prevPos) { + g.setColor(0, 0, 0).fillRect(paddle.prevPos.x - 1, paddle.prevPos.y - 1, paddle.prevPos.x + paddle.width + 1, paddle.prevPos.y + paddle.height + 1); + } + if (ball.prevPos) { + g.setColor(0, 0, 0).fillCircle(ball.prevPos.x, ball.prevPos.y, ball.radius + 1); + } + drawHUD(); + drawBall(); + drawPaddle(); + g.flip(); + ball.prevPos = { x: ball.x, y: ball.y }; + paddle.prevPos = { x: paddle.x, y: paddle.y, width: paddle.width, height: paddle.height }; + } + + function showGameOver() { + g.clear(); + g.setFont("6x8", 2); + g.setFontAlign(0, 0); + g.setColor(1, 0, 0); + g.drawString("GAME OVER", g.getWidth() / 2, g.getHeight() / 2 - 20); + g.setFont("6x8", 1); + g.setColor(1, 1, 1); + g.drawString("Score: " + score, g.getWidth() / 2, g.getHeight() / 2); + g.drawString("High: " + highScore, g.getWidth() / 2, g.getHeight() / 2 + 12); + g.drawString("BTN2 = Restart", g.getWidth() / 2, g.getHeight() / 2 + 28); + g.flip(); + } + + function collisionDetection() { + for (var i = 0; i < bricks.length; i++) { + if (bricks[i]) { + var c = i % BRICK_COLS; + var r = Math.floor(i / BRICK_COLS); + var brickX = BRICK_OFFSET_LEFT + c * (BRICK_WIDTH + BRICK_PADDING); + var brickY = BRICK_OFFSET_TOP + r * (BRICK_HEIGHT + BRICK_PADDING); + if (ball.x + ball.radius > brickX && ball.x - ball.radius < brickX + BRICK_WIDTH && ball.y + ball.radius > brickY && ball.y - ball.radius < brickY + BRICK_HEIGHT) { + ball.dy = -ball.dy; + bricks[i] = 0; + score += 10; + g.setColor(0, 0, 0).fillRect(brickX, brickY, brickX + BRICK_WIDTH - 1, brickY + BRICK_HEIGHT - 1); + break; + } + } + } + } + + function allBricksCleared() { + for (var i = 0; i < bricks.length; i++) { + if (bricks[i]) return false; + } + return true; + } + + function resetAfterLifeLost() { + clearInterval(interval); + interval = undefined; + ball.x = g.getWidth() / 2; + ball.y = g.getHeight() - 40; + ball.dx = (Math.random() > 0.5 ? 1 : -1) * 3; + ball.dy = -3; + paddle.x = g.getWidth() / 2 - PADDLE_WIDTH / 2; + ball.prevPos = null; + paddle.prevPos = null; + g.clear(); + drawBricks(); + draw(); + setTimeout(() => { interval = setInterval(update, 50); }, 1000); + } + + function update() { + if (paused || gameOver) return; + if (paddleMove) { + paddle.x += paddleMove * PADDLE_SPEED; + if (paddle.x < 0) paddle.x = 0; + if (paddle.x + paddle.width > g.getWidth()) { + paddle.x = g.getWidth() - paddle.width; + } + } + ball.x += ball.dx; + ball.y += ball.dy; + if (ball.x + ball.radius > g.getWidth() || ball.x - ball.radius < 0) { + ball.dx = -ball.dx; + } + if (ball.y - ball.radius < 0) { + ball.dy = -ball.dy; + } + if (ball.y + ball.radius >= paddle.y && ball.x >= paddle.x && ball.x <= paddle.x + paddle.width) { + ball.dy = -ball.dy; + ball.y = paddle.y - ball.radius; + } + if (ball.y + ball.radius > g.getHeight()) { + lives--; + if (lives > 0) { + resetAfterLifeLost(); + return; + } else { + clearInterval(interval); + interval = undefined; + saveHighScore(); + gameOver = true; + setTimeout(showGameOver, 50); + return; + } + } + collisionDetection(); + if (allBricksCleared()) { + level++; + ball.dx = (Math.random() > 0.5 ? 1 : -1) * Math.abs(ball.dx) * SPEED_MULTIPLIER; + ball.dy *= SPEED_MULTIPLIER; + initBricks(); + ball.prevPos = null; + paddle.prevPos = null; + g.clear(); + drawBricks(); + } + draw(); + } + + function showGetReady(callback) { + g.clear(); + g.setFont("6x8", 2); + g.setFontAlign(0, 0); + g.setColor(1, 1, 0); + g.drawString("GET READY!", g.getWidth() / 2, g.getHeight() / 2); + g.flip(); + setTimeout(() => { + g.clear(); + drawBricks(); + draw(); + callback(); + }, 1500); + } + + function startGame() { + initGame(); + showGetReady(() => { + interval = setInterval(update, 50); + }); + } + + setWatch(() => { + if (gameOver) { + startGame(); + return; + } + paused = !paused; + if (paused) { + drawHUD(); + g.flip(); + } else { + g.clear(); + drawBricks(); + draw(); + } + }, BTN2, { repeat: true, edge: "rising" }); + + setWatch(() => { paddleMove = -1; }, BTN1, { repeat: true, edge: "rising" }); + setWatch(() => { paddleMove = 0; }, BTN1, { repeat: true, edge: "falling" }); + setWatch(() => { paddleMove = 1; }, BTN3, { repeat: true, edge: "rising" }); + setWatch(() => { paddleMove = 0; }, BTN3, { repeat: true, edge: "falling" }); + + startGame(); +})(); \ No newline at end of file diff --git a/apps/bbreaker/bbreaker.png b/apps/bbreaker/bbreaker.png new file mode 100644 index 000000000..d32d72099 Binary files /dev/null and b/apps/bbreaker/bbreaker.png differ diff --git a/apps/bbreaker/metadata.json b/apps/bbreaker/metadata.json new file mode 100644 index 000000000..41d081489 --- /dev/null +++ b/apps/bbreaker/metadata.json @@ -0,0 +1,15 @@ + { "id": "bbreaker", + "name": "BrickBreaker", + "shortName":"BrickBreaker", + "icon": "bbreaker.png", + "version":"0.04", + "description": "A simple BreakOut clone for the Banglejs", + "tags": "game", + "readme": "README.md", + "supports": ["BANGLEJS"], + "allow_emulator": true, + "storage": [ + {"name":"bbreaker.app.js","url":"app.js"}, + {"name":"bbreaker.img","url":"app-icon.js","evaluate":true} + ] + } \ No newline at end of file diff --git a/apps/bbreaker/playing.png b/apps/bbreaker/playing.png new file mode 100644 index 000000000..97d9fca25 Binary files /dev/null and b/apps/bbreaker/playing.png differ diff --git a/apps/beeptest/metadata.json b/apps/beeptest/metadata.json index a9856bc93..7c25a3848 100644 --- a/apps/beeptest/metadata.json +++ b/apps/beeptest/metadata.json @@ -5,7 +5,7 @@ "version": "0.01", "description": "Aerobic fitness test created by Léger & Lambert", "icon": "beeptest.png", - "tags": "Health", + "tags": "health", "supports": ["BANGLEJS2"], "readme": "README.md", "storage": [ diff --git a/apps/berlinc/settings.js b/apps/berlinc/settings.js index a1b655a62..b240a5f46 100644 --- a/apps/berlinc/settings.js +++ b/apps/berlinc/settings.js @@ -23,4 +23,4 @@ }; E.showMenu(mainmenu); -}); +}) diff --git a/apps/bikespeedo/ChangeLog b/apps/bikespeedo/ChangeLog index 7330eb937..e63622217 100644 --- a/apps/bikespeedo/ChangeLog +++ b/apps/bikespeedo/ChangeLog @@ -1,7 +1,8 @@ -0.01: New App! -0.02: Barometer altitude adjustment setting -0.03: Use default Bangle formatter for booleans -0.04: Add options for units in locale and recording GPS -0.05: Allow toggling of "max" values (screen tap) and recording (button press) -0.06: Fix local unit setting +0.01: New App! +0.02: Barometer altitude adjustment setting +0.03: Use default Bangle formatter for booleans +0.04: Add options for units in locale and recording GPS +0.05: Allow toggling of "max" values (screen tap) and recording (button press) +0.06: Fix local unit setting 0.07: Minor code improvements +0.08: Ensure graphics state is reset at the start of a draw (such as if a widget has altered state) diff --git a/apps/bikespeedo/app.js b/apps/bikespeedo/app.js index a1f0b53ce..7d0c65ab1 100644 --- a/apps/bikespeedo/app.js +++ b/apps/bikespeedo/app.js @@ -196,7 +196,7 @@ var emulator = (process.env.BOARD=="EMSCRIPTEN" || process.env.BOARD=="EMSCRIPTE var SATinView = 0; function drawFix(dat) { - g.clearRect(0,screenYstart,screenW,screenH); + g.reset().clearRect(0,screenYstart,screenW,screenH); var v = ''; var u=''; @@ -234,7 +234,6 @@ function drawFix(dat) { drawSats('View:' + SATinView); } } - g.reset(); } @@ -404,12 +403,12 @@ function onGPS(fix) { } function updateClock() { - drawTime(); g.reset(); + drawTime(); if ( emulator ) { max.spd++; max.alt++; - const d=new Date(); + const d=new Date(); sec=d.getSeconds(); onGPS(lf); } @@ -499,7 +498,7 @@ function nextMode() { function start() { Bangle.setBarometerPower(1); // needs some time... - g.clearRect(0,screenYstart,screenW,screenH); + g.reset().clearRect(0,screenYstart,screenW,screenH); onGPS(lf); Bangle.setGPSPower(1); Bangle.on('GPS', onGPS); diff --git a/apps/bikespeedo/metadata.json b/apps/bikespeedo/metadata.json index 20c7d4f53..2df77ec17 100644 --- a/apps/bikespeedo/metadata.json +++ b/apps/bikespeedo/metadata.json @@ -2,7 +2,7 @@ "id": "bikespeedo", "name": "Bike Speedometer (beta)", "shortName": "Bike Speedometer", - "version": "0.07", + "version": "0.08", "description": "Shows GPS speed, GPS heading, Compass heading, GPS altitude and Barometer altitude from internal sources", "icon": "app.png", "screenshots": [{"url":"Screenshot.png"}], diff --git a/apps/bikespeedo/settings.js b/apps/bikespeedo/settings.js index bb943c081..0326d7529 100644 --- a/apps/bikespeedo/settings.js +++ b/apps/bikespeedo/settings.js @@ -68,4 +68,4 @@ E.showMenu(appMenu); -}); +}) diff --git a/apps/blc/ChangeLog b/apps/blc/ChangeLog new file mode 100644 index 000000000..6075cacf8 --- /dev/null +++ b/apps/blc/ChangeLog @@ -0,0 +1,4 @@ +0.10: New app introduced to the app loader! +0.20: skipped (internal revision) +0.30: skipped (internal revision) +0.40: added functionality for customizing colors diff --git a/apps/blc/README.md b/apps/blc/README.md new file mode 100644 index 000000000..3d126bcf8 --- /dev/null +++ b/apps/blc/README.md @@ -0,0 +1,17 @@ +# Binary LED Clock + +A binary watch with LEDs, showing time and date. + +From top to bottom the watch face shows four rows of leds: + +* hours (red leds) +* minutes (green leds) +* day (yellow leds, top row) +* month (yellow leds, bottom row) + +The colors are default colors and can be changed at the settings page, also, the outer ring can be disabled. + +The rightmost LED represents 1, the second 2, the third 4, the next 8 and so on, i.e. values are the powers of two. + +As usual, luminous leds represent a logical one, and "dark" leds a logcal '0'. Dark means the color of the background. +Widgets aren't affected and are shown as normal. diff --git a/apps/blc/blc-icon.js b/apps/blc/blc-icon.js new file mode 100644 index 000000000..a8d30baee --- /dev/null +++ b/apps/blc/blc-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEw4n/AAIHBqut8FPgH4sspk1T885/feoMI74TB1Fc51Dmfg28gKmMCrNSAgMlyo5BgV7uQIKgEhiMRkECAYMSgErolLBBIXBqIKBqEFAYMVgF0olEuAIIC4ORBQOQhIDBjMA2gOB2AIIF7JfXR67X0lvdHwQII7vSa4/TmYKBBBEtmc9a40NmYKBBBIbBmfQa4oOEBBAXFF65fXR64A/AG8IvN4AgOG62ABAuHy4IGgEHiMXAgNu91gBAtxiNwBAsAhMRjIEB73ucIIIEyMRyAIFF7BfXAH6/IttoKxRoIgEG93mQxSYIgEN93tWxTIIF7BfXAH4AGw93u/A44IDhl8vQRFBogXB0ECuGoBAcKxRxBC53Hhlyk8ggVyuQGBvlwhgNBk98BAN6I4UgC4N4BwWgAwWsC4fAk4IB0AvBAgIQBBwUIkQOBAwQXCJIIEBI4UAkQXE48sAwgXJF40mgAvDvRtCC4pfEC4WCPYJdBDYNyC4wAX")) diff --git a/apps/blc/blc-icon.png b/apps/blc/blc-icon.png new file mode 100644 index 000000000..8bbf6ae71 Binary files /dev/null and b/apps/blc/blc-icon.png differ diff --git a/apps/blc/blc.js b/apps/blc/blc.js new file mode 100644 index 000000000..6015bc548 --- /dev/null +++ b/apps/blc/blc.js @@ -0,0 +1,182 @@ +//Binary LED Clock (BLC) by aeMKai + +{ // must be inside our own scope here so that when we are unloaded everything disappears + // we also define functions using 'let fn = function() {..}' for the same reason. function decls are global + + const SETTINGSFILE = "BinaryClk.settings.json"; + + // variables defined from settings + let HourCol; + let MinCol; + let DayCol; + let MonCol; + let RingOn; + + // color arrays + // !!! don't change order unless change oder in BinaryClk.settings.js !!! + // !!! order must correspond to each other between arrays !!! + let LED_Colors = ["#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#000"]; + let LED_ColorNames = ["white", "red", "green", "blue", "yellow", "magenta", "cyan", "black"]; + + // load settings + let loadSettings = function() + { + function def (value, def) {return value !== undefined ? value : def;} + + var settings = require('Storage').readJSON(SETTINGSFILE, true) || {}; + // get name from setting, find index of name and assign corresponding color code by index + HourCol = LED_Colors[LED_ColorNames.indexOf(def(settings.HourCol, "red"))]; + MinCol = LED_Colors[LED_ColorNames.indexOf(def(settings.MinCol, "green"))]; + DayCol = LED_Colors[LED_ColorNames.indexOf(def(settings.DayCol, "yellow"))]; + MonCol = LED_Colors[LED_ColorNames.indexOf(def(settings.MonCol, "yellow"))]; + RingOn = def(settings.RingOn, true); + + delete settings; // settings in local var -> no more required + } + + let drawTimeout; + + // actually draw the watch face + let draw = function() + { + // Bangle.js2 -> 176x176 + var x_rgt = g.getWidth(); + var y_bot = g.getHeight(); + //var x_cntr = x_rgt / 2; + var y_cntr = y_bot / 18*7; + g.reset().clearRect(Bangle.appRect); // clear whole background (w/o widgets) + + var white = "#FFF"; + var black = "#000"; + var bord_col = white; + var col_off = black; + + var col = new Array(HourCol, MinCol, DayCol, MonCol); // each #rgb + if (g.theme.dark) + { + bord_col = white; + col_off = black; + } + else + { + bord_col = black; + col_off = white; + } + + let pwr2 = [1, 2, 4, 8, 16, 32]; // array with powers of 2, because poweroperator '**' doesnt work + // maybe also faster + + + var no_lines = 4; // 4 rows: hour (hr), minute (min), day (day), month (mon) + var no_hour = 5; + var no_min = 6; + var no_day = 5; + var no_mon = 4; + + // arrays: [hr, min, day, mon] + let msbits = [no_hour-1, no_min-1, no_day-1, no_mon-1]; // MSB = No bits - 1 + let rad = [13, 13, 9, 9]; // radiuses for each row + var x_dist = 29; + let y_dist = [0, 35, 75, 100]; // y-position from y_centr for each row from top + // don't calc. automatic as for x, because of different spaces + var x_offs_rgt = 15; // offset from right border (layout) + var y_offs_cntr = 25; // vertical offset from center + + //////////////////////////////////////// + // compute bit-pattern from time/date and draw leds + //////////////////////////////////////// + + // date-time-array: 4x6 bit + //var idx_hour = 0; + //var idx_min = 1; + //var idx_day = 2; + //var idx_mon = 3; + var dt_bit_arr = [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]]; + + var date_time = new Date(); + var hour = date_time.getHours(); // 0..23 + var min = date_time.getMinutes(); // 0..59 + var day = date_time.getDate(); // 1..31 + var mon = date_time.getMonth() + 1; // GetMonth() -> 0..11 + + let dt_array = [hour, min, day, mon]; + + var line_cnt = 0; + var cnt = 0; + var bit_cnt = 0; + + while (line_cnt < no_lines) + { + + //////////////////////////////////////// + // compute bit-pattern + bit_cnt = msbits[line_cnt]; + + while (bit_cnt >= 0) + { + if (dt_array[line_cnt] >= pwr2[bit_cnt]) + { + dt_array[line_cnt] -= pwr2[bit_cnt]; + dt_bit_arr[line_cnt][bit_cnt] = 1; + } + else + { + dt_bit_arr[line_cnt][bit_cnt] = 0; + } + bit_cnt--; + } + + //////////////////////////////////////// + // draw leds (and border, if enabled) + cnt = 0; + + while (cnt <= msbits[line_cnt]) + { + if (RingOn) // draw outer ring, if enabled + { + g.setColor(bord_col); + g.drawCircle(x_rgt-x_offs_rgt-cnt*x_dist, y_cntr-y_offs_cntr+y_dist[line_cnt], rad[line_cnt]); + } + if (dt_bit_arr[line_cnt][cnt] == 1) + { + g.setColor(col[line_cnt]); + } + else + { + g.setColor(col_off); + } + g.fillCircle(x_rgt-x_offs_rgt-cnt*x_dist, y_cntr-y_offs_cntr+y_dist[line_cnt], rad[line_cnt]-1); + cnt++; + } + line_cnt++; + } + + // queue next draw + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() + { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); + } + + + // Init the settings of the app + loadSettings(); + + // Show launcher when middle button pressed + Bangle.setUI( + { + mode : "clock", + remove : function() + { + // Called to unload all of the clock app + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } + }); + // Load widgets + Bangle.loadWidgets(); + draw(); + setTimeout(Bangle.drawWidgets,0); +} diff --git a/apps/blc/blc.settings.js b/apps/blc/blc.settings.js new file mode 100644 index 000000000..9143fc16e --- /dev/null +++ b/apps/blc/blc.settings.js @@ -0,0 +1,72 @@ +// Change settings for BinaryClk + +(function(back){ + + // color array -- don't change order unless change oder in BinaryClk.js + let LED_ColorNames = ["white", "red", "green", "blue", "yellow", "magenta", "cyan", "black"]; + + var FILE = "BinaryClk.settings.json"; + // Load settings + var settings = Object.assign({ + HourCol: "red", + MinCol: "green", + DayCol: "yellow", + MonCol: "yellow", + RingOn: true, + }, require('Storage').readJSON(FILE, true) || {}); + + function writeSettings(){ + require('Storage').writeJSON(FILE, settings); + } + + // Helper method which uses int-based menu item for set of string values + function stringItems(startvalue, writer, values) { + return{ + value: (startvalue === undefined ? 0 : values.indexOf(startvalue)), + format: v => values[v], + min: 0, + max: values.length - 1, + wrap: true, + step: 1, + onchange: v => { + writer(values[v]); + writeSettings(); + } + }; + } + + // Helper method which breaks string set settings down to local settings object + function stringInSettings(name, values) { + return stringItems(settings[name], v => settings[name] = v, values); + } + + // Show the menu + var mainmenu = { + "" : { + "title" : "BinaryCLK" + }, + "< Back" : () => back(), + 'Color Hour.:': stringInSettings("HourCol", LED_ColorNames), + 'Color Minute:': stringInSettings("MinCol", LED_ColorNames), + 'Color Day': stringInSettings("DayCol", LED_ColorNames), + 'Color Month:': stringInSettings("MonCol", LED_ColorNames), + 'LED ring on/off': { + value: (settings.RingOn !== undefined ? settings.RingOn : true), + onchange: v => { + settings.RingOn = v; + writeSettings(); + } + }, + }; + + // Show submenues + //var submenu1 = { + //"": { + // "title": "Show sub1..." + //}, + //"< Back": () => E.showMenu(mainmenu), + //"ItemName": stringInSettings("settingsVar", ["Yes", "No", "DontCare"]), + //}; + + E.showMenu(mainmenu); +}) diff --git a/apps/blc/blc.settings.json b/apps/blc/blc.settings.json new file mode 100644 index 000000000..37abfc700 --- /dev/null +++ b/apps/blc/blc.settings.json @@ -0,0 +1,7 @@ +{ + "HourCol": "red", + "MinCol": "green", + "DayCol": "yellow", + "MonCol": "yellow", + "RingOn": true +} diff --git a/apps/blc/metadata.json b/apps/blc/metadata.json new file mode 100644 index 000000000..53dde47e3 --- /dev/null +++ b/apps/blc/metadata.json @@ -0,0 +1,19 @@ +{ + "id":"blc", + "name":"Binary LED Clock", + "version": "0.40", + "description": "a binary LED-Clock with time and date and customizable LED-colors", + "icon":"blc-icon.png", + "screenshots": [{"url":"screenshot_blc_1.bmp"},{"url":"screenshot_blc_2.bmp"}], + "type": "clock", + "tags": "clock", + "supports": ["BANGLEJS2"], + "allow_emulator": true, + "readme": "README.md", + "storage": [ + {"name":"blc.app.js","url":"blc.js"}, + {"name":"blc.settings.js","url":"blc.settings.js"}, + {"name":"blc.img","url":"blc-icon.js","evaluate":true} + ], + "data": [{"name":"blc.settings.json"}] +} diff --git a/apps/blc/screenshot_blc_1.bmp b/apps/blc/screenshot_blc_1.bmp new file mode 100644 index 000000000..8a8c86ce5 Binary files /dev/null and b/apps/blc/screenshot_blc_1.bmp differ diff --git a/apps/blc/screenshot_blc_2.bmp b/apps/blc/screenshot_blc_2.bmp new file mode 100644 index 000000000..ee07e3bb3 Binary files /dev/null and b/apps/blc/screenshot_blc_2.bmp differ diff --git a/apps/blecsc/clkinfo.js b/apps/blecsc/clkinfo.js index 9a9515c3a..69cd022af 100644 --- a/apps/blecsc/clkinfo.js +++ b/apps/blecsc/clkinfo.js @@ -70,5 +70,3 @@ }; return ci; }) - - diff --git a/apps/boot/ChangeLog b/apps/boot/ChangeLog index 1d8e44b72..fa1967d11 100644 --- a/apps/boot/ChangeLog +++ b/apps/boot/ChangeLog @@ -72,3 +72,8 @@ 0.61: Instead of breaking execution with an Exception when updating boot, just use if..else (fix 'Uncaught undefined') 0.62: Handle setting for configuring BLE privacy 0.63: Only set BLE `display:1` if we have a passkey +0.64: Automatically create .widcache and .clkinfocache to speed up loads + Bangle.loadWidgets overwritten with fast version on success + Refuse to work on firmware <2v16 and remove old polyfills +0.65: Only display interpreter errors if log is nonzero +0.66: Ensure __FILE__ is set even after a fresh boot (fix #3857) \ No newline at end of file diff --git a/apps/boot/bootloader.js b/apps/boot/bootloader.js index 6e6466f48..8228ab482 100644 --- a/apps/boot/bootloader.js +++ b/apps/boot/bootloader.js @@ -23,7 +23,8 @@ if (!_clkApp) { require("Storage").writeJSON("setting.json", s); } } +if (s.clock) __FILE__=s.clock; delete s; if (!_clkApp) _clkApp=`E.showMessage("No Clock Found");setWatch(()=>{Bangle.showLauncher();}, global.BTN2||BTN, {repeat:false,edge:"falling"});`; eval(_clkApp); -delete _clkApp; +delete _clkApp; \ No newline at end of file diff --git a/apps/boot/bootupdate.js b/apps/boot/bootupdate.js index aa4a7e7b5..07d8d2031 100644 --- a/apps/boot/bootupdate.js +++ b/apps/boot/bootupdate.js @@ -12,14 +12,13 @@ if (DEBUG) { boot += "var _tm=Date.now()\n"; bootPost += "delete _tm;"; } -if (require('Storage').hash) { // new in 2v11 - helps ensure files haven't changed - let CRC = E.CRC32(require('Storage').read('setting.json'))+require('Storage').hash(/\.boot\.js/)+E.CRC32(process.env.GIT_COMMIT); - boot += `if(E.CRC32(require('Storage').read('setting.json'))+require('Storage').hash(/\\.boot\\.js/)+E.CRC32(process.env.GIT_COMMIT)!=${CRC})`; -} else { - let CRC = E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\.boot\.js/))+E.CRC32(process.env.GIT_COMMIT); - boot += `if(E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\\.boot\\.js/))+E.CRC32(process.env.GIT_COMMIT)!=${CRC})`; +if (FWVERSION < 216) { + E.showMessage(/*LANG*/"Please update Bangle.js firmware\n\nCurrent = "+process.env.VERSION,{title:"ERROR"}); + throw new Error("Old firmware"); } -boot += `{eval(require('Storage').read('bootupdate.js'));print("Storage Updated!")}else{\n`; +let CRC = E.CRC32(require('Storage').read('setting.json'))+require('Storage').hash(/\.js$/)+E.CRC32(process.env.GIT_COMMIT); +boot += `if(E.CRC32(require('Storage').read('setting.json'))+require('Storage').hash(/\\.js$/)+E.CRC32(process.env.GIT_COMMIT)!=${CRC})`; +boot += `{eval(require('Storage').read('bootupdate.js'));}else{\n`; boot += `E.setFlags({pretokenise:1});\n`; boot += `var bleServices = {}, bleServiceOptions = { uart : true};\n`; bootPost += `NRF.setServices(bleServices,bleServiceOptions);delete bleServices,bleServiceOptions;\n`; // executed after other boot code @@ -44,7 +43,7 @@ LoopbackA.setConsole(true);\n`; boot += ` Bluetooth.line=""; Bluetooth.on('data',function(d) { - var l = (Bluetooth.line + d).split(/[\\n\\r]/); + let l = (Bluetooth.line + d).split(/[\\n\\r]/); Bluetooth.line = l.pop(); l.forEach(n=>Bluetooth.emit("line",n)); }); @@ -67,12 +66,12 @@ if (s.ble===false) boot += `if (!NRF.getSecurityStatus().connected) NRF.sleep(); if (s.timeout!==undefined) boot += `Bangle.setLCDTimeout(${s.timeout});\n`; if (!s.timeout) boot += `Bangle.setLCDPower(1);\n`; boot += `E.setTimeZone(${s.timezone});`; -// Draw out of memory errors onto the screen -boot += `E.on('errorFlag', function(errorFlags) { +// Draw out of memory errors onto the screen if logging enabled +if (s.log) boot += `E.on('errorFlag', function(errorFlags) { g.reset(1).setColor("#ff0000").setFont("6x8").setFontAlign(0,1).drawString(errorFlags,g.getWidth()/2,g.getHeight()-1).flip(); print("Interpreter error:", errorFlags); - E.getErrorFlags(); // clear flags so we get called next time -});\n`; + E.getErrorFlags(); +});\n`;// E.getErrorFlags() -> clear flags so we get called next time // stop users doing bad things! if (global.save) boot += `global.save = function() { throw new Error("You can't use save() on Bangle.js without overwriting the bootloader!"); }\n`; // Apply any settings-specific stuff @@ -86,30 +85,18 @@ if (s.bleprivacy || (s.passkey!==undefined && s.passkey.length==6)) { if (s.blename === false) boot+=`NRF.setAdvertising({},{showName:false});\n`; if (s.whitelist && !s.whitelist_disabled) boot+=`NRF.on('connect', function(addr) { if (!NRF.ignoreWhitelist) { let whitelist = (require('Storage').readJSON('setting.json',1)||{}).whitelist; if (NRF.resolveAddress !== undefined) { let resolvedAddr = NRF.resolveAddress(addr); if (resolvedAddr !== undefined) addr = resolvedAddr + " (resolved)"; } if (!whitelist.includes(addr)) NRF.disconnect(); }});\n`; if (s.rotate) boot+=`g.setRotation(${s.rotate&3},${s.rotate>>2});\n` // screen rotation +boot+=`Bangle.loadWidgets=function(){if(!global.WIDGETS)eval(require("Storage").read(".widcache"))};\n`; // ================================================== FIXING OLDER FIRMWARES -if (FWVERSION<215.068) // 2v15.68 and before had compass heading inverted. - boot += `Bangle.on('mag',e=>{if(!isNaN(e.heading))e.heading=360-e.heading;}); -Bangle.getCompass=(c=>(()=>{e=c();if(!isNaN(e.heading))e.heading=360-e.heading;return e;}))(Bangle.getCompass);`; - // deleting stops us getting confused by our own decl. builtins can't be deleted // this is a polyfill without fastloading capability delete Bangle.showClock; if (!Bangle.showClock) boot += `Bangle.showClock = ()=>{load(".bootcde")};\n`; delete Bangle.load; if (!Bangle.load) boot += `Bangle.load = load;\n`; -let date = new Date(); -delete date.toLocalISOString; // toLocalISOString was only introduced in 2v15 -if (!date.toLocalISOString) boot += `Date.prototype.toLocalISOString = function() { - var o = this.getTimezoneOffset(); - var d = new Date(this.getTime() - o*60000); - var sign = o>0?"-":"+"; - o = Math.abs(o); - return d.toISOString().slice(0,-1)+sign+Math.floor(o/60).toString().padStart(2,0)+(o%60).toString().padStart(2,0); -};\n`; // show timings if (DEBUG) boot += `print(".boot0",0|(Date.now()-_tm),"ms");_tm=Date.now();\n` -// ================================================== BOOT.JS +// ================================================== .BOOT0 // Append *.boot.js files. // Name files with a number - eg 'foo.5.boot.js' to enforce order (lowest first). Numbered files get placed before non-numbered // These could change bleServices/bleServiceOptions if needed @@ -128,17 +115,47 @@ let bootFiles = require('Storage').list(/\.boot\.js$/).sort((a,b)=>{ }); // precalculate file size bootPost += "}"; -let fileSize = boot.length + bootPost.length; -bootFiles.forEach(bootFile=>{ - // match the size of data we're adding below in bootFiles.forEach - if (DEBUG) fileSize += 2+bootFile.length+1; // `//${bootFile}\n` comment - fileSize += require('Storage').read(bootFile).length+2; // boot code plus ";\n" - if (DEBUG) fileSize += 48+E.toJS(bootFile).length; // `print(${E.toJS(bootFile)},0|(Date.now()-_tm),"ms");_tm=Date.now();\n` -}); -// write file in chunks (so as not to use up all RAM) -require('Storage').write('.boot0',boot,0,fileSize); -let fileOffset = boot.length; -bootFiles.forEach(bootFile=>{ +let fileOffset,fileSize; +/* code to output a file, plus preable and postable +when called with dst==undefined it just increments +fileOffset so we can see ho wbig the file has to be */ +let outputFile = (dst,src,pre,post) => {"ram"; + if (DEBUG) { + if (dst) require('Storage').write(dst,`//${src}\n`,fileOffset); + fileOffset+=2+src.length+1; + } + if (pre) { + if (dst) require('Storage').write(dst,pre,fileOffset); + fileOffset+=pre.length; + } + let f = require('Storage').read(src); + if (src.endsWith("clkinfo.js") && f[0]!="(") { + /* we shouldn't have to do this but it seems sometimes (sched 0.28) folks have + used libraries which get added into the clockinfo, and we can't use them directly + to we have to revert back to eval */ + f = `eval(require('Storage').read(${E.toJS(src)}))`; + } + if (dst) { + // we can't just write 'f' in one go because it can be too big + let len = f.length; + let offset = 0; + while (len) { + let chunk = Math.min(len, 2048); + require('Storage').write(dst,f.substr(offset, chunk),fileOffset); + fileOffset+=chunk; + offset+=chunk; + len-=chunk; + } + } else + fileOffset+=f.length; + if (dst) require('Storage').write(dst,post,fileOffset); + fileOffset+=post.length; + if (DEBUG) { + if (dst) require('Storage').write(dst,`print(${E.toJS(src)},0|(Date.now()-_tm),"ms");_tm=Date.now();\n`,fileOffset); + fileOffset += 48+E.toJS(src).length; + } +}; +let outputFileComplete = (dst,fn) => { // we add a semicolon so if the file is wrapped in (function(){ ... }() // with no semicolon we don't end up with (function(){ ... }()(function(){ ... }() // which would cause an error! @@ -146,31 +163,48 @@ bootFiles.forEach(bootFile=>{ // "//"+bootFile+"\n"+require('Storage').read(bootFile)+";\n"; // but we need to do this without ever loading everything into RAM as some // boot files seem to be getting pretty big now. - if (DEBUG) { - require('Storage').write('.boot0',`//${bootFile}\n`,fileOffset); - fileOffset+=2+bootFile.length+1; - } - let bf = require('Storage').read(bootFile); - // we can't just write 'bf' in one go because at least in 2v13 and earlier - // Espruino wants to read the whole file into RAM first, and on Bangle.js 1 - // it can be too big (especially BTHRM). - let bflen = bf.length; - let bfoffset = 0; - while (bflen) { - let bfchunk = Math.min(bflen, 2048); - require('Storage').write('.boot0',bf.substr(bfoffset, bfchunk),fileOffset); - fileOffset+=bfchunk; - bfoffset+=bfchunk; - bflen-=bfchunk; - } - require('Storage').write('.boot0',";\n",fileOffset); - fileOffset+=2; - if (DEBUG) { - require('Storage').write('.boot0',`print(${E.toJS(bootFile)},0|(Date.now()-_tm),"ms");_tm=Date.now();\n`,fileOffset); - fileOffset += 48+E.toJS(bootFile).length - } -}); + outputFile(dst,fn,"",";\n"); +}; +fileOffset = boot.length + bootPost.length; +bootFiles.forEach(fn=>outputFileComplete(undefined,fn)); // just get sizes +fileSize = fileOffset; +require('Storage').write('.boot0',boot,0,fileSize); +fileOffset = boot.length; +bootFiles.forEach(fn=>outputFileComplete('.boot0',fn)); require('Storage').write('.boot0',bootPost,fileOffset); +delete boot,bootPost,bootFiles; +// ================================================== .WIDCACHE for widgets +let widgetFiles = require("Storage").list(/\.wid\.js$/); +let widget = `// Made by bootupdate.js\nglobal.WIDGETS={};`, widgetPost = `var W=WIDGETS;WIDGETS={}; +Object.keys(W).sort((a,b)=>(0|W[b].sortorder)-(0|W[a].sortorder)).forEach(k=>WIDGETS[k]=W[k]);`; // sort +if (DEBUG) widget+="var _tm=Date.now();"; +outputFileComplete = (dst,fn) => { + outputFile(dst,fn,"try{",`}catch(e){print(${E.toJS(fn)},e,e.stack)}\n`); +}; +fileOffset = widget.length + widgetPost.length; +widgetFiles.forEach(fn=>outputFileComplete(undefined,fn)); // just get sizes +fileSize = fileOffset; +require('Storage').write('.widcache',widget,0,fileSize); +fileOffset = widget.length; +widgetFiles.forEach(fn=>outputFileComplete('.widcache',fn)); +require('Storage').write('.widcache',widgetPost,fileOffset); +delete widget,widgetPost,widgetFiles; +// ================================================== .clkinfocache for clockinfos +let ciFiles = require("Storage").list(/\.clkinfo\.js$/); +let ci = `// Made by bootupdate.js\n`; +if (DEBUG) ci+="var _tm=Date.now();"; +outputFileComplete = (dst,fn) => { + outputFile(dst,fn,"try{let fn=",`;let a=fn(),b=menu.find(x=>x.name===a.name);if(b)b.items=b.items.concat(a.items)else menu=menu.concat(a);}catch(e){print(${E.toJS(fn)},e,e.stack)}\n`); +}; +fileOffset = ci.length; +ciFiles.forEach(fn=>outputFileComplete(undefined,fn)); // just get sizes +fileSize = fileOffset; +require('Storage').write('.clkinfocache',ci,0,fileSize); +fileOffset = ci.length; +ciFiles.forEach(fn=>outputFileComplete('.clkinfocache',fn)); +delete ci,ciFiles; +// test with require("clock_info").load() +// ================================================== END E.showMessage(/*LANG*/"Reloading..."); } // .bootcde should be run automatically after if required, since diff --git a/apps/boot/metadata.json b/apps/boot/metadata.json index dcc55da58..93d699c15 100644 --- a/apps/boot/metadata.json +++ b/apps/boot/metadata.json @@ -1,7 +1,7 @@ { "id": "boot", "name": "Bootloader", - "version": "0.63", + "version": "0.66", "description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings", "icon": "bootloader.png", "type": "bootloader", @@ -11,6 +11,9 @@ {"name":".boot0","url":"boot0.js"}, {"name":".bootcde","url":"bootloader.js"}, {"name":"bootupdate.js","url":"bootupdate.js"} + ],"data": [ + {"name":".widcache"}, + {"name":".clkinfocache"} ], "sortorder": -10 } diff --git a/apps/bordle/metadata.json b/apps/bordle/metadata.json index f6011f798..0dbcf09f9 100644 --- a/apps/bordle/metadata.json +++ b/apps/bordle/metadata.json @@ -6,7 +6,7 @@ "description": "Bangle version of a popular word search game", "supports" : ["BANGLEJS2"], "readme": "README.md", - "tags": "game, text", + "tags": "game,text", "storage": [ {"name":"bordle.app.js","url":"bordle.app.js"}, {"name":"wordlencr.txt","url":"wordlencr.txt"}, diff --git a/apps/boxclk/ChangeLog b/apps/boxclk/ChangeLog index b78eba44c..65a6c979f 100644 --- a/apps/boxclk/ChangeLog +++ b/apps/boxclk/ChangeLog @@ -3,4 +3,14 @@ 0.03: Allows showing the month in short or long format by setting `"shortMonth"` to true or false 0.04: Improves touchscreen drag handling for background apps such as Pattern Launcher 0.05: Fixes step count not resetting after a new day starts -0.06 Added clockbackground app functionality +0.06: Added clockbackground app functionality +0.07: Allow custom backgrounds per boxclk config and from the clockbg module +0.08: Improves performance, responsiveness, and bug fixes +- [+] Added box size caching to reduce calculations +- [+] Improved step count with real-time updates +- [+] Improved battery level update logic to reduce unnecessary refreshes +- [+] Fixed optional seconds not displaying in time +- [+] Fixed drag handler by adding E.stopEventPropagation() +- [+] General code optimization and cleanup +0.09: Revised event handler code +0.10: Revised suffix formatting in getDate function \ No newline at end of file diff --git a/apps/boxclk/app.js b/apps/boxclk/app.js index 548062349..71dbda94f 100644 --- a/apps/boxclk/app.js +++ b/apps/boxclk/app.js @@ -1,58 +1,123 @@ { - /** - * --------------------------------------------------------------- - * 1. Module dependencies and initial configurations - * --------------------------------------------------------------- - */ - + // 1. Module dependencies and initial configurations let background = require("clockbg"); let storage = require("Storage"); let locale = require("locale"); let widgets = require("widget_utils"); - let date = new Date(); + let bgImage; let configNumber = (storage.readJSON("boxclk.json", 1) || {}).selectedConfig || 0; let fileName = 'boxclk' + (configNumber > 0 ? `-${configNumber}` : '') + '.json'; - // Add a condition to check if the file exists, if it does not, default to 'boxclk.json' if (!storage.read(fileName)) { fileName = 'boxclk.json'; } let boxesConfig = storage.readJSON(fileName, 1) || {}; let boxes = {}; - let boxPos = {}; - let isDragging = {}; - let wasDragging = {}; + let isDragging = false; let doubleTapTimer = null; let g_setColor; let saveIcon = require("heatshrink").decompress(atob("mEwwkEogA/AHdP/4AK+gWVDBQWNAAIuVGBAIB+UQdhMfGBAHBCxUAgIXHIwPyCxQwEJAgXB+MAl/zBwQGBn8ggQjBGAQXG+EA/4XI/8gBIQXTGAMPC6n/C6HzkREBC6YACC6QAFC57aHCYIXOOgLsEn4XPABIX/C6vykQAEl6/WgCQBC5imFAAT2BC5gCBI4oUCC5x0IC/4X/C4K8Bl4XJ+TCCC4wKBABkvC4tEEoMQCxcBB4IWEC4XyDBUBFwIXGJAIAOIwowDABoWGGB4uHDBwWJAH4AzA")); - /** - * --------------------------------------------------------------- - * 2. Graphical and visual configurations - * --------------------------------------------------------------- - */ - + // 2. Graphical and visual configurations let w = g.getWidth(); let h = g.getHeight(); - let totalWidth, totalHeight; let drawTimeout; - /** - * --------------------------------------------------------------- - * 3. Touchscreen Handlers - * --------------------------------------------------------------- - */ - - let touchHandler; - let dragHandler; - let movementDistance = 0; - - /** - * --------------------------------------------------------------- - * 4. Font loading function - * --------------------------------------------------------------- - */ + // 3. Event handlers + let touchHandler = function(zone, e) { + let boxTouched = false; + let touchedBox = null; + + for (let boxKey in boxes) { + if (touchInText(e, boxes[boxKey])) { + touchedBox = boxKey; + boxTouched = true; + break; + } + } + + if (boxTouched) { + // Toggle the selected state of the touched box + boxes[touchedBox].selected = !boxes[touchedBox].selected; + + // Update isDragging based on whether any box is selected + isDragging = Object.values(boxes).some(box => box.selected); + + if (isDragging) { + widgets.hide(); + } else { + deselectAllBoxes(); + } + } else { + // If tapped outside any box, deselect all boxes + deselectAllBoxes(); + } + + // Always redraw after a touch event + draw(); + + // Handle double tap for saving + if (!boxTouched && !isDragging) { + if (doubleTapTimer) { + clearTimeout(doubleTapTimer); + doubleTapTimer = null; + for (let boxKey in boxes) { + boxesConfig[boxKey].boxPos.x = (boxes[boxKey].pos.x / w).toFixed(3); + boxesConfig[boxKey].boxPos.y = (boxes[boxKey].pos.y / h).toFixed(3); + } + storage.write(fileName, JSON.stringify(boxesConfig)); + displaySaveIcon(); + return; + } + + doubleTapTimer = setTimeout(() => { + doubleTapTimer = null; + }, 500); + } + }; + + let dragHandler = function(e) { + if (!isDragging) return; + + // Stop propagation of the drag event to prevent other handlers + E.stopEventPropagation(); + + for (let key in boxes) { + if (boxes[key].selected) { + let boxItem = boxes[key]; + calcBoxSize(boxItem); + let newX = boxItem.pos.x + e.dx; + let newY = boxItem.pos.y + e.dy; + + if (newX - boxItem.cachedSize.width / 2 >= 0 && + newX + boxItem.cachedSize.width / 2 <= w && + newY - boxItem.cachedSize.height / 2 >= 0 && + newY + boxItem.cachedSize.height / 2 <= h) { + boxItem.pos.x = newX; + boxItem.pos.y = newY; + } + } + } + + draw(); + }; + + let stepHandler = function(up) { + if (boxes.step && !isDragging) { + boxes.step.string = formatStr(boxes.step, Bangle.getHealthStatus("day").steps); + boxes.step.cachedSize = null; + draw(); + } + }; + + let lockHandler = function(isLocked) { + if (isLocked) { + deselectAllBoxes(); + draw(); + } + }; + // 4. Font loading function let loadCustomFont = function() { Graphics.prototype.setFontBrunoAce = function() { // Actual height 23 (24 - 2) @@ -60,42 +125,43 @@ E.toString(require('heatshrink').decompress(atob('ABMHwADBh4DKg4bKgIPDAYUfAYV/AYX/AQMD/gmC+ADBn/AByE/GIU8AYUwLxcfAYX/8AnB//4JIP/FgMP4F+CQQBBjwJBFYRbBAd43DHoJpBh/g/xPEK4ZfDgEEORKDDAY8////wADLfZrTCgITBnhEBAYJMBAYMPw4DCM4QDjhwDCjwDBn0+AYMf/gDBh/4AYMH+ADBLpc4ToK/NGYZfnAYcfL4U/x5fBW4LvB/7vC+LvBgHAsBfIn76Cn4WBcYQDFEgJ+CQQYDyH4L/BAZbHLNYjjCAZc8ngDunycBZ4KkBa4KwBnEHY4UB+BfMgf/ZgMH/4XBc4cf4F/gE+ZgRjwAYcfj5jBM4U4M4RQBM4UA8BjIngDFEYJ8BAYUDAYQvCM4ZxBC4V+AYQvBnkBQ4M8gabBJQPAI4WAAYM/GYQaBAYJKCnqyCn5OCn4aBAYIaBAYJPCU4IABnBhIuDXCFAMD+Z/BY4IDBQwOPwEfv6TDAYUPAcwrDAYQ7BAYY/BI4cD8bLCK4RfEAA0BRYTeDcwIrFn0Pw43Bg4DugYDBjxBBU4SvDMYMH/5QBgP/LAQAP8EHN4UPwADHB4YAHA'))), 46, atob("CBEdChgYGhgaGBsaCQ=="), - 32|65536 + 32 | 65536 ); }; }; - /** - * --------------------------------------------------------------- - * 5. Initial settings of boxes and their positions - * --------------------------------------------------------------- + // 5. Initial settings of boxes and their positions + let isBool = (val, defaultVal) => val !== undefined ? Boolean(val) : defaultVal; + + for (let key in boxesConfig) { + if (key === 'bg' && boxesConfig[key].img) { + bgImage = storage.read(boxesConfig[key].img); + } else if (key !== 'selectedConfig') { + boxes[key] = Object.assign({}, boxesConfig[key]); + // Set default values for short, shortMonth, and disableSuffix + boxes[key].short = isBool(boxes[key].short, true); + boxes[key].shortMonth = isBool(boxes[key].shortMonth, true); + boxes[key].disableSuffix = isBool(boxes[key].disableSuffix, false); + + // Set box position + boxes[key].pos = { + x: w * boxes[key].boxPos.x, + y: h * boxes[key].boxPos.y + }; + // Cache box size + boxes[key].cachedSize = null; + } + } + + // 6. Text and drawing functions + + /* + Overwrite the setColor function to allow the + use of (x) in g.theme.x as a string + in your JSON config ("fg", "bg", "fg2", "bg2", "fgH", "bgH") */ - - let boxKeys = Object.keys(boxes); - - boxKeys.forEach((key) => { - let boxConfig = boxes[key]; - boxPos[key] = { - x: w * boxConfig.boxPos.x, - y: h * boxConfig.boxPos.y - }; - isDragging[key] = false; - wasDragging[key] = false; - }); - - /** - * --------------------------------------------------------------- - * 6. Text and drawing functions - * --------------------------------------------------------------- - */ - - // Overwrite the setColor function to allow the - // use of (x) in g.theme.x as a string - // in your JSON config ("fg", "bg", "fg2", "bg2", "fgH", "bgH") let modSetColor = function() { - // Save the original setColor function g_setColor = g.setColor; - // Overwrite setColor with the new function g.setColor = function(color) { if (typeof color === "string" && color in g.theme) { g_setColor.call(g, g.theme[color]); @@ -106,7 +172,6 @@ }; let restoreSetColor = function() { - // Restore the original setColor function if (g_setColor) { g.setColor = g_setColor; } @@ -130,25 +195,6 @@ } }; - let calcBoxSize = function(boxItem) { - g.reset(); - g.setFontAlign(0,0); - g.setFont(boxItem.font, boxItem.fontSize); - let strWidth = g.stringWidth(boxItem.string) + 2 * boxItem.outline; - let fontHeight = g.getFontHeight() + 2 * boxItem.outline; - totalWidth = strWidth + 2 * boxItem.xPadding; - totalHeight = fontHeight + 2 * boxItem.yPadding; - }; - - let calcBoxPos = function(boxKey) { - return { - x1: boxPos[boxKey].x - totalWidth / 2, - y1: boxPos[boxKey].y - totalHeight / 2, - x2: boxPos[boxKey].x + totalWidth / 2, - y2: boxPos[boxKey].y + totalHeight / 2 - }; - }; - let displaySaveIcon = function() { draw(boxes); g.drawImage(saveIcon, w / 2 - 24, h / 2 - 24); @@ -159,33 +205,26 @@ }, 2000); }; - /** - * --------------------------------------------------------------- - * 7. String forming helper functions - * --------------------------------------------------------------- - */ - - let isBool = function(val, defaultVal) { - return typeof val !== 'undefined' ? Boolean(val) : defaultVal; - }; - + // 7. String forming helper functions let getDate = function(short, shortMonth, disableSuffix) { const date = new Date(); - const dayOfMonth = date.getDate(); + const day = date.getDate(); const month = shortMonth ? locale.month(date, 1) : locale.month(date, 0); const year = date.getFullYear(); - let suffix; - if ([1, 21, 31].includes(dayOfMonth)) { - suffix = "st"; - } else if ([2, 22].includes(dayOfMonth)) { - suffix = "nd"; - } else if ([3, 23].includes(dayOfMonth)) { - suffix = "rd"; - } else { - suffix = "th"; - } - let dayOfMonthStr = disableSuffix ? dayOfMonth : dayOfMonth + suffix; - return month + " " + dayOfMonthStr + (short ? '' : (", " + year)); // not including year for short version + + const getSuffix = (day) => { + if (day >= 11 && day <= 13) return 'th'; + const lastDigit = day % 10; + switch (lastDigit) { + case 1: return 'st'; + case 2: return 'nd'; + case 3: return 'rd'; + default: return 'th'; + } + }; + + const dayStr = disableSuffix ? day : `${day}${getSuffix(day)}`; + return `${month} ${dayStr}${short ? '' : `, ${year}`}`; // not including year for short version }; let getDayOfWeek = function(date, short) { @@ -198,187 +237,215 @@ return short ? meridian[0] : meridian; }; - let modString = function(boxItem, data) { - let prefix = boxItem.prefix || ''; - let suffix = boxItem.suffix || ''; - return prefix + data + suffix; + let formatStr = function(boxItem, data) { + return `${boxItem.prefix || ''}${data}${boxItem.suffix || ''}`; }; - /** - * --------------------------------------------------------------- - * 8. Main draw function - * --------------------------------------------------------------- - */ + // 8. Main draw function and update logic + let lastDay = -1; + const BATTERY_UPDATE_INTERVAL = 300000; - let draw = (function() { - let updatePerMinute = true; // variable to track the state of time display + let updateBoxData = function() { + let date = new Date(); + let currentDay = date.getDate(); + let now = Date.now(); - return function(boxes) { - date = new Date(); - g.clear(); - background.fillRect(Bangle.appRect); + if (boxes.time || boxes.meridian || boxes.date || boxes.dow) { if (boxes.time) { - boxes.time.string = modString(boxes.time, locale.time(date, isBool(boxes.time.short, true) ? 1 : 0)); - updatePerMinute = isBool(boxes.time.short, true); - } - if (boxes.meridian) { - boxes.meridian.string = modString(boxes.meridian, locale.meridian(date, isBool(boxes.meridian.short, true))); - } - if (boxes.date) { - boxes.date.string = ( - modString(boxes.date, - getDate(isBool(boxes.date.short, true), - isBool(boxes.date.shortMonth, true), - isBool(boxes.date.disableSuffix, false) - ))); - } - if (boxes.dow) { - boxes.dow.string = modString(boxes.dow, getDayOfWeek(date, isBool(boxes.dow.short, true))); - } - if (boxes.batt) { - boxes.batt.string = modString(boxes.batt, E.getBattery()); - } - if (boxes.step) { - boxes.step.string = modString(boxes.step, Bangle.getHealthStatus("day").steps); - } - boxKeys.forEach((boxKey) => { - let boxItem = boxes[boxKey]; - calcBoxSize(boxItem); - const pos = calcBoxPos(boxKey); - if (isDragging[boxKey]) { - g.setColor(boxItem.border); - g.drawRect(pos.x1, pos.y1, pos.x2, pos.y2); + let showSeconds = !boxes.time.short; + let timeString = locale.time(date, 1).trim(); + if (showSeconds) { + let seconds = date.getSeconds().toString().padStart(2, '0'); + timeString += ':' + seconds; + } + let newTimeString = formatStr(boxes.time, timeString); + if (newTimeString !== boxes.time.string) { + boxes.time.string = newTimeString; + boxes.time.cachedSize = null; } - g.drawString( - boxItem, - boxItem.string, - boxPos[boxKey].x + boxItem.xOffset, - boxPos[boxKey].y + boxItem.yOffset - ); - }); - if (!Object.values(isDragging).some(Boolean)) { - if (drawTimeout) clearTimeout(drawTimeout); - let interval = updatePerMinute ? 60000 - (Date.now() % 60000) : 1000; - drawTimeout = setTimeout(() => draw(boxes), interval); } - }; - })(); - /** - * --------------------------------------------------------------- - * 9. Helper function for touch event - * --------------------------------------------------------------- - */ + if (boxes.meridian) { + let newMeridianString = formatStr(boxes.meridian, locale.meridian(date, boxes.meridian.short)); + if (newMeridianString !== boxes.meridian.string) { + boxes.meridian.string = newMeridianString; + boxes.meridian.cachedSize = null; + } + } - let touchInText = function(e, boxItem, boxKey) { + if (boxes.date && currentDay !== lastDay) { + let newDateString = formatStr(boxes.date, + getDate(boxes.date.short, + boxes.date.shortMonth, + boxes.date.noSuffix) + ); + if (newDateString !== boxes.date.string) { + boxes.date.string = newDateString; + boxes.date.cachedSize = null; + } + } + + if (boxes.dow) { + let newDowString = formatStr(boxes.dow, getDayOfWeek(date, boxes.dow.short)); + if (newDowString !== boxes.dow.string) { + boxes.dow.string = newDowString; + boxes.dow.cachedSize = null; + } + } + + lastDay = currentDay; + } + + if (boxes.step) { + let newStepCount = Bangle.getHealthStatus("day").steps; + let newStepString = formatStr(boxes.step, newStepCount); + if (newStepString !== boxes.step.string) { + boxes.step.string = newStepString; + boxes.step.cachedSize = null; + } + } + + if (boxes.batt) { + if (!boxes.batt.lastUpdate || now - boxes.batt.lastUpdate >= BATTERY_UPDATE_INTERVAL) { + let currentLevel = E.getBattery(); + if (currentLevel !== boxes.batt.lastLevel) { + let newBattString = formatStr(boxes.batt, currentLevel); + if (newBattString !== boxes.batt.string) { + boxes.batt.string = newBattString; + boxes.batt.cachedSize = null; + boxes.batt.lastLevel = currentLevel; + } + } + boxes.batt.lastUpdate = now; + } + } + }; + + let draw = function() { + g.clear(); + + // Always draw backgrounds full screen + if (bgImage) { // Check for bg in boxclk config + g.drawImage(bgImage, 0, 0); + } else { // Otherwise use clockbg module + background.fillRect(0, 0, g.getWidth(), g.getHeight()); + } + + if (!isDragging) { + updateBoxData(); + } + + for (let boxKey in boxes) { + let boxItem = boxes[boxKey]; + + // Set font and alignment for each box individually + g.setFont(boxItem.font, boxItem.fontSize); + g.setFontAlign(0, 0); + + calcBoxSize(boxItem); + + const pos = calcBoxPos(boxItem); + + if (boxItem.selected) { + g.setColor(boxItem.border); + g.drawRect(pos.x1, pos.y1, pos.x2, pos.y2); + } + + g.drawString( + boxItem, + boxItem.string, + boxItem.pos.x + boxItem.xOffset, + boxItem.pos.y + boxItem.yOffset + ); + } + + if (!isDragging) { + if (drawTimeout) clearTimeout(drawTimeout); + let updateInterval = boxes.time && !isBool(boxes.time.short, true) ? 1000 : 60000 - (Date.now() % 60000); + drawTimeout = setTimeout(draw, updateInterval); + } + }; + + // 9. Helper function for touch event + let calcBoxPos = function(boxItem) { calcBoxSize(boxItem); - const pos = calcBoxPos(boxKey); + return { + x1: boxItem.pos.x - boxItem.cachedSize.width / 2, + y1: boxItem.pos.y - boxItem.cachedSize.height / 2, + x2: boxItem.pos.x + boxItem.cachedSize.width / 2, + y2: boxItem.pos.y + boxItem.cachedSize.height / 2 + }; + }; + + // Use cached size if available, otherwise calculate and cache + let calcBoxSize = function(boxItem) { + if (boxItem.cachedSize) { + return boxItem.cachedSize; + } + + g.setFont(boxItem.font, boxItem.fontSize); + g.setFontAlign(0, 0); + + let strWidth = g.stringWidth(boxItem.string) + 2 * boxItem.outline; + let fontHeight = g.getFontHeight() + 2 * boxItem.outline; + let totalWidth = strWidth + 2 * boxItem.xPadding; + let totalHeight = fontHeight + 2 * boxItem.yPadding; + + boxItem.cachedSize = { + width: totalWidth, + height: totalHeight + }; + + return boxItem.cachedSize; + }; + + let touchInText = function(e, boxItem) { + calcBoxSize(boxItem); + const pos = calcBoxPos(boxItem); return e.x >= pos.x1 && - e.x <= pos.x2 && - e.y >= pos.y1 && - e.y <= pos.y2; + e.x <= pos.x2 && + e.y >= pos.y1 && + e.y <= pos.y2; }; let deselectAllBoxes = function() { - Object.keys(isDragging).forEach((boxKey) => { - isDragging[boxKey] = false; - }); + isDragging = false; + for (let boxKey in boxes) { + boxes[boxKey].selected = false; + } restoreSetColor(); widgets.show(); widgets.swipeOn(); modSetColor(); }; - /** - * --------------------------------------------------------------- - * 10. Setup function to configure event handlers - * --------------------------------------------------------------- - */ - + // 10. Setup function to configure event handlers let setup = function() { - // ------------------------------------ - // Define the touchHandler function - // ------------------------------------ - touchHandler = function(zone, e) { - wasDragging = Object.assign({}, isDragging); - let boxTouched = false; - boxKeys.forEach((boxKey) => { - if (touchInText(e, boxes[boxKey], boxKey)) { - isDragging[boxKey] = true; - wasDragging[boxKey] = true; - boxTouched = true; - } - }); - if (!boxTouched) { - if (!Object.values(isDragging).some(Boolean)) { // check if no boxes are being dragged - deselectAllBoxes(); - if (doubleTapTimer) { - clearTimeout(doubleTapTimer); - doubleTapTimer = null; - // Save boxesConfig on double tap outside of any box and when no boxes are being dragged - Object.keys(boxPos).forEach((boxKey) => { - boxesConfig[boxKey].boxPos.x = (boxPos[boxKey].x / w).toFixed(3); - boxesConfig[boxKey].boxPos.y = (boxPos[boxKey].y / h).toFixed(3); - }); - storage.write(fileName, JSON.stringify(boxesConfig)); - displaySaveIcon(); - return; - } - } else { - // if any box is being dragged, just deselect all without saving - deselectAllBoxes(); - } - } - if (Object.values(wasDragging).some(Boolean) || !boxTouched) { - draw(boxes); - } - doubleTapTimer = setTimeout(() => { - doubleTapTimer = null; - }, 500); // Increase or decrease this value based on the desired double tap timing - movementDistance = 0; - }; - - // ------------------------------------ - // Define the dragHandler function - // ------------------------------------ - dragHandler = function(e) { - // Check if any box is being dragged - if (!Object.values(isDragging).some(Boolean)) return; - // Calculate the movement distance - movementDistance += Math.abs(e.dx) + Math.abs(e.dy); - // Check if the movement distance exceeds a threshold - if (movementDistance > 1) { - boxKeys.forEach((boxKey) => { - if (isDragging[boxKey]) { - widgets.hide(); - let boxItem = boxes[boxKey]; - calcBoxSize(boxItem); - let newX = boxPos[boxKey].x + e.dx; - let newY = boxPos[boxKey].y + e.dy; - if (newX - totalWidth / 2 >= 0 && - newX + totalWidth / 2 <= w && - newY - totalHeight / 2 >= 0 && - newY + totalHeight / 2 <= h ) { - boxPos[boxKey].x = newX; - boxPos[boxKey].y = newY; - } - const pos = calcBoxPos(boxKey); - g.clearRect(pos.x1, pos.y1, pos.x2, pos.y2); - } - }); - draw(boxes); - } - }; - + Bangle.on('lock', lockHandler); Bangle.on('touch', touchHandler); Bangle.on('drag', dragHandler); - + + if (boxes.step) { + boxes.step.string = formatStr(boxes.step, Bangle.getHealthStatus("day").steps); + Bangle.on('step', stepHandler); + } + + if (boxes.batt) { + boxes.batt.lastLevel = E.getBattery(); + boxes.batt.string = formatStr(boxes.batt, boxes.batt.lastLevel); + boxes.batt.lastUpdate = Date.now(); + } + Bangle.setUI({ - mode : "clock", - remove : function() { - // Remove event handlers, stop draw timer, remove custom font if used + mode: "clock", + remove: function() { + // Remove event handlers, stop draw timer, remove custom font Bangle.removeListener('touch', touchHandler); Bangle.removeListener('drag', dragHandler); + Bangle.removeListener('lock', lockHandler); + if (boxes.step) { + Bangle.removeListener('step', stepHandler); + } if (drawTimeout) clearTimeout(drawTimeout); drawTimeout = undefined; delete Graphics.prototype.setFontBrunoAce; @@ -388,16 +455,12 @@ widgets.show(); } }); + loadCustomFont(); - draw(boxes); + draw(); }; - /** - * --------------------------------------------------------------- - * 11. Main execution part - * --------------------------------------------------------------- - */ - + // 11. Main execution Bangle.loadWidgets(); widgets.swipeOn(); modSetColor(); diff --git a/apps/boxclk/boxclk-2.json b/apps/boxclk/boxclk-2.json index 64b842f1c..1bdc89252 100644 --- a/apps/boxclk/boxclk-2.json +++ b/apps/boxclk/boxclk-2.json @@ -12,14 +12,14 @@ "yOffset": 0, "boxPos": { "x": "0.5", - "y": "0.33" + "y": "0.739" } }, "dow": { "font": "6x8", "fontSize": 3, - "outline": 1, - "color": "#5ccd73", + "outline": 2, + "color": "bgH", "outlineColor": "fg", "border": "#f0f", "xPadding": -1, @@ -28,15 +28,15 @@ "yOffset": 0, "boxPos": { "x": "0.5", - "y": "0.57" + "y": "0.201" }, "short": false }, "date": { "font": "6x8", "fontSize": 2, - "outline": 1, - "color": "#5ccd73", + "outline": 2, + "color": "bgH", "outlineColor": "fg", "border": "#f0f", "xPadding": -0.5, @@ -45,7 +45,7 @@ "yOffset": 0, "boxPos": { "x": "0.5", - "y": "0.75" + "y": "0.074" }, "shortMonth": false, "disableSuffix": true @@ -63,7 +63,7 @@ "yOffset": 1, "boxPos": { "x": "0.5", - "y": "0.92" + "y": "0.926" }, "prefix": "Steps: " }, @@ -79,8 +79,8 @@ "xOffset": 2, "yOffset": 2, "boxPos": { - "x": "0.85", - "y": "0.08" + "x": "0.8", + "y": "0.427" }, "suffix": "%" } diff --git a/apps/boxclk/boxclk.space.img b/apps/boxclk/boxclk.space.img new file mode 100644 index 000000000..1708b5c24 Binary files /dev/null and b/apps/boxclk/boxclk.space.img differ diff --git a/apps/boxclk/metadata.json b/apps/boxclk/metadata.json index 79b4c3019..48f9f82ae 100644 --- a/apps/boxclk/metadata.json +++ b/apps/boxclk/metadata.json @@ -1,7 +1,7 @@ { "id": "boxclk", "name": "Box Clock", - "version": "0.05", + "version": "0.10", "description": "A customizable clock with configurable text boxes that can be positioned to show your favorite background", "icon": "app.png", "dependencies" : { "clockbg":"module" }, @@ -24,4 +24,4 @@ "data": [ {"name":"boxclk.json","url":"boxclk.json"} ] -} +} \ No newline at end of file diff --git a/apps/boxclk/screenshot-2.png b/apps/boxclk/screenshot-2.png index b7a73d66a..361185406 100644 Binary files a/apps/boxclk/screenshot-2.png and b/apps/boxclk/screenshot-2.png differ diff --git a/apps/boxclk/settings.js b/apps/boxclk/settings.js index e35db455d..c4b41101b 100644 --- a/apps/boxclk/settings.js +++ b/apps/boxclk/settings.js @@ -91,4 +91,4 @@ }); E.showMenu(menu); -}); +}) diff --git a/apps/btadv/app.ts b/apps/btadv/app.ts index 4ae75fae3..0c1803fdb 100644 --- a/apps/btadv/app.ts +++ b/apps/btadv/app.ts @@ -720,7 +720,7 @@ const hook = (enable: boolean) => { // --- intervals --- const setIntervals = ( - locked: boolean = Bangle.isLocked(), + locked: ShortBoolean = Bangle.isLocked(), connected: boolean = NRF.getSecurityStatus().connected, ) => { changeInterval( diff --git a/apps/bthome/clkinfo.js b/apps/bthome/clkinfo.js index 8698c9828..bcf2a6fa4 100644 --- a/apps/bthome/clkinfo.js +++ b/apps/bthome/clkinfo.js @@ -14,4 +14,4 @@ } }) }; -}) // must not have a semi-colon! \ No newline at end of file +}) diff --git a/apps/bthrm/settings.js b/apps/bthrm/settings.js index 68e958db8..310816dda 100644 --- a/apps/bthrm/settings.js +++ b/apps/bthrm/settings.js @@ -371,4 +371,4 @@ }; E.showMenu(buildMainMenu()); -}); +}) diff --git a/apps/bttfclock/ChangeLog b/apps/bttfclock/ChangeLog new file mode 100644 index 000000000..2d7ac2abd --- /dev/null +++ b/apps/bttfclock/ChangeLog @@ -0,0 +1,3 @@ +0.01: Back to the future clock first version. +0.02: Added more icons to the status field. Made it posible to custemize the step goal thrue the Health Tracking app. +0.03: Added charging screen. \ No newline at end of file diff --git a/apps/bttfclock/README.md b/apps/bttfclock/README.md new file mode 100644 index 000000000..5417328c0 --- /dev/null +++ b/apps/bttfclock/README.md @@ -0,0 +1,40 @@ +# Back to the future Clock + +![](screenshot.png) + +A watchface inspierd by this garmin watchface.
+ +## Todo + +- Improving quality of Fonts. +- More status icons. + +## Functionalities + +- Current time +- Current day and month +- Battery +- Steps +- Step goal can be set white the Health Tracking app defult is 10000 +- Bluetooth connected icon +- Alarm icon +- Notification icon + +## Screenshots +Clock:
+![](screenshot.png)
+Clock when charging:
+![](screenshotCharging.png)
+ +## Usage +Install it and enjoy + + +## Links +### code ispired by +advCasioBangleClock https://github.com/dotgreg/advCasioBangleClock + +93dub https://github.com/espruino/BangleApps/tree/master/apps/93dub + +### Creator +https://github.com/NoobEjby diff --git a/apps/bttfclock/app-icon.js b/apps/bttfclock/app-icon.js new file mode 100644 index 000000000..f2d2f8aed --- /dev/null +++ b/apps/bttfclock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwyEAhN0AMF1AIl2AKAXFH8Jbny4BKu5j/LZWWJ4W4AIXYhPZAJAPDzBnIMc3GjABFLZBZB25XDgP5gUaAIU7AJUbgP6AIRnB3JlEMYw/KLbAjIGIJbBWIJZDrcCvkCzkC3oBMzsCvsCrkCnhnDZomXH6BfU9HkAIIfGLoP4gU6LYRZB7sC/sDj0DnwBCrwBEBIYPBj0C7xnCMoZjD3I/QLqwhJLYpJCKIOege/gffAIX/AIwJBB4IBBv8Dn5lEZYNcH6ZfPDo4hHLYl+I4X/gkfgk/glfAJgPBAIMfM4WfgdfMYW+H6ZffW4W+LI1/gmfAKATBAIIZBMYLNBMYM/L8bfPToJbYMpZjD74/TL5ZhLBIv9vJdCLbpjJn4tBH58JupfTAJP+oJhCLsYBCFIItBH55fOBoIBBywbHF4YBDMMotJLZGYhN3L6GWhO3gUagWcgcdgeegkfGYvvmxhhEIIlBRY0fgefgcegV+gUcgO6L4V2MJhfD7ECrcC3sDr0D/8Er43FAIZhdEplfHIMDr8C70CnsB7bBCL5YJBAIO3hP5gV7gX9XocEv47JTIhdYcYaDIGoLBCgX+gV9gP8hO5YIRfLNoO4gUagWcb4MD78En4/LfYxdWDp0/HoMDn8Cz0CjkB3RfOy0J7ECncC3sDrzjBc4JDPUJBdMbYZ7Or49BgdfgW+gU9gPbhOYWYRfNrcC7pfPI4oBDMJoVVL6DBHA4OXhPZL4l+gkfgl/VKKrDJZLVDLqQBBv5fE70CrpfS/JfXJ4oBDJ4oNNL9C/FrwhBL6JTHL5ZdSAINfL4m+gU9L4WZL6E7gW9L4lfHKRVC982AIIFBA44jTL/ZhFL4pdWL4ffgc/gWeL4mYL5gLB3ECjcCzsDnwhBgk/HqzDID61/HIMD38Dj5fCjsB3cJvBfPgP7gV9gX+gYnBj4pCL+sfHoMC/8Cv0B/pfSy8B7UCrkC70DcYP/c4JfX/1BAIJfYHIQ9BgW/gVegP8gOaL5wBBy8J3MCjcCzsDjzBZL7i9EgcfgWegUdgPchOZhN3KohfFYIu4gP7gVdYInfgk/MKZfaFoM/GoMDn69E/sB3a9ML4+XgPagUcgV9gX+MK5ZB982AIJfSFIIxB/41BgX/gV+XocBzS9CL54BBCYOYgPbgU9cIQrBv5hTL6y7DGIRdCz8Cny9KL5bBFMIO5gP8MIyRB38Ej6XBMZZfSXIQlBRYK7ELoNeLomZXqDBHCoLBB3RhISoOfS4LFCMZBZB/1BAIJfILYa5DEoJdGgUdgPcgOaXqhhHPIJhB3ZhEv0CSoKZBYoJjDY4JlDr5fIBYS3ELYO/EIUfFIJdMIYJdTMIp5BDoN4MIkdGIQ1BMY4HBMoRfHK4QBBCIK3CLYm/RYU+gP9LoW6Loi9DLqZhL3QtBMIU+HIQ9BIIJNBn5LCr/GjABFBYQPBn4VBW4l/EoS5BLoO8LsRhLzTFCMYrHBMoOfLY4BHLIlfDoUeXIgrBzJdkMI5jDzDFCMYQ/BMoZVF9HkAIJfGLIf+LY2aLZBdhMIrFGhOZY4pdJMJMB7sB3gbC3UJvJduMI5jHvD7BLpZhHW4hbLLtJjPu5fTLIhb3MZxPDMJINFLIRb9MZhhJLoxZFLf4BIKooBJJ/5jbI/4B/AP4B/AP4BLA")) \ No newline at end of file diff --git a/apps/bttfclock/app.js b/apps/bttfclock/app.js new file mode 100644 index 000000000..9689cfb56 --- /dev/null +++ b/apps/bttfclock/app.js @@ -0,0 +1,308 @@ +require("Font8x16").add(Graphics); +require("Font7x11Numeric7Seg").add(Graphics); +require("Font5x7Numeric7Seg").add(Graphics); +require("Font4x5").add(Graphics); + +const timeTextY = 4; +const timeDataY = timeTextY+19; +const DateTextY = 48; +const DateDataY = DateTextY+19; +const stepGoalBatTextY = 100; +const stepGoalBatdataY = stepGoalBatTextY+19; +const statusTextY = 140; +const statusDataY = statusTextY+19; +let stepGoal = (require("Storage").readJSON("health.json",1)||10000).stepGoal; +let steps = 0; +let alarmStatus = (require('Storage').readJSON('sched.json',1)||[]).some(alarm=>alarm.on); +let charching = Bangle.isCharging(); +let chargeAniFrame= 0; + +const chargeAni =[require("heatshrink").decompress(atob("2GwgcEiFBAX4CbhEgwQC/ATeAUP4CegSh/ATyh/AT0AUP4CeUP4CeoCh/AT0BUP4CeUP4CewCh/AT0CUP4CeUP4CegCh/ATyh/AT1AUP4CegKh/ATyh/AT2AUP4CJgUBgAXSoBxNgEgaLUAAAMCCh8kKB4kCgKDXgAuBwAdLiRBCAoJEOgEEyFAAYJBVoECpMkyUIIJWChJEBAQJEBI4ZlIoIjBpJBQXI0AiRBCDoK/HQYQ+EyFIkiMBQxBlDpLuBQasADQIdDYRA4BIJAICKwsIMokkgB0GAR0EIIgdBBwh0BHApBIdIwjFwCDVDQZBDBYdIHBBBJwUBIJGQgBBTgBBMHxwIDdJJBWiJBGwDjCQCBBHdI2SEYT+JAQ+AII4pCHZwIGIJOQIKmBIIwdBF4KARBAhBBEY2SYryDXpBoBYo5BdBYI+UBAbFHyTFUwBBIHywIDII2QQYkAIP4CRDoxZBYrOCoBlGIKqDGgA+YBARBGyECX5oCGQYsggDFbgESdIyDUL4sAgECHy4IBiAcBU4pBWL4dIgHYgCDZwE2gCnFYSQCDgEJDoMAg3bAwKDYgO24EBEYNAgCATAQkALgJBCsEBIK8ghpBBEILKBEAJBYAAMSgHbtBIBQCgIBgFt2w/CAAI+WAQpBBjVtUgKDWgdp2EABAI4ThEgwQCGFgMIgdNEwZBToEbpuAMQIsJASiqDtKqCYqkA7VscAZBdEAcN23AgQ+RBAOAg3bsEBIMApDgO27EAYqeAm3bgAgEfxICSF4cAFISDTLJAyLgSDOF4qtBoEBIKMAboZBQQakSgHTtEAYqMAts2gEQBYr+ROIJBFGQ1AjVtwALHpJEHhEDtOwgALFQbZiFoEDposBPQpBCQY1AjdNKxA7URgiwJ2ywFkGShIFBbQ3btjaIYqICIeo0Ahu24ECYQmSoMkIgK5Eg3bsDsBaI47RRIxBHgkB23YgALBQARBDpIICgmAm3bgEIUIrFWAQggGIgMAm3agALBQYI+CAQeCCIJTFcw4yJgSJMMQ6zDzdAgJ6BII7IChuma4IdHYqYCGMQ4IBgHTtkAHw4CCoMAts2gEQDpFIfZgCLMQwmCoEatuAghBJpEDtOwgAdJHCBBTgdtGQJBJoEbKATjIBAQvDoDFRUhAICWwO2gESIJEA7bUBcZTFGIL0N23AgRBHyEG7dggKhKBAIvDCILFQMpckgO26EAII+Am3bgDCKIIwCFI5hBMwE07Q1BII0B2nYgAaKBAR9QIKcGzdAgJBFkEN0zRBIOOSgHTtkAIIsAts2gESpLFWARhlLkGSoEatuAghBDpEDtuggAIBIOI4C2A4CIINAjZKEUJi/QgBBDYpZxBXge2XgTOC7bOEILoCBoBBRkEN22Ag1Jk2Qg3bsEBIIShLBAJxCgJEQMRQIBGQcB03QgHJ0uAmnagAOEIJ8IILlBGQeAm2bgEPI4O07EAZYRBSkBBgX4ObsBBBhum4ECIIjmLIIoCPMRYFBGQWSgHTtkHkFt2kAiRB4oEbIIewgALDIMYgKyAyEyVIgdtw/jtuAghB5pMAhuAgdggALFIOvkgAACh5B78+eIANz55BGDpIIBiFBggCTQaX//Ef+fJIPVPk+fIPyDB/1AgZB9nnz43DzwLGkg7FEAuChACTIKN5k+Sg3AjxBpUI4jDAoKDFz027BB9knwIIMCIPuQIJTgGEAovCgMEiFBARpfHEYhBIzBBXwA+OIK80QbA+PIKESIJ47HEAg7PagQCCMRdBQaJBXgA7DIKeCIJ4dLGQ4CPYpcgQY026BB3ghBHQY7CKBATFKARbpMYoxBtU5iDPL5jFkyBBODRQICF4WAYr8SoJBFzBBFDRjFMgCDXwQFBHAc0QYyALYrKDNhJBMLhi/SAQwmNO4JBJC5aDHgJBSExpBKTZiDpkGSZAOQm3QIIYXNyBBtQYcSTZsSYQQCXFJ1BkkQIITOCIK8BQbwICwBBEC57FZiAsRIISAOBATFaQaDFBzECCiKDsmiDBINiwQwBBCYqkBQf4CGfxACIFiJBXHaICGQaE26BBQHa5BXQaJBdVpgICwBBCYRoICiFAIPqAcAQYvNiDFRoKDBATqDPzCDRwBBsmjFPQDwCDF5pBCYpr+YARKDngRB2QcZxNm3QYpr+aARKDMmyDcgJBxQcsQYphBBYpb+cARRBewCGhWxU2zBBLYUgCEQZM0QZgaBgDImQZJBLHcoCEGQKDTYVICDQaY+pgSGCAoI1Gm3QII7CpAQ5BGQY7CsZBWAIITCuARZ6DQYw+zQwsQgEAIIUSdjJEfkBABAAI+ZAUcBkmSgEBgkCIPMApJBBpEAFkjFVoESIIVJkDpdATlAHwJBCkkAIPMAINbdUghBFwECfzICeIP8gwA+DAQWQIMraTII8AfzQCdIP5B/IP5B/AQ8EIIuAFklAkGChACQII8CDSICmgBBFgBB/IIIsjwDaViRBDkD+cAT0AIIVIgBB8gJBBAYIphgTdZgAACfzgChIAJfaAX4CDcEIC8oCh/AT0BUP4CeUP4CewBxPA=")), +require("heatshrink").decompress(atob("2GwgcEiFBAX4CbhEgwQC/ATeAUP4CegSh/ATyh/AT0AUP4CeUP4CeoCh/AT0BUP4CeUP4CewCh/AT0CUP4CeUP4CegCh/ATyh/AT1AUP4CegKh/ATyh/AT2AUP4CJgUBgAXSoBxNgEgaLUAAAMCCh8kKB4kCgKDXgAuBwAdLiRBCAoJEOgEEyFAAYJBVoECpMkyUIIJWChJEBAQJEBI4ZlIoIjBpJBQXI0AiRBCDoK/HQYQ+EyFIkiMBQxBlDpLuBQasADQIdDYRA4BIJAICKwsIMokkgB0GAR0EIIgdBBwh0BHApBIdIwjFwCDVDQZBDBYdIHBBBJwUBIJGQgBBTgBBMHxwIDdJJBWiJBGwDjCQCBBHdI2SEYT+JAQ+AII4pCHZwIGIJOQIKmBIIwdBF4KARBAhBBEY2SYryDXpBoBYo5BdBYI+UBAbFHyTFUwBBIHywIDII2QQYkAIP4CRDoxZBYrOCoBlGIKqDGgA+YBARBGyECX5oCGQYsggDFbgESdIyDUL4sAgECHy4IBiAcBU4pBWL4dIgHYgCDZwE2gCnFYSQCDgEJDoMAg3bAwKDYgO24EBEYNAgCATAQkALgJBCsEBIK8ghpBBEILKBEAJBYAAMSgHbthIBQCgIBgFt2w/CAAI+WAQpBBjdtUgKDWgdt2EABAI4ThEgwQCGFgMIgdN0AmCIKdAjdNwBiBFhICUVQdp2iqBYqkA7TgEILogDhs24ECHyIIBwEG6dggJBgFIcB03YgDFTwE27UAEAj+JASQvDgE27cAQacB2xZGGRcCQZwvFg3bVoJBRgEN2zdBIKCDUiUA7dsgDFRgFt20AiALFfyJxBIIoyGoEbpuABY9JIg8IgdN2EABYqDbMQtAFgOggB6FIISDGKxY7URgiwItKwGkGShIFBbQ3abRLFRARD1GgENm3AgTCEyVBkhEBXIkG7VgdgLRHHaKJGII8EgO27EABYKACIIdJBAUEwE27cAhChFYqwCEEAxEBgAvCBYKDBHwQCDwQRBKYrmHGRMCRJhiHWYfbWYJ6BII7IChu2a4IdHYqYCGMQ4IBgHatkAHw4CCoMAtO2gEQDpFIfZgCLMQwmCoEatsAghBJpEDtOwgAdJHCBBTgdNGQJBJoEbpuAgjjIBAQvDoDFRUhAICWwcSIJEA7dMgDjKYoxBehu24ECII+Qg3bsEBUJQIBF4YRBYqBlLkkB23YgBBHwE27cAYRRBGAQpHMIJg1EIIxNDDRQICPqBBTg3TXIJBFkENmzRBIOOSgHTtEAIIsAts2gESpLFWARhlLkGSoEatuAghBDpEDtOwgAIBIOI4Bpo4DIINAjdpJQahMX6EAIIbFLOIK8D2y8CZwXbtjODILoCBoBBRkEN23AgVJk+Qg3bsEBIIShLBAJxCgJEQMRQIBGQcB23YgFJ8mAm3bgAOEIJ8IILlBGQY7B6cAh5HB2hHCIKkgIMC/BzdAjtkhs2wDLBBwbmLIIoCPMRYFBGQWSgHatkHkFtm0AiRB4oEaIIcwgALDIMYgKyAyEyVIgdtw/jtuAghB5pMAhuAgdggALFIOvkgAACh5B78+eIANz55BGDpIIBiFBggCTQaX//Ef+fJIPVPk+fIPyDB/1AgZB9nnz43DzwLGkg7FEAuChACTIKN5k+Sg3AjxBpUI4jDAoKDFz027BB9knwm2YgRB9yBBKcAwgFF4UBgkQoICNL44jEIMOAHxxBXmnYIK4+PIKESIJ47HEAg7PagQCCMRdBYpHQIL8AHYZBTwRBGQZAdLGQ4CPYpcgQY5B4ghBPYRQICYpQCLdJjFPIMinMQY+YIIxfMYsmQIIs0QY4aKBAQvCwDFfiVBIJgaMYpkAQa+CAoJBLQBbFZQZsJIJhcMX6QCGExp3BIIU26BBEC5aDHgJBSExpBFQYibMQdMgyTIBIIwXNyBBxiSbNiTCCAS4pOoMkiBBCZwRBXgKDeBAWAm2YIIQXPYrMQFiM0QYKAOBATFaQaEQIIQURQd5BsWCGAYq8BQdE26CDbfxACIFiM2Yqw7RAQyDRIKI7XIP4CIVpYICwBBCYRoICiFAINmYIJ6AcAQYvNiE0YqFBQYICdQZxBCQaGAIPqAeAQbFefzACJQZs26CDXgRBnYpyDjOJpBCYpj+aARKDqgJBxQcsQYpmYYpj+cARRBKmiDBIKGAQ0K2KIJrCkAQiDXDQMAZEyDVHcoCEGQKDIm3QIJDCpAQaDImyDJH1MCQwQFBQY5BIYVICHIJzCsZBWAIITCuARZ6Dm2YQYg+zQwsQgEAIIUSdjJEfkBABAAI+ZAUcBkmSgEBgkCIPMApJBBpEAFkjFVoESIIVJkDpdATlAHwJBCkkAIPMAINbdUghBFwECfzICeIP8gwA+DAQWQIMraTII8AfzQCdIP5B/IP5B/AQ8EIIuAFklAkGChACQII8CDSICmgBBFgBB/IIIsjwDaViRBDkD+cAT0AIIVIgBB8gJBBAYIphgTdZgAACfzgChIAJfaAX4CDcEIC8oCh/AT0BUP4CeUP4CewBxP")), +require("heatshrink").decompress(atob("2GwgcEiFBAX4CbhEgwQC/ATeAUP4CegSh/ATyh/AT0AUP4CeUP4CeoCh/AT0BUP4CeUP4CewCh/AT0CUP4CeUP4CegCh/ATyh/AT1AUP4CegKh/ATyh/AT2AUP4CJgUBgAXSoBxNgEgaLUAAAMCCh8kKB4kCgKDXgAuBwAdLiRBCAoJEOgEEyFAAYJBVoECpMkyUIIJWChJEBAQJEBI4ZlIoIjBpJBQXI0AiRBCDoK/HQYQ+EyFIkiMBQxBlDpLuBQasADQIdDYRA4BIJAICKwsIMokkgB0GAR0EIIgdBBwh0BHApBIdIwjFwCDVDQZBDBYdIHBBBJwUBIJGQgBBTgBBMHxwIDdJJBWiJBGwDjCQCBBHdI2SEYT+JAQ+AII4pCHZwIGIJOQIKmBIIwdBF4KARBAhBBEY2SYryDXpBoBYo5BdBYI+UBAbFHyTFUwBBIHywIDII2QQYkAIP4CRDoxZBYrOCoBlGIKqDGgA+YBARBGyECX5oCGQYsggDFbgESdIyDUL4sAgECHy4IBiAcBU4pBWL4dIgHQgCDZwE2gCnFYSQCDgEJDoMAg2bAwKDYgO04EBEYNAgCATAQkALgJBCsEBIK8ghpBBEILKBEAJBYAAMSgHbthIBQCgIBgFt2w/CAAI+WAQpBBjdtwCDXgdt2EABAI4ThEgwQCGFgMIEwpBToBcDEAIsIASiqE0yqBYqkA6bgEILogDhs2wECHyIIBwEG6dggJBgFIcB03YgDFTwE2zcAEAj+JASQvDgE07cAQacB22YLIoyLgSDOF4sG7atBIKMAhu24ECIKCDUiUA7dsgDFRgFt20AiALFfyJxBIIoyGoEbtuABY9JIg8Igdt2EABYqDbMQtAFgMwgB6FIISDGoEaKxI7URgiwItO0WAsgyUJAoLaG7TaJYqICIeo0Ahs24ECYQmSoMkIgK5Eg3TsDsBaI47RRIxBHgkB03YgALBQARBDpIICgmAm3TgEIUIrFWAQggGIgMAm3bgALBQYI+CAQeCCIMB2xTDcw4yJgSJMMQ6zD7azBPQJBHZAUN2zXBDo7FTAQxiHBAMA7dsgA+HAQVBgFt20AiAdIpD7MARZiGEwVAjdpwEEIJNIgdN2EADpI4QIKYyB0EAIJJQBppQBcZAICF4dAYqKkIBAUAtK2BiRBIgHaagLjKYoxBehs24ECII+Qg3TsEBUJQIBF4YRBYqBlLkkB23YgBBHwE27cAYRRBGAQpHMIJg1EIIxNDDRQICPqBBTg3bXIJBFkEN2zRBIOOSgHbtEAIIsAtu2gESpLFWARhlLkGSoEatsAghBDpEDtOwgAIBIOI4Bpo4DIINAjdNwBKCUJi/QgBBDYpZxBXgVpXgbOC7VsZwZBdAQNAIKMghu24ECpMnyEG7dggJBCUJYIBOIUBIiBiKBAIyDgO27EApPkwE27cABwhBPhBBcoIyDHYcPI4pBUkBBgX4VAjtkhs2ZYQODcxZBFAR5iLAoIyCyUA6dog9gtO0gESIPFAjdMg8gtswgALDIMYgKyAyEyVIgdpw/jpuAghB5pMAhuAgdggALFIOvkgAACh5B78+eIANz55BGDpIIBiFBggCTQaX//Ef+fJIPVPk+fIPyDB/1AgZB9nnz43DzwLGkg7FEAuChACTIKN5k+Sg3AjxBpUI4jDAoKDFz007BB9knwIIMCIPuQm2YIJDgGEAovCgMEiFBARpfHEYhBhwA+OILHQIK4+PIKESII3YII47HEAg7PagQCCMRdBQZBBggA7DIKeCIJ4dLGQ4CPYpcgQaBBvghBHzBBGYRQICYpQCLdJjFGmiDHIMinMQYxBIL5jFkyBBODRQICF4WAYr8SoJBMDRjFMgCDXwQFBHAc26BBFQBbFZQZsJIIqDGLhi/SAQwmNO4JBJC5aDHgJBSExpBKTZiDpkGSZAJBGC5uQINuYIIUSTZsSYQQCXFJ1BkkQmiDBZwRBXgKDeBAWAIIgXPYrMQFiJBCQBwICYrSDQYoYURQdk26BBtWCGAmzFWgKDpYrj+IARAsRIK47RAQyDjHa5BXzBBuVpgICwE0QYLCNBAUQoBB9QDgCDF5sQIITFOoKDBATqDiwBBsm3QIJyAeAQYvNmzFPfzACJQZzFPNZECIOyDjYrr+aARKDNzCDbgJBimjFNQcsQYpZBCYpb+cARRBewCGhWxRBNYUgCEQZM26BBNgDImQZM2QZQ7lAQgyBQZJBJYVICDQaY+pgSGCAoKDQYVICHII2YIIzCsZBWAmiDBYVwCLPQZBCQYY+zQwsQgEAIIUSdjJEfkBABAAI+ZAUcBkmSgEBgkCIPMApJBBpEAFkjFVoESIIVJkDpdATlAHwJBCkkAIPMAINbdUghBFwECfzICeIP8gwA+DAQWQIMraTII8AfzQCdIP5B/IP5B/AQ8EIIuAFklAkGChACQII8CDSICmgBBFgBB/IIIsjwDaViRBDkD+cAT0AIIVIgBB8gJBBAYIphgTdZgAACfzgChIAJfaAX4CDcEIC8oCh/AT0BUP4CeUP4CewBxPA==")), +require("heatshrink").decompress(atob("2GwgcEiFBAX4CbhEgwQC/ATeAUP4CegSh/ATyh/AT0AUP4CeUP4CeoCh/AT0BUP4CeUP4CewCh/AT0CUP4CeUP4CegCh/ATyh/AT1AUP4CegKh/ATyh/AT2AUP4CJgUBgAXSoBxNgEgaLUAAAMCCh8kKB4kCgKDXgAuBwAdLiRBCAoJEOgEEyFAAYJBVoECpMkyUIIJWChJEBAQJEBI4ZlIoIjBpJBQXI0AiRBCDoK/HQYQ+EyFIkiMBQxBlDpLuBQasADQIdDYRA4BIJAICKwsIMokkgB0GAR0EIIgdBBwh0BHApBIdIwjFwCDVDQZBDBYdIHBBBJwUBIJGQgBBTgBBMHxwIDdJJBWiJBGwDjCQCBBHdI2SEYT+JAQ+AII4pCHZwIGIJOQIKmBIIwdBF4KARBAhBBEY2SYryDXpBoBYo5BdBYI+UBAbFHyTFUwBBIHywIDII2QQYkAIP4CRDoxZBYrOCoBlGIKqDGgA+YBARBGyECX5oCGQYsggDFbgESdIyDUL4sAgECHy4IBiAcBU4pBWL4dIgHQgCDZwE2gCnFYSQCDgEJDoMAg2bAwKDYgOm4EBEYNAgCATAQkALgJBCoEBIK8ghpBBEILKBEAJBYAAMSgHTthIBQCgIBgFtYoI/BAAI+WAQpBBjVtwCDXgdt0EABAI4ThEgwQCGFgMIEwOwEwRBToEbLgQgBFhACUVQm2VQLFUgHbcAhBdEAcN22AgQ+RBAOAg3bsEBIMApDgOm6EAYqeAm2bgAgEfxICSF4cAmnagCDTgO07BZFGRcCQZwvFg2bVoJBRgEN03AgRBQQakSgHTtkAYqMAtu0gEQBYr+ROIJBFGQ1AjdtwALHpJEHhEDtuwgALFQbZiFoAsDPQpBCQYxWLHaiMEWCEgyUJAoLaG7baJYqICIeo0Ahs2wECYQmSoMkIgK5Eg3TsDsBaI47RRIxBHgkB03QgALBQARBDpIICgmAm2bgEIUIrFWAQggGIgMAmnbgALBQYI+CAQeCCIMB2nYKYTmHGRMCRJhiHWYebWYJ6BII7IChu2a4IdHYqYCGMQ4IBgHbtkAHw4CCoMAtu2gEQDpFIfZgCLMQwmCoEbtuAghBJpEDtuwgAdJHCBBTGQOggBBJKAjjIBAQvDoDFRUhAICgFp2kAiRBIgHaagLjKYoxBehs2wECII+Qg3TsEBUJQIBF4YRBYqBlLkkB03YgBBHwE2zcAYRRBGAQpHMIJmAmnbGoJBGgO26EADRQICPqBBTg3bXIJBFkEN23AgRBxyUA7dsgBBFgFt20AiVJYqwCMMpcgyVAjdtgEEIIdIgdt2EABAJBxHANN0A4CIIJKBpuAJQShMX6EAIIbFLOIK8CtO0XgPJZwXaZwhBdAQNAIKMghs24ECpMnyEG6dggJBCUJYIBOIUBIiBiKBAIyDgOm7EApPkwE26cABwhBPhBBcoIyDHYPbgEPI4O2I4RBUkBBgX4PbsBBBhu2ZYQODcxZBFAR5iLAoIyCyUA7dsg8gtu2gESIPFAjdMIIWggALDIMYgKyAyEyVYgdNw/jpuAghB5pMAhuAgdAgFkIPWsgAACh4LFIOvnzxABufPIIwdJBAMQoMEASZBR8n//Ef+fJIPVPk+fIPyDB/1AgZB9nnz42D3VZIIw7FEAuChACTIKNpk+Wg2AnSDHIMKhHEYYFBGok1zU2zEeR4xB1knwmnYgRB9yE2IJLgGEAovCgMEiFBARpfHEYhBhwA+OIOI+PIKESIJ47HEAg7PagQCCMRdBQaJBXgA7DIKeCII2YII4dLGQ4CPYpcgQY00QZBBvghBPYRQICYpQCLdJjFGINqnMQZ5fMYsmQIIs26BBGDRQICF4WAYr8SoJBFQYwaMYpkAQa+CAoJBLQBbFZQZsJIJhcMX6QCGExp3BIJIXLQY8BIKQmNIIuYIIabMQdMgyTIByE0QYgXNyBBxiSbNiTCCAS4pOoMkiBBCZwRBXgKDeBAWAIIgXPYrMQFiM26ECQBwICYrSDQiE2QYIURQdpBuWCGAIITFUgKD/AQz+IARAsRm2YIKo7RAQyDQmiDRHa5B/ARCtLBAWAIITCNBAUQoBB9QDgCDF5sQm3QYp9BQYICdQZ02QaWAIPqAeAQbFOIILFNfzACJQc8CIM+YIJqDjOJs0Ypz+aARKDMIISDagJBxQcsQYrT+cARRBKm3QIKOAQ0K2KmyDMYUgCEQZRBOgDImQao7lAQgyBQabCpAQaDJzBBygSGCAoI1GmiDIYVICHIJzCsZBWAIITCuARZ6DQYw+zQwsQgEAIIUSdjJEfkBABAAI+ZAUcBkmSgEBgkCIPMApJBBpEAFkjFVoESIIVJkDpdATlAHwJBCkkAIPMAINbdUghBFwECfzICeIP8gwA+DAQWQIMraTII8AfzQCdIP5B/IP5B/AQ8EIIuAFklAkGChACQII8CDSICmgBBFgBB/IIIsjwDaViRBDkD+cAT0AIIVIgBB8gJBBAYIphgTdZgAACfzgChIAJfaAX4CDcEIC8oCh/AT0BUP4CeUP4CewBxPA==")), +require("heatshrink").decompress(atob("2GwgcEiFBAX4CbhEgwQC/ATeAUP4CegSh/ATyh/AT0AUP4CeUP4CeoCh/AT0BUP4CeUP4CewCh/AT0CUP4CeUP4CegCh/ATyh/AT1AUP4CegKh/ATyh/AT2AUP4CJgUBgAXSoBxNgEgaLUAAAMCCh8kKB4kCgKDXgAuBwAdLiRBCAoJEOgEEyFAAYJBVoECpMkyUIIJWChJEBAQJEBI4ZlIoIjBpJBQXI0AiRBCDoK/HQYQ+EyFIkiMBQxBlDpLuBQasADQIdDYRA4BIJAICKwsIMokkgB0GAR0EIIgdBBwh0BHApBIdIwjFwCDVDQZBDBYdIHBBBJwUBIJGQgBBTgBBMHxwIDdJJBWiJBGwDjCQCBBHdI2SEYT+JAQ+AII4pCHZwIGIJOQIKmBIIwdBF4KARBAhBBEY2SYryDXpBoBYo5BdBYI+UBAbFHyTFUwBBIHywIDII2QQYkAIP4CRDoxZBYrOCoBlGIKqDGgA+YBARBGyECX5oCGQYsggDFbgESdIyDUL4sAgECHy4IBiAcBU4pBWL4dIgHYgCDZwE2gCnFYSQCDgEJDoMAg3bAwKDYgO24EBEYNAgCATAQkALgJBB6dggJBXkENm3AEILKBEAJBYAAMSgHTtBIBQCgIBgFtYoI/BAAI+WAQpBBjVtwCDXgdp2EABAI4ThEgwQCGFgMIgdNEwZBToEbtJcBEAIsIASiqE2yqBYqkA7dscAZBdEAcN23AgQ+RBAOAg3bsEBIMApDgO27EAYqeAm3bgAgEfxICSF4cAm2bgCDTgOmLIwyLgSDOF4sGzdAgJBRgEN0zdBIKCDUiUA6dsgDFRgFtm0AiALFfyJxBIIoyGoEatuABY9JIg8IgdtmEABYqDbMQtAFgOwgB6FIISDGoEbKxI7URgiwJ2ywFkGShIFBbQ3bbRLFRARD1GgEN23AgTCEyVBkhEBXIkG7dgdgLRHHaKJGII8EgO2zEABYKACIIdJBAUEwE07cAhChFYqwCEEAxEBgE07UABYKDBHwQCDwQRBgO07BTCcw4yJgSJMMQ6zDzazBPQJBHZAUN0zXBDo7FTAQxiHBAMA6dsgA+HAQVBgFt00AiAdIpD7MARZiGEwVAjdtwEEIJNIgdt2EADpI4QIKYyDIJJQEcZAICF4dAYqKkIBAS2B20AiRBIgHbagLjKYoxBehu04ECII+Qg2bsEBUJQIBF4YRBYqBlLkkB03QgBBHwE2zcAYRRBGAQpHMIJmAmnbGoJBGgO07EADRQICPqBBTXIZBFkDRDIOOSgHbtkAIIsAtu2gESpLFWARhlLkGSoEbtuAghBDpEDtuwgAIBIOI4GIIJKGUJi/QgBBDYpZxBXgemXgTOC7TOEILoCBoBBRkENm2Ag1Jk2Qg3TsEBIIShLBAJxCgJEQMRQIBGQcB03YgFJ8mAm2bgAOEIJ8IILlBGQeAmnbgEPI4O2zBHBIKkgIMC/B7dgIIMN23AgRBEcxZBFAR5iLAoIyCyUA7dsg8gtu2gESIPFAjZBD2EABYZBjEBWQGQmSpEDtsH8dNwEEIPNJgENwEDoEAshB61kAAAUPBYpB18+eIANz55BGDpIIBiFBggCTIKPk//4j/z5JB6p8nz5B+QYP+oEDIPs8+fGwe6rJBGHYogFwUIASZBRtMny0GwE6QY5BhUI4jDAoI1Emuam3YjyPGIOsk+BBBgRB9yBBKcAwgFF4UBgkQoICNL44jEIMOAHxxBxHx5BQiRBGzBBHHY4gEHZ7UCAQRiLoKDHmiDIIK8AHYZBTwRBPDpYyHAR7FLkCDQIN8EIJ7CKBATFKARbpMYo026BBrU5iDGmyDHL5jFkyBBODRQICF4WAYr8SoJBMDRjFMgCDXwQFBIJaALYrKDNhJBFzBBFLhi/SAQwmNO4JBCmiDFC5aDHgJBSExpBKTZiDpkGSZAJBGC5uQIOMSTZsSYQQCXFJ1BkkQm3QgTOCIK8BQbwICwE2QYI7LYr8QFiJBCQBwICYrSDQYoJBBCiKDvINiwQwE2zDFVgKDomiDcfxACIFiJBXHaICGQcY7XIP4CIVpYICwE26ECYRoICiFAINiDBIJyAcAQYvNiBBCYp1BQYICdQcWAIPqAeAQbFOzDFOfzACJQZs0QbECIOyDjOJpBCYpj+aARKDqgJBim3QIJiDliDFLmzFNfzgCKIL2AQ0K2KIJrCkAQiDXDQMAZEyDKzBBJHcoCEGQKDImiDJYVICDQZBB0gSGCAoKDQYVICHIJzCsZBWAm3QgTCuARZ6DmyDFH2aGFiEAgBBCiTsZIj8gIAIABHzICjgMkyUAgMEgRB5gFJIINIgAskYqtAiRBCpMgdLoCcoA+BIIUkgBB5gBBrbqkEIIuAgT+ZATxB/kGAHwYCCyBBlbSZBHgD+aATpB/IP5B/IP4CHghBFwAskoEgwUIASBBHgQaRAU0AIIsAIP5BBFkeAbSsSIIcgfzgCegBBCpEAIPkBIIIDBFMMCbrMAAAT+cAUJABL7QC/AQbghAXlAUP4CegKh/ATyh/AT2AOJ4=")) + ]; + +const bluetoothOnIcon = require("heatshrink").decompress(atob("iEQwYROg3AAokYAgUMg0DAoUBwwFDgE2CIYdHAogREDoopFGoodGABI=")); + +const bluetoothOffIcon = require("heatshrink").decompress(atob("iEQwYLIgwFF4ADBgYFBjAKCsEGBAIABhgFEgOA7AdDmApKmwpCC4OGFIYjFGoVgIIkMEZAAD")); + +const alarmIcon = require("heatshrink").decompress(atob("iEQyBC/AA3/8ABBB7INHA4YLLDqIHVApJRJCZodNCJ4dPHqqPJGp4RLOaozZT8btLF64hJFJpFbAEYA=")); + +const notificationIcon = require("heatshrink").decompress(atob("iEQyBC/AB3/8ABBD+4bHEa4VJD6YTNEKIf/D/rTDAJ7jTADo5hK+IA==")); + + +//the following 2 sections are used from waveclk to schedule minutely updates +// timeout used to update every minute +var drawTimeout; + +// schedule a draw for the next minute +function queueDraw(time) { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + //draw; + //console.log(drawTimeout); + }, time - (Date.now() % time)); + +} + +function getSteps() { + steps = Bangle.getHealthStatus("day").steps; +} + +function drawBackground() { + //g.setBgColor(1,1,1); + g.setBgColor('#555555'); + g.setColor(1,1,1); + g.clear(); + //g.drawImage(imgBg,0,0); + g.reset(); +} +function drawBlackBox() { + g.reset(); + g.setBgColor(1,0,0); + g.setColor(0,0,0); + + //Hour, Min and Sec + g.fillRect(50, timeDataY,50+33,timeDataY+22); + g.fillRect(90, timeDataY,90+33, timeDataY+22); + g.fillRect(128, timeDataY+8,130+24, timeDataY+8+14); + //Day, Month, Day and Year + g.fillRect(9, DateDataY,9+24, DateDataY+15); + g.fillRect(42, DateDataY,42+40, DateDataY+15); + g.fillRect(91, DateDataY,91+24, DateDataY+15); + g.fillRect(124, DateDataY,124+43, DateDataY+15); + //Present day + g.fillRect(60, 86,60+47, 86+7); + //Middle line + g.drawLine(0,95,176,95); + //Step and bat + g.fillRect(3, stepGoalBatdataY-1, 62, stepGoalBatdataY+15); + g.fillRect(121, stepGoalBatdataY-1, 150, stepGoalBatdataY+15); + + //Status + g.fillRect(62, statusDataY-1, 62+49, statusDataY+15); +} + + +function draw(){ + let time = 60000; + if(charching){ + drawCharging(); + time = 500; + }else{ + drawWatchface(); + } + //console.log(charching); + queueDraw(time); +} + +function drawGoal() { + var goal = stepGoal <= steps; + g.reset(); + g.setColor(0,0,0); + + g.fillRect(84, stepGoalBatdataY-1, 92, stepGoalBatdataY+15); + + if (goal){ + g.reset(); + g.setColor(0,1,0); + g.fillRect(84, stepGoalBatdataY, 92, stepGoalBatdataY+7); + } else { + g.reset(); + g.setColor(1,0,0); + g.fillRect(84, stepGoalBatdataY+7, 92, stepGoalBatdataY+14); + } +} +function drawRedkBox() { + g.reset(); + g.setBgColor(1,0,0); + g.setColor(1,0,0); + //Hour, Min and Sec + g.fillRect(50, timeTextY,50+33,timeTextY+15); + g.fillRect(90, timeTextY,90+33, timeTextY+15); + g.fillRect(128, timeTextY+8,130+24, timeTextY+8+15); + //Day, Month, Day and Year + g.fillRect(9, DateTextY,9+24, DateTextY+15); + g.fillRect(42, DateTextY,42+40, DateTextY+15); + g.fillRect(91, DateTextY,91+24, DateTextY+15); + g.fillRect(124, DateTextY,124+43, DateTextY+15); + //Step, Goal and Bat + g.fillRect(2, stepGoalBatTextY,2+61, stepGoalBatTextY+15); + g.fillRect(70, stepGoalBatTextY,72+33, stepGoalBatTextY+15); + g.fillRect(120, stepGoalBatTextY,120+31, stepGoalBatTextY+15); + //Status + g.fillRect(62, statusTextY,62+49, statusTextY+15); +} + +function drawCharging(){ + g.drawImage(chargeAni[chargeAniFrame], 0, 0); + chargeAniFrame+=1; + if(chargeAniFrame>=chargeAni.length){ + chargeAniFrame=0; + } + + + var date = new Date(); + var h = date.getHours(), m = date.getMinutes(); + + if (h<10) { + h = ("0"+h).substr(-2); + } + if (m<10) { + m = ("0"+m).substr(-2); + } + + //time + g.reset(); + g.setBgColor(0,0,0); + g.setColor(1,0,0); + g.setFont("7x11Numeric7Seg",3); + g.drawString(h, 40, 105); + g.drawString(m, 95, 105); + + + var bat = E.getBattery(); + var batl = bat.toString().length-1; + var batDrawX = 80-(11*batl); + //80 69 58 + g.drawString(bat, batDrawX, 20); + //g.drawLine(77,18,94,18); + +} + +function drawWatchface(){ + drawBackground(); + getSteps(); + drawBlackBox(); + drawRedkBox(); + drawGoal(); + var date = new Date(); + var h = date.getHours(), m = date.getMinutes(), s = date.getSeconds(); + var d = date.getDate(), y = date.getFullYear();//, w = date.getDay(); + + if (h<10) { + h = ("0"+h).substr(-2); + } + if (m<10) { + m = ("0"+m).substr(-2); + } + if (s<10) { + s = ("0"+s).substr(-2); + } + if (d<10) { + d = ("0"+d).substr(-2); + } + + g.reset(); + g.setBgColor(1,0,0); + g.setColor(1,1,1); + //Draw text + g.setFont("8x16"); + g.drawString('HOUR', 51, timeTextY+1); + g.drawString('MIN', 96, timeTextY+1); + g.drawString('SEC', 130, timeTextY+9); + + g.drawString('DAY', 10, DateTextY+1); + g.drawString('MONTH', 43, DateTextY+1); + g.drawString('DAY', 92, DateTextY+1); + g.drawString(' YEAR ', 125, DateTextY+1); + + g.drawString('STEPS', 15, stepGoalBatTextY+1); + g.drawString('GOAL', 72, stepGoalBatTextY+1); + g.drawString(' BAT ', 120, stepGoalBatTextY+1); + g.drawString('STATUS', 64, statusTextY+1); + + //time + g.reset(); + g.setBgColor(0,0,0); + g.setColor(1,0,0); + g.setFont("5x7Numeric7Seg",2); + g.drawString(s, 131, timeDataY+8); + g.setFont("7x11Numeric7Seg",2); + g.drawString(h, 53, timeDataY); + g.drawString(m, 93, timeDataY); + //Date + g.reset(); + g.setBgColor(0,0,0); + g.setColor(0,1,0); + g.setFont("5x7Numeric7Seg",2); + g.drawString(d, 13, DateDataY); + g.drawString(y, 127, DateDataY); + g.setFont("8x16"); + g.drawString(require("locale").month(new Date(), 2).toUpperCase(), 52, DateDataY); + g.drawString(require("locale").dow(new Date(), 2).toUpperCase(), 92, DateDataY); + + + //status + g.reset(); + g.setBgColor(0,0,0); + g.setColor(1,1,0); + g.setFont("5x7Numeric7Seg",2); + var step = steps; + var stepl = steps.toString().length; + var stepdDrawX = 4+(36-(stepl*6))+(4*(6-stepl)); + g.drawString(step, stepdDrawX, stepGoalBatdataY); + var bat = E.getBattery(); + var batl = bat.toString().length; + var batDrawX = 122+(18-(batl*6))+(4*(3-batl)); + g.drawString(bat, batDrawX, stepGoalBatdataY); + + //status + var b = bluetoothOffIcon; + if (NRF.getSecurityStatus().connected){ + b = bluetoothOnIcon; + } + g.drawImage(b, 62, statusDataY-1); + if (alarmStatus){ + g.drawImage(alarmIcon, 78, statusDataY-1); + } + if ((require('Storage').readJSON('messages.json',1)||[]).some(messag=>messag.new==true)){ + g.drawImage(notificationIcon, 94, statusDataY-1); + } + + g.reset(); + g.setBgColor(0,0,0); + g.setColor(1,1,1); + g.setFont("4x5"); + g.drawString('Present day', 62, 88); + +} + +/** + * This watch is mostly dark, it does not make sense to respect the + * light theme as you end up with a white strip at the top for the + * widgets and black watch. So set the colours to the dark theme. + * + */ +g.setTheme({bg:"#000",fg:"#fff",dark:true}).clear(); +//draw(); +//the following section is from waveclk +Bangle.on('lcdPower',function(on) { + if (on) { + draw(); // draw immediately, queue redraw + console.log(drawTimeout); + } else { // stop draw timer + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } +}); + +Bangle.on('charging', function(charging) { + Bangle.setLCDTimeout(!charging); + Bangle.setLCDPower(1); + charching = charging; + draw(); +}); + + +Bangle.setUI("clock"); +// Load widgets, but don't show them +Bangle.loadWidgets(); +require("widget_utils").swipeOn(); // hide widgets, make them visible with a swipe +g.clear(1); +//queueDraw(); +draw(); \ No newline at end of file diff --git a/apps/bttfclock/app.png b/apps/bttfclock/app.png new file mode 100644 index 000000000..e33ad3e84 Binary files /dev/null and b/apps/bttfclock/app.png differ diff --git a/apps/bttfclock/metadata.json b/apps/bttfclock/metadata.json new file mode 100644 index 000000000..eb66c30ef --- /dev/null +++ b/apps/bttfclock/metadata.json @@ -0,0 +1,17 @@ +{ + "id": "bttfclock", + "name": "Back To The Future", + "version": "0.03", + "description": "The watch of Marty McFly", + "readme": "README.md", + "icon": "app.png", + "screenshots": [{"url":"screenshot.png"}], + "type": "clock", + "tags": "clock", + "supports": ["BANGLEJS2"], + "allow_emulator": true, + "storage": [ + {"name":"bttfclock.app.js","url":"app.js"}, + {"name":"bttfclock.img","url":"app-icon.js","evaluate":true} + ] +} \ No newline at end of file diff --git a/apps/bttfclock/screenshot.png b/apps/bttfclock/screenshot.png new file mode 100644 index 000000000..c756bffca Binary files /dev/null and b/apps/bttfclock/screenshot.png differ diff --git a/apps/bttfclock/screenshotCharging.png b/apps/bttfclock/screenshotCharging.png new file mode 100644 index 000000000..852ddbf2d Binary files /dev/null and b/apps/bttfclock/screenshotCharging.png differ diff --git a/apps/bwclk/ChangeLog b/apps/bwclk/ChangeLog index 191bb51e5..84ca21d20 100644 --- a/apps/bwclk/ChangeLog +++ b/apps/bwclk/ChangeLog @@ -32,4 +32,6 @@ clkinfo.addInteractive that would cause ReferenceError. 0.30: Use widget_utils 0.31: Use clock_info module as an app 0.32: Make the border of the clock_info box extend all the way to the right of the screen. -0.33: Fix issue rendering ClockInfos with for fg+bg color set to the same (#2749) \ No newline at end of file +0.33: Fix issue rendering ClockInfos with for fg+bg color set to the same (#2749) +0.34: Support 12-hour time format +0.35: Adjust clock info positions to better fit long text diff --git a/apps/bwclk/app.js b/apps/bwclk/app.js index fdb82df73..252cffa9b 100644 --- a/apps/bwclk/app.js +++ b/apps/bwclk/app.js @@ -141,7 +141,7 @@ let clockInfoMenu = clock_info.addInteractive(clockInfoItems, { var hideClkInfo = info.text == null; g.reset().setBgColor(g.theme.fg).clearRect(options.x, options.y, options.x+options.w, options.y+options.h); - g.setFontAlign(0,0).setColor(g.theme.bg); + g.setFontAlign(-1,-1).setColor(g.theme.bg); if (options.focus){ var y = hideClkInfo ? options.y+20 : options.y+2; @@ -157,26 +157,36 @@ let clockInfoMenu = clock_info.addInteractive(clockInfoItems, { return; } - // Set text and font + // Set text and font, compute sizes. var image = info.img; + var imgWidth = image == null ? 0 : 24; + let imgWidthClear = parseInt(imgWidth*1.3); var text = String(info.text); + let strWidth; if(text.split('\n').length > 1){ g.setMiniFont(); + strWidth = g.stringWidth(text); } else { g.setSmallFont(); + strWidth = g.stringWidth(text); + if (strWidth+imgWidthClear > options.w) { + g.setMiniFont(); + text = g.wrapString(text, options.w-imgWidthClear).join("\n"); + strWidth = g.stringWidth(text); + } } - // Compute sizes - var strWidth = g.stringWidth(text); - var imgWidth = image == null ? 0 : 24; + // Compute positions var midx = options.x+options.w/2; + let imgPosX = Math.max(midx-Math.floor(imgWidthClear/2)-parseInt(strWidth/2), 0); + let strPosX = imgPosX+imgWidthClear; // Draw if (image) { var scale = imgWidth / image.width; - g.drawImage(image, midx-parseInt(imgWidth*1.3/2)-parseInt(strWidth/2), options.y+6, {scale: scale}); + g.drawImage(image, imgPosX, options.y+6, {scale: scale}); } - g.drawString(text, midx+parseInt(imgWidth*1.3/2), options.y+20); + g.drawString(text, strPosX, options.y+6); // In case we are in focus and the focus box changes (fullscreen yes/no) // we draw the time again. Otherwise it could happen that a while line is @@ -239,11 +249,9 @@ let drawTime = function() { var y = y1; var date = new Date(); - var hours = String(date.getHours()); - var minutes = date.getMinutes(); - minutes = minutes < 10 ? String("0") + minutes : minutes; - var colon = settings.hideColon ? "" : ":"; - var timeStr = hours + colon + minutes; + var timeStr = locale.time(date, 1); + if (settings.hideColon) + timeStr = timeStr.replace(":", ""); // Set y coordinates correctly y += parseInt((H - y)/2) + 5; diff --git a/apps/bwclk/metadata.json b/apps/bwclk/metadata.json index d4091c2fe..ab2c8c81b 100644 --- a/apps/bwclk/metadata.json +++ b/apps/bwclk/metadata.json @@ -1,7 +1,7 @@ { "id": "bwclk", "name": "BW Clock", - "version": "0.33", + "version": "0.35", "description": "A very minimalistic clock.", "readme": "README.md", "icon": "app.png", diff --git a/apps/bwclklite/ChangeLog b/apps/bwclklite/ChangeLog index c68c62edc..59020f86c 100644 --- a/apps/bwclklite/ChangeLog +++ b/apps/bwclklite/ChangeLog @@ -35,4 +35,6 @@ clkinfo.addInteractive that would cause ReferenceError. Remove invertion of theme as this doesn'twork very well with fastloading. Do an quick inital fillRect on theclock info area. 0.33: Make the border of the clock_info box extend all the way to the right of the screen. -0.34: Fix issue rendering ClockInfos with for fg+bg color set to the same (#2749) \ No newline at end of file +0.34: Fix issue rendering ClockInfos with for fg+bg color set to the same (#2749) +0.35: Support 12-hour time format +0.36: Adjust clock info positions to better fit long text diff --git a/apps/bwclklite/app.js b/apps/bwclklite/app.js index 05f61ec58..e6d6b9a9c 100644 --- a/apps/bwclklite/app.js +++ b/apps/bwclklite/app.js @@ -101,7 +101,7 @@ let clockInfoMenu = clock_info.addInteractive(clockInfoItems, { let hideClkInfo = info.text == null; g.reset().setBgColor(g.theme.fg).clearRect(options.x, options.y, options.x+options.w, options.y+options.h); - g.setFontAlign(0,0).setColor(g.theme.bg); + g.setFontAlign(-1,-1).setColor(g.theme.bg); if (options.focus){ let y = hideClkInfo ? options.y+20 : options.y+2; @@ -117,26 +117,36 @@ let clockInfoMenu = clock_info.addInteractive(clockInfoItems, { return; } - // Set text and font + // Set text and font, compute sizes. let image = info.img; + let imgWidth = image == null ? 0 : 24; + let imgWidthClear = parseInt(imgWidth*1.3); let text = String(info.text); + let strWidth; if(text.split('\n').length > 1){ g.setFont("6x8"); //g.setMiniFont(); + strWidth = g.stringWidth(text); } else { g.setFont("6x8:3"); //g.setSmallFont(); + strWidth = g.stringWidth(text); + if (strWidth+imgWidthClear > options.w) { + g.setFont("6x8"); //g.setMiniFont(); + text = g.wrapString(text, options.w-imgWidthClear).join("\n"); + strWidth = g.stringWidth(text); + } } - // Compute sizes - let strWidth = g.stringWidth(text); - let imgWidth = image == null ? 0 : 24; + // Compute positions let midx = options.x+options.w/2; + let imgPosX = Math.max(midx-Math.floor(imgWidthClear/2)-parseInt(strWidth/2), 0); + let strPosX = imgPosX+imgWidthClear; // Draw if (image) { let scale = imgWidth / image.width; - g.drawImage(image, midx-parseInt(imgWidth*1.3/2)-parseInt(strWidth/2), options.y+6, {scale: scale}); + g.drawImage(image, imgPosX, options.y+6, {scale: scale}); } - g.drawString(text, midx+parseInt(imgWidth*1.3/2), options.y+20); + g.drawString(text, strPosX, options.y+6); // In case we are in focus and the focus box changes (fullscreen yes/no) // we draw the time again. Otherwise it could happen that a while line is @@ -199,11 +209,9 @@ let drawTime = function() { let y = y1; let date = new Date(); - let hours = String(date.getHours()); - let minutes = date.getMinutes(); - minutes = minutes < 10 ? String("0") + minutes : minutes; - let colon = settings.hideColon ? "" : ":"; - let timeStr = hours + colon + minutes; + var timeStr = locale.time(date, 1); + if (settings.hideColon) + timeStr = timeStr.replace(":", ""); // Set y coordinates correctly y += parseInt((H - y)/2) + 5; diff --git a/apps/bwclklite/metadata.json b/apps/bwclklite/metadata.json index f8dffdca9..ef51f72fe 100644 --- a/apps/bwclklite/metadata.json +++ b/apps/bwclklite/metadata.json @@ -1,7 +1,7 @@ { "id": "bwclklite", "name": "BW Clock Lite", - "version": "0.34", + "version": "0.36", "description": "A very minimalistic clock. This version of BW Clock is quicker at the cost of the custom font.", "readme": "README.md", "icon": "app.png", diff --git a/apps/calclock/metadata.json b/apps/calclock/metadata.json index c339e8ce0..31dcb88d0 100644 --- a/apps/calclock/metadata.json +++ b/apps/calclock/metadata.json @@ -6,7 +6,7 @@ "description": "Show the current and upcoming events synchronized from Gadgetbridge", "icon": "calclock.png", "type": "clock", - "tags": "clock agenda", + "tags": "clock,agenda", "supports": ["BANGLEJS2"], "readme": "README.md", "storage": [ diff --git a/apps/calculator/ChangeLog b/apps/calculator/ChangeLog index 2e1ace7bf..7b47d3a4c 100644 --- a/apps/calculator/ChangeLog +++ b/apps/calculator/ChangeLog @@ -5,3 +5,4 @@ 0.05: Grid positioning and swipe controls to switch between numbers, operators and special (for Bangle.js 2) 0.06: Bangle.js 2: Exit with a short press of the physical button 0.07: Bangle.js 2: Exit by pressing upper left corner of the screen +0.08: truncate long numbers (and append '...' to displayed value) diff --git a/apps/calculator/app.js b/apps/calculator/app.js index 465291d13..5f4e77a47 100644 --- a/apps/calculator/app.js +++ b/apps/calculator/app.js @@ -10,9 +10,9 @@ g.clear(); require("Font7x11Numeric7Seg").add(Graphics); -var DEFAULT_SELECTION_NUMBERS = '5', DEFAULT_SELECTION_OPERATORS = '=', DEFAULT_SELECTION_SPECIALS = 'R'; -var RIGHT_MARGIN = 20; +var DEFAULT_SELECTION_NUMBERS = '5'; var RESULT_HEIGHT = 40; +var RESULT_MAX_LEN = Math.floor((g.getWidth() - 20) / 14); var COLORS = { // [normal, selected] DEFAULT: ['#7F8183', '#A6A6A7'], @@ -88,28 +88,11 @@ function prepareScreen(screen, grid, defaultColor) { } function drawKey(name, k, selected) { - var rMargin = 0; - var bMargin = 0; var color = k.color || COLORS.DEFAULT; g.setColor(color[selected ? 1 : 0]); g.setFont('Vector', 20).setFontAlign(0,0); g.fillRect(k.xy[0], k.xy[1], k.xy[2], k.xy[3]); g.setColor(-1); - // correct margins to center the texts - if (name == '0') { - rMargin = (RIGHT_MARGIN * 2) - 7; - } else if (name === '/') { - rMargin = 5; - } else if (name === '*') { - bMargin = 5; - rMargin = 3; - } else if (name === '-') { - rMargin = 3; - } else if (name === 'R' || name === 'N') { - rMargin = k.val === 'C' ? 0 : -9; - } else if (name === '%') { - rMargin = -3; - } g.drawString(k.val || name, (k.xy[0] + k.xy[2])/2, (k.xy[1] + k.xy[3])/2); } @@ -138,29 +121,21 @@ function drawGlobal() { screen[k] = specials[k]; } drawKeys(); - var selected = DEFAULT_SELECTION_NUMBERS; - var prevSelected = DEFAULT_SELECTION_NUMBERS; } function drawNumbers() { screen = numbers; screenColor = COLORS.DEFAULT; drawKeys(); - var selected = DEFAULT_SELECTION_NUMBERS; - var prevSelected = DEFAULT_SELECTION_NUMBERS; } function drawOperators() { screen = operators; screenColor =COLORS.OPERATOR; drawKeys(); - var selected = DEFAULT_SELECTION_OPERATORS; - var prevSelected = DEFAULT_SELECTION_OPERATORS; } function drawSpecials() { screen = specials; screenColor = COLORS.SPECIAL; drawKeys(); - var selected = DEFAULT_SELECTION_SPECIALS; - var prevSelected = DEFAULT_SELECTION_SPECIALS; } function getIntWithPrecision(x) { @@ -218,8 +193,6 @@ function doMath(x, y, operator) { } function displayOutput(num) { - var len; - var minusMarge = 0; g.setBgColor(0).clearRect(0, 0, g.getWidth(), RESULT_HEIGHT-1); g.setColor(-1); if (num === Infinity || num === -Infinity || isNaN(num)) { @@ -230,9 +203,7 @@ function displayOutput(num) { num = '-INFINITY'; } else { num = 'NOT A NUMBER'; - minusMarge = -25; } - len = (num + '').length; currNumber = null; results = null; isDecimal = false; @@ -261,6 +232,9 @@ function displayOutput(num) { num = num.toString(); num = num.replace("-","- "); // fix padding for '-' g.setFont('7x11Numeric7Seg', 2); + if (num.length > RESULT_MAX_LEN) { + num = num.substr(0, RESULT_MAX_LEN - 1)+'...'; + } } g.setFontAlign(1,0); g.drawString(num, g.getWidth()-20, RESULT_HEIGHT/2); diff --git a/apps/calculator/metadata.json b/apps/calculator/metadata.json index 1674b7843..a88444e11 100644 --- a/apps/calculator/metadata.json +++ b/apps/calculator/metadata.json @@ -2,7 +2,7 @@ "id": "calculator", "name": "Calculator", "shortName": "Calculator", - "version": "0.07", + "version": "0.08", "description": "Basic calculator reminiscent of MacOs's one. Handy for small calculus.", "icon": "calculator.png", "screenshots": [{"url":"screenshot_calculator.png"}], diff --git a/apps/calendar/ChangeLog b/apps/calendar/ChangeLog index 9a4f81491..b5a5fbe2f 100644 --- a/apps/calendar/ChangeLog +++ b/apps/calendar/ChangeLog @@ -19,3 +19,5 @@ Display Widgets in menus 0.17: Load holidays before events so the latter is not overpainted 0.18: Minor code improvements +0.19: Read events synchronized from Gadgetbridge +0.20: Correct start time of all-day events synchronized from Gadgetbridge diff --git a/apps/calendar/calendar.js b/apps/calendar/calendar.js index e140ff576..d6eefce39 100644 --- a/apps/calendar/calendar.js +++ b/apps/calendar/calendar.js @@ -60,6 +60,14 @@ const loadEvents = () => { date.setSeconds(time.s); return {date: date, msg: a.msg, type: "e"}; })); + // all events synchronized from Gadgetbridge + events = events.concat((require("Storage").readJSON("android.calendar.json",1) || []).map(a => { + // All-day events always start at 00:00:00 UTC, so we need to "undo" the + // timezone offsetting to make sure that the day is correct. + const offset = a.allDay ? new Date().getTimezoneOffset() * 60 : 0 + const date = new Date((a.timestamp+offset) * 1000); + return {date: date, msg: a.title, type: a.allDay ? "o" : "e"}; + })); }; const loadSettings = () => { @@ -221,8 +229,8 @@ const drawCalendar = function(date) { }, []); let i = 0; g.setFont("8x12", fontSize); - for (y = 0; y < rowN - 1; y++) { - for (x = 0; x < colN; x++) { + for (let y = 0; y < rowN - 1; y++) { + for (let x = 0; x < colN; x++) { i++; const day = days[i]; const curMonth = day < 15 ? month+1 : day < 50 ? month-1 : month; diff --git a/apps/calendar/metadata.json b/apps/calendar/metadata.json index 468bceabb..36713a487 100644 --- a/apps/calendar/metadata.json +++ b/apps/calendar/metadata.json @@ -1,7 +1,7 @@ { "id": "calendar", "name": "Calendar", - "version": "0.18", + "version": "0.20", "description": "Monthly calendar, displays holidays uploaded from the web interface and scheduled events.", "icon": "calendar.png", "screenshots": [{"url":"screenshot_calendar.png"}], diff --git a/apps/carcrazy/settings.js b/apps/carcrazy/settings.js index ee3bbd417..48301a865 100644 --- a/apps/carcrazy/settings.js +++ b/apps/carcrazy/settings.js @@ -17,4 +17,4 @@ } }; E.showMenu(menu); -}); +}) diff --git a/apps/cassioWatch/metadata.json b/apps/cassioWatch/metadata.json index fb7dfd401..5ec12e751 100644 --- a/apps/cassioWatch/metadata.json +++ b/apps/cassioWatch/metadata.json @@ -6,7 +6,7 @@ "icon": "app.png", "version": "0.13", "type": "clock", - "tags": "clock, weather, cassio, retro", + "tags": "clock,weather,cassio,retro", "supports": ["BANGLEJS2"], "allow_emulator": true, "readme": "README.md", diff --git a/apps/cc_abstract/ChangeLog b/apps/cc_abstract/ChangeLog new file mode 100644 index 000000000..fe82a5231 --- /dev/null +++ b/apps/cc_abstract/ChangeLog @@ -0,0 +1 @@ +0.01: copied from cc_clock24 (V0.01) diff --git a/apps/cc_abstract/README.md b/apps/cc_abstract/README.md new file mode 100644 index 000000000..db8416c74 --- /dev/null +++ b/apps/cc_abstract/README.md @@ -0,0 +1,13 @@ +# Analog Clock With Abstract Face + +## Features + +* inspired from the abstract face of the google smartwatch +* second hand (only on unlocked screen) +* turned off or swipeable widgets (choose in settings) + +![logo](screenshot1.png) + +## Settings + +* whether to load widgets, or not; if widgets are loaded, they are swipeable from the top; if not, NO ACTIONS of widgets are available diff --git a/apps/cc_abstract/app.js b/apps/cc_abstract/app.js new file mode 100644 index 000000000..1ce71f5b8 --- /dev/null +++ b/apps/cc_abstract/app.js @@ -0,0 +1,228 @@ +// ----- const ----- + +const defaultSettings = { + loadWidgets: false +}; + +const settings = Object.assign(defaultSettings, require('Storage').readJSON('cc_abstract.json', 1) || {}); + +const center = { + "x": g.getWidth()/2, + "y": g.getHeight()/2 +}; + +// ----- global vars ----- + +let drawTimeout; +let queueMillis = 1000; +let unlock = true; +let lastBatteryStates = [E.getBattery()]; + + +// ----- functions ----- + +function updateState() { + updateBatteryStates(); + + if (Bangle.isLCDOn()) { + if (!Bangle.isLocked()) { + queueMillis = 1000; + unlock = true; + } + else { + queueMillis = 60000; + unlock = false; + } + draw(); + } + else { + if (drawTimeout) + clearTimeout(drawTimeout); + drawTimeout = undefined; + } +} + +function updateBatteryStates() { + lastBatteryStates.push(E.getBattery()); + if (lastBatteryStates.length > 5) + lastBatteryStates.shift(); // remove 1st item +} + +function draw() { + clearScreen(); + drawTicks(); + drawHands(); + queueDraw(); +} + +function clearScreen() { + g.setBgColor(0, 0, 0); + g.clear(); +} + +function drawTicks() { // draws the scale once the app is startet + for (let i = 1; i <= 12; i++) { + const phi = 30 * i * (Math.PI / 180); + const r = 80; + const x = center.x + r * Math.cos(phi); + const y = center.y + r * Math.sin(phi); + + g.setColor(1, 1, 1); + g.fillCircle(x, y, 2); + } +} + +function drawHands() { + const date = new Date(); + const batteryState = calcAvgBatteryState(); + + setColorByBatteryState(batteryState); + drawHourHand(date.getHours(), date.getMinutes()); + + setColorByBatteryState(batteryState); + drawMinuteHand(date.getMinutes()); + + if (unlock) { + setColorByBatteryState(batteryState); + drawSecondHand(date.getSeconds()); + } +} + +function setColorByBatteryState(batteryState) { + if (batteryState <= 20) + g.setColor(1, 0, 0); + else if (batteryState <= 40) + g.setColor(1, 1, 0); + else + g.setColor(0, 1, 1); +} + +function drawHourHand(hours, minutes) { + const hand_len = 40; + const hand_thickness = 14; + const border_thickness = 3; + const hour_angle = 30 * (hours + minutes/60) * (Math.PI / 180) - Math.PI/2; + const hourPolygon = calcOval(center.x, center.y, hour_angle, hand_len, hand_thickness/2); + + // g.drawPoly(hourPolygon, true); + g.fillPoly(hourPolygon); + if (!unlock) { + const innerPolygon = calcOval(center.x, center.y, hour_angle, hand_len, hand_thickness/2 - border_thickness); + g.setColor(0, 0, 0); + g.fillPoly(innerPolygon); + } +} + +function drawMinuteHand(minutes) { + const hand_dist = 60; + const hand_len = 12; + const hand_thickness = 6; + const minute_angle = 6 * minutes * (Math.PI / 180) - Math.PI/2; + const x0 = center.x + hand_dist * Math.cos(minute_angle); + const y0 = center.y + hand_dist * Math.sin(minute_angle); + const minutePolygon = calcOval(x0, y0, minute_angle, hand_len, hand_thickness/2); + + g.fillPoly(minutePolygon); +} + +function drawSecondHand(seconds) { + const hand_radius = 6; + const r = 80; + const second_angle = 6 * seconds * (Math.PI / 180) - Math.PI/2; + const x = center.x + r * Math.cos(second_angle); + const y = center.y + r * Math.sin(second_angle); + + g.fillCircle(x, y, hand_radius); +} + +function calcOval(x0, y0, phi0, len, r) { + // * 2 * * 3 * + // * A B * + // * 1 * * 4 * + // + // A: (x0, y0) + // dist(A, B): len + // dist(A, 1): r + // atan2(A, B): phi + + var polygon = []; + + const n = 4; + const dphi = Math.PI / n; // pi=180° + + // half circle around A + for (let i = 0; i <= n; i += 1) { + const phi = phi0 + Math.PI/2 + i * dphi; + polygon.push(x0 + r * Math.cos(phi)); + polygon.push(y0 + r * Math.sin(phi)); + } + + // half circle around B + const x1 = x0 + len * Math.cos(phi0); + const y1 = y0 + len * Math.sin(phi0); + + for (let i = 0; i <= n; i += 1) { + const phi = phi0 - Math.PI/2 + i * dphi; + polygon.push(x1 + r * Math.cos(phi)); + polygon.push(y1 + r * Math.sin(phi)); + } + + return polygon; +} + +function calcAvgBatteryState() { + const n = lastBatteryStates.length; + if (n == 0) + return 100; + + let sum = lastBatteryStates.reduce((acc, value) => acc + value, 0); + return Math.round(sum / n); +} + +function queueDraw() { + if (drawTimeout) + clearTimeout(drawTimeout); + + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, queueMillis - (Date.now() % queueMillis)); +} + + +//// main running sequence //// + +// Show launcher when middle button pressed, and widgets that we're clock +Bangle.setUI({ + mode: "clock", + remove: function() { + Bangle.removeListener('lcdPower', updateState); + Bangle.removeListener('lock', updateState); + Bangle.removeListener('charging', draw); + + // We clear drawTimout after removing all listeners, because they can add one again + if (drawTimeout) + clearTimeout(drawTimeout); + + drawTimeout = undefined; + require("widget_utils").show(); + } +}); + +// Load widgets if needed, and make them show swipeable +if (settings.loadWidgets) { + Bangle.loadWidgets(); + require("widget_utils").swipeOn(); +} +else if (global.WIDGETS) { + require("widget_utils").hide(); +} + +// Stop updates when LCD is off, restart when on +Bangle.on('lcdPower', updateState); +Bangle.on('lock', updateState); +Bangle.on('charging', draw); // Immediately redraw when charger (dis)connected + +updateState(); +drawTicks(); +draw(); diff --git a/apps/cc_abstract/app_icon.js b/apps/cc_abstract/app_icon.js new file mode 100644 index 000000000..12223c5ae --- /dev/null +++ b/apps/cc_abstract/app_icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEw4X/AoOuuf3gswwgcQgILKgfAHydQAgcFBYvQAgcHM60CBZUKoALKC5UoBZUgAgdwBo8NNIxtKAH4AfgWAAwkMTAiNEnkcCwgLEigWEgOQFpLIJYwOgBZFgb5VgCxMAlSLsfZdwBY8NcP4ALKokHBZRpCACMB4ALVAAwA=")) \ No newline at end of file diff --git a/apps/cc_abstract/app_icon.png b/apps/cc_abstract/app_icon.png new file mode 100644 index 000000000..19ebfab39 Binary files /dev/null and b/apps/cc_abstract/app_icon.png differ diff --git a/apps/cc_abstract/cc_abstract_icon.png b/apps/cc_abstract/cc_abstract_icon.png new file mode 100644 index 000000000..cded02071 Binary files /dev/null and b/apps/cc_abstract/cc_abstract_icon.png differ diff --git a/apps/cc_abstract/metadata.json b/apps/cc_abstract/metadata.json new file mode 100644 index 000000000..86bc959e2 --- /dev/null +++ b/apps/cc_abstract/metadata.json @@ -0,0 +1,17 @@ +{ "id": "cc_abstract", + "name": "CC Abstract", + "shortName": "CC-Abstract", + "version": "0.01", + "description": "analog clock abstract face", + "icon": "app_icon.png", + "type": "clock", + "tags": "clock,abstract", + "supports" : ["BANGLEJS2"], + "screenshots": [{"url":"screenshot1.png"}, {"url":"screenshot2.png"}], + "readme": "README.md", + "storage": [ + {"name": "cc_abstract.app.js", "url": "app.js"}, + {"name": "cc_abstract.img", "url": "app_icon.js", "evaluate": true} + ], + "data": [{"name":"cc_abstract.json"}] +} diff --git a/apps/cc_abstract/screenshot1.png b/apps/cc_abstract/screenshot1.png new file mode 100644 index 000000000..ffa76b602 Binary files /dev/null and b/apps/cc_abstract/screenshot1.png differ diff --git a/apps/cc_abstract/screenshot2.png b/apps/cc_abstract/screenshot2.png new file mode 100644 index 000000000..a6a49d143 Binary files /dev/null and b/apps/cc_abstract/screenshot2.png differ diff --git a/apps/cc_astro/ChangeLog b/apps/cc_astro/ChangeLog new file mode 100644 index 000000000..1678d5285 --- /dev/null +++ b/apps/cc_astro/ChangeLog @@ -0,0 +1 @@ +0.01: First functional release diff --git a/apps/cc_astro/README.md b/apps/cc_astro/README.md new file mode 100644 index 000000000..87e7d03eb --- /dev/null +++ b/apps/cc_astro/README.md @@ -0,0 +1,10 @@ +# Astronomy Clock + +## Features + +* shows earth as hour and venus as minute hand +* shows mercury as second hand only on unlocked screen +* you will be enabled, to recognize the time from the planet positions +* if battery is low, the sun will become a red giant + +![logo](screenshot1.png) diff --git a/apps/cc_astro/app.js b/apps/cc_astro/app.js new file mode 100644 index 000000000..09bb21069 --- /dev/null +++ b/apps/cc_astro/app.js @@ -0,0 +1,184 @@ +// ----- const ----- + +const center = { + "x": g.getWidth()/2, + "y": g.getHeight()/2 +}; + +const parameters = { + "earthOrbitRadius": 80, + "venusOrbitRadius": 60, + "mercuryOrbitRadius": 40, + "earthRadius": 6, + "venusRadius": 6, + "mercuryRadius": 4, + "sunRadius": 12, + "maxSunRadius": 115 +}; + +// ----- global vars ----- + +let drawTimeout; +let queueMillis = 1000; +let unlock = true; +let lastBatteryStates = [E.getBattery()]; + +// ----- functions ----- + +function updateState() { + updateBatteryStates(); + + if (Bangle.isLCDOn()) { + if (!Bangle.isLocked()) { + queueMillis = 1000; + unlock = true; + } + else { + queueMillis = 60000; + unlock = false; + } + draw(); + } + else { + if (drawTimeout) + clearTimeout(drawTimeout); + drawTimeout = undefined; + } +} + +function updateBatteryStates() { + lastBatteryStates.push(E.getBattery()); + if (lastBatteryStates.length > 5) + lastBatteryStates.shift(); // remove 1st item +} + +function draw() { + drawBackground(); + drawHands(); + queueDraw(); +} + +function drawBackground() { + clearScreen(); + drawSun(); +} + +function clearScreen() { + g.setBgColor(0, 0, 0); + g.clear(); +} + +function drawSun() { + const batteryState = calcAvgBatteryState(); + + if (batteryState <= 25) + g.setColor(1, 0, 0); // red sun, if battery low + else + g.setColor(1, 1, 0); + + let r = parameters.sunRadius; + if (batteryState <= 20) { + const relSize = (20 - batteryState) / 20; + const dr = parameters.maxSunRadius - parameters.sunRadius; + r = parameters.sunRadius + relSize * dr; + } + + g.fillCircle(center.x, center.y, r); +} + +function drawHands() { + const date = new Date(); + + drawHourHand(date.getHours(), date.getMinutes()); + drawMinuteHand(date.getMinutes()); + + if (unlock) { + drawSecondHand(date.getSeconds()); + } +} + +function drawHourHand(hours, minutes) { + const r = parameters.earthOrbitRadius; + const phi = 30 * (hours + minutes/60) * (Math.PI / 180) - Math.PI/2; + const x = center.x + r * Math.cos(phi); + const y = center.y + r * Math.sin(phi); + + g.setColor(1, 1, 1); + g.drawCircle(center.x, center.y, r); + + g.setColor(0, 1, 1); + g.fillCircle(x, y, parameters.earthRadius); +} + +function drawMinuteHand(minutes) { + const r = parameters.venusOrbitRadius; + const phi = 6 * minutes * (Math.PI / 180) - Math.PI/2; + const x = center.x + r * Math.cos(phi); + const y = center.y + r * Math.sin(phi); + + g.setColor(1, 1, 1); + g.drawCircle(center.x, center.y, r); + + g.setColor(1, 1, 1); + g.fillCircle(x, y, parameters.venusRadius); +} + +function drawSecondHand(seconds) { + const r = parameters.mercuryOrbitRadius; + const phi = 6 * seconds * (Math.PI / 180) - Math.PI/2; + const x = center.x + r * Math.cos(phi); + const y = center.y + r * Math.sin(phi); + + g.setColor(1, 1, 1); + g.drawCircle(center.x, center.y, r); + + g.setColor(1, 0, 1); + g.fillCircle(x, y, parameters.mercuryRadius); +} + +function calcAvgBatteryState() { + const n = lastBatteryStates.length; + if (n == 0) + return 100; + + let sum = lastBatteryStates.reduce((acc, value) => acc + value, 0); + return Math.round(sum / n); +} + +function queueDraw() { + if (drawTimeout) + clearTimeout(drawTimeout); + + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, queueMillis - (Date.now() % queueMillis)); +} + + +//// main running sequence //// + +// Show launcher when middle button pressed, and widgets that we're clock +Bangle.setUI({ + mode: "clock", + remove: function() { + Bangle.removeListener('lcdPower', updateState); + Bangle.removeListener('lock', updateState); + Bangle.removeListener('charging', draw); + + // We clear drawTimout after removing all listeners, because they can add one again + if (drawTimeout) + clearTimeout(drawTimeout); + + drawTimeout = undefined; + require("widget_utils").show(); + } +}); + +// Stop updates when LCD is off, restart when on +Bangle.on('lcdPower', updateState); +Bangle.on('lock', updateState); +Bangle.on('charging', draw); // Immediately redraw when charger (dis)connected + +updateState(); +draw(); diff --git a/apps/cc_astro/app_icon.js b/apps/cc_astro/app_icon.js new file mode 100644 index 000000000..5c8e704bf --- /dev/null +++ b/apps/cc_astro/app_icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+If4AxlYALFkQOaFqITlDQ5FpJDgZUCY2s1mBeJB5bCI1W64ABDhAyKGB4PHwIvCRSgwNCw4HBwOBqxJVGBguHdrTOSCJLtMGA4QXFgYAFJywuPayIgTUyIwWFzIcPCTBhQAogLFAowuVJqRecEiQKQAAUqv1+qhgSAhQvMqnSAAWoF7iOMFwYABMI1KpQvflQvFvwMEku53MlF/6PVlS/GFwYqVd5heFd6wvNSQQABBQ4vaGBQAIlYkVF7IFiFyCuMFJgwORopMOGDIuHEJkHjkjjkHHpQxIBJBeNisjAAMcLJYnBAArDTAAReBAATsUFykAhwuCirsTFyowCisVCg4xQYZwWRC5jDQDKbpGeJapSLBYqDB5rYaDCQZWIyxHYDaaXMGKjHOFrjtKeRwA/AE4A=")) \ No newline at end of file diff --git a/apps/cc_astro/app_icon.png b/apps/cc_astro/app_icon.png new file mode 100644 index 000000000..a00a36b9c Binary files /dev/null and b/apps/cc_astro/app_icon.png differ diff --git a/apps/cc_astro/metadata.json b/apps/cc_astro/metadata.json new file mode 100644 index 000000000..54f3fd869 --- /dev/null +++ b/apps/cc_astro/metadata.json @@ -0,0 +1,21 @@ +{ "id": "cc_astro", + "name": "CC Astro", + "shortName": "CC-Astro", + "version": "0.01", + "description": "A clock with planets as clock hands", + "icon": "app_icon.png", + "type": "clock", + "tags": "clock,astro,planets,earth,venus,mercury,sun", + "supports" : ["BANGLEJS2"], + "screenshots": [ + {"url":"screenshot1.png"}, + {"url":"screenshot2.png"}, + {"url":"screenshot3.png"} + ], + "readme": "README.md", + "storage": [ + {"name": "cc_astro.app.js", "url": "app.js"}, + {"name": "cc_astro.img", "url": "app_icon.js", "evaluate":true} + ], + "data": [{"name":"cc_astro.json"}] +} diff --git a/apps/cc_astro/screenshot1.png b/apps/cc_astro/screenshot1.png new file mode 100644 index 000000000..e93e44ce0 Binary files /dev/null and b/apps/cc_astro/screenshot1.png differ diff --git a/apps/cc_astro/screenshot2.png b/apps/cc_astro/screenshot2.png new file mode 100644 index 000000000..ec56c599e Binary files /dev/null and b/apps/cc_astro/screenshot2.png differ diff --git a/apps/cc_astro/screenshot3.png b/apps/cc_astro/screenshot3.png new file mode 100644 index 000000000..ce43bc54f Binary files /dev/null and b/apps/cc_astro/screenshot3.png differ diff --git a/apps/cc_clock24/ChangeLog b/apps/cc_clock24/ChangeLog new file mode 100644 index 000000000..c807c40a0 --- /dev/null +++ b/apps/cc_clock24/ChangeLog @@ -0,0 +1,3 @@ +0.01: copied from andark (V0.08) + refactored + add 24 hour mode diff --git a/apps/cc_clock24/README.md b/apps/cc_clock24/README.md new file mode 100644 index 000000000..84b1fa874 --- /dev/null +++ b/apps/cc_clock24/README.md @@ -0,0 +1,16 @@ +# Analog Clock With 24 hour hands + +## Features + +* second hand (only on unlocked screen) +* date +* battery percentage (showing charge status with color) +* turned off or swipeable widgets (choose in settings) + +![logo](cc_clock24_screen.png) + +## Settings + +* whether to load widgets, or not; if widgets are loaded, they are swipeable from the top; if not, NO ACTIONS of widgets are available +* date and battery can be printed both below hands (as if hands were physical) and above (more readable) +* hour hand can be made slighly shorter to improve readability when minute hand is behind a number diff --git a/apps/cc_clock24/app.js b/apps/cc_clock24/app.js new file mode 100644 index 000000000..82487a5dd --- /dev/null +++ b/apps/cc_clock24/app.js @@ -0,0 +1,277 @@ +// ----- const ----- + +const defaultSettings = { + loadWidgets : false, + textAboveHands : false, + shortHrHand : false, + show24HourMode : false +}; + +const settings = Object.assign(defaultSettings, require('Storage').readJSON('cc_clock24.json', 1) || {}); + +const center = { + "x": g.getWidth()/2, + "y": g.getHeight()/2 +}; + +const hourNumberPositions = (function() { + let positions = []; + + for (let hour = 1; hour <= 12; hour += 1) { + let phi = 30 * (hour - 3) * (Math.PI / 180); + let x = center.x + 2 + Math.cos(phi) * (center.x - 10); + let y = center.y + 2 + Math.sin(phi) * (center.x - 10); + + // fix positions, which are not on a circle + if (hour == 3){ x -= 10; } + else if (hour == 6){ y -= 10; } + else if (hour == 9){ x += 10; } + else if (hour == 12){ y += 10; } + else if (hour == 10){ x += 3; } + + positions.push([hour, x, y]); + } + return positions; +})(); + + +// ----- global vars ----- + +let drawTimeout; +let queueMillis = 1000; +let unlock = true; +let lastBatteryStates = [E.getBattery()]; + + +// ----- functions ----- + +function updateState() { + updateBatteryStates(); + + if (Bangle.isLCDOn()) { + if (!Bangle.isLocked()) { + queueMillis = 1000; + unlock = true; + } + else { + queueMillis = 60000; + unlock = false; + } + draw(); + } + else { + if (drawTimeout) + clearTimeout(drawTimeout); + drawTimeout = undefined; + } +} + + +function updateBatteryStates() { + lastBatteryStates.push(E.getBattery()); + if (lastBatteryStates.length > 5) + lastBatteryStates.shift(); // remove 1st item +} + +function drawTicks() { // draws the scale once the app is startet + // clear screen + g.setBgColor(0, 0, 0); + g.clear(); + + // draw ticks + for (let i = 1; i <= 60; i++){ + const phi = 6 * i * (Math.PI / 180); + let thickness = 2; + if (i % 5 == 0) + thickness = 5; + + g.fillPoly(calcHandPolygon(300, thickness, phi), true); + g.setColor(0, 0, 0); + g.fillRect(10, 10, 2 * center.x - 10, 2 * center.x - 10); + g.setColor(1, 1, 1); + } +} + +function calcHandPolygon(len, thickness, phi) { + const x = center.x + Math.cos(phi) * len/2, + y = center.y + Math.sin(phi) * len/2, + d = { + "d": 3, + "x": thickness/2 * Math.cos(phi + Math.PI/2), + "y": thickness/2 * Math.sin(phi + Math.PI/2) + }, + polygon = [ + center.x - d.x, + center.y - d.y, + center.x + d.x, + center.y + d.y, + x + d.x, + y + d.y, + x - d.x, + y - d.y + ]; + return polygon; +} + + +// ----- draw ---- + +function draw() { + // draw black rectangle in the middle to clear screen from scale and hands + g.setColor(0, 0, 0); + g.fillRect(10, 10, 2 * center.x - 10, 2 * center.x - 10); + + g.setFontAlign(0, 0); + drawNumbers(); + + const date = new Date(); + if (settings.textAboveHands) { + drawHands(date); + drawText(date); + } + else { + drawText(date); + drawHands(date); + } + queueDraw(); +} + + +function drawNumbers() { + g.setFont("Vector", 20); + + const batteryState = calcAvgBatteryState(); + if (batteryState < 20) + g.setColor(1, 0, 0); // draw in red, if battery is low + else if (batteryState < 40) + g.setColor(1, 1, 0); + else + g.setColor(1, 1, 1); + + g.setBgColor(0, 0, 0); + for(let i = 0; i < 12; i++) { + let hour = hourNumberPositions[i][0]; + if (settings.show24HourMode) + hour *= 2; + + g.drawString(hour, hourNumberPositions[i][1], hourNumberPositions[i][2], true); + } +} + +function calcAvgBatteryState() { + const n = lastBatteryStates.length; + if (n == 0) + return 100; + + let sum = lastBatteryStates.reduce((acc, value) => acc + value, 0); + return Math.round(sum / n); +} + +function drawHands(date) { + let m = date.getMinutes(), + h = date.getHours(), + s = date.getSeconds(); + + g.setColor(1, 1, 1); + + let numHoursForHourHand = settings.show24HourMode? 24 : 12; + + if (h > numHoursForHourHand) + h = h - numHoursForHourHand; + + + const hour_angle = 2 * Math.PI / numHoursForHourHand * (h + m/60) - Math.PI/2, + minute_angle = 2 * Math.PI / 60 * m - Math.PI/2, + second_angle = 2 * Math.PI / 60 * s - Math.PI/2; + + const hourPolygon = calcHandPolygon(settings.shortHrHand ? 88 : 100, 5, hour_angle); + g.fillPoly(hourPolygon, true); + + const minutePolygon = calcHandPolygon(150, 5, minute_angle); + g.fillPoly(minutePolygon, true); + + if (unlock) { + const secondPolygon = calcHandPolygon(150, 2, second_angle); + g.fillPoly(secondPolygon, true); + } + g.fillCircle(center.x, center.y, 4); +} + +function drawText(date) { + if (!unlock) + return; + + g.setBgColor(0, 0, 0); + g.setColor(1, 1, 1); + + const today = new Date(); + const dateStr = formatDate(today); + g.setFont("Vector", 16); + g.drawString(dateStr, center.x + 5, center.y - 30, true); + + const batteryStr = calcAvgBatteryState() + "%"; + + if (Bangle.isCharging()) + g.setBgColor(1, 0, 0); + + g.setFont("Vector", 24); + g.drawString(batteryStr, center.x, center.y + 30, true); +} + +function formatDate(date) { + const weekdays = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]; + const month_names = ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]; + const day = date.getDate(); + const month_name = month_names[date.getMonth()]; + const weekday = weekdays[date.getDay()]; + + return weekday + " " + day + ". " + month_name; +} + +function queueDraw() { + if (drawTimeout) + clearTimeout(drawTimeout); + + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, queueMillis - (Date.now() % queueMillis)); +} + + +//// main running sequence //// + +// Show launcher when middle button pressed, and widgets that we're clock +Bangle.setUI({ + mode: "clock", + remove: function() { + Bangle.removeListener('lcdPower', updateState); + Bangle.removeListener('lock', updateState); + Bangle.removeListener('charging', draw); + + // We clear drawTimout after removing all listeners, because they can add one again + if (drawTimeout) + clearTimeout(drawTimeout); + + drawTimeout = undefined; + require("widget_utils").show(); + } +}); + +// Load widgets if needed, and make them show swipeable +if (settings.loadWidgets) { + Bangle.loadWidgets(); + require("widget_utils").swipeOn(); +} +else if (global.WIDGETS) { + require("widget_utils").hide(); +} + +// Stop updates when LCD is off, restart when on +Bangle.on('lcdPower', updateState); +Bangle.on('lock', updateState); +Bangle.on('charging', draw); // Immediately redraw when charger (dis)connected + +updateState(); +drawTicks(); +draw(); diff --git a/apps/cc_clock24/app_icon.js b/apps/cc_clock24/app_icon.js new file mode 100644 index 000000000..b213fe5c8 --- /dev/null +++ b/apps/cc_clock24/app_icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwgIEBoUAiAKCgUCBQUEColEAYUQhAmKCwgeCAAcCgEDjwEBkEAg8TBocNgYFDh8GAYMDxkPjEA8EAwkHJgIcBAoPfAoYWCBYYFIgfvAoX4FYRJEAp9gAomYNAOAArPwAogAC4AFiRoIFJLgIFJuADCg//Q4U//4FDj4FEAAV4Aoi0CSxBsCA==")) \ No newline at end of file diff --git a/apps/cc_clock24/cc_clock24_icon.png b/apps/cc_clock24/cc_clock24_icon.png new file mode 100644 index 000000000..cded02071 Binary files /dev/null and b/apps/cc_clock24/cc_clock24_icon.png differ diff --git a/apps/cc_clock24/cc_clock24_screen.png b/apps/cc_clock24/cc_clock24_screen.png new file mode 100644 index 000000000..1f0e5b089 Binary files /dev/null and b/apps/cc_clock24/cc_clock24_screen.png differ diff --git a/apps/cc_clock24/metadata.json b/apps/cc_clock24/metadata.json new file mode 100644 index 000000000..e450893b7 --- /dev/null +++ b/apps/cc_clock24/metadata.json @@ -0,0 +1,18 @@ +{ "id": "cc_clock24", + "name": "CC Clock 24", + "shortName":"CC-Clock24", + "version":"0.01", + "description": "analog clock face with 24 hour pointer", + "icon": "cc_clock24_icon.png", + "type": "clock", + "tags": "clock", + "supports" : ["BANGLEJS2"], + "screenshots": [{"url":"cc_clock24_screen.png"}], + "readme": "README.md", + "storage": [ + {"name":"cc_clock24.app.js","url":"app.js"}, + {"name":"cc_clock24.settings.js","url":"settings.js"}, + {"name":"cc_clock24.img","url":"app_icon.js","evaluate":true} + ], + "data": [{"name":"cc_clock24.json"}] +} diff --git a/apps/cc_clock24/settings.js b/apps/cc_clock24/settings.js new file mode 100644 index 000000000..4aa19215d --- /dev/null +++ b/apps/cc_clock24/settings.js @@ -0,0 +1,33 @@ +(function(back) { + const defaultSettings = { + loadWidgets : false, + textAboveHands : false, + shortHrHand : false, + show24HourMode : false + } + let settings = Object.assign(defaultSettings, require('Storage').readJSON('cc_clock24.json',1) || {}); + + const save = () => require('Storage').write('cc_clock24.json', settings); + + const appMenu = { + '': {title: 'cc_clock24'}, '< Back': back, + /*LANG*/'Load widgets': { + value : !!settings.loadWidgets, + onchange : v => { settings.loadWidgets=v; save();} + }, + /*LANG*/'Text above hands': { + value : !!settings.textAboveHands, + onchange : v => { settings.textAboveHands=v; save();} + }, + /*LANG*/'Short hour hand': { + value : !!settings.shortHrHand, + onchange : v => { settings.shortHrHand=v; save();} + }, + /*LANG*/'Show 24 hour mode': { + value : !!settings.show24HourMode, + onchange : v => { settings.show24HourMode=v; save();} + }, + }; + + E.showMenu(appMenu); +}) diff --git a/apps/chargeanim/ChangeLog b/apps/chargeanim/ChangeLog index a7262b0c9..42e2cc260 100644 --- a/apps/chargeanim/ChangeLog +++ b/apps/chargeanim/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Bangle.js 2 compatibility +0.03: Add settings menu for showing time and battery percent with animation. diff --git a/apps/chargeanim/Screenshot1.png b/apps/chargeanim/Screenshot1.png new file mode 100644 index 000000000..047ab2ca6 Binary files /dev/null and b/apps/chargeanim/Screenshot1.png differ diff --git a/apps/chargeanim/Screenshot2.png b/apps/chargeanim/Screenshot2.png new file mode 100644 index 000000000..ba6b543fe Binary files /dev/null and b/apps/chargeanim/Screenshot2.png differ diff --git a/apps/chargeanim/Screenshot3.png b/apps/chargeanim/Screenshot3.png new file mode 100644 index 000000000..d1c6bcb0b Binary files /dev/null and b/apps/chargeanim/Screenshot3.png differ diff --git a/apps/chargeanim/app.js b/apps/chargeanim/app.js index 68d0cdff5..8913bda4a 100644 --- a/apps/chargeanim/app.js +++ b/apps/chargeanim/app.js @@ -1,8 +1,19 @@ + +var settings = Object.assign({ + // default values + showBatPercent: true, + showTime: true, + + + }, require("Storage").readJSON("chargeAnimSettings.json", true) || {}); + + g.setBgColor(0, 0, 0); g.clear().flip(); var imgbat = require("heatshrink").decompress(atob("nFYhBC/AH4A/AGUeACA22HEo3/G8YrTAC422HBQ2tHBI3/G/43/G/43/G/43/G/43/G/43/G+fTG+vSN+w326Q31GwI3/G9g2WG742CG/43rGwY3yGwg33RKo3bNzQ3bGwo3/G9A2GG942dG/43QGw43uGxA34IKw3VGyY3iG0I3pb8pBRG+wYPG8wYQG/42uG8oZSG/43bDKY3iDKg3cNzI3iRKo3gGyo3/G7A2WG7g2aG/43WGzA3dGzI3/G6fTGzRvcG/43/G/43/G/43/G/43/G/43/G/437HFw2IHFo2KAH4A/AH4Aa")); var imgbubble = require("heatshrink").decompress(atob("i0UhAebgoAFCaYXNBocjAAIWNCYoVHCw4UFIZwqELJQWFKZQVOChYVzABwVaCx7wKCqIWNCg4WMChIXJCZgAnA==")); - +require("Font8x12").add(Graphics); +var batteryPercentStr=""; var W=g.getWidth(),H=g.getHeight(); var b2v = (W != 240)?-1:1; var b2rot = (W != 240)?Math.PI:0; @@ -12,11 +23,50 @@ for (var i=0;i<10;i++) { bubbles.push({y:Math.random()*H,ly:0,x:(0.5+(i<5?i:i+8))*W/18,v:0.6+Math.random(),s:0.5+Math.random()}); } +g.setFont("Vector",22); +g.setFontAlign(0,0); + +var clockStr=""; +var x=g.getWidth()/2; +var cy=g.getHeight()-(g.getHeight()/7) +var by=g.getHeight()-(g.getHeight()/3.500) + + +function calculateTime(){ + + var d=new Date(); + clockStr = require("locale").time(d, 1); // Hour and minute + var meridian=require("locale").meridian(d); + if(meridian!=""){ + //Meridian active + clockStr=clockStr+" "+meridian; + } + +} +function calculate(){ + if(settings.showTime==true){ + calculateTime(); + } + if(settings.showBatPercent==true){ + batteryPercentStr=E.getBattery()+"%"; + } + + +} + function anim() { /* we don't use any kind of buffering here. Just draw one image at a time (image contains a background) too, and there is minimal flicker. */ - var mx = W/2.0, my = H/2.0; + var mx = W/2.0; + var my; + if(settings.showBatPercent){ + var my = H/2.5; + }else{ + var my = H/2.0; + } + + bubbles.forEach(f=>{ f.y-=f.v * b2v; if (f.y<-24) @@ -26,10 +76,25 @@ function anim() { g.drawImage(imgbubble,f.y,f.x,{scale:f.s * b2scale, rotate:b2rot}); }); g.drawImage(imgbat, mx,my,{scale:b2scale, rotate:Math.sin(getTime()*2)*0.5-Math.PI/2 + b2rot}); + if(settings.showTime==true){ + g.drawString(clockStr,x,cy); + } + if(settings.showBatPercent==true){ + g.drawString(batteryPercentStr,x,by,true); + } g.flip(); + + +} + +if(settings.showBatPercent||settings.showTime){ + //Eliminate unnesccesary need for calculation + calculate(); + setInterval(calculate,20000); } -setInterval(anim,20); +setInterval(anim,22); + Bangle.on("charging", isCharging => { if (!isCharging) load(); diff --git a/apps/chargeanim/bangle-charge-animation-screenshot.png b/apps/chargeanim/bangle-charge-animation-screenshot.png deleted file mode 100644 index 83ef1dbda..000000000 Binary files a/apps/chargeanim/bangle-charge-animation-screenshot.png and /dev/null differ diff --git a/apps/chargeanim/bangle2-charge-animation-screenshot.png b/apps/chargeanim/bangle2-charge-animation-screenshot.png deleted file mode 100644 index c3fb7c8c8..000000000 Binary files a/apps/chargeanim/bangle2-charge-animation-screenshot.png and /dev/null differ diff --git a/apps/chargeanim/metadata.json b/apps/chargeanim/metadata.json index 05d894e00..d8c5fa18f 100644 --- a/apps/chargeanim/metadata.json +++ b/apps/chargeanim/metadata.json @@ -1,16 +1,21 @@ { "id": "chargeanim", "name": "Charge Animation", - "version": "0.02", - "description": "When charging, show a sideways charging animation and keep the screen on. When removed from the charger load the clock again.", + "version": "0.03", + "description": "When charging, show a sideways charging animation and optionally, show time, or show battery percentage. When removed from the charger, clock loads again.", "icon": "icon.png", "tags": "battery", "supports": ["BANGLEJS", "BANGLEJS2"], "allow_emulator": true, - "screenshots": [{"url":"bangle2-charge-animation-screenshot.png"},{"url":"bangle-charge-animation-screenshot.png"}], + "screenshots": [ + {"url":"Screenshot1.png"}, + {"url":"Screenshot2.png"}, + {"url":"Screenshot3.png"}], "storage": [ {"name":"chargeanim.app.js","url":"app.js"}, {"name":"chargeanim.boot.js","url":"boot.js"}, + {"name":"chargeanim.settings.js","url":"settings.js"}, {"name":"chargeanim.img","url":"app-icon.js","evaluate":true} - ] + ], + "data": [{"name":"chargeAnimSettings.json"}] } diff --git a/apps/chargeanim/settings.js b/apps/chargeanim/settings.js new file mode 100644 index 000000000..39fc2333b --- /dev/null +++ b/apps/chargeanim/settings.js @@ -0,0 +1,44 @@ +(function(back) { + var FILE = "chargeAnimSettings.json"; + // Load settings + + var settings = Object.assign({ + // default values + showBatPercent: true, + showTime: true, + + + }, require('Storage').readJSON(FILE, true) || {}); + + function writeSettings() { + require('Storage').writeJSON(FILE, settings); + } + + // Show the menu + E.showMenu({ + "" : { "title" : "Charge Animation" }, + "< Back" : () => back(), + 'Show Percent Charged': { + value: !!settings.showBatPercent, // !! converts undefined to false + onchange: v => { + settings.showBatPercent = v; + writeSettings(); + } + // format: ... may be specified as a function which converts the value to a string + // if the value is a boolean, showMenu() will convert this automatically, which + // keeps settings menus consistent + }, + 'Show Time': { + value: !!settings.showTime, // !! converts undefined to false + onchange: v => { + settings.showTime = v; + writeSettings(); + } + // format: ... may be specified as a function which converts the value to a string + // if the value is a boolean, showMenu() will convert this automatically, which + // keeps settings menus consistent + } + + + }); +}) diff --git a/apps/chess/ChangeLog b/apps/chess/ChangeLog index 1fb70549c..516bcb055 100644 --- a/apps/chess/ChangeLog +++ b/apps/chess/ChangeLog @@ -3,3 +3,4 @@ 0.03: Use Bangle.setBacklight() 0.04: Add option to buzz after computer move 0.05: Minor code improvements +0.06: Use button rising edge for Menu diff --git a/apps/chess/app.js b/apps/chess/app.js index 19802083d..69c49836d 100644 --- a/apps/chess/app.js +++ b/apps/chess/app.js @@ -306,4 +306,4 @@ setWatch(() => { } }, }); -}, BTN, { repeat: true, edge: "falling" }); +}, BTN, { repeat: true, edge: "rising" }); diff --git a/apps/chess/metadata.json b/apps/chess/metadata.json index 4f810886b..1e2885392 100644 --- a/apps/chess/metadata.json +++ b/apps/chess/metadata.json @@ -2,7 +2,7 @@ "id": "chess", "name": "Chess", "shortName": "Chess", - "version": "0.05", + "version": "0.06", "description": "Chess game based on the [p4wn engine](https://p4wn.sourceforge.net/). Drag on the touchscreen to move the green cursor onto a piece, select it with a single touch and drag the now red cursor around. Release the piece with another touch to finish the move. The button opens a menu.", "icon": "app.png", "tags": "game", diff --git a/apps/chimer/settings.js b/apps/chimer/settings.js index 55160c9be..1cfb980f4 100644 --- a/apps/chimer/settings.js +++ b/apps/chimer/settings.js @@ -91,4 +91,4 @@ settings = readSettings(); showMainMenu(); -}); +}) diff --git a/apps/chronlog/metadata.json b/apps/chronlog/metadata.json index 8ed618b27..50a9166bf 100644 --- a/apps/chronlog/metadata.json +++ b/apps/chronlog/metadata.json @@ -3,7 +3,7 @@ "version":"0.01", "description": "Record time active on a task, course, work or anything really.", "icon": "app.png", - "tags": "logging, record, work, tasks", + "tags": "logging,record,work,tasks", "supports" : ["BANGLEJS2"], "readme": "README.md", "screenshots" : [ { "url":"dump.png"}, { "url":"dump1.png" }, { "url":"dump2.png" }, { "url":"dump3.png" }, { "url":"dump4.png" }, { "url":"dump5.png" }, { "url":"dump6.png" } ], diff --git a/apps/circlesclock/settings.js b/apps/circlesclock/settings.js index 714b48f2e..0a92f5a5a 100644 --- a/apps/circlesclock/settings.js +++ b/apps/circlesclock/settings.js @@ -92,4 +92,4 @@ } showMainMenu(); -}); +}) diff --git a/apps/clicompleteclk/settings.js b/apps/clicompleteclk/settings.js index 0213ead6e..f062b98b1 100644 --- a/apps/clicompleteclk/settings.js +++ b/apps/clicompleteclk/settings.js @@ -47,4 +47,4 @@ }, '< Back': back, }); -}); +}) diff --git a/apps/clkinfocal/settings.js b/apps/clkinfocal/settings.js index 6fe8f2817..508de5ddc 100644 --- a/apps/clkinfocal/settings.js +++ b/apps/clkinfocal/settings.js @@ -34,4 +34,4 @@ } }); -}); +}) diff --git a/apps/clkinfoclk/metadata.json b/apps/clkinfoclk/metadata.json index 8d676d0e0..0160b59d9 100644 --- a/apps/clkinfoclk/metadata.json +++ b/apps/clkinfoclk/metadata.json @@ -5,7 +5,7 @@ "icon": "app.png", "screenshots": [{"url":"screenshot.png"}], "type": "clkinfo", - "tags": "clkinfo", + "tags": "clkinfo,clock", "supports" : ["BANGLEJS2"], "storage": [ {"name":"clkinfoclk.clkinfo.js","url":"clkinfo.js"} diff --git a/apps/clkinfodist/ChangeLog b/apps/clkinfodist/ChangeLog new file mode 100644 index 000000000..2286a7f70 --- /dev/null +++ b/apps/clkinfodist/ChangeLog @@ -0,0 +1 @@ +0.01: New App! \ No newline at end of file diff --git a/apps/clkinfodist/app.png b/apps/clkinfodist/app.png new file mode 100644 index 000000000..84544fa86 Binary files /dev/null and b/apps/clkinfodist/app.png differ diff --git a/apps/clkinfodist/clkinfo.js b/apps/clkinfodist/clkinfo.js new file mode 100644 index 000000000..93cbe9fcd --- /dev/null +++ b/apps/clkinfodist/clkinfo.js @@ -0,0 +1,22 @@ +(function() { + let strideLength = (require("Storage").readJSON("myprofile.json",1)||{}).strideLength ?? 0.79, + lastSteps = 0; + function stepUpdateHandler() { distance.emit("redraw"); } + var distance = { + name : "Distance", + get : () => { let v = (Bangle.getHealthStatus("day").steps - lastSteps)*strideLength; return { + text : require("locale").distance(v,1), + img : atob("GBiBAAMAAAeAAA/AAA/AAA/gAA/gwAfh4AfD4APD4AOH4AAH4ADj4AHjwAHhwADgAAACAAAHgAAPAAAHAAgCEBgAGD///BgAGAgAEA==") + };}, + run : function() { + lastSteps = (lastSteps>=Bangle.getHealthStatus("day").steps) ? 0 : Bangle.getHealthStatus("day").steps; + this.emit("redraw"); + }, + show : function() { Bangle.on("step", stepUpdateHandler); stepUpdateHandler(); }, + hide : function() { Bangle.removeListener("step", stepUpdateHandler); } + }; + return { + name: "Bangle", + items: [ distance ] + }; +}) diff --git a/apps/clkinfodist/icon.png b/apps/clkinfodist/icon.png new file mode 100644 index 000000000..70a6d496a Binary files /dev/null and b/apps/clkinfodist/icon.png differ diff --git a/apps/clkinfodist/metadata.json b/apps/clkinfodist/metadata.json new file mode 100644 index 000000000..2a60547dd --- /dev/null +++ b/apps/clkinfodist/metadata.json @@ -0,0 +1,14 @@ +{ "id": "clkinfodist", + "name": "Clockinfo Distance", + "version":"0.01", + "description": "Uses the 'My Profile' app's Stride Length to calculate distance travelled based on step count. Tap to reset for measuring distances.", + "icon": "app.png", + "screenshots": [{"url":"screenshot.png"}], + "type": "clkinfo", + "tags": "clkinfo,distance,steps,outdoors,tool", + "dependencies": {"myprofile":"app"}, + "supports" : ["BANGLEJS2"], + "storage": [ + {"name":"clkinfodist.clkinfo.js","url":"clkinfo.js"} + ] +} diff --git a/apps/clkinfodist/screenshot.png b/apps/clkinfodist/screenshot.png new file mode 100644 index 000000000..9463e4064 Binary files /dev/null and b/apps/clkinfodist/screenshot.png differ diff --git a/apps/clkinfogps/clkinfo.js b/apps/clkinfogps/clkinfo.js index 7db9bbdae..740e05eda 100644 --- a/apps/clkinfogps/clkinfo.js +++ b/apps/clkinfogps/clkinfo.js @@ -124,4 +124,4 @@ }; return info; -}); +}) diff --git a/apps/clkinfogpsspeed/clkinfo.js b/apps/clkinfogpsspeed/clkinfo.js index a2c1f51c1..4875f2687 100644 --- a/apps/clkinfogpsspeed/clkinfo.js +++ b/apps/clkinfogpsspeed/clkinfo.js @@ -24,4 +24,4 @@ ] }; return ci; -}) // must not have a semi-colon! \ No newline at end of file +}) diff --git a/apps/clkinfom/clkinfo.js b/apps/clkinfom/clkinfo.js index a3dae43e1..f01649c4c 100644 --- a/apps/clkinfom/clkinfo.js +++ b/apps/clkinfom/clkinfo.js @@ -58,4 +58,4 @@ }; return info; -}); +}) diff --git a/apps/clkinfomag/clkinfo.js b/apps/clkinfomag/clkinfo.js index 620227472..f841bb490 100644 --- a/apps/clkinfomag/clkinfo.js +++ b/apps/clkinfomag/clkinfo.js @@ -46,4 +46,4 @@ ] }; return ci; -}) // must not have a semi-colon! \ No newline at end of file +}) diff --git a/apps/clkinfomsg/ChangeLog b/apps/clkinfomsg/ChangeLog new file mode 100644 index 000000000..7b83706bf --- /dev/null +++ b/apps/clkinfomsg/ChangeLog @@ -0,0 +1 @@ +0.01: First release diff --git a/apps/clkinfomsg/README.md b/apps/clkinfomsg/README.md new file mode 100644 index 000000000..90baa3d70 --- /dev/null +++ b/apps/clkinfomsg/README.md @@ -0,0 +1,18 @@ +# Messages Clockinfo + +A simple messages counter for clockinfo enabled watchfaces + +## Usage + +You can choose between read and unread counter. +Tap to go to messages UI. + +## Todo / Known Issues + +* GB triggers for message read on phone are not handled +* Icons are not consistent +* Maybe use messageicons for handling icon from last notification + +## Attributions + +All icons used in this app are from [icons8](https://icons8.com). \ No newline at end of file diff --git a/apps/clkinfomsg/app.png b/apps/clkinfomsg/app.png new file mode 100644 index 000000000..81a968a40 Binary files /dev/null and b/apps/clkinfomsg/app.png differ diff --git a/apps/clkinfomsg/clkinfo.js b/apps/clkinfomsg/clkinfo.js new file mode 100644 index 000000000..bbb950f3f --- /dev/null +++ b/apps/clkinfomsg/clkinfo.js @@ -0,0 +1,84 @@ +(function() { + + var unreadImg = function() { + return atob("GBiBAAAAAAAAAAAAAB//+D///D///D///D///D///D///D5mfD5mfD///D///D///D///D///D///B//+APgAAOAAAOAAAAAAAAAAA=="); + } + var allImg = function() { + return atob("GBiBAAAAAAAAAAB+AAD/AAPDwA8A8B4AeDgAHDgAHDwAPD8A/D/D/D/n/D///D///D///D///D///D///B//+AAAAAAAAAAAAAAAAA=="); + } + + var debug = function(o) { + //console.log(o); + } + var msgUnread; + var msgAll; + var msgs = require("messages"); + + var getAllMSGs = function() { + if (msgAll === undefined) { + debug("msgAll is undefined"); + msgAll = msgs.getMessages().filter(m => !['call', 'map', 'music'].includes(m.id)).length; + } + return msgAll; + } + + + var getUnreadMGS = function() { + if (msgUnread === undefined) { + debug("msgUnread is undefined"); + msgUnread = msgs.getMessages().filter(m => m.new && !['call', 'map', 'music'].includes(m.id)).length; + } + return msgUnread; + } + + var msgCounter = function(type, msg) { + var msgsNow = msgs.getMessages(msg); + msgUnread = msgsNow.filter(m => m.new && !['call', 'map', 'music'].includes(m.id)).length; + msgAll = msgsNow.filter(m => !['call', 'map', 'music'].includes(m.id)).length; + //TODO find nicer way to redraw current shown CI counter + info.items[0].emit("redraw"); + info.items[1].emit("redraw"); + } + + var info = { + name: "Messages", + img: unreadImg(), + items: [ + { name : "Unread", + get : () => { + return { + text : getUnreadMGS(), + img : unreadImg() + }; + }, + show : function() { + Bangle.on("message", msgCounter); + }, + hide : function() { + Bangle.removeListener("message", msgCounter); + }, + run : () => { + require("messages").openGUI(); + } + }, + { name : "All", + get : () => { + return { + text : getAllMSGs(), + img : allImg() + }; + }, + show : function() { + Bangle.on("message", msgCounter); + }, + hide : function() { + Bangle.removeListener("message", msgCounter); + }, + run : () => { + require("messages").openGUI(); + } + } + ] + }; + return info; +}) diff --git a/apps/clkinfomsg/metadata.json b/apps/clkinfomsg/metadata.json new file mode 100644 index 000000000..e675b69f7 --- /dev/null +++ b/apps/clkinfomsg/metadata.json @@ -0,0 +1,15 @@ +{ "id": "clkinfomsg", + "name": "Messages Clockinfo", + "version":"0.01", + "description": "For clocks that display 'clockinfo', this displays the messages count", + "icon": "app.png", + "type": "clkinfo", + "screenshots": [{"url":"screenshot.png"}], + "readme":"README.md", + "tags": "clkinfo", + "supports" : ["BANGLEJS2"], + "dependencies" : { "messages":"app" }, + "storage": [ + {"name":"clkinfomsg.clkinfo.js","url":"clkinfo.js"} + ] +} diff --git a/apps/clkinfomsg/screenshot.png b/apps/clkinfomsg/screenshot.png new file mode 100644 index 000000000..e46415ad5 Binary files /dev/null and b/apps/clkinfomsg/screenshot.png differ diff --git a/apps/clkinfostopw/clkinfo.js b/apps/clkinfostopw/clkinfo.js index fbbe80a55..8b7a6a9ad 100644 --- a/apps/clkinfostopw/clkinfo.js +++ b/apps/clkinfostopw/clkinfo.js @@ -74,4 +74,4 @@ } ] }; -}); +}) diff --git a/apps/clkinfostopw/clkinfo.ts b/apps/clkinfostopw/clkinfo.ts index f0c2a6ccb..78794205e 100644 --- a/apps/clkinfostopw/clkinfo.ts +++ b/apps/clkinfostopw/clkinfo.ts @@ -80,4 +80,4 @@ } ] }; -}) satisfies ClockInfoFunc +}) satisfies ClockInfoFunc // FIXME: semi-colon added automatically when Typescript generates Javascript file? diff --git a/apps/clkshortcuts/ChangeLog b/apps/clkshortcuts/ChangeLog new file mode 100644 index 000000000..759f68777 --- /dev/null +++ b/apps/clkshortcuts/ChangeLog @@ -0,0 +1 @@ +0.01: New app! \ No newline at end of file diff --git a/apps/clkshortcuts/README.md b/apps/clkshortcuts/README.md new file mode 100644 index 000000000..0d4b72318 --- /dev/null +++ b/apps/clkshortcuts/README.md @@ -0,0 +1,10 @@ +# Shortcuts + +An app that allows you to create custom ClockInfos that act as shortcuts to your favourite apps. + +## Create a Shortcut +After installing the app, you can open the app to add and manage existing shortcuts. If no shortcuts exist, the app will display a ``[+] Shortcuts`` button as a ClockInfo on your Clock (see screenshots), which when clicked will quickly launch into the app so you can add new shortcuts. + +When adding a shortcut, first select the app you wish to use, then select the icon you wish to register to the shortcut. If a keyboard is installed, you'll get the option to rename the shortcut before saving. + +Once created, your shortcut will appear on any Clocks with ClockInfo support, and tapping the shortcut will launch the chosen app \ No newline at end of file diff --git a/apps/clkshortcuts/add_shortcuts_screenshot.png b/apps/clkshortcuts/add_shortcuts_screenshot.png new file mode 100644 index 000000000..ea7c6273b Binary files /dev/null and b/apps/clkshortcuts/add_shortcuts_screenshot.png differ diff --git a/apps/clkshortcuts/app-icon.js b/apps/clkshortcuts/app-icon.js new file mode 100644 index 000000000..99f51a2e8 --- /dev/null +++ b/apps/clkshortcuts/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEw4UB/4ACBIM889VAHmqAAwKCrQLH0oLCuBoFhoLCtJ1HtILBtYLH9ILBtALHlILQlRFCwALSnWwgECBY8O1gLJgeoBaojLHZfqAQILIFwMDBY8CFwMO2QLGhwuBlWuBY0K4ED1aDHBYJUBlQLGnRUChQLIKgJHHBYJUBZY8KgZUBBZHCKgILHh2CBZMC0fABZC+CBZBSBC5JUB14MDcY2q1YLIDAILGtY4EAAXpBYNpBY9pBYNauAKFhulBYWqAAwLCqoLHBQQA6A=")) \ No newline at end of file diff --git a/apps/clkshortcuts/app.js b/apps/clkshortcuts/app.js new file mode 100644 index 000000000..197ca70cf --- /dev/null +++ b/apps/clkshortcuts/app.js @@ -0,0 +1,224 @@ +var storage = require("Storage"); +var keyboard = "textinput"; +try { + keyboard = require(keyboard); +} catch (e) { + keyboard = null; +} + +var icons = [ + {name:"agenda", img :"GBiBAAAAAAA8AAB+AA/n8B/n+BgAGBgAGBn/mBn/mBgAGBgAGBn/mBn/+BgD/BgHDhn+Bhn8MxgMIxgMIx/8Ew/+BgAHDgAD/AAA8A=="}, + {name:"alarm", img:"GBiBAAAAAAAAAAYAYA4AcBx+ODn/nAOBwAcA4A4YcAwYMBgYGBgYGBgYGBgYGBgeGBgHGAwBMA4AcAcA4AOBwAH/gAB+AAAAAAAAAA=="}, + {name:"mail", img:"GBiBAAAAAAAAAAAAAAAAAB//+D///DAADDgAHDwAPDcA7DPDzDDnDDA8DDAYDDAADDAADDAADDAADD///B//+AAAAAAAAAAAAAAAAA=="}, + {name:"android", img: "GBiBAAAAAAEAgAD/AAD/AAHDgAGBgAMkwAMAwAP/wBv/2BsA2BsA2BsA2BsA2BsA2BsA2Bv/2AP/wADnAADnAADnAADnAADnAAAAAA=="}, + {name:"add", img:"GBiBAAAAAAAAAAAAAA//8B//+BgAGBgAGBgYGBgYGBgYGBgYGBn/mBn/mBgYGBgYGBgYGBgYGBgAGBgAGB//+A//8AAAAAAAAAAAAA=="}, + {name:"bangle", img:"GBiBAAD+AAH+AAH+AAH+AAH/AAOHAAYBgAwAwBgwYBgwYBgwIBAwOBAwOBgYIBgMYBgAYAwAwAYBgAOHAAH/AAH+AAH+AAH+AAD+AA=="}, + {name:"bike", img:"GBiBAAAAAAAAAAAAAAAD+AAD/AADjAABjAfhnAfjyAMDwAcGwB4O+H8M/GGZ5sD7c8fzM8fjM8DDA2GBhn8B/h4AeAAAAAAAAAAAAA=="}, + {name:"map", img:"GBiBAAAAAAAAAAAAAADgGAf8+B//+BjHGBjDGBjDGBjDGBjDGBjDGBjDGBjDGBjDGBjDGBjDGBjjGB//+B8/4BgHAAAAAAAAAAAAAA=="}, + {name:"play", img:"GBiBAAAAAAAAAAAAAA//8B//+BgAGBjAGBjwGBj8GBjeGBjHmBjB2BjB2BjHmBjeGBj8GBjwGBjAGBgAGB//+A//8AAAAAAAAAAAAA=="}, + {name:"fast forward", img:"GBiBAAAAAAAAAAAAAH///v///8AAA8YYA8eeA8f/g8b7w8Y488YYO8YYO8Y488b7w8f/g8eeA8YYA8AAA////3///gAAAAAAAAAAAA=="}, + {name:"rewind", img:"GBiBAAAAAAAAAAAAAH///v///8AAA8AYY8B548H/48PfY88cY9wYY9wYY88cY8PfY8H/48B548AYY8AAA////3///gAAAAAAAAAAAA=="}, + {name:"timer", img:"GBiBAAAAAAB+AAB+AAAAMAB+OAH/nAOByAcA4A4YcAwYMBgYGBgYGBgYGBgYGBgAGBgAGAwAMA4AcAcA4AOBwAH/gAB+AAAAAAAAAA=="}, + {name:"connected", img:"GBiBAAAAAAAAAAAAAA//8B//+BgAGBgAGBngGBn4GBgcGBgOGBnHGBnzGBgxmBgZmBmZmBmZmBgAGBgAGB//+A//8AAAAAAAAAAAAA=="}, + {name:"lock", img:"GBiBAAAAAAA8AAD/AAHDgAGBgAMAwAMAwAMAwAf/4A//8AwAMAwAMAwAMAwYMAw8MAw8MAwYMAwAMAwAMAwAMA//8Af/4AAAAAAAAA=="}, + {name:"battery", img:"GBiBAAAAAAAAAAB+AAB+AAHngAPnwAMAwAMAwAMIwAMIwAMYwAM4wAM+wAN8wAMcwAMYwAMQwAMQwAMAwAMAwAP/wAH/gAAAAAAAAA=="}, + {name:"game", img:"GBiBAAAAAAAAAAAAAAA8AAB+AABmAABmAAB+AAA8AAAYAAAYAAAYAAMYAA//8B//+BgAGBgAGBgAGBgAGB//+A//8AAAAAAAAAAAAA=="}, + {name:"dice", img:"GBiBAAAAAB//8D//+HAAPGMDHmeHnmeHnmMDHmAAHmMDHmeHnmeHnmMDHmAAHmMDHmeHnmeHnmMDHnAAPn///j///h///g///AAAAA=="}, + {name:"gear", img:"GBiBAAAAAAAAAAA8AAB+AABmAA3nsA/D8B8A+Dg8HBx+OAznMAzDMAzDMAznMBx+ODg8HB8A+A/D8A3nsABmAAB+AAA8AAAAAAAAAA=="}, + {name:"wrench", img:"GBiBAAAAAAAAAAAAAAAHgAAfwAA7gAAzEABjOABj+ABh+ABgGADgMAHAcAOP4AcfgA44AB9wADHgADHAADGAAB8AAA4AAAAAAAAAAA=="}, + {name:"calendar", img:"FhgBDADAMAMP/////////////////////8AADwAAPAAA8AADwAAPAAA8AADwAAPAAA8AADwAAPAAA8AADwAAP///////"}, + {name:"power", img:"GBiBAAAAAAAAAAB+AAH/gAeBwA4YcAwYMBjbGBnbmDGZjDMYzDMYzDMAzDMAzDGBjBnDmBj/GAw8MA4AcAeB4AH/gAB+AAAAAAAAAA=="}, + {name:"terminal", img:"GBiBAAAAAAAAAAAAAA//8B//+B//+B//+B//+BgAGBgAGBgAGBmAGBjAGBhgGBhgGBjAGBmPmBgAGBgAGB//+A//8AAAAAAAAAAAAA=="}, + {name:"camera", img:"GBiBAAAAAAAAAAD/AAH/gAMAwD8A/H8A/mA8BmD/BmHDhmGBhmMAxmMAxmMAxmMAxmGBhmHDhmD/BmA8BmAABn///j///AAAAAAAAA=="}, + {name:"phone", img:"GBiBAAAAAAAAAAOAAA/AABzgADBgADBgADBgABjgABjAABzAAAxgAA5wAAc58AMf+AGHHADgDABwDAA8GAAfGAAH8AAA4AAAAAAAAA=="}, + {name:"two prong plug", img:"GBiBAAABgAADwAAHwAAPgACfAAHOAAPkBgHwDwP4Hwf8Pg/+fB//OD//kD//wD//4D//8D//4B//QB/+AD/8AH/4APnwAHAAACAAAA=="}, + {name:"steps", img:"GBiBAAcAAA+AAA/AAA/AAB/AAB/gAA/g4A/h8A/j8A/D8A/D+AfH+AAH8AHn8APj8APj8AHj4AHg4AADAAAHwAAHwAAHgAAHgAADAA=="}, + {name:"graph", img:"GBiBAAAAAAAAAAAAAAAAAAAAAADAAADAAAHAAAHjAAHjgAPngH9n/n82/gA+AAA8AAA8AAAcAAAYAAAYAAAAAAAAAAAAAAAAAAAAAA=="}, + {name:"hills", img:"GBiBAAAAAAAAAAAAAAAAAAAAAAACAAAGAAAPAAEZgAOwwAPwQAZgYAwAMBgAGBAACDAADGAABv///////wAAAAAAAAAAAAAAAAAAAA=="}, + {name:"sun", img:"GBiBAAAYAAAYAAAYAAgAEBwAOAx+MAD/AAHDgAMAwAcA4AYAYOYAZ+YAZwYAYAcA4AMAwAHDgAD/AAx+MBwAOAgAEAAYAAAYAAAYAA=="}, + {name:"home", img:"GBiBAAAAAAAAAAAAAAH/gAP/wAdg4A5wYA44MBwf+DgP/BgAGBgAGBgAGBnnmBnnmBnnmBnnmBngGBngGB//+B//+AAAAAAAAAAAAA=="}, + {name:"bell", img:"GBiBAAAAAAAAAAAfgAB/2ADw+AHAMAOAGAcAGD4ADHgADDgADBwADA4AHAcAGAOAOAHAcAPg4ANxwAM5gAP/AAHvAAAHAAACAAAAAA=="}, + {name:"bin", img:"GBiBAAAAAAAAAAB+AB//+B//+AwAMAwAMAxmMAZmYAZmYAZmYAZmYAZmYAZmYAZmYAZmYAZmYANmwAMAwAMAwAP/wAH/gAAAAAAAAA=="}, +]; + +let storedApps; +var showMainMenu = () => { + storedApps = storage.readJSON("clkshortcuts.json", 1) || {}; + + var mainMenu = { + "": { + title: "Shortcuts", + }, + "< Back": () => { + load(); + }, + "New": () => { + // Select the app + getSelectedApp().then((app) => { + getSelectedIcon().then((icon) => { + promptForRename(app.name).then((name) => { + E.showMessage("Saving..."); + storedApps[app.src] = { + name: name, src: app.src, icon: icon + }; + storage.writeJSON("clkshortcuts.json", storedApps); + showMainMenu(); + }).catch(() => { + E.showMessage("Saving..."); + storedApps[app.src] = { + name: app.name, src: app.src, icon: icon + }; + storage.writeJSON("clkshortcuts.json", storedApps); + showMainMenu(); + } ); + }).catch(() => {showMainMenu();}); + }).catch(() => {showMainMenu();}); + }, + }; + getStoredAppsArray(storedApps).forEach((app) => { + mainMenu[app.name] = { + onchange: () => { + showEditMenu(app).then((dirty) => { + if (dirty) { + E.showMessage("Saving..."); + storage.writeJSON("clkshortcuts.json", storedApps); + } + showMainMenu(); + }); + }, + format: v=>"\0" + atob(app.icon) + }; + }); + E.showMenu(mainMenu); +}; + +var showEditMenu = (app) => { + return new Promise((resolve, reject) => { + var editMenu = { + "": { + title: "Edit " + app.name, + }, + "< Back": () => { + resolve(false); + }, + "Name":{ + onchange: () => { + promptForRename(app.name).then((name) => { + storedApps[app.src].name = name; + resolve(true); + }).catch(); + }, + format: v=>app.name.substring(0, 7) + }, + "Icon": { + onchange: () => { + getSelectedIcon().then((icon) => { + storedApps[app.src].icon = icon; + resolve(true); + }).catch(() => resolve(false)); + }, + format: v=>"\0" + atob(app.icon) + }, + "Delete": { + onchange: () => { + delete storedApps[app.src] + resolve(true); + }, + format: v=>"\0" + atob("GBiBAAAAAAAAAAB+AB//+B//+AwAMAwAMAxmMAZmYAZmYAZmYAZmYAZmYAZmYAZmYAZmYAZmYANmwAMAwAMAwAP/wAH/gAAAAAAAAA==") + } + }; + E.showMenu(editMenu); + }); +}; + +var promptForRename = (name) => { + return new Promise((resolve, reject) => { + if (!keyboard) { reject("No textinput is available"); } + else { + return require("textinput").input({text:name}).then((result) => resolve(result)); + } + }); +}; + +var getStoredAppsArray = (apps) => { + var appList = Object.keys(apps); + var storedAppArray = []; + for (var i = 0; i < appList.length; i++) { + var app = "" + appList[i]; + storedAppArray.push( + apps[app] + ); + } + return storedAppArray; +}; + +var getSelectedIcon = () => { + return new Promise((resolve, reject) => { + var iconMenu = { + "": { + title: "Select Icon", + }, + "< Back": () => { + reject("The user cancelled the operation"); + }, + }; + + icons.forEach((icon) => { + iconMenu["\0" + atob(icon.img) + " " + icon.name] = () => { + resolve(icon.img); + }; + }); + + E.showMenu(iconMenu); + }); +}; + +var getAppList = () => { + var appList = storage + .list(/\.info$/) + .map((appInfoFileName) => { + var appInfo = storage.readJSON(appInfoFileName, 1); + return ( + appInfo && { + name: appInfo.name, + sortorder: appInfo.sortorder, + src: appInfo.src, + } + ); + }) + .filter((app) => app && !!app.src); + appList.sort((a, b) => { + var n = (0 | a.sortorder) - (0 | b.sortorder); + if (n) return n; + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + return 0; + }); + + return appList; +}; + +var getSelectedApp = () => { + return new Promise((resolve, reject) => { + E.showMessage("Loading apps..."); + var selectAppMenu = { + "": { + title: "Select App", + }, + "< Back": () => { + reject("The user cancelled the operation"); + }, + }; + + var appList = getAppList(); + appList.forEach((app) => { + selectAppMenu[app.name] = () => { + resolve(app); + }; + }); + + E.showMenu(selectAppMenu); + }); +}; + +showMainMenu(); \ No newline at end of file diff --git a/apps/clkshortcuts/app.png b/apps/clkshortcuts/app.png new file mode 100644 index 000000000..66e28fde7 Binary files /dev/null and b/apps/clkshortcuts/app.png differ diff --git a/apps/clkshortcuts/clkinfo.js b/apps/clkshortcuts/clkinfo.js new file mode 100644 index 000000000..842ae2747 --- /dev/null +++ b/apps/clkshortcuts/clkinfo.js @@ -0,0 +1,45 @@ +(function() { + var storage = require("Storage"); + var storedApps = storage.readJSON("clkshortcuts.json", 1) || {}; + var items = []; + if (Object.keys(storedApps).length !== 0) { + for (var key in storedApps) { + var source = { + name: storedApps[key].name, + img: storedApps[key].icon, + src: storedApps[key].src, + get : function() { + return { + text : this.name, + img : atob(this.img) + } + }, + run: function() { load(this.src);}, + show : function() {}, + hide : function() {}, + } + items.push(source); + } + } + else { + var source = { + name: "Shortcuts", + img: "GBiBAAAAAAAAAAAAAA//8B//+BgAGBgAGBgYGBgYGBgYGBgYGBn/mBn/mBgYGBgYGBgYGBgYGBgAGBgAGB//+A//8AAAAAAAAAAAAA==", + src: "clkshortcuts.app.js", + get : function() { + return { + text : this.name, + img : atob(this.img) + } + }, + run: function() { load(this.src);}, + show : function() {}, + hide : function() {}, + }; + items = [source]; + } + return { + name: "Shortcuts", + items: items + }; +}) \ No newline at end of file diff --git a/apps/clkshortcuts/example_shortcuts_screenshot.png b/apps/clkshortcuts/example_shortcuts_screenshot.png new file mode 100644 index 000000000..b60a57f57 Binary files /dev/null and b/apps/clkshortcuts/example_shortcuts_screenshot.png differ diff --git a/apps/clkshortcuts/metadata.json b/apps/clkshortcuts/metadata.json new file mode 100644 index 000000000..3b58bcb48 --- /dev/null +++ b/apps/clkshortcuts/metadata.json @@ -0,0 +1,17 @@ +{ "id": "clkshortcuts", + "name": "Shortcuts", + "shortName": "Shortcuts", + "version": "0.01", + "description": "Add shortcuts to launch your favourite apps straight from the Clock", + "icon": "app.png", + "screenshots": [{"url":"add_shortcuts_screenshot.png"}, {"url":"example_shortcuts_screenshot.png"}], + "tags": "clkinfo,clockinfo", + "supports": ["BANGLEJS2"], + "readme": "README.md", + "storage": [ + { "name": "clkshortcuts.app.js", "url": "app.js" }, + { "name": "clkshortcuts.img", "url": "app-icon.js", "evaluate": true }, + {"name":"clkshortcuts.clkinfo.js","url":"clkinfo.js"} + ], + "data": [{"name":"clkshortcuts.json"}] +} \ No newline at end of file diff --git a/apps/clock_info/ChangeLog b/apps/clock_info/ChangeLog index 8276321ac..18439d3a2 100644 --- a/apps/clock_info/ChangeLog +++ b/apps/clock_info/ChangeLog @@ -10,4 +10,13 @@ 0.09: Save clkinfo settings on kill and remove 0.10: Fix focus bug when changing focus between two clock infos 0.11: Prepend swipe listener if possible -0.12: Add drawFilledImage to allow drawing icons with a separately coloured middle \ No newline at end of file +0.12: Add drawFilledImage to allow drawing icons with a separately coloured middle +0.13: Cache loaded ClockInfos so if we have clockInfoWidget and a clock, we don't load them twice (saves ~300ms) +0.14: Check for .clkinfocache and use that if exists (from boot 0.64) +0.15: Fix error when displaying a category with only one clockinfo (fix #3728) +0.16: Add BLE clkinfo entry +0.17: Fix BLE icon alignment and border on some clocks +0.18: Tweak BLE icon to add gap and ensure middle of B isn't filled +0.19: Fix Altitude ClockInfo after BLE added + Tapping Altitude now updates the reading +0.20: Altitude ClockInfo now uses the distance units set in locale. diff --git a/apps/clock_info/README.md b/apps/clock_info/README.md index 031f89121..220a0cf4d 100644 --- a/apps/clock_info/README.md +++ b/apps/clock_info/README.md @@ -50,7 +50,7 @@ extensions). `load()` returns an array of menu objects, where each object contains a list of menu items: * `name` : text to display and identify menu object (e.g. weather) * `img` : a 24x24px image -* `dynamic` : if `true`, items are not constant but are sorted (e.g. calendar events sorted by date) +* `dynamic` : if `true`, items are not constant but are sorted (e.g. calendar events sorted by date). This is only used by a few clocks, for example `circlesclock` * `items` : menu items such as temperature, humidity, wind etc. Note that each item is an object with: diff --git a/apps/clock_info/lib.js b/apps/clock_info/lib.js index a9ca7de31..055069247 100644 --- a/apps/clock_info/lib.js +++ b/apps/clock_info/lib.js @@ -14,6 +14,8 @@ if (stepGoal == undefined) { exports.loadCount = 0; /// A list of all the instances returned by addInteractive exports.clockInfos = []; +/// A list of loaded clockInfos +exports.clockInfoMenus = undefined; /// Load the settings, with defaults exports.loadSettings = function() { @@ -29,28 +31,32 @@ exports.loadSettings = function() { /// Load a list of ClockInfos - this does not cache and reloads each time exports.load = function() { + if (exports.clockInfoMenus) + return exports.clockInfoMenus; var settings = exports.loadSettings(); delete settings.apps; // keep just the basic settings in memory // info used for drawing... var hrm = 0; var alt = "--"; // callbacks (needed for easy removal of listeners) - function batteryUpdateHandler() { bangleItems[0].emit("redraw"); } - function stepUpdateHandler() { bangleItems[1].emit("redraw"); } + function batteryUpdateHandler() { bangleItems.find(i=>i.name=="Battery").emit("redraw"); } + function stepUpdateHandler() { bangleItems.find(i=>i.name=="Steps").emit("redraw"); } function hrmUpdateHandler(e) { if (e && e.confidence>60) hrm = Math.round(e.bpm); - bangleItems[2].emit("redraw"); + bangleItems.find(i=>i.name=="HRM").emit("redraw"); } function altUpdateHandler() { try { Bangle.getPressure().then(data=>{ if (!data) return; - alt = Math.round(data.altitude) + "m"; - bangleItems[3].emit("redraw"); + + alt =require("locale").distance(data.altitude); + bangleItems.find(i=>i.name=="Altitude").emit("redraw"); }); } catch (e) { print("Caught "+e+"\n in function altUpdateHandler in module clock_info"); - bangleItems[3].emit('redraw');} + bangleItems.find(i=>i.name=="Altitude").emit('redraw'); + } } // actual menu var menu = [{ @@ -114,6 +120,30 @@ exports.load = function() { } hrm = 0; }, + }, + { name: "BLE", + isOn: () => { + const s = NRF.getSecurityStatus(); + return s.advertising || s.connected; + }, + get: function() { + return { + text: this.isOn() ? "On" : "Off", + img: atob("GBiBAAAAAAAAAAAYAAAcAAAWAAATAAARgAMRgAGTAADGAAB8AAA4AAA4AAB8AADGAAGTAAMRgAARgAATAAAWAAAcAAAYAAAAAAAAAA==") + // small gaps added to BLE icon to ensure middle of B isn't filled + }; + }, + run: function() { + if (this.isOn()) { + NRF.sleep(); + } else { + NRF.wake(); + Bluetooth.setConsole(1); + } + setTimeout(() => this.emit("redraw"), 250); + }, + show: function(){}, + hide: function(){}, } ], }]; @@ -127,14 +157,19 @@ exports.load = function() { min : 0, max : settings.maxAltitude, img : atob("GBiBAAAAAAAAAAAAAAAAAAAAAAACAAAGAAAPAAEZgAOwwAPwQAZgYAwAMBgAGBAACDAADGAABv///////wAAAAAAAAAAAAAAAAAAAA==") }), + run : function() { alt = "--"; this.emit("redraw"); altUpdateHandler(); }, show : function() { this.interval = setInterval(altUpdateHandler, 60000); alt = "--"; altUpdateHandler(); }, hide : function() { clearInterval(this.interval); delete this.interval; }, }); } - + var clkInfoCache = require('Storage').read('.clkinfocache'); + if (clkInfoCache!==undefined) { + // note: code below is included in clkinfocache by bootupdate.js + // we use clkinfocache if it exists as it's faster + eval(clkInfoCache); + } else require("Storage").list(/clkinfo\.js$/).forEach(fn => { // In case there exists already a menu object b with the same name as the next // object a, we append the items. Otherwise we add the new object a to the list. - require("Storage").list(/clkinfo.js$/).forEach(fn => { try{ var a = eval(require("Storage").read(fn))(); var b = menu.find(x => x.name === a.name); @@ -146,6 +181,7 @@ exports.load = function() { }); // return it all! + exports.clockInfoMenus = menu; return menu; }; @@ -274,7 +310,7 @@ exports.addInteractive = function(menu, options) { //in the worst case we come back to 0 } while(menu[options.menuA].items.length==0); // When we change, ensure we don't display the same thing as another clockinfo if we can avoid it - while ((options.menuB < menu[options.menuA].items.length) && + while ((options.menuB < menu[options.menuA].items.length-1) && exports.clockInfos.some(m => (m!=options) && m.menuA==options.menuA && m.menuB==options.menuB)) options.menuB++; } @@ -345,6 +381,9 @@ exports.addInteractive = function(menu, options) { menuHideItem(menu[options.menuA].items[options.menuB]); exports.loadCount--; delete exports.clockInfos[options.index]; + // If nothing loaded now, clear our list of loaded menus + if (exports.loadCount==0) + exports.clockInfoMenus = undefined; }; options.redraw = function() { drawItem(menu[options.menuA].items[options.menuB]); diff --git a/apps/clock_info/metadata.json b/apps/clock_info/metadata.json index 3d47c5062..bfc008398 100644 --- a/apps/clock_info/metadata.json +++ b/apps/clock_info/metadata.json @@ -1,7 +1,7 @@ { "id": "clock_info", "name": "Clock Info Module", "shortName": "Clock Info", - "version":"0.12", + "version":"0.20", "description": "A library used by clocks to provide extra information on the clock face (Altitude, BPM, etc)", "icon": "app.png", "type": "module", diff --git a/apps/clockbg/ChangeLog b/apps/clockbg/ChangeLog index 026dc1aa0..7350c6bac 100644 --- a/apps/clockbg/ChangeLog +++ b/apps/clockbg/ChangeLog @@ -1,3 +1,9 @@ 0.01: New App! 0.02: Moved settings into 'Settings->Apps' -0.03: Add 'Squares' option for random squares background \ No newline at end of file +0.03: Add 'Squares' option for random squares background +0.04: More options for different background colors + 'Plasma' generative background + Add a 'view' option in settings menu to view the current background +0.05: Random square+plasma speed improvements (~2x faster) +0.06: 25% speed improvement if Math.randInt exists (2v25 fw) +0.07: Added 'rings'and 'tris' background styles \ No newline at end of file diff --git a/apps/clockbg/README.md b/apps/clockbg/README.md index 14bbeb7a7..4a3cd70da 100644 --- a/apps/clockbg/README.md +++ b/apps/clockbg/README.md @@ -15,6 +15,9 @@ You can either: * `Random Color` - a new color every time the clock starts * `Image` - choose from a previously uploaded image * `Squares` - a randomly generated pattern of squares in the selected color palette + * `Plasma` - a randomly generated 'plasma' pattern of squares in the selected color palette (random noise with a gaussian filter applied) + * `Rings` - randomly generated rings in the selected color palette + * `Tris` - randomly generated overlapping triangles in the selected color palette ## Usage in code @@ -30,6 +33,9 @@ background.fillRect(Bangle.appRect); // to fill just one part of the screen background.fillRect(x1, y1, x2, y2); + +// if you ever need to reload to a new background (this could take ~100ms) +background.reload(); ``` You should also add `"dependencies" : { "clockbg":"module" },` to your app's metadata to @@ -39,8 +45,9 @@ ensure that the clock background library is automatically loaded. A few features could be added that would really improve functionality: -* When 'fast loading', 'random' backgrounds don't update at the moment +* When 'fast loading', 'random' backgrounds don't update at the moment (calling `.reload` can fix this now, but it slows things down) * Support for >1 image to be uploaded (requires some image management in `interface.html`), and choose randomly between them * Support for gradients (random colors) * More types of auto-generated pattern (as long as they can be generated quickly or in the background) -* Storing 'clear' areas of uploaded images so clocks can easily position themselves \ No newline at end of file +* Storing 'clear' areas of uploaded images so clocks can easily position themselves +* Some backgrounds could update themselves in the background (eg a mandelbrot could calculate the one it should display next time while the watch is running) \ No newline at end of file diff --git a/apps/clockbg/lib.js b/apps/clockbg/lib.js index c9b1fb1d2..0b8fd5996 100644 --- a/apps/clockbg/lib.js +++ b/apps/clockbg/lib.js @@ -1,25 +1,72 @@ -let settings = Object.assign({ - style : "randomcolor", - colors : ["#F00","#0F0","#00F"] -},require("Storage").readJSON("clockbg.json")||{}); -if (settings.style=="image") - settings.img = require("Storage").read(settings.fn); -else if (settings.style=="randomcolor") { - settings.style = "color"; - let n = (0|(Math.random()*settings.colors.length)) % settings.colors.length; - settings.color = settings.colors[n]; - delete settings.colors; -} else if (settings.style=="squares") { - settings.style = "image"; - let bpp = (settings.colors.length>4)?4:2; - let bg = Graphics.createArrayBuffer(11,11,bpp,{msb:true}); - E.mapInPlace(bg.buffer, bg.buffer, ()=>Math.random()*256); // random pixels - bg.palette = new Uint16Array(1<g.toColor(c))); - settings.img = bg.asImage("string"); - settings.imgOpt = {scale:16}; - delete settings.colors; -} +let settings; + +exports.reload = function() { + //let t = Date.now(); + settings = Object.assign({ + style : "randomcolor", + colors : ["#F00","#0F0","#00F"] + },require("Storage").readJSON("clockbg.json",1)||{}); + if (settings.style=="image") + settings.img = require("Storage").read(settings.fn); + else if (settings.style=="randomcolor") { + settings.style = "color"; + let n = (0|(Math.random()*settings.colors.length)) % settings.colors.length; + settings.color = settings.colors[n]; + } else if (settings.style=="rings") { // 45 ms + settings.style = "image"; + let bg = Graphics.createArrayBuffer(g.getWidth(),g.getHeight(),1,{msb:true}); + var x,y,r,ri=Math.randInt,s=bg.getWidth()-20; + for (var i=0;i<10;i++) { + x = 10+ri(s);y=10+ri(s);r=10+ri(40); + bg.drawCircle(x,y,r).drawCircle(x,y,r-1).drawCircle(x,y,r-2).drawCircle(x,y,r-3); + } + bg.palette = new Uint16Array([g.toColor(settings.colors[0]),g.toColor(settings.colors[1])]); + settings.img = bg; + settings.imgOpt = {}; + } else if (settings.style=="tris") { // 58ms + settings.style = "image"; + let cols = settings.colors, ri = Math.randInt, r = ri(settings.colors.length), bpp = (cols.length>4)?4:2; + cols = cols.slice(r).concat(cols.slice(0,r)); // rotate palette + let bg = Graphics.createArrayBuffer(88,88,bpp,{msb:true}); + bg.palette = new Uint16Array(1<g.toColor(c))); + let c = cols.length-1, rp = (function(r){"ram";return r()-10}).bind(null,ri.bind(null,bg.getWidth()+20)), a = [0,0,0,0,0,0]; + for (var i=1;i<9;i++) bg.setColor(1+ri(c)).fillPoly(a.map(rp)); + settings.img = bg; + settings.imgOpt = {scale:g.getWidth()/88}; + } else if (settings.style=="squares") { // 32ms + settings.style = "image"; + let bpp = (settings.colors.length>4)?4:2; + let bg = Graphics.createArrayBuffer(11,11,bpp,{msb:true}); + let u32 = new Uint32Array(bg.buffer); // faster to do 1/4 of the ops of E.mapInPlace(bg.buffer, bg.buffer, ()=>Math.random()*256); + if (Math.randInt) E.mapInPlace(u32, u32, Math.randInt); // random pixels + else E.mapInPlace(u32, u32, function(r,n){"ram";return r()*n}.bind(null,Math.random,0x100000000)); // random pixels + bg.buffer[bg.buffer.length-1]=Math.random()*256; // 11x11 isn't a multiple of 4 bytes - we need to set the last one! + bg.palette = new Uint16Array(1<g.toColor(c))); + settings.img = bg; + settings.imgOpt = {scale:g.getWidth()/11}; + } else if (settings.style=="plasma") { // ~47ms + settings.style = "image"; + let bg = Graphics.createArrayBuffer(16,16,4,{msb:true}); + let u32 = new Uint32Array(bg.buffer); // faster to do 1/4 of the ops of E.mapInPlace(bg.buffer, bg.buffer, ()=>Math.random()*256); + if (Math.randInt) E.mapInPlace(u32, u32, Math.randInt); // random pixels + else E.mapInPlace(u32, u32, function(r,n){"ram";return r()*n}.bind(null,Math.random,0x100000000)); // random pixels + bg.filter([ // a gaussian filter to smooth out + 1, 4, 7, 4, 1, + 4,16,26,16, 4, + 7,26,41,26, 7, + 4,16,26,16, 4, + 1, 4, 7, 4, 1 + ], { w:5, h:5, div:120, offset:-800 }); + bg.palette = new Uint16Array(16); + bg.palette.set(settings.colors.map(c=>g.toColor(c))); + settings.img = bg; + settings.imgOpt = {scale:g.getWidth()/16}; + } + delete settings.colors; // not needed now + //console.log("bg",Date.now()-t); +}; // Fill a rectangle with the current background style, rect = {x,y,w,h} // eg require("clockbg").fillRect({x:10,y:10,w:50,h:50}) @@ -34,4 +81,9 @@ exports.fillRect = function(rect,y,x2,y2) { console.log("clockbg: No background set!"); g.setBgColor(g.theme.bg).clearRect(rect); } -}; \ No newline at end of file +}; + +// load background +exports.reload(); + +//exports.fillRect(Bangle.appRect); // testing \ No newline at end of file diff --git a/apps/clockbg/metadata.json b/apps/clockbg/metadata.json index 2221e99bd..1824f23b2 100644 --- a/apps/clockbg/metadata.json +++ b/apps/clockbg/metadata.json @@ -1,10 +1,10 @@ { "id": "clockbg", "name": "Clock Backgrounds", "shortName":"Backgrounds", - "version": "0.03", + "version": "0.07", "description": "Library that allows clocks to include a custom background (generated on demand or uploaded).", "icon": "app.png", - "screenshots": [{"url":"screenshot.png"},{"url":"screenshot2.png"}], + "screenshots": [{"url":"screenshot.png"},{"url":"screenshot2.png"},{"url":"screenshot3.png"},{"url":"screenshot4.png"},{"url":"screenshot5.png"}], "type": "module", "readme": "README.md", "provides_modules" : ["clockbg"], diff --git a/apps/clockbg/screenshot3.png b/apps/clockbg/screenshot3.png new file mode 100644 index 000000000..c1aaae219 Binary files /dev/null and b/apps/clockbg/screenshot3.png differ diff --git a/apps/clockbg/screenshot4.png b/apps/clockbg/screenshot4.png new file mode 100644 index 000000000..d5d64a602 Binary files /dev/null and b/apps/clockbg/screenshot4.png differ diff --git a/apps/clockbg/screenshot5.png b/apps/clockbg/screenshot5.png new file mode 100644 index 000000000..221caa33d Binary files /dev/null and b/apps/clockbg/screenshot5.png differ diff --git a/apps/clockbg/settings.js b/apps/clockbg/settings.js index c39017262..38a4d6ef5 100644 --- a/apps/clockbg/settings.js +++ b/apps/clockbg/settings.js @@ -1,122 +1,212 @@ (function(back) { -let settings = Object.assign({ - style : "randomcolor", - colors : ["#F00","#0F0","#00F"] -},require("Storage").readJSON("clockbg.json")||{}); + let settings = Object.assign({ + style : "randomcolor", + colors : ["#F00","#0F0","#00F"] + },require("Storage").readJSON("clockbg.json",1)||{}); -function saveSettings() { - if (settings.style!="image") - delete settings.fn; - if (settings.style!="color") - delete settings.color; - if (settings.style!="randomcolor" && settings.style!="squares") - delete settings.colors; - require("Storage").writeJSON("clockbg.json", settings); -} + function saveSettings() { + if (settings.style!="image") + delete settings.fn; + if (settings.style!="color") + delete settings.color; + if (!["randomcolor","squares","plasma","rings","tris"].includes(settings.style)) + delete settings.colors; + require("Storage").writeJSON("clockbg.json", settings); + } -function getColorsImage(cols) { - var bpp = 1; - if (cols.length>4) bpp=4; - else if (cols.length>2) bpp=2; - var w = (cols.length>8)?8:16; - var b = Graphics.createArrayBuffer(w*cols.length,16,bpp); - b.palette = new Uint16Array(1<{ - b.setColor(i).fillRect(i*w,0,i*w+w-1,15); - b.palette[i] = g.toColor(c); - }); - return "\0"+b.asImage("string"); -} + function getColorsImage(cols) { + var bpp = 1; + if (cols.length>4) bpp=4; + else if (cols.length>2) bpp=2; + var w = (cols.length>8)?8:16; + var b = Graphics.createArrayBuffer(w*cols.length,16,bpp); + b.palette = new Uint16Array(1<{ + b.setColor(i).fillRect(i*w,0,i*w+w-1,15); + b.palette[i] = g.toColor(c); + }); + return "\0"+b.asImage("string"); + } -function showModeMenu() { - E.showMenu({ - "" : {title:/*LANG*/"Background", back:showMainMenu}, - /*LANG*/"Solid Color" : function() { - var cols = ["#F00","#0F0","#FF0", - "#00F","#F0F","#0FF", - "#000","#888","#fff",]; - var menu = {"":{title:/*LANG*/"Colors", back:showModeMenu}}; - cols.forEach(col => { - menu["-"+getColorsImage([col])] = () => { - settings.style = "color"; - settings.color = col; - saveSettings(); - showMainMenu(); - }; - }); - E.showMenu(menu); - }, - /*LANG*/"Random Color" : function() { - var cols = [ - ["#F00","#0F0","#FF0","#00F","#F0F","#0FF"], - ["#F00","#0F0","#00F"], - // Please add some more! - ]; - var menu = {"":{title:/*LANG*/"Colors", back:showModeMenu}}; - cols.forEach(col => { - menu[getColorsImage(col)] = () => { - settings.style = "randomcolor"; - settings.colors = col; - saveSettings(); - showMainMenu(); - }; - }); - E.showMenu(menu); - }, - /*LANG*/"Image" : function() { - let images = require("Storage").list(/clockbg\..*\.img/); - if (images.length) { - var menu = {"":{title:/*LANG*/"Images", back:showModeMenu}}; - images.forEach(im => { - menu[im.slice(8,-4)] = () => { - settings.style = "image"; - settings.fn = im; + function showModeMenu() { + E.showMenu({ + "" : {title:/*LANG*/"Background", back:showMainMenu}, + /*LANG*/"Solid Color" : function() { + var cols = ["#F00","#0F0","#FF0", + "#00F","#F0F","#0FF", + "#000","#888","#fff",]; + var menu = {"":{title:/*LANG*/"Colors", back:showModeMenu}}; + cols.forEach(col => { + menu["-"+getColorsImage([col])] = () => { + settings.style = "color"; + settings.color = col; saveSettings(); showMainMenu(); }; }); E.showMenu(menu); - } else { - E.showAlert("Please use App Loader to upload images").then(showModeMenu); + }, + /*LANG*/"Random Color" : function() { + var cols = [ + ["#F00","#0F0","#FF0","#00F","#F0F","#0FF"], + ["#F00","#0F0","#00F"], + ["#FF0","#F0F","#0FF"], + ["#00f","#0bf","#0f7","#3f0","#ff0","#f30","#f07","#b0f"], + ["#66f","#6df","#6fb","#8f6","#ff6","#f86","#f6b","#d6f"], + ["#007","#057","#073","#170","#770","#710","#703","#507"] + // Please add some more! + ]; + var menu = {"":{title:/*LANG*/"Colors", back:showModeMenu}}; + cols.forEach(col => { + menu[getColorsImage(col)] = () => { + settings.style = "randomcolor"; + settings.colors = col; + saveSettings(); + showMainMenu(); + }; + }); + E.showMenu(menu); + }, + /*LANG*/"Image" : function() { + let images = require("Storage").list(/clockbg\..*\.img/); + if (images.length) { + var menu = {"":{title:/*LANG*/"Images", back:showModeMenu}}; + images.forEach(im => { + menu[im.slice(8,-4)] = () => { + settings.style = "image"; + settings.fn = im; + saveSettings(); + showMainMenu(); + }; + }); + E.showMenu(menu); + } else { + E.showAlert("Please use App Loader to upload images").then(showModeMenu); + } + }, + /*LANG*/"Squares" : function() { + var cols = [ // list of color palettes used as possible square colours - either 4 or 16 entries + ["#00f","#05f","#0bf","#0fd","#0f7","#0f1","#3f0","#9f0","#ff0","#f90","#f30","#f01","#f07","#f0d","#b0f","#50f"], + ["#44f","#48f","#4df","#4fe","#4fa","#4f6","#7f4","#bf4","#ff4","#fb4","#f74","#f46","#f4a","#f4e","#d4f","#84f"], + ["#009","#039","#079","#098","#094","#091","#290","#590","#990","#950","#920","#901","#904","#908","#709","#309"], + ["#0FF","#0CC","#088","#044"], + ["#FFF","#FBB","#F66","#F44"], + ["#FFF","#BBB","#666","#000"], + ["#fff","#bbf","#77f","#33f"], + ["#fff","#bff","#7fe","#3fd"] + // Please add some more! 4 or 16 only! + ]; + var menu = {"":{title:/*LANG*/"Squares", back:showModeMenu}}; + cols.forEach(col => { + menu[getColorsImage(col)] = () => { + settings.style = "squares"; + settings.colors = col; + saveSettings(); + showMainMenu(); + }; + }); + E.showMenu(menu); + }, + /*LANG*/"Plasma" : function() { + var cols = [ // list of color palettes used as possible square colours - 16 entries + ["#00f","#05f","#0bf","#0fd","#0f7","#0f1","#3f0","#9f0","#ff0","#f90","#f30","#f01","#f07","#f0d","#b0f","#50f"], + ["#44f","#48f","#4df","#4fe","#4fa","#4f6","#7f4","#bf4","#ff4","#fb4","#f74","#f46","#f4a","#f4e","#d4f","#84f"], + ["#009","#039","#079","#098","#094","#091","#290","#590","#990","#950","#920","#901","#904","#908","#709","#309"], + ["#fff","#fef","#fdf","#fcf","#fbf","#fae","#f9e","#f8e","#f7e","#f6e","#f5d","#f4d","#f3d","#f2d","#f1d","#f0c"], + ["#fff","#eff","#dff","#cef","#bef","#adf","#9df","#8df","#7cf","#6cf","#5bf","#4bf","#3bf","#2af","#1af","#09f"], + ["#000","#010","#020","#130","#140","#250","#260","#270","#380","#390","#4a0","#4b0","#5c0","#5d0","#5e0","#6f0"] + // Please add some more! + ]; + var menu = {"":{title:/*LANG*/"Plasma", back:showModeMenu}}; + cols.forEach(col => { + menu[getColorsImage(col)] = () => { + settings.style = "plasma"; + settings.colors = col; + saveSettings(); + showMainMenu(); + }; + }); + E.showMenu(menu); + }, + /*LANG*/"Rings" : function() { + var cols = [ // list of color palettes used as possible square colours - 2 entries + ["#ff0","#f00"], // yellow/red + ["#0ff","#000"], // cyan/blue + ["#888","#000"], // grey/black + ["#888","#fff"], // grey/white + ["#444","#0f0"], // grey/green + ["#444","#f0f"], // grey/purple + // Please add some more! + ]; + var menu = {"":{title:/*LANG*/"Rings", back:showModeMenu}}; + cols.forEach(col => { + menu[getColorsImage(col)] = () => { + settings.style = "rings"; + settings.colors = col; + saveSettings(); + showMainMenu(); + }; + }); + E.showMenu(menu); + }, + /*LANG*/"Tris" : function() { + var cols = [ // 2/4/8/16 (8/16 both use 4bpp) + ["#00f","#05f","#0bf","#0fd","#0f7","#0f1","#3f0","#9f0","#ff0","#f90","#f30","#f01","#f07","#f0d","#b0f","#50f"], + ["#00f","#0bf","#0f7","#3f0","#ff0","#f30","#f07","#b0f"], + ["#0ef","#6f0","#f10","#90f"], + ["#09f","#1f0","#f60","#e0f"], + ["#000","#444","#888","#fff"] + // Please add some more! + ]; + var menu = {"":{title:/*LANG*/"Colors", back:showModeMenu}}; + cols.forEach(col => { + menu[getColorsImage(col)] = () => { + settings.style = "tris"; + settings.colors = col; + saveSettings(); + showMainMenu(); + }; + }); + E.showMenu(menu); + }, + }); + } + + function showMainMenu() { + E.showMenu({ + "" : {title:/*LANG*/"Clock Background", back:back}, + /*LANG*/"Mode" : { + value : settings.style, + onchange : showModeMenu + }, + /*LANG*/"View" : () => { + Bangle.setUI({mode:"custom",touch:showMainMenu,btn:showMainMenu}); + require("clockbg").reload(); + require("clockbg").fillRect(Bangle.appRect); } - }, - /*LANG*/"Squares" : function() { - /* - a = new Array(16); - a.fill(0); - print(a.map((n,i)=>E.HSBtoRGB(0 + i/16,1,1,24).toString(16).padStart(6,0).replace(/(.).(.).(.)./,"\"#$1$2$3\"")).join(",")) - */ - var cols = [ // list of color palettes used as possible square colours - either 4 or 16 entries - ["#00f","#05f","#0bf","#0fd","#0f7","#0f1","#3f0","#9f0","#ff0","#f90","#f30","#f01","#f07","#f0d","#b0f","#50f"], - ["#0FF","#0CC","#088","#044"], - ["#FFF","#FBB","#F66","#F44"], - ["#FFF","#BBB","#666","#000"] - // Please add some more! - ]; - var menu = {"":{title:/*LANG*/"Squares", back:showModeMenu}}; - cols.forEach(col => { - menu[getColorsImage(col)] = () => { - settings.style = "squares"; - settings.colors = col; - console.log(settings); - saveSettings(); - showMainMenu(); - }; - }); - E.showMenu(menu); - } - }); -} + }); + } -function showMainMenu() { - E.showMenu({ - "" : {title:/*LANG*/"Clock Background", back:back}, - /*LANG*/"Mode" : { - value : settings.style, - onchange : showModeMenu - } - }); -} + /* Scripts for generating colors. Change the values in HSBtoRGB to generate different effects -showMainMenu(); -}) \ No newline at end of file + + a = new Array(16); + a.fill(0); + g.clear(); + w = Math.floor(g.getWidth()/a.length); + print(a.map((n,i)=>{ + var j = i/(a.length-1); // 0..1 + var c = E.HSBtoRGB(j,1,1,24); // rainbow + var c = E.HSBtoRGB(j,0.6,1,24); // faded rainbow + var c = E.HSBtoRGB(0.8, j,1,24); // purple->white + var c = E.HSBtoRGB(0.1, j,1,24); // blue->white + var c = E.HSBtoRGB(0.4, 1,j,24); // black->green + var col = c.toString(16).padStart(6,0).replace(/(.).(.).(.)./,"\"#$1$2$3\""); + g.setColor(eval(col)).fillRect(i*w,0, i*w+w-1,31); + return col; + }).join(",")) + + */ + + showMainMenu(); + }) \ No newline at end of file diff --git a/apps/clockcal/ChangeLog b/apps/clockcal/ChangeLog index 6780313ce..f2365fab7 100644 --- a/apps/clockcal/ChangeLog +++ b/apps/clockcal/ChangeLog @@ -8,3 +8,4 @@ 0.08: Fixed typo in settings.js for DRAGDOWN to make option work 0.09: You can now back out of the calendar using the button 0.10: Fix linter warnings +0.11: Added option to show prior weeks on clock calendar diff --git a/apps/clockcal/app.js b/apps/clockcal/app.js index 185f2adea..06436420a 100644 --- a/apps/clockcal/app.js +++ b/apps/clockcal/app.js @@ -2,7 +2,8 @@ Bangle.setUI("clock"); Bangle.loadWidgets(); var s = Object.assign({ - CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets. + CAL_ROWS: 4, //total number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets. + CAL_ROWS_PRIOR: 0, //number of calendar rows.(weeks) that show above the current week BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually MODE24: true, //24h mode vs 12h mode FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su @@ -178,7 +179,7 @@ function drawWatch() { const dow = (s.FIRSTDAY + d.getDay()) % 7; //MO=0, SU=6 const today = d.getDate(); var rD = new Date(d.getTime()); - rD.setDate(rD.getDate() - dow); + rD.setDate(rD.getDate() - dow - s.CAL_ROWS_PRIOR * 7); var rDate = rD.getDate(); g.setFontAlign(1, 1); for (var y = 1; y <= s.CAL_ROWS; y++) { @@ -187,7 +188,7 @@ function drawWatch() { bottomrightY = y * CELL_H + CAL_Y; g.setFont("Vector", 16); var fg = ((s.REDSUN && rD.getDay() == 0) || (s.REDSAT && rD.getDay() == 6)) ? '#f00' : '#fff'; - if (y == 1 && today == rDate) { + if (y == s.CAL_ROWS_PRIOR + 1 && today == rDate) { g.setColor('#0f0'); g.fillRect(bottomrightX - CELL_W + 1, bottomrightY - CELL_H - 1, bottomrightX, bottomrightY - 2); g.setColor('#000'); diff --git a/apps/clockcal/metadata.json b/apps/clockcal/metadata.json index b84b08575..189d68597 100644 --- a/apps/clockcal/metadata.json +++ b/apps/clockcal/metadata.json @@ -1,7 +1,7 @@ { "id": "clockcal", "name": "Clock & Calendar", - "version": "0.10", + "version": "0.11", "description": "Clock with Calendar", "readme":"README.md", "icon": "app.png", diff --git a/apps/clockcal/settings.js b/apps/clockcal/settings.js index ea613f5c0..c3abe6f1c 100644 --- a/apps/clockcal/settings.js +++ b/apps/clockcal/settings.js @@ -1,7 +1,8 @@ (function (back) { var FILE = "clockcal.json"; const defaults={ - CAL_ROWS: 4, //number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets. + CAL_ROWS: 4, //total number of calendar rows.(weeks) Shouldn't exceed 5 when using widgets. + CAL_ROWS_PRIOR: 0, //number of calendar rows.(weeks) that show above the current week BUZZ_ON_BT: true, //2x slow buzz on disconnect, 2x fast buzz on connect. Will be extra widget eventually MODE24: true, //24h mode vs 12h mode FIRSTDAY: 6, //First day of the week: mo, tu, we, th, fr, sa, su @@ -39,6 +40,14 @@ writeSettings(); } }, + '#Cal Rows Prior': { + value: settings.CAL_ROWS_PRIOR, + min: 0, max: 4, + onchange: v => { + settings.CAL_ROWS_PRIOR = v; + writeSettings(); + } + }, 'Clock mode': { value: settings.MODE24, format: v => v ? "24h" : "12h", @@ -114,4 +123,4 @@ }; // Show the menu E.showMenu(menu); -}); +}) diff --git a/apps/cogclock/settings.js b/apps/cogclock/settings.js index fb1dd761c..deae484c9 100644 --- a/apps/cogclock/settings.js +++ b/apps/cogclock/settings.js @@ -7,4 +7,4 @@ "showDate", "hideWidgets" ]); E.showMenu(menu); -}); +}) diff --git a/apps/coin_info/.gitignore b/apps/coin_info/.gitignore new file mode 100644 index 000000000..2461f4834 --- /dev/null +++ b/apps/coin_info/.gitignore @@ -0,0 +1,2 @@ +/dummy.js +/pebbleppApp.js diff --git a/apps/coin_info/ChangeLog b/apps/coin_info/ChangeLog new file mode 100644 index 000000000..5c40ee93d --- /dev/null +++ b/apps/coin_info/ChangeLog @@ -0,0 +1,7 @@ +0.03: Initial creation +0.04: Using GB http for Binance API requests +0.05: Lot of cleanup +0.06: Creating app v1 +0.07: Finishing touches for v1 +0.09: Clean up +0.10: Finalize documentation for v1 \ No newline at end of file diff --git a/apps/coin_info/README.md b/apps/coin_info/README.md new file mode 100644 index 000000000..47bb8fc06 --- /dev/null +++ b/apps/coin_info/README.md @@ -0,0 +1,66 @@ +# Crypto-Coin Info + +Crypto-Coins Infos with the help of the Binance and CoinStats API + +## Description + +- Is a clock_info module and an app +- I use Pebble++ watch to show a bigger size of clock_info +- I use a wider, more readable font for Pebble++ +- Upload data via App-Loader interface first!!! + +![Screenshot Click_Info 01](screenshots/20250316_01.jpg) +![Screenshot Click_Info 02](screenshots/20250316_02.jpg) +![Screenshot App BTC Graph](screenshots/20250322_01.jpg) +![Screenshot APP BTC Details](screenshots/20250322_02.jpg) +![Screenshot APP STORJ Low/High](screenshots/20250323_01.jpg) + +## Creator + +Martin Zwigl + +## Parts Infos + +### App-Loader web-interface + +- Binance + - Find docs here [Binance API](https://www.binance.com/en/binance-api) + - For Binance use symbols like BTC,ETH,STORJ + - For the calc counterpart use USDT (I don't know why USD is measured on the stablecoin) or EUR or other fiat currency +- Coinstats + - Find docs here [Coinstats API](https://openapi.coinstats.app/) + - Get an API key at the website. Free is worth 1Mio token, which in turn is worth around 250k - 300k requests per month + - Supply crypto token in the form of its IDs like bitcoin,ethereum,storj +- It is not necessary to re-upload the app when uploading data. Data is read with app start + +### Clock-Info + +- Updates prices with the free Binance API +- clkInfo updates after around 15 sec and then every x minutes (via settings) thereafter. +- The token you want to have tracked and compared to what currency have to be uploaded via app loader web-interface +- After that you can decide which token to display in settings + +### App + +- Using CoinStats for chart-data +- token-names on CoinStats are different to Binance; they also have to be uploaded via Interface +- You also need a CoinStats API access key which is good for a fair amount of calls +- I tried with gridy for the axis, but for this data - it is just not readable... +- Let me know when you have good suggestions for improvement. +- ".." button shows current details for current token +- "LH" button shows low and high on graph as well as the first and last point in series +- Swipe L-R changes token you supplied via interface +- Not much guard-rails in the app -> you should have at least one token (each) present +- Also the API token and fiat currency you want to match against (eg. USD, EUR) +- New data is requested every minute, except on button touch + +### Settings + +- Choose which of the uploaded tokens to display in clock_info +- Choose update-time for clock_info HTTP requests to Binance + +## Possible Improvements / TODOs + +- Better choosing of fonts for more space +- set UI properly to have back button next to widgets +- clean-up code structure \ No newline at end of file diff --git a/apps/coin_info/app-icon.js b/apps/coin_info/app-icon.js new file mode 100644 index 000000000..6cd06c707 --- /dev/null +++ b/apps/coin_info/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+AH4A/AH4AT5gAGFdYzmFx4xfEAfN53U6oAC53O5owg6wjB5wrDAA3UGQxaW5vWAAgwLGIIwXRAYvFGBxiEXCnOF4wwBKoKWHGAPUGCguLAAINCMJIwEFzgvLGC3NFw7gFAAfNehovN65aKABDEGGAouNAAIvSSg6RRF4QwGDAQIF6qSLMBwuDGAwvIGAj0IF6YwEF5IKDF4/VSAQtIO4QwJL6vVSBaoDGBC/UF5gJCGBQNEAA/VGoIAEBIIvEGQYaHGA4vML4IwEFgYAFF5PM54vSGAKXCL4gvOIIXVF5DvG6xWD5wwMYBAUCR5IvHGAZgCGBLwJFo4vEegIAHHgwwGFwwwD5wvMGBHNL4gwFFpBgEF5owI53VA4ovQ6wvNSRIAGFxYvD5ovKAAyKFAA4vLMBYvJagIuXMBfOL6fN5ovNGAfOeRD0PFwIPCGCPPF54wHOQYuOF4YwKEIJtFFxAvQGAiSLAAqMGFyIwFcQIwP6ouXGAoxOFoouVGI6VB6ozDRAPVXAgtZGBAANFzQxSFrozNFcYA/AH4AvA")) \ No newline at end of file diff --git a/apps/coin_info/app.js b/apps/coin_info/app.js new file mode 100644 index 000000000..128bddade --- /dev/null +++ b/apps/coin_info/app.js @@ -0,0 +1,219 @@ +// const logFile = require("Storage").open("coin_info_log.txt", "a"); +const db = require("Storage").readJSON("coin_info.cmc_key.json", 1) || {}; +const csTokens = db.csTokens.split(','); +// +const ciLib = require("coin_info"); +// +var ticker = 0; +var currLoadMsg = "..."; +var timePeriod = "24h"; +var tknChrtData = [5,6,5,6,5,6,5,6,5,6,5,6,5,6,]; +var optSpacing = {}; +var isPaused = false; + + +// +Bangle.loadWidgets(); // loading widgets after drawing the layout in `drawMain()` to display the app UI ASAP. +require("widget_utils").swipeOn(); // hide widgets, make them visible with a swipe +// Bangle.setUI({ +// mode: 'custom', +// back: Bangle.showClock +// // btn: function() { // Handle button press +// // console.log("Button pressed"); +// // } +// }); +// +function swipeHandler(lr, ud) { + if (lr == 1) { + ticker = ticker - 1; + if (ticker < 0) ticker = 0; + } + if (lr == -1) { + ticker = ticker + 1; + if (ticker > csTokens.length - 1) ticker = csTokens.length - 1; + } +} +Bangle.on("swipe", swipeHandler); + + +// +function renderGraph(l) { + const bounds = ciLib.findMinMax(tknChrtData); + // logFile.write("?. graphy: " + JSON.stringify(bounds) + "\n"); + require("graph").drawLine(g, tknChrtData, { + axes: true, + x: l.x, y: l.y, width: l.w, height: l.h, + miny: bounds.min, + maxy: bounds.max, + // gridy: 5 + }); +} + +var Layout = require("Layout"); +var layout = new Layout({ + type:"v", c: [ + {type:"h", valign:-1, + c: [ + {type:"txt", id:"tknName", font:"6x8:2", label:"", halign:-1, fillx:1}, + {type:"btn", label:"..", halign:1, cb: d=>showDetails()}, + {type:"btn", label:"LH", halign:1, cb: d=>showLowHigh()} + ] + }, + {type:"txt", id:"loadMsg", font:"6x8", label:"", fillx:1 }, + {type:"custom", render:renderGraph, id:"tknGraph", bgCol:g.theme.bg, fillx:1, filly:1 }, + {type:"h", valign:1, + c: [ + {type:"btn", label:"24h", cb: d=>getChart("24h")}, + {type:"btn", label:"1w", cb: d=>getChart("1w")}, + {type:"btn", label:"1m", cb: d=>getChart("1m")}, + {type:"btn", label:"3m", cb: d=>getChart("3m")} + ] + } + ] + }, + { lazy:true }); +layout.update(); + + +// +var updateTimeout; +function getChart(period) { + if (isPaused) { + if (updateTimeout) clearTimeout(updateTimeout); + return; + } + + // + timePeriod = period; + currLoadMsg = `Load... ${period}`; + // + // const date = new Date(); + // logFile.write("Called:" + date.toISOString() + " -- " + timePeriod + " -- " + csTokens[ticker] + "\n"); + + const url = `https://openapiv1.coinstats.app/coins/${csTokens[ticker]}/charts?period=${timePeriod}`; + Bangle + .http(url, { + method: 'GET', + headers: { + 'X-API-KEY': db.csApiKey + } + }) + .then(data => { + // logFile.write("HTTP resp:" + JSON.stringify(data)); + const apiData = JSON.parse(data.resp); + tknChrtData = apiData.map(innerArray => innerArray[1]); + // logFile.write("Chart data:" + JSON.stringify(tknChrtData)); + + // just not readable + optSpacing = ciLib.calculateOptimalYAxisSpacing(tknChrtData); + // + g.clearRect(layout.tknGraph.x, layout.tknGraph.y, layout.tknGraph.w, layout.tknGraph.h); + layout.forgetLazyState(); // Force a full re-render + layout.render(layout.tknGraph); // Render just the graph area + + // + currLoadMsg = ""; + layout.render(layout.loadMsg); + }) + .catch(err => { + // logFile.write("API Error: " + JSON.stringify(err)); + tknChrtData = [1,2,3,4,5,6,7,8,9,8,7,6,5,4,]; + }); + + if (updateTimeout) clearTimeout(updateTimeout); + updateTimeout = setTimeout(function() { + updateTimeout = undefined; + getChart(period); + }, 60000 - (Date.now() % 60000)); +} + +// +function showLowHigh() { + const title = `L/H ${csTokens[ticker]}`; + // + // logFile.write("OptSpacing:" + JSON.stringify(optSpacing) + "\n"); + const first = ciLib.formatPriceString(optSpacing.first); + const last = ciLib.formatPriceString(optSpacing.last); + const low = ciLib.formatPriceString(optSpacing.rawMin); + const high = ciLib.formatPriceString(optSpacing.rawMax); + const msg = ` + First: ${first} + Last: ${last} + Low: ${low} + High: ${high} + `; + isPaused = true; + E.showAlert(msg, title).then(function() { + isPaused = false; + g.clear(); + layout.forgetLazyState(); + layout.render(); + layout.setUI(); + }); +} +function showDetails() { + const token = csTokens[ticker]; + const url = `https://openapiv1.coinstats.app/coins/${token}`; + Bangle.http(url, { + method: 'GET', + headers: { + 'X-API-KEY': db.csApiKey + } + }) + .then(data => { + const tokenInfo = JSON.parse(data.resp); + const priceFmt = ciLib.formatPriceString(tokenInfo.price); + const mCapFmt = ciLib.formatPriceString(tokenInfo.marketCap); + const title = `Details ${tokenInfo.symbol}`; + const msg = ` + Price: ${priceFmt} + M-Cap: ${mCapFmt} + 1h:${tokenInfo.priceChange1h} + 1d:${tokenInfo.priceChange1d} 1w:${tokenInfo.priceChange1w} + `; + isPaused = true; + E.showAlert(msg, title).then(function() { + isPaused = false; + g.clear(); + layout.forgetLazyState(); + layout.render(); + layout.setUI(); + }); + }) + .catch(err => { + const msg = `Failed to fetch details for ${token.toUpperCase()}`; + E.showAlert(msg, "Error").then(function() { + // print("Ok pressed"); + g.clear(); + layout.forgetLazyState(); + layout.render(); + layout.setUI(); + }); + }); +} + + +// timeout used to update every minute +var drawTimeout; +// update the screen +function draw() { + // + layout.tknName.label = (csTokens[ticker]).toUpperCase(); + layout.loadMsg.label = currLoadMsg; + // + layout.render(layout.graph); + // + layout.render(); + + // schedule a draw for the next minute + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 1000 - (Date.now() % 1000)); +} + +// update time and draw +g.clear(); +draw(); +getChart("24h"); diff --git a/apps/coin_info/app.png b/apps/coin_info/app.png new file mode 100644 index 000000000..97fe8df7d Binary files /dev/null and b/apps/coin_info/app.png differ diff --git a/apps/coin_info/app_mono.png b/apps/coin_info/app_mono.png new file mode 100644 index 000000000..794f2b563 Binary files /dev/null and b/apps/coin_info/app_mono.png differ diff --git a/apps/coin_info/clkinfo.js b/apps/coin_info/clkinfo.js new file mode 100644 index 000000000..f16829522 --- /dev/null +++ b/apps/coin_info/clkinfo.js @@ -0,0 +1,89 @@ +(function() { + const LOAD_ICON_24 = atob("GBiBAAAAAAAeAAGfwAGB4AAAcBgAOBgYHAAYDAAYDGAYBmAYBgAYBgAYBmDbBmB+BgA8DAAYDBgAHBgAOAAAcAGB4AGfwAAeAAAAAA=="); + const DECR_ICON_24 = atob("GBiBAAAAAAAAAAAAAAAAAAAAABgAADwAAH4cAD8+AB//AA//gAf/wAPz7AHh/ADA/AAAfAAA/gAA/gAAHgAAAAAAAAAAAAAAAAAAAA=="); + const INCR_ICON_24 = atob("GBiBAAAAAAAAAAAAAAAAAAAAAAAAHgAA/gAA/gAAfADA/AHh/APz7Af/wA//gB//AD8+AH4cADwAABgAAAAAAAAAAAAAAAAAAAAAAA=="); + + const settings = require("Storage").readJSON("coin_info.settings.json", 1) || {}; + const db = require("Storage").readJSON("coin_info.cmc_key.json", 1) || {}; + // const logFile = require("Storage").open("coin_info_log.txt", "a"); + const ciLib = require("coin_info"); + + if (!(settings.tokenSelected instanceof Array)) settings.tokenSelected = []; + + let cache = {}; + return { + name: "CoinInfo", + items: settings.tokenSelected.map(token => { + return { + name: token, + get: function() { + // Return cached data if available + if (cache[token]) { + return cache[token]; + } + + // Return placeholder while waiting for data + return { + text: "Load", + img: LOAD_ICON_24 + }; + }, + show: function() { + var self = this; + + // Function to fetch data from API + const fetchData = (callback) => { + const url = `https://api.binance.com/api/v3/ticker/24hr?symbol=${token}${db.calcPair}`; + + Bangle.http(url, { method: 'GET' }) + .then(cmcResult => { + // logFile.write("HTTP resp:" + JSON.stringify(cmcResult)); + const apiData = JSON.parse(cmcResult.resp); + // logFile.write("data:" + JSON.stringify(apiData)); + let priceString = ciLib.formatPriceString(apiData.lastPrice); + + let changeIcon = INCR_ICON_24; + if (apiData.priceChange.startsWith("-")) + changeIcon = DECR_ICON_24; + // Update cache with fetched data + cache[token] = { + text: `${token}\n${priceString}`, + img: changeIcon + }; + + callback(); + }) + .catch(err => { + // logFile.write("API Error: " + JSON.stringify(err)); + cache[token] = { + text: "Error", + img: LOAD_ICON_24 + }; + callback(); + }); + }; + + // Set timeout to align to the next hour and then continue updating every hour + const updateTime = settings.getRateMin * 60 * 1000; + self.interval = setTimeout(function timerTimeout() { + fetchData(() => { + self.emit("redraw"); + }); + // Continue updating every hour + self.interval = setInterval(function intervalCallback() { + fetchData(() => { + self.emit("redraw"); + }); + }, updateTime); + }, 30000 - (Date.now() % 30000 )); + }, + hide: function() { + if (this.interval) { + clearInterval(this.interval); + this.interval = null; + } + } + }; + }) + }; +}) \ No newline at end of file diff --git a/apps/coin_info/icons/icons8-decrease-24.png b/apps/coin_info/icons/icons8-decrease-24.png new file mode 100644 index 000000000..323dfea2a Binary files /dev/null and b/apps/coin_info/icons/icons8-decrease-24.png differ diff --git a/apps/coin_info/icons/icons8-increase-24.png b/apps/coin_info/icons/icons8-increase-24.png new file mode 100644 index 000000000..dc1132f56 Binary files /dev/null and b/apps/coin_info/icons/icons8-increase-24.png differ diff --git a/apps/coin_info/icons/icons8-submit-progress-24.png b/apps/coin_info/icons/icons8-submit-progress-24.png new file mode 100644 index 000000000..71b950334 Binary files /dev/null and b/apps/coin_info/icons/icons8-submit-progress-24.png differ diff --git a/apps/coin_info/interface.html b/apps/coin_info/interface.html new file mode 100644 index 000000000..7d91dbea5 --- /dev/null +++ b/apps/coin_info/interface.html @@ -0,0 +1,80 @@ + + + + + +

Settings for Crypto-Coin Info

+

Input for coins to request and calculate against pair.

+

+
+ + +
+ + +
+ + +
+ + + +

+

General Info:

+

Requesting from Binance with free API. Get info from their website.

+ + + + + diff --git a/apps/coin_info/lib.js b/apps/coin_info/lib.js new file mode 100644 index 000000000..9f4bf9b62 --- /dev/null +++ b/apps/coin_info/lib.js @@ -0,0 +1,115 @@ +/** + * Formats a number string with common prefixes like K, M, B, T. + * For negative numbers, it returns "Negative". + * For numbers between 0 and 1, it rounds up to two decimal places. + * + * @param {string} input - The input string containing numerals. + * @returns {string} The formatted string. + */ +exports.formatPriceString = function(input) { + // Ensure input is a number + let number = typeof input === 'string' ? parseFloat(input) : input; + + // Check if input is not a number + if (isNaN(number)) { + return 'Invalid input'; + } + + // Handle negative numbers + if (number < 0) { + return 'Negative'; + } + + // Handle zero + if (number === 0) { + return 'Zero'; + } + + // Handle numbers between 0 and 1 + if (number < 1) { + return Math.ceil(number * 100) / 100; + } + + // Define suffixes + const suffixes = ['', 'K', 'M', 'B', 'T']; + + // Determine the suffix index + let suffixIndex = 0; + while (number >= 1000 && suffixIndex < suffixes.length - 1) { + number /= 1000; + suffixIndex++; + } + + // Format the number with three decimal places after the comma + const formattedNumber = number.toFixed(3) + suffixes[suffixIndex]; + + return formattedNumber; +} + +exports.findMinMax = function(values) { + var min = values[0]; + var max = values[0]; + + for (var i = 1; i < values.length; i++) { + if (values[i] < min) min = values[i]; + if (values[i] > max) max = values[i]; + } + + return { min: min, max: max }; +} + +exports.myLog10 = function(value) { + return Math.log(value) / Math.LN10; +} + +exports.calculateOptimalYAxisSpacing = function(data) { + // Check if data is empty + if (data.length === 0) { + return { min: 0, max: 1, interval: 1 }; + } + + // Find the minimum and maximum values in the data + const bounds = exports.findMinMax(data); + let minY = bounds.min; + let maxY = bounds.max; + + // Calculate the range of the data + let range = maxY - minY; + + // If all values are the same, set a small range to avoid division by zero + if (range === 0) { + range = 1; + } + + // Determine the number of ticks (e.g., 5 to 10 ticks) + let numTicks = 7; // You can adjust this value based on your preference + + // Calculate the interval + let interval = range / (numTicks - 1); + + // Round the interval to a nice number (e.g., 1, 2, 5, 10) + let roundedInterval = Math.pow(10, Math.floor(exports.myLog10(interval))); + if (interval / roundedInterval > 5) { + roundedInterval *= 5; + } else if (interval / roundedInterval > 2) { + roundedInterval *= 2; + } + + // Adjust min and max to ensure they are on the rounded interval + let adjustedMin = Math.floor(minY / roundedInterval) * roundedInterval; + let adjustedMax = Math.ceil(maxY / roundedInterval) * roundedInterval; + + let first = data[0]; + let last = data[data.length - 1]; + return { + min: adjustedMin, + max: adjustedMax, + interval: roundedInterval, + first: first, + last: last, + rawMin: minY, + rawMax: maxY + }; +} + + diff --git a/apps/coin_info/metadata.json b/apps/coin_info/metadata.json new file mode 100644 index 000000000..976be7707 --- /dev/null +++ b/apps/coin_info/metadata.json @@ -0,0 +1,23 @@ +{ "id": "coin_info", + "name": "Crypto-Coins Info", + "shortName":"Coins Info", + "version": "0.10", + "description": "Crypto-Coins Infos with the help of the Binance API", + "icon": "app.png", + "tags": "clkinfo", + "supports" : ["BANGLEJS2"], + "interface": "interface.html", + "readme": "README.md", + "data": [ + {"name":"coin_info.settings.json"}, + {"name":"coin_info.cmc_key.json"}, + {"name":"coin_info.coin_info_log.txt"} + ], + "storage": [ + {"name":"coin_info.app.js","url":"app.js"}, + {"name":"coin_info.clkinfo.js","url":"clkinfo.js"}, + {"name":"coin_info.settings.js","url":"settings.js"}, + {"name":"coin_info.img","url":"app-icon.js","evaluate":true}, + {"name":"coin_info","url":"lib.js"} + ] +} \ No newline at end of file diff --git a/apps/coin_info/screenshots/20250316_01.jpg b/apps/coin_info/screenshots/20250316_01.jpg new file mode 100644 index 000000000..80ed025a0 Binary files /dev/null and b/apps/coin_info/screenshots/20250316_01.jpg differ diff --git a/apps/coin_info/screenshots/20250316_02.jpg b/apps/coin_info/screenshots/20250316_02.jpg new file mode 100644 index 000000000..8b431c980 Binary files /dev/null and b/apps/coin_info/screenshots/20250316_02.jpg differ diff --git a/apps/coin_info/screenshots/20250322_01.jpg b/apps/coin_info/screenshots/20250322_01.jpg new file mode 100644 index 000000000..04cc22c94 Binary files /dev/null and b/apps/coin_info/screenshots/20250322_01.jpg differ diff --git a/apps/coin_info/screenshots/20250322_02.jpg b/apps/coin_info/screenshots/20250322_02.jpg new file mode 100644 index 000000000..38ba6052d Binary files /dev/null and b/apps/coin_info/screenshots/20250322_02.jpg differ diff --git a/apps/coin_info/screenshots/20250323_01.jpg b/apps/coin_info/screenshots/20250323_01.jpg new file mode 100644 index 000000000..462d4fac6 Binary files /dev/null and b/apps/coin_info/screenshots/20250323_01.jpg differ diff --git a/apps/coin_info/settings.js b/apps/coin_info/settings.js new file mode 100644 index 000000000..944f737c3 --- /dev/null +++ b/apps/coin_info/settings.js @@ -0,0 +1,53 @@ +(function(back) { + const SETTINGS_FILE = "coin_info.settings.json"; + const storage = require('Storage'); + + // Default settings with sorted tokens and load settings + let settings = Object.assign({ + // TODO: MZw - retrieve from upload-storage + tokens: ['BTC', 'ETH', 'STORJ'], + tokenSelected: ['BTC'], + getRateMin: 60 + }, storage.readJSON(SETTINGS_FILE, 1) || {}); + + function save() { + storage.write(SETTINGS_FILE, settings); + } + + function createMenu() { + const menu = { + '': { 'title': 'Crypto-Coin Info' }, + '< Back': () => Bangle.showClock() + }; + + // Dynamic checkbox creation + settings.tokens.sort().forEach(token => { + menu[token] = { + value: settings.tokenSelected.includes(token), + onchange: v => { + if (v) { + settings.tokenSelected.push(token); + } else { + settings.tokenSelected = settings.tokenSelected.filter(f => f !== token); + } + save(); + } + }; + }); + + // update time + menu['Refresh Rate (min)'] = { + value: settings.getRateMin, + min: 1, + max: 1440, + onchange: v => { + settings.getRateMin = v; + save(); + } + }; + + return menu; + } + + E.showMenu(createMenu()); +}) \ No newline at end of file diff --git a/apps/color_catalog/metadata.json b/apps/color_catalog/metadata.json index 4d49308ef..e445e3175 100644 --- a/apps/color_catalog/metadata.json +++ b/apps/color_catalog/metadata.json @@ -5,7 +5,7 @@ "version": "0.03", "description": "Displays RGB565 and RGB888 colors, its name and code in screen.", "icon": "app.png", - "tags": "Color,input,buttons,touch,UI", + "tags": "color,input,buttons,touch,ui", "supports": ["BANGLEJS"], "readme": "README.md", "storage": [ diff --git a/apps/compass/compass-icon.js b/apps/compass/compass-icon.js index 6a09df608..63a12aeee 100644 --- a/apps/compass/compass-icon.js +++ b/apps/compass/compass-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("mEwghC/AE8IxAAEwAWVDB4WIDBwWJAAIWOwcz///mc4DBhFDwYVBAAYYDJJAWJDAoXKCw//+YXJIwWPCQk/Aof4JBAuHC4v/GBBdHC4nzMIZGHCAIOBC4vz75hDJAgXCCgS9CC4fdAYQXGIwsyCAPyl//nvdVQoXFRofzkYXCCwJGBSIgXFQ4kymcykfdIwZgDC5XzkUyCwJGDC6FNCwPTC5i9FmQXCMgLZFC48zLgMilUv/vdkUjBII9BC6HSC55HD1WiklDNIgXIBok61QYBkSBFC5kqCwMjC6RGB1RcCR4gXIx4MC+Wqkfyl70BEQf4C4+DIwYqBC4XzGAc4C4sISAfz0QDCFgUzRwmAC4wQB+QTCC4f/AYJeCC4hIEPQi9FIwwXDbIzVHC4xICSIYXGRoRGFGAgqFXgouGC4iqDLo4XIJAQYHCwZGHGAgYBXQUzCwYuIDAwAHCxRJEAAxFJDBgWNDBAWPAH4AYA=")) +require("heatshrink").decompress(atob("mEwwZC/AB8G7dt2AQMtu2CIICBCBUbCItsCJIODAQeACA82BYO////+wUCCA0BDoN/CAIAB/YRB4ARFhu274QDAAPt23YNA4QF//9Nw9t24RG/4RGgZWDAApcBsCMFCA///ySFjdvCA+f/4RF7YRH8gCBUgqMFAAUkSQYRL5MnCJ36pM/CI0G7YiFyQRD/9t2ARI8gRBAwYRJ/1m6VNCJ1//VPCJvyCIJgECJVPCYIRNK4KNCCJf8CIKVFCIahECIIQFWZPkyamFCJNkdgwRGt4JBKwoAB7YREjYRB/IQGCINsCAQRBtoPHXIIRFgdt34RH+3bsARDgFt24RH23bCAgRB2wQG/oRHhu274RF9u27ARFgIaBWIiMB23ACIsAmyGBLgRWBCIIQGUgQLBAQieDAAqSBCIiMEAAwRFCBQABgwRB2AQMAH4AB")) \ No newline at end of file diff --git a/apps/confthyttan/ChangeLog b/apps/confthyttan/ChangeLog new file mode 100644 index 000000000..77d527619 --- /dev/null +++ b/apps/confthyttan/ChangeLog @@ -0,0 +1,6 @@ +0.01: New App! +0.02: update to my current preferences. +0.03: update app list +0.04: change app name "mysetup" -> "anotherconf" +0.05: remove apps that are not "core" to the experience. +0.06: change name "anotherconf" -> "confthyttan" diff --git a/apps/confthyttan/README.md b/apps/confthyttan/README.md new file mode 100644 index 000000000..e9b952c82 --- /dev/null +++ b/apps/confthyttan/README.md @@ -0,0 +1,31 @@ +# Thyttan's Default Config + +A different default set of apps and configurations. Brings many quality of life improvements. Opinionated based on the creators taste. Read more below before installing. + +## Usage + +Before installing do this: + +1. Backup your current setup (via the "More..." tab of the App Loader) so you can restore it later if you want. +2. Install this app (you'll be prompted about all data being removed from your Bangle) +3. Try it out, switch out apps to your favorites and tweak to your liking! + +## Features + +There will not be a trace of a "Thyttan's Default Config" app on your watch after installation. Only the apps it installed and the configurations. + +On the clock face: +- Swipe right on the screen to open the launcher (Desktop Launcher) - or press the hardware button. +- Swipe left to open a flashlight app. +- Swipe up to open the messages. +- Swipe down for quick access to music and podcast controls. + - (Do a subsequent left or right swipe to enter the listed apps) +- (Check out the "Quick Launch" app readme for more info) + +## Requests + +Add to the espruino/BangleApps issue tracker and mention @thyttan for bug reports and suggestions. + +## Creator + +thyttan diff --git a/apps/confthyttan/app.png b/apps/confthyttan/app.png new file mode 100644 index 000000000..24ff01b8a Binary files /dev/null and b/apps/confthyttan/app.png differ diff --git a/apps/confthyttan/autoreset.json b/apps/confthyttan/autoreset.json new file mode 100644 index 000000000..18e94a282 --- /dev/null +++ b/apps/confthyttan/autoreset.json @@ -0,0 +1 @@ +{"mode":0,"apps":[{"name":"Run+","src":"runplus.app.js","files":"runplus.info,runplus.app.js,runplus.img,runplus.settings.js,runplus_karvonen"}],"timeout":10} \ No newline at end of file diff --git a/apps/confthyttan/backswipe.json b/apps/confthyttan/backswipe.json new file mode 100644 index 000000000..aa66bd534 --- /dev/null +++ b/apps/confthyttan/backswipe.json @@ -0,0 +1 @@ +{"mode":0,"apps":[{"name":"Calculator","src":"calculator.app.js"},{"name":"SleepLog","src":"sleeplog.app.js"},{"name":"Messages","sortorder":-9,"src":"messagegui.app.js"},{"name":"Messages","sortorder":-9,"src":"messagegui.app.js","files":"messagegui.info,messagegui,messagegui.app.js,messagegui.new.js,messagegui.boot.js,messagegui.img"}],"standardNumSwipeHandlers":5,"standardNumDragHandlers":1} diff --git a/apps/confthyttan/dtlaunch.json b/apps/confthyttan/dtlaunch.json new file mode 100644 index 000000000..5417cca3b --- /dev/null +++ b/apps/confthyttan/dtlaunch.json @@ -0,0 +1 @@ +{"showClocks":true,"showLaunchers":true,"direct":false,"swipeExit":false,"timeOut":"15s"} \ No newline at end of file diff --git a/apps/confthyttan/edgeclk.settings.json b/apps/confthyttan/edgeclk.settings.json new file mode 100644 index 000000000..bdf875621 --- /dev/null +++ b/apps/confthyttan/edgeclk.settings.json @@ -0,0 +1 @@ +{"buzzOnCharge":true,"monthFirst":true,"twentyFourH":true,"showAmPm":false,"showSeconds":true,"showWeather":false,"stepGoal":10000,"stepBar":true,"weekBar":true,"mondayFirst":true,"dayBar":true,"redrawOnStep":false} diff --git a/apps/confthyttan/fastload.json b/apps/confthyttan/fastload.json new file mode 100644 index 000000000..beef5d0cc --- /dev/null +++ b/apps/confthyttan/fastload.json @@ -0,0 +1 @@ +{useAppHistory:true,disregardQuicklaunch:true,hideLoading:true} \ No newline at end of file diff --git a/apps/confthyttan/lightswitch.json b/apps/confthyttan/lightswitch.json new file mode 100644 index 000000000..818aa6b07 --- /dev/null +++ b/apps/confthyttan/lightswitch.json @@ -0,0 +1 @@ +{"colors":"011","image":"heart","touchOn":"always","oversize":7,"dragDelay":500,"minValue":0.01,"tapToLock":false,"unlockSide":"","tapSide":"","tapOn":"always","tOut":2000,"minFlash":0.2,"isOn":true,"value":0.9109} \ No newline at end of file diff --git a/apps/confthyttan/messages.settings.json b/apps/confthyttan/messages.settings.json new file mode 100644 index 000000000..88efa6082 --- /dev/null +++ b/apps/confthyttan/messages.settings.json @@ -0,0 +1 @@ +{vibrateTimeout:10,vibrate:":",vibrateCalls:":::",flash:false} \ No newline at end of file diff --git a/apps/confthyttan/metadata.json b/apps/confthyttan/metadata.json new file mode 100644 index 000000000..e662879a7 --- /dev/null +++ b/apps/confthyttan/metadata.json @@ -0,0 +1,68 @@ +{ "id": "confthyttan", + "name": "Thyttan's Default Config", + "version":"0.06", + "description": "A different default set of apps and configurations. Brings many quality of life improvements. Opinionated based on the creators taste. Read more below before installing.", + "icon": "app.png", + "type": "defaultconfig", + "tags": "system,configuration,config,anotherconfig,thyttan,defaultconfig", + "supports" : ["BANGLEJS2"], + "readme": "README.md", + "dependencies" : { + "sched":"app", + "kbmulti":"app", + "messageicons":"app", + "widmsggrid":"app", + "msgwakefup":"app", + "delaylock":"app", + "notify":"app", + "health":"app", + "widminbate":"app", + "podadrem":"app", + "spotrem":"app", + "android":"app", + "widanclk":"app", + "backswipe":"app", + "torch":"app", + "calculator":"app", + "widbt_notify":"app", + "smpltmr":"app", + "clkinfostopw":"app", + "runplus":"app", + "dtlaunch":"app", + "quicklaunch":"app", + "kineticscroll":"app", + "alarm":"app", + "recorder":"app", + "agenda":"app", + "edgeclk":"app", + "autoreset":"app", + "chargent":"app", + "setting":"app", + "fastload":"app", + "boot":"app", + "ateatimer":"app", + "drained":"app" + }, + "storage": [ + {"name":"backswipe.json", + "url":"backswipe.json"}, + {"name":"autoreset.json", + "url":"autoreset.json"}, + {"name":"dtlaunch.json", + "url":"dtlaunch.json"}, + {"name":"fastload.json", + "url":"fastload.json"}, + {"name":"quicklaunch.json", + "url":"quicklaunch.json"}, + {"name":"messages.settings.json", + "url":"messages.settings.json"}, + {"name":"widbt_notify.json", + "url":"widbt_notify.json"}, + {"name":"recorder.json", + "url":"recorder.json"}, + {"name":"edgeclk.settings.json", + "url":"edgeclk.settings.json"}, + {"name":"setting.json", + "url":"setting.json"} + ] +} diff --git a/apps/confthyttan/quicklaunch.json b/apps/confthyttan/quicklaunch.json new file mode 100644 index 000000000..4edbb083b --- /dev/null +++ b/apps/confthyttan/quicklaunch.json @@ -0,0 +1 @@ +{lapp:{name:"Show Launcher",sortorder:-12,src:"no source"},rapp:{name:"torch",type:"app",sortorder:-11,src:"torch.app.js"},uapp:{name:"Messages",sortorder:-9,src:"messagegui.app.js"},dapp:{name:"Extension",type:"app",sortorder:-11,src:"quicklaunch.app.js"},tapp:{name:""},dlapp:{name:"PA Remote",src:"podadrem.app.js"},drapp:{name:"Remote for Spotify",src:"spotrem.app.js"},duapp:{name:""},ddapp:{name:"Extension",type:"app",sortorder:-11,src:"quicklaunch.app.js"},dtapp:{name:""},ddlapp:{name:"Alarms",src:"alarm.app.js"},ddrapp:{name:"Run+",src:"runplus.app.js"},dduapp:{name:""},dddapp:{name:"Agenda",src:"agenda.app.js"},ddtapp:{name:""},rlapp:{name:""},rrapp:{name:""},ruapp:{name:""},rdapp:{name:""},rtapp:{name:""},trace:"dr"} diff --git a/apps/confthyttan/recorder.json b/apps/confthyttan/recorder.json new file mode 100644 index 000000000..f598b41d2 --- /dev/null +++ b/apps/confthyttan/recorder.json @@ -0,0 +1 @@ +{recording:false,period:10,record:["gps","hrm","steps"],file:"recorder.log0.csv"} \ No newline at end of file diff --git a/apps/confthyttan/setting.json b/apps/confthyttan/setting.json new file mode 100644 index 000000000..ece0c87ed --- /dev/null +++ b/apps/confthyttan/setting.json @@ -0,0 +1 @@ +{ble:true,blerepl:true,log:false,quiet:0,timeout:10,vibrate:true,beep:true,timezone:2,HID:false,clock:"edgeclk.app.js","12hour":false,firstDayOfWeek:1,brightness:0.5,options:{wakeOnBTN1:true,wakeOnBTN2:true,wakeOnBTN3:true,wakeOnFaceUp:false,wakeOnTouch:false,wakeOnTwist:false,twistThreshold:819.2,twistMaxY:-800,twistTimeout:1000,btnLoadTimeout:700},theme:{fg:65535,bg:0,fg2:65535,bg2:8,fgH:65535,bgH:31,dark:true},clockHasWidgets:true,launcher:"dtlaunch.app.js",touch:{x1:6,y1:14,x2:197,y2:178}} diff --git a/apps/confthyttan/widbt_notify.json b/apps/confthyttan/widbt_notify.json new file mode 100644 index 000000000..fbcd97f76 --- /dev/null +++ b/apps/confthyttan/widbt_notify.json @@ -0,0 +1 @@ +{showWidget:true,buzzOnConnect:false,buzzOnLoss:false,hideConnected:false,showMessage:false,nextBuzz:30000} \ No newline at end of file diff --git a/apps/contacts/ChangeLog b/apps/contacts/ChangeLog index a0be5eaf6..5d6abbb74 100644 --- a/apps/contacts/ChangeLog +++ b/apps/contacts/ChangeLog @@ -2,3 +2,4 @@ 0.02: Minor code improvements 0.03: Minor code improvements 0.04: Allow calling contacts from the app, Refactoring +0.05: Nicer UI, Refactoring, new icon \ No newline at end of file diff --git a/apps/contacts/README.md b/apps/contacts/README.md index 1bfc99c8e..7ab15eb43 100644 --- a/apps/contacts/README.md +++ b/apps/contacts/README.md @@ -1,6 +1,7 @@ # Contacts -This app provides a common way to set up the `contacts.json` file. +View, edit and call contacts on your bangle.js. Calling is done via the bluetooth connection to your android phone. +Requires allowing "intents" in GadgetBridge device settings. ## Contacts JSON file @@ -11,12 +12,14 @@ has the following contents: ``` [ { - "name":"NONE" + "name":"First Last", + "number":"123456789", }, { - "name":"First Last", - "number":"123456789", - } + "name": "James Bond", + "number":"555-007", + }, + ... ] ``` @@ -26,4 +29,12 @@ Clicking on the download icon of `Contents` in the app loader invokes the contact editor. The editor downloads and displays the current `contacts.json` file. Clicking the `Edit` button beside an entry causes the entry to be deleted from the list and displayed in the edit -boxes. It can be restored - by clicking the `Add` button. \ No newline at end of file +boxes. It can be restored - by clicking the `Add` button. + +# Icons + +Phone icon by Icons8 + +Delete Button icon by Icons8 + +Call List icon by Icons8 diff --git a/apps/contacts/app-icon.js b/apps/contacts/app-icon.js index 3012be8d8..0333b855a 100644 --- a/apps/contacts/app-icon.js +++ b/apps/contacts/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("mEwwcBkmSpIC/AVsJCJ+AQaCZBCOeACKGQLKGQBA0ggARPJ4IRsYo0ggR9IoAIGiRiIpEECJsAiACBBYoRGpEAI4JBFI47CBLIRlDHYJrGYQIRCwQICL4MQOgx9GboUSeQ4RFwAFBiSGHCIo4CiVIWZyPICP4RaRIQROgARHdIwICoIIFkDpGBAKqHgGACI0AyVIggIDoEEMQ1ICINJCIj4CfwIREBwUgQYYOCfYoFDJQKDFCIopEO4RoDKAqJHRhAC/ATA=")) +require("heatshrink").decompress(atob("mEwwZC/ABcN23btoCG7ARFBw4CDCP4RegYRQjY1RgE2LMlsHY4RIsBfHLJBxICKxrDCJxHQCK59LBYYRBa59sgzXPCJwLDwACCgENCJewjbaBgEBCJkDLgIRIO4vABIQRN7ARKNYaSELJo4EPpgCHCAjjGYpwRNLIzFPCP4RnZwQRHd4YA/AA4A=")) \ No newline at end of file diff --git a/apps/contacts/app.png b/apps/contacts/app.png index 147dcc61a..a1594e7a9 100644 Binary files a/apps/contacts/app.png and b/apps/contacts/app.png differ diff --git a/apps/contacts/contacts.app.js b/apps/contacts/contacts.app.js index 34e40927a..bf2f8a455 100644 --- a/apps/contacts/contacts.app.js +++ b/apps/contacts/contacts.app.js @@ -1,14 +1,14 @@ -/* contacts.js */ - var Layout = require("Layout"); -var wp = require('Storage').readJSON("contacts.json", true) || []; +var contacts = require('Storage').readJSON("contacts.json", true) || []; function writeContacts() { - require('Storage').writeJSON("contacts.json", wp); + require('Storage').writeJSON("contacts.json", contacts); } function callNumber (number) { + E.showMessage('Calling ' + number + '...'); + setTimeout(() => mainMenu(), 2000); Bluetooth.println(JSON.stringify({ t:"intent", target:"activity", @@ -17,35 +17,49 @@ function callNumber (number) { categories:["android.intent.category.DEFAULT"], data: 'tel:' + number, })) - } function mainMenu() { var menu = { + "": { + "title": "Contacts", + }, "< Back" : Bangle.load }; - if (!wp.length) { + if (!contacts.length) { menu['No Contacts'] = () => {}; - } else { - for (const e of wp) { - const closureE = e; - menu[e.name] = () => showContact(closureE); - } } - menu["Add"] = addContact; - menu["Remove"] = removeContact; + contacts.forEach((e, idx) => { + menu[e.name] = () => showContact(idx) + }) + menu["Add Contact"] = addContact; g.clear(); E.showMenu(menu); } -function showContact(i) { +function showContact(idx) { g.clear(); + var name = contacts[idx].name; + let longName = g.setFont("6x8:2").stringWidth(name) >= g.getWidth(); + var number = contacts[idx].number; + let longNumber = g.setFont("6x8:2").stringWidth(number) >= g.getWidth(); (new Layout ({ type:"v", c: [ - {type:"txt", font:"10%", pad:1, fillx:1, filly:1, label: i["name"] + "\n" + i["number"]}, - {type:"btn", font:"10%", pad:1, fillx:1, filly:1, label: "Call", cb: l => callNumber(i['number'])}, - {type:"btn", font:"10%", pad:1, fillx:1, filly:1, label: "Back to list", cb: mainMenu} + {type: 'h', filly: 3, fillx:1, c: [ + {type:"btn", font:"6x8", pad:1, fillx:1, filly:1, label: "<- Back to list", cb: mainMenu}, + {type:"btn", pad:1, fillx:1, filly:3, src: require("heatshrink").decompress(atob("jUawYGDgVJkgQGBAOSBAsJkALBBIoaCDogaCAQYXBgIIFkmAC4IIFyVAgAIGGQUJHwo4FAo2QBwICDNAVAkgCEEAYUFEAQUFE34mRPwgmEcYgmDUg8AgjLGgAA==")), + cb: () => ( + E.showPrompt("Delete Contact '" + name + "'?", ) + .then((res) => { if (res) { deleteContact(idx) } else { mainMenu() } }) + ) + }, + ]}, + {type:"txt", font:longName ? "6x8" : "6x8:2", pad:1, fillx:2, filly:3, label: longName ? name.slice(0, name.length/2) + '\n' + name.slice(name.length/2) : name}, + {type:"txt", font: "6x8:2", pad:1, fillx:2, filly:3, label: longNumber ? number.slice(0, number.length/2) + '\n' + number.slice(number.length/2) : number}, + {type: 'h', filly: 3, fillx:1, c: [ + {type:"btn", pad:1, fillx:1, filly:3, src:atob("GBiBAAAAAAAAAAAAAB8AAB+AAB+AAB+AAB+AAA+AAA8AAA4AAAYAAAcAAAMAAAGAAAHB8ADz+AA/+AAf+AAH+AAA+AAAAAAAAAAAAA=="), cb: l => callNumber(number)}, + ]}, ], lazy:true })).render(); @@ -80,10 +94,10 @@ function showNumpad() { {type:"h",filly:1, c: [digitBtn("4"), digitBtn("5"), digitBtn("6")]}, {type:"h",filly:1, c: [digitBtn("7"), digitBtn("8"), digitBtn("9")]}, {type:"h",filly:1, c: [ - {type:"btn", font:ds, width:58, label:"C", cb: removeDigit}, - digitBtn('0'), - {type:"btn", font:ds, width:58, id:"OK", label:"OK", cb: l => resolve(number)} - ]} + {type:"btn", font:ds, width:58, label:"C", cb: removeDigit}, + digitBtn('0'), + {type:"btn", font:ds, width:58, id:"OK", label:"OK", cb: l => resolve(number)} + ]} ]} ], lazy:true}); g.clear(); @@ -92,77 +106,28 @@ function showNumpad() { }); } -function removeContact() { - var menu = { - "" : {title : "Select Contact"}, - "< Back" : mainMenu - }; - if (wp.length===0) Object.assign(menu, {"No Contacts":""}); - else { - wp.forEach((val, card) => { - const name = wp[card].name; - menu[name]=()=>{ - E.showMenu(); - var confirmRemove = new Layout ( - {type:"v", c: [ - {type:"txt", font:"15%", pad:1, fillx:1, filly:1, label:"Delete"}, - {type:"txt", font:"15%", pad:1, fillx:1, filly:1, label:name}, - {type:"h", c: [ - {type:"btn", font:"15%", pad:1, fillx:1, filly:1, label: "YES", cb:l=>{ - wp.splice(card, 1); - writeContacts(); - mainMenu(); - }}, - {type:"btn", font:"15%", pad:1, fillx:1, filly:1, label: " NO", cb:l=>{mainMenu();}} - ]} - ], lazy:true}); - g.clear(); - confirmRemove.render(); - }; - }); - } - E.showMenu(menu); -} - - -function addNewContact(name) { - g.clear(); - showNumpad().then((number) => { - wp.push({name: name, number: number}); - writeContacts(); - mainMenu(); - }) - - - -} - -function tryAddContact(name) { - if (wp.filter((e) => e.name === name).length) { - E.showMenu(); - var alreadyExists = new Layout ( - {type:"v", c: [ - {type:"txt", font:Math.min(15,100/name.length)+"%", pad:1, fillx:1, filly:1, label:name}, - {type:"txt", font:"12%", pad:1, fillx:1, filly:1, label:"already exists."}, - {type:"h", c: [ - {type:"btn", font:"10%", pad:1, fillx:1, filly:1, label: "REPLACE", cb:l=>{ addNewContact(name); }}, - {type:"btn", font:"10%", pad:1, fillx:1, filly:1, label: "CANCEL", cb:l=>{mainMenu();}} - ]} - ], lazy:true}); - g.clear(); - alreadyExists.render(); - return; - } - addNewContact(name); +function deleteContact(idx) { + contacts.splice(idx, 1); + writeContacts(); + mainMenu(); } function addContact() { - require("textinput").input({text:""}).then(name => { - if (name !== "") { - tryAddContact(name); - } else - mainMenu(); - }); + require("textinput").input({text:""}) + .then(name => { + name = name.trim(); + if (name !== "") { + g.clear(); + showNumpad().then((number) => { + contacts.push({name: name, number: number}); + writeContacts(); + mainMenu(); + }) + } else { + E.showMessage("Invalid name"); + setTimeout(() => mainMenu(), 1000); + } + }); } g.reset(); diff --git a/apps/contacts/interface.html b/apps/contacts/interface.html index 4a533bff7..00dcd6655 100644 --- a/apps/contacts/interface.html +++ b/apps/contacts/interface.html @@ -33,7 +33,7 @@ -

Contacts v.2

+

Contacts

diff --git a/apps/contacts/metadata.json b/apps/contacts/metadata.json index 50354f74f..384c2aa7d 100644 --- a/apps/contacts/metadata.json +++ b/apps/contacts/metadata.json @@ -1,7 +1,7 @@ { "id": "contacts", "name": "Contacts", - "version": "0.04", - "description": "Provides means of storing user contacts, viewing/editing them on device and from the App loader", + "version": "0.05", + "description": "View, edit and call contacts on device and from the App loader", "icon": "app.png", "tags": "tool", "supports" : ["BANGLEJS2"], diff --git a/apps/contourclock/ChangeLog b/apps/contourclock/ChangeLog index 6078b4ff3..488e07b29 100644 --- a/apps/contourclock/ChangeLog +++ b/apps/contourclock/ChangeLog @@ -12,3 +12,4 @@ 0.30: Added options to show widgets and date on twist and tap. New fonts. 0.31: Bugfix, no more freeze. 0.32: Minor code improvements +0.33: Messages would sometimes halt the clock. This should be fixed now. diff --git a/apps/contourclock/app.js b/apps/contourclock/app.js index 55d29a3dd..95587369e 100644 --- a/apps/contourclock/app.js +++ b/apps/contourclock/app.js @@ -1,9 +1,6 @@ { let drawTimeout; - let extrasTimeout; - let onLock; - //let onTap; - //let onTwist; + let extrasTimer=0; let settings = require('Storage').readJSON("contourclock.json", true) || {}; if (settings.fontIndex == undefined) { settings.fontIndex = 0; @@ -16,9 +13,9 @@ require('Storage').writeJSON("contourclock.json", settings); } require("FontTeletext10x18Ascii").add(Graphics); - let extrasShown = (!settings.hidewhenlocked) && (!Bangle.isLocked()); let installedFonts = require('Storage').readJSON("contourclock-install.json") || {}; - if (installedFonts.n > 0) { //New install - check for unused font files + // New install - check for unused font files. This should probably be handled by the installer instead + if (installedFonts.n > 0) { settings.fontIndex = E.clip(settings.fontIndex, -installedFonts.n + 1, installedFonts.n - 1); require('Storage').writeJSON("contourclock.json", settings); for (let n = installedFonts.n;; n++) { @@ -27,14 +24,22 @@ } require("Storage").erase("contourclock-install.json"); } - let showExtras = function() { //show extras for a limited time + let onLock = function(locked) {if (!locked) showExtras();}; + let showExtras = function() { //show extras for 5s drawExtras(); - if (extrasTimeout) clearTimeout(extrasTimeout); - extrasTimeout = setTimeout(() => { - extrasTimeout = undefined; - hideExtras(); - }, 5000); - extrasShown = false; + extrasTimer = 5000-60000-(Date.now()%60000); + if (extrasTimer<0) { //schedule next redraw early to hide extras + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 5000); + } + }; + let hideExtras = function() { + g.reset(); + g.clearRect(0, 138, g.getWidth() - 1, 176); + if (settings.widgets) require("widget_utils").hide(); }; let drawExtras = function() { //draw date, day of the week and widgets let date = new Date(); @@ -43,38 +48,27 @@ g.setFont("Teletext10x18Ascii").setFontAlign(0, 1); if (settings.weekday) g.drawString(require("locale").dow(date).toUpperCase(), g.getWidth() / 2, g.getHeight() - 18); if (settings.date) g.drawString(require('locale').date(date, 1), g.getWidth() / 2, g.getHeight()); - require("widget_utils").show(); - extrasShown = true; - }; - let hideExtras = function() { - if (extrasTimeout) clearTimeout(extrasTimeout); - extrasTimeout = undefined; //NEW - g.reset(); - g.clearRect(0, 138, g.getWidth() - 1, 176); - require("widget_utils").hide(); - extrasShown = false; ///NEW + if (settings.widgets) require("widget_utils").show(); }; let draw = function() { - if (drawTimeout) clearTimeout(drawTimeout); //NEW - drawTimeout = setTimeout(function() { - drawTimeout = undefined; - draw(); - }, 60000 - (Date.now() % 60000)); + if (extrasTimer>0) { //schedule next draw early to remove extras + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, extrasTimer); + extrasTimer=0; + } else { + if (settings.hideWhenLocked) hideExtras(); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); + } g.reset(); - if (extrasShown) drawExtras(); - else hideExtras(); + if (!settings.hideWhenLocked) drawExtras(); require('contourclock').drawClock(settings.fontIndex); }; if (settings.hideWhenLocked) { - onLock = locked => { - if (!locked) { - require("widget_utils").show(); - drawExtras(); - } else { - require("widget_utils").hide(); - hideExtras(); - } - }; Bangle.on('lock', onLock); if (settings.tapToShow) Bangle.on('tap', showExtras); if (settings.twistToShow) Bangle.on('twist', showExtras); @@ -82,14 +76,16 @@ Bangle.setUI({ mode: "clock", remove: function() { - Bangle.removeListener('lock', onLock); - Bangle.removeListener('tap', showExtras); - Bangle.removeListener('twist', showExtras); - if (drawTimeout) clearTimeout(drawTimeout); - if (extrasTimeout) clearTimeout(extrasTimeout); - drawTimeout = undefined; - extrasTimeout = undefined; - if (settings.hideWhenLocked) require("widget_utils").show(); + if (settings.hideWhenLocked) { + Bangle.removeListener('lock', onLock); + if (settings.tapToShow) Bangle.removeListener('tap', showExtras); + if (settings.twistToShow) Bangle.removeListener('twist', showExtras); + } + if (drawTimeout) { + clearTimeout(drawTimeout); + drawTimeout = undefined; + } + if (settings.hideWhenLocked && settings.widgets) require("widget_utils").show(); g.reset(); g.clear(); } @@ -97,7 +93,8 @@ g.clear(); if (settings.widgets) { Bangle.loadWidgets(); - setTimeout(Bangle.drawWidgets,0); //NEW + Bangle.drawWidgets(); } draw(); + if (!settings.hideWhenLocked || !Bangle.isLocked()) showExtras(); } diff --git a/apps/contourclock/metadata.json b/apps/contourclock/metadata.json index 61c0f5643..f29dc7f6b 100644 --- a/apps/contourclock/metadata.json +++ b/apps/contourclock/metadata.json @@ -1,7 +1,7 @@ { "id": "contourclock", "name": "Contour Clock", "shortName" : "Contour Clock", - "version": "0.32", + "version": "0.33", "icon": "app.png", "readme": "README.md", "description": "A Minimalist clockface with large Digits.", diff --git a/apps/coretemp/ChangeLog b/apps/coretemp/ChangeLog index 30c775a49..141a2bfe5 100644 --- a/apps/coretemp/ChangeLog +++ b/apps/coretemp/ChangeLog @@ -3,3 +3,4 @@ 0.03: Move code for recording to this app 0.04: Use default Bangle formatter for booleans 0.05: Minor code improvements +0.06: Added advanced settings, adapted code to mirror bthrm funcitonality, and will work with latest firmware CORE Sensor Firmware (V0.87) diff --git a/apps/coretemp/README.md b/apps/coretemp/README.md index 87be44bb6..0ee967b31 100644 --- a/apps/coretemp/README.md +++ b/apps/coretemp/README.md @@ -1,19 +1,43 @@ # CoreTemp display -Basic example of connecting to a bluetooth [CoreTemp](https://corebodytemp.com/) device and displaying the current skin and body core temperature readings. +Application to connect to the [CORE](https://corebodytemp.com/) or [calera](https://info.greenteg.com/calera-research) devices from greenteg and display the current skin and body core temperature readings. + +This also includes a module (heavily influenced by the BTHRM app) so you can integrate the core sensor into your own apps/widgets. You can also pair an ANT+ heart rate strap to the CORE/calera sensor as well in the App Settings so that you can leverage the exertional algorthim for estimating core temperature. ## Usage -Background task connects to any CoreTemp device (2100/2101) and emits a CoreTemp signal value for each reading. -Application contains three components, one is a background task that monitors the sensor and emits a 'CoreTemp' signal on activity if activated in settings. -The widget shows when the sensor is enabled with a mini value and blinks on use. -The app listens for 'CoreTemp' signals and shows the current skin and core temperatures in large numbers. +Background task connects to a paired and emits a CORESensor signal value for each reading. +Application contains three components, one is a background task that monitors the sensor and emits a 'CORESensor' signal on activity if activated in settings. +The widget shows when the sensor is enabled and connected (green) or disconnected (grey). +The app listens for 'CORESensor' signals and shows the current data. + +## CORESensor Module + +With the module, you can add the CORE Sensor to your own app. Simply power on the module and listen to CORESensor: + +``` +Bangle.setCORESensorPower(1,appName); +Bangle.on('CORESensor', (x) =>{ ... }); +``` + +The CORESensor emits an object with following keys: + +* **core**: Estimated/Predicted core temperature +* **skin**: Measured skin temperature +* **unit**: "F" or "C" +* **hr**: Heart Rate (only when ANT+ heart rate monitor is paired) +* **heatflux**: (calera device only - needs encryption level b released by greenteg) +* **hsi**: Heat Strain Index ([read more here](https://help.corebodytemp.com/en/articles/10447107-heat-strain-index), exertional algorithm only) +* **battery**: battery level +* **quality**: Used to indicate the quality or trust level of the current measurement values ## TODO * Integrate with other tracking/sports apps to log data. -* Add specific device selection +* Emit Bangle.js heart rate to device as a heart rate for internal algorthim -## Creator +## Creators/Contributors Ivor Hewitt + +[Nicholas Ravanelli](https://github.com/nravanelli) diff --git a/apps/coretemp/app-settings.json b/apps/coretemp/app-settings.json index 05e922f9d..121c18b1a 100644 --- a/apps/coretemp/app-settings.json +++ b/apps/coretemp/app-settings.json @@ -1,3 +1,4 @@ { - "enabled":false + "enabled":false, + "debuglog": false } diff --git a/apps/coretemp/boot.js b/apps/coretemp/boot.js index 27d437cb1..647a0c4bc 100644 --- a/apps/coretemp/boot.js +++ b/apps/coretemp/boot.js @@ -1,114 +1 @@ -// -// If enabled in settings run constantly in background -// -(function() { -var log = function() {};//print -var settings = {}; -var device; -var gatt; -var service; -var characteristic; - -class CoreSensor { - constructor() { - this.unit = ""; - this.core = -1; - this.skin = -1; - this.battery = 0; - } - - updateSensor(event) { - if (event.target.uuid == "00002101-5b1e-4347-b07c-97b514dae121") { - var dv = event.target.value; - var flags = dv.buffer[0]; - - if (flags & 8) { - this.unit = "F"; - } else { - this.unit = "C"; - } - - if (flags & 1) { - this.skin = (dv.buffer[4] * 256 + dv.buffer[3]) / 100; - } else { - this.skin = 0; - } - if (flags & 2) { - this.core = (dv.buffer[2] * 256 + dv.buffer[1]) / 100; - } else { - this.core = 0; - } - - Bangle.emit('CoreTemp', - {core : this.core, skin : this.skin, unit : this.unit}); - } - } - - updateBatteryLevel(event) { - if (event.target.uuid == "0x2a19") - this.battery = event.target.value.getUint8(0); - } -} - -var mySensor = new CoreSensor(); - -function getSensorBatteryLevel(gatt) { - gatt.getPrimaryService("180f") - .then(function(s) { return s.getCharacteristic("2a19"); }) - .then(function(c) { - c.on('characteristicvaluechanged', - (event) => mySensor.updateBatteryLevel(event)); - return c.startNotifications(); - }); -} - -function connection_setup() { - log("Scanning for CoreTemp sensor..."); - NRF.requestDevice({active:true,timeout : 20000, filters : [ {namePrefix : 'CORE'} ]}) - .then(function(d) { - device = d; - log("Found device"); - return device.gatt.connect(); - }) - .then(function(g) { - gatt = g; - return gatt.getPrimaryService('00002100-5b1e-4347-b07c-97b514dae121'); - }) - .then(function(s) { - service = s; - return service.getCharacteristic( - '00002101-5b1e-4347-b07c-97b514dae121'); - }) - .then(function(c) { - characteristic = c; - characteristic.on('characteristicvaluechanged', - (event) => mySensor.updateSensor(event)); - return characteristic.startNotifications(); - }) - .then(function() { - log("Done!"); - // getSensorBatteryLevel(gatt); - }) - .catch(function(e) { - log(e.toString(), "ERROR"); - log(e); - }); -} - -function connection_end() { - if (gatt != undefined) - gatt.disconnect(); -} - -settings = require("Storage").readJSON("coretemp.json", 1) || {}; -log("Settings:"); -log(settings); - -if (settings.enabled) { - connection_setup(); - NRF.on('disconnect', connection_setup); -} - -E.on('kill', () => { connection_end(); }); - -})(); +if ((require('Storage').readJSON("coretemp.json", true) || {}).enabled != false) require("CORESensor").enable(); \ No newline at end of file diff --git a/apps/coretemp/coretemp.js b/apps/coretemp/coretemp.js index 0337891e1..26806cac3 100644 --- a/apps/coretemp/coretemp.js +++ b/apps/coretemp/coretemp.js @@ -1,5 +1,5 @@ +var settings = require("Storage").readJSON("coretemp.json", 1) || {}; // Simply listen for core events and show data - //var btm = g.getHeight() - 1; var px = g.getWidth() / 2; @@ -21,25 +21,14 @@ var corelogo = { function onCore(c) { // Large or small font var sz = ((process.env.HWVERSION == 1) ? 3 : 2); - g.setFontAlign(0, 0); g.clearRect(0, 32 + 48, g.getWidth(), 32 + 48 + 24 * 4); g.setColor(g.theme.dark ? "#CCC" : "#333"); // gray - g.setFont("6x8", sz).drawString( - "Core: " + ((c.core < 327) ? (c.core + c.unit) : 'n/a'), px, 48 + 48); - g.setFont("6x8", sz).drawString("Skin: " + c.skin + c.unit, px, 48 + 48 + 24); -} - -// Background task will activate once settings are enabled. -function enableSensor() { - settings = require("Storage").readJSON("coretemp.json", 1) || {}; - - if (!settings.enabled) { - settings.enabled = true; - require("Storage").write("coretemp.json", settings); - - drawBackground("Waiting for\ndata..."); - } + g.setFont("6x8", sz).drawString("Core: " + ((c.core < 327) ? (c.core + c.unit) : 'n/a'), px, 48 + 48); + g.setFont("6x8", sz).drawString("Skin: " + c.skin + c.unit, px, 48 + 48 + 14); + g.setFont("6x8", sz).drawString("HR: " + c.hr + " BPM", px, 48 + 48 + 28); + g.setFont("6x8", sz).drawString("HSI: " + c.hsi+ "/10", px, 48 + 48 + 42); + g.setFont("6x8", sz).drawString("BATT: " + c.battery+ "%", px, 48 + 48 + 56); } function drawBackground(message) { @@ -51,16 +40,11 @@ function drawBackground(message) { g.drawString(message, g.getWidth() / 2, g.getHeight() / 2 + 16); } -Bangle.on('CoreTemp', onCore); - -settings = require("Storage").readJSON("coretemp.json", 1) || {}; if (!settings.enabled) { - drawBackground("Sensor off\nBTN" + - ((process.env.HWVERSION == 1) ? '2' : '1') + " to enable"); + drawBackground("Sensor off\nEnable in Settings"); } else { + Bangle.setCORESensorPower(1,"COREAPP"); + Bangle.on('CORESensor', onCore); drawBackground("Waiting for\ndata..."); } - -setWatch(() => { enableSensor(); }, (process.env.HWVERSION == 1) ? BTN2 : BTN1, - {repeat : false}); diff --git a/apps/coretemp/lib.js b/apps/coretemp/lib.js new file mode 100644 index 000000000..885261061 --- /dev/null +++ b/apps/coretemp/lib.js @@ -0,0 +1,279 @@ +exports.enable = () => { + var settings = require("Storage").readJSON("coretemp.json", 1) || {}; + let log = function () { };//print + Bangle.enableCORESensorLog = function () { + log = function (text, param) { + let logline = new Date().toISOString() + " - " + text; + if (param) logline += ": " + JSON.stringify(param); + print(logline); + }; + }; + let gatt; + let device; + let characteristics; + let blockInit = false; + let waitingPromise = function (timeout) { + return new Promise(function (resolve) { + log("Start waiting for " + timeout); + setTimeout(() => { + log("Done waiting for " + timeout); + resolve(); + }, timeout); + }); + }; + + if (settings.enabled && settings.cache) { + let addNotificationHandler = function (characteristic) { + log("Setting notification handler"/*supportedCharacteristics[characteristic.uuid].handler*/); + characteristic.on('characteristicvaluechanged', (ev) => supportedCharacteristics[characteristic.uuid].handler(ev.target.value)); + }; + let characteristicsFromCache = function (device) { + let service = { device: device }; // fake a BluetoothRemoteGATTService + log("Read cached characteristics"); + let cache = settings.cache; + if (!cache.characteristics) return []; + let restored = []; + for (let c in cache.characteristics) { + let cached = cache.characteristics[c]; + let r = new BluetoothRemoteGATTCharacteristic(); + log("Restoring characteristic ", cached); + r.handle_value = cached.handle; + r.uuid = cached.uuid; + r.properties = {}; + r.properties.notify = cached.notify; + r.properties.read = cached.read; + r.service = service; + addNotificationHandler(r); + log("Restored characteristic: ", r); + restored.push(r); + } + return restored; + }; + let supportedCharacteristics = { + "00002101-5b1e-4347-b07c-97b514dae121": { + handler: function (dv) { + log(dv); + let index = 0; + let flags = dv.getUint8(index++); + let coreTemp = dv.getInt16(index, true) / 100.0; + index += 2; + let skinTemp = dv.getInt16(index, true) / 100.0; + index += 2; + let coreReserved = dv.getInt16(index, true); //caleraGT only with firmware decryption provided by Greenteg + index += 2; + let qualityAndState = dv.getUint8(index++); + let heartRate = dv.getUint8(index++); + let heatStrainIndex = dv.getUint8(index) / 10.0; + let dataQuality = qualityAndState & 0x07; + let hrState = (qualityAndState >> 4) & 0x03; + let data = { + core: coreTemp, + skin: skinTemp, + unit: (flags & 0b00001000) ? "F" : "C", + hr: heartRate, + heatflux: coreReserved, + hsi: heatStrainIndex, + battery: 0, + dataQuality: dataQuality, + hrState: hrState + }; + if (lastReceivedData.hasOwnProperty("0x180f")) { + data.battery = lastReceivedData["0x180f"]["0x2a19"]; + } + log("data", data); + Bangle.emit("CORESensor", data); + } + }, + "00002102-5b1e-4347-b07c-97b514dae121": { + handler: function (dv) { + log(dv);//just log the response, handle write and responses in another Promise Function (Bangle.CORESensorSendOpCode) + } + }, + "0x2a19": { + //Battery + handler: function (dv) { + if (!lastReceivedData["0x180f"]) lastReceivedData["0x180f"] = {}; + log("Got battery", dv); + lastReceivedData["0x180f"]["0x2a19"] = dv.getUint8(0); + } + } + }; + let lastReceivedData = { + }; + + Bangle.isCORESensorOn = function () { + return (Bangle._PWR && Bangle._PWR.CORESensor && Bangle._PWR.CORESensor.length > 0); + }; + + Bangle.isCORESensorConnected = function () { + return gatt && gatt.connected; + }; + + let onDisconnect = function (reason) { + blockInit = false; + log("Disconnect: " + reason); + if (Bangle.isCORESensorOn()) { + setTimeout(initCORESensor, 5000); + } + }; + let createCharacteristicPromise = function (newCharacteristic) { + log("Create characteristic promise", newCharacteristic); + let result = Promise.resolve(); + if (newCharacteristic.readValue) { + result = result.then(() => { + log("Reading data", newCharacteristic); + return newCharacteristic.readValue().then((data) => { + if (supportedCharacteristics[newCharacteristic.uuid] && supportedCharacteristics[newCharacteristic.uuid].handler) { + supportedCharacteristics[newCharacteristic.uuid].handler(data); + } + }); + }); + } + if (newCharacteristic.properties.notify) { + result = result.then(() => { + log("Starting notifications", newCharacteristic); + let startPromise = newCharacteristic.startNotifications().then(() => log("Notifications started", newCharacteristic)); + startPromise = startPromise.then(() => { + return waitingPromise(3000); + }); + return startPromise; + }); + } + return result.then(() => log("Handled characteristic", newCharacteristic)); + }; + + let attachCharacteristicPromise = function (promise, characteristic) { + return promise.then(() => { + log("Handling characteristic:", characteristic); + return createCharacteristicPromise(characteristic); + }); + }; + let initCORESensor = function () { + if (!settings.btname) { + log("CORESensor not paired, quitting"); + return; + } + if (blockInit) { + log("CORESensor already turned on by another app, quitting"); + return; + } + blockInit = true; + NRF.setScan(); + let promise; + let filters; + + if (!device) { + if (settings.btname) { + log("Configured device name ", settings.btname); + filters = [{ name: settings.btname }]; + } else { + return; + } + log("Requesting device with filters", filters); + try { + promise = NRF.requestDevice({ filters: filters, active: true }); + } catch (e) { + log("Error during initial request:", e); + onDisconnect(e); + return; + } + promise = promise.then((d) => { + log("Wait after request"); + return waitingPromise(2000).then(() => Promise.resolve(d)); + }); + + promise = promise.then((d) => { + log("Got device", d); + d.on('gattserverdisconnected', onDisconnect); + device = d; + }); + } else { + promise = Promise.resolve(); + log("Reuse device", device); + } + + promise = promise.then(() => { + gatt = device.gatt; + return Promise.resolve(gatt); + }); + + promise = promise.then((gatt) => { + if (!gatt.connected) { + log("Connecting..."); + let connectPromise = gatt.connect().then(function () { + log("Connected."); + }); + connectPromise = connectPromise.then(() => { + log("Wait after connect"); + return waitingPromise(2000); + }); + return connectPromise; + } else { + return Promise.resolve(); + } + }); + + promise = promise.then(() => { + if (!characteristics || characteristics.length == 0) { + characteristics = characteristicsFromCache(device); + } + let characteristicsPromise = Promise.resolve(); + for (let characteristic of characteristics) { + characteristicsPromise = attachCharacteristicPromise(characteristicsPromise, characteristic, true); + } + + return characteristicsPromise; + }); + + return promise.then(() => { + log("Connection established, waiting for notifications"); + }).catch((e) => { + characteristics = []; + log("Error:", e); + onDisconnect(e); + }); + }; + Bangle.setCORESensorPower = function (isOn, app) { + // Do app power handling + if (!app) app = "?"; + log("setCORESensorPower ->", isOn, app); + if (Bangle._PWR === undefined) Bangle._PWR = {}; + if (Bangle._PWR.CORESensor === undefined) Bangle._PWR.CORESensor = []; + if (isOn && !Bangle._PWR.CORESensor.includes(app)) Bangle._PWR.CORESensor.push(app); + if (!isOn && Bangle._PWR.CORESensor.includes(app)) Bangle._PWR.CORESensor = Bangle._PWR.CORESensor.filter(a => a != app); + isOn = Bangle._PWR.CORESensor.length; + // so now we know if we're really on + if (isOn) { + log("setCORESensorPower on" + app); + if (!Bangle.isCORESensorConnected()) initCORESensor(); + } else { // being turned off! + log("setCORESensorPower turning off ", app); + if (gatt) { + if (gatt.connected) { + log("CORESensor: Disconnect with gatt", gatt); + try { + gatt.disconnect().then(() => { + log("CORESensor: Successful disconnect"); + }).catch((e) => { + log("CORESensor: Error during disconnect promise", e); + }); + } catch (e) { + log("CORESensor: Error during disconnect attempt", e); + } + } + } + } + }; + + // disconnect when swapping apps + E.on("kill", function () { + if (gatt) { + log("CORESensor connected - disconnecting"); + try { gatt.disconnect(); } catch (e) { + log("CORESensor disconnect error", e); + } + gatt = undefined; + } + }); + } +}; \ No newline at end of file diff --git a/apps/coretemp/metadata.json b/apps/coretemp/metadata.json index 2b7de0bf0..90d7f03c4 100644 --- a/apps/coretemp/metadata.json +++ b/apps/coretemp/metadata.json @@ -1,7 +1,7 @@ { "id": "coretemp", "name": "CoreTemp", - "version": "0.05", + "version": "0.06", "description": "Display CoreTemp device sensor data", "icon": "coretemp.png", "type": "app", @@ -11,10 +11,11 @@ "storage": [ {"name":"coretemp.wid.js","url":"widget.js"}, {"name":"coretemp.app.js","url":"coretemp.js"}, + {"name":"CORESensor","url":"lib.js"}, {"name":"coretemp.recorder.js","url":"recorder.js"}, {"name":"coretemp.settings.js","url":"settings.js"}, {"name":"coretemp.img","url":"coretemp-icon.js","evaluate":true}, - {"name":"coretemp.boot.js","url":"boot.js"} + {"name":"coretemp.0.boot.js","url":"boot.js"} ], "data": [{"name":"coretemp.json","url":"app-settings.json"}], "screenshots": [{"url":"screenshot.png"}] diff --git a/apps/coretemp/recorder.js b/apps/coretemp/recorder.js index 1499605f3..fb0352fb6 100644 --- a/apps/coretemp/recorder.js +++ b/apps/coretemp/recorder.js @@ -1,28 +1,40 @@ (function(recorders) { recorders.coretemp = function() { - var core = "", skin = ""; + var core = "", skin = "", unit="", hr="", heatflux="", hsi="", battery="", quality=""; var hasCore = false; function onCore(c) { core=c.core; skin=c.skin; hasCore = true; + unit = c.unit; + hr = c.hr; + heatflux = c.heatflux; + hsi = c.hsi; + battery= c.battery; + quality = c.dataQuality; } return { name : "Core", - fields : ["Core","Skin"], + fields : ["Core","Skin","Unit","HeartRate","HeatFlux","HeatStrainIndex","Battery","Quality"], getValues : () => { - var r = [core,skin]; + var r = [core,skin,unit,hr,heatflux,hsi,battery,quality]; core = ""; skin = ""; + unit=""; + hr=""; + heatflux=""; + hsi=""; + battery=""; + quality=""; return r; }, start : () => { hasCore = false; - Bangle.on('CoreTemp', onCore); + Bangle.on('CORESensor', onCore); }, stop : () => { hasCore = false; - Bangle.removeListener('CoreTemp', onCore); + Bangle.removeListener('CORESensor', onCore); }, draw : (x,y) => g.setColor(hasCore?"#0f0":"#8f8").drawImage(atob("DAyBAAHh0js3EuDMA8A8AWBnDj9A8A=="),x,y) }; diff --git a/apps/coretemp/settings.js b/apps/coretemp/settings.js index 23ea09167..f79a11a4d 100644 --- a/apps/coretemp/settings.js +++ b/apps/coretemp/settings.js @@ -2,45 +2,532 @@ /** * @param {function} back Use back() to return to settings menu */ -(function(back) { +(function (back) { + var settings = {}; const SETTINGS_FILE = 'coretemp.json' - // initialize with default settings... - let s = { - 'enabled': true, - } - // ...and overwrite them with any saved values - // This way saved values are preserved if a new version adds more settings - const storage = require('Storage') - const saved = storage.readJSON(SETTINGS_FILE, 1) || {} - for (const key in saved) { - s[key] = saved[key]; - } + var CORECONNECTED = false; // creates a function to safe a specific setting, e.g. save('color')(1) - function save(key) { - return function (value) { - s[key] = value; - storage.write(SETTINGS_FILE, s); - } + function writeSettings(key, value) { + let s = require('Storage').readJSON(SETTINGS_FILE, true) || {}; + s[key] = value; + require('Storage').writeJSON(SETTINGS_FILE, s); + readSettings(); } - function updateSettings() { - require("Storage").write("coretemp.json", s); - if (WIDGETS["coretemp"]) - WIDGETS["coretemp"].reload(); - return; -} - -const menu = { - '' : {'title' : 'CoreTemp sensor'}, - '< Back' : back, - 'Enabled' : { - value : !!s.enabled, - onchange : v => { - s.enabled = v; - updateSettings(); - } + function readSettings() { + settings = Object.assign( + require('Storage').readJSON(SETTINGS_FILE, true) || {} + ); } -} - E.showMenu(menu); -}) + readSettings(); + let log = () => { }; + if (settings.debuglog) + log = print; + + let supportedServices = [ + "00002100-5b1e-4347-b07c-97b514dae121", // Core Body Temperature Service + "0x180f", // Battery + "0x1809", // Health Thermometer Service + ]; + + let supportedCharacteristics = [ + "00002101-5b1e-4347-b07c-97b514dae121", // Core Body Temperature Characteristic + "00002102-5b1e-4347-b07c-97b514dae121", //Core Temp Control Point (opCode for extra function) + //"0x2a1c", //Thermometer + //"0x2a1d", //Sensor Location (CORE) + "0x2a19", // Battery + ]; + + var characteristicsToCache = function (characteristics) { + log("Cache characteristics"); + let cache = {}; + if (!cache.characteristics) cache.characteristics = {}; + for (var c of characteristics) { + log("Saving handle " + c.handle_value + " for characteristic: ", c.uuid); + cache.characteristics[c.uuid] = { + "handle": c.handle_value, + "uuid": c.uuid, + "notify": c.properties.notify, + "read": c.properties.read, + "write": c.properties.write + }; + } + writeSettings("cache", cache); + }; + + var controlPointChar; + + let createCharacteristicPromise = function (newCharacteristic) { + log("Create characteristic promise", newCharacteristic.uuid); + if (newCharacteristic.uuid === "00002102-5b1e-4347-b07c-97b514dae121") { + log("Subscribing to CoreTemp Control Point Indications."); + controlPointChar = newCharacteristic; + return controlPointChar.writeValue(new Uint8Array([0x02]), { + type: "command", + handle: true + }) + .then(() => { + log("Indications enabled! Listening for responses..."); + return controlPointChar.startNotifications(); //now we can send opCodes + }) + .then(() => log("Finished handling CoreTemp Control Point.")) + .catch(error => { + log("Error enabling indications:", error); + }); + } + return Promise.resolve().then(() => log("Handled characteristic", newCharacteristic.uuid)); + }; + + let attachCharacteristicPromise = function (promise, characteristic) { + return promise.then(() => { + log("Handling characteristic:", characteristic.uuid); + return createCharacteristicPromise(characteristic); + }); + }; + + let characteristics; + let createCharacteristicsPromise = function (newCharacteristics) { + log("Create characteristics promise ", newCharacteristics.length); + let result = Promise.resolve(); + for (let c of newCharacteristics) { + if (!supportedCharacteristics.includes(c.uuid)) continue; + log("Supporting characteristic", c.uuid); + characteristics.push(c); + + result = attachCharacteristicPromise(result, c); + } + return result.then(() => log("Handled characteristics")); + }; + + let createServicePromise = function (service) { + log("Create service promise", service.uuid); + let result = Promise.resolve(); + result = result.then(() => { + log("Handling service", service.uuid); + return service.getCharacteristics().then((c) => createCharacteristicsPromise(c)); + }); + return result.then(() => log("Handled service", service.uuid)); + }; + + let attachServicePromise = function (promise, service) { + return promise.then(() => createServicePromise(service)); + }; + + function writeToControlPoint(opCode, params) { + return new Promise((resolve, reject) => { + let data = new Uint8Array([opCode].concat(params)); + + if (!controlPointChar) { + log("Control Point characteristic not found! Reconnecting..."); + return; + } + // Temporary handler to capture the response + function handleResponse(event) { + let response = new Uint8Array(event.target.value.buffer); + //let responseOpCode = response[0]; + let requestOpCode = response[1]; // Matches the sent OpCode + let resultCode = response[2]; // 0x01 = Success + controlPointChar.removeListener("characteristicvaluechanged", handleResponse); + if (requestOpCode === opCode) { + if (resultCode === 0x01) { //successful + resolve(response); + } else { + reject("Error Code: " + resultCode); + } + } + } + + controlPointChar.on("characteristicvaluechanged", handleResponse); + controlPointChar.writeValue(data) + .then(() => log("Sent OpCode:", opCode.toString(16), "Params:", data)) + .catch(error => { + log("Write error:", error); + reject(error); + }); + }); + } + let gatt; + function cacheDevice(deviceName) { + let promise; + let filters; + characteristics = []; + filters = [{ name: deviceName }]; + log("Requesting device with filters", filters); + promise = NRF.requestDevice({ filters: filters, active: settings.active }); + promise = promise.then((d) => { + E.showMessage("Found!!\n" + deviceName + "\nConnecting..."); + log("Got device", d); + gatt = d.gatt; + log("Connecting..."); + d.on('gattserverdisconnected', function () { + CORECONNECTED = false; + log("Disconnected! "); + gatt = null; + //setTimeout(() => cacheDevice(deviceName), 5000); // Retry in 5 seconds + }); + return gatt.connect().then(function () { + log("Connected."); + }); + }); + promise = promise.then(() => { + log(JSON.stringify(gatt.getSecurityStatus())); + if (gatt.getSecurityStatus().bonded) { + log("Already bonded"); + return Promise.resolve(); + } else { + log("Start bonding"); + return gatt.startBonding() + .then(() => log("Security status after bonding" + gatt.getSecurityStatus())); + } + }); + promise = promise.then(() => { + log("Getting services"); + return gatt.getPrimaryServices(); + }); + + promise = promise.then((services) => { + log("Got services", services.length); + let result = Promise.resolve(); + for (let service of services) { + if (!(supportedServices.includes(service.uuid))) continue; + log("Supporting service", service.uuid); + result = attachServicePromise(result, service); + } + return result; + }); + + return promise.then(() => { + log("Connection established, saving cache"); + E.showMessage("Found " + deviceName + "\nConnected!"); + CORECONNECTED = true; + characteristicsToCache(characteristics); + }); + } + + function ConnectToDevice(d) { + E.showMessage("Connecting..."); + let count = 0; + const successHandler = () => { + E.showMenu(buildMainMenu()); + }; + const errorHandler = (e) => { + count++; + log("ERROR", e); + if (count <= 10) { + E.showMessage("Error during caching\nRetry " + count + "/10", e); + return cacheDevice(d).then(successHandler).catch(errorHandler); + } else { + E.showAlert("Error during caching", e).then(() => { + E.showMenu(buildMainMenu()); + }); + } + }; + return cacheDevice(d).then(successHandler).catch(errorHandler); + } + /* + function getPairedAntHRM() { + writeToControlPoint(0x04) // Get paired HRMs + .then(response => { + let totalHRMs = response[3]; // HRM count at index 3 + log("📡 PAIRED ANT+:", totalHRMs); + let promises = []; + let hrmFound = []; + for (let i = 0; i < totalHRMs; i++) { + promises.push( + writeToControlPoint(0x05, [i]) // Get HRM ID from paired list + .then(hrmResponse => { + log("🔍 Response 0x05:", hrmResponse); + + let byte1 = hrmResponse[3]; // LSB + let byte2 = hrmResponse[4]; // Middle Byte + let byte3 = hrmResponse[5]; // MSB + let txType = hrmResponse[5]; // Transmission Type + let hrmState = hrmResponse[6]; // Connection State + let pairedAntId = (byte1) | (byte2 << 8) | (byte3 << 16); // ✅ Corrected parsing + let stateText = ["Closed", "Searching", "Synchronized", "Reserved"][hrmState & 0x03]; + log(`🔗 HRM ${i}: ANT ID = ${pairedAntId}, Tx-Type = ${txType}, State = ${stateText}`); + hrmFound.push({ index: i, antId: pairedAntId, txType: txType, stateText: stateText }); + }) + .catch(e => log(`❌ Error fetching HRM ${i} ID:`, e)) + ); + } + return Promise.all(promises).then(() => hrmFound); + }) + .then(allHRMs => { + log("Retrieved all paired HRMs:", allHRMs); + return // Modified start scanning command + }) + } + */ + function clearPairedHRM_ANT() { + return writeToControlPoint(0x01) // Send OpCode 0x01 to clear list + .then(response => { + let resultCode = response[2]; // Check the success flag + if (resultCode === 0x01) { + log("ANT+ HRM list cleared successfully."); + return Promise.resolve(); + } else { + log("Failed to clear ANT+ HRM list. Error code:", resultCode); + return Promise.reject(new Error(`Error code: ${resultCode}`)); + } + }) + .catch(error => { + log("Error clearing ANT+ HRM list:", error); + return Promise.reject(error); + }); + } + + function scanUntilSynchronized(maxRetries, delay) { + let attempts = 0; + function checkHRMState() { + if (attempts >= maxRetries) { + log("Max scan attempts reached. HRM did not synchronize."); + E.showAlert("Max scan attempts reached. HRM did not synchronize.").then(() => E.showMenu(HRM_MENU())); + return; + } + log(`Attempt ${attempts + 1}/${maxRetries}: Checking HRM state...`); + writeToControlPoint(0x05, [0]) // Check paired HRM state + .then(hrmResponse => { + log("Sent OpCode: 0x05, response: ", hrmResponse); + let byte1 = hrmResponse[3]; // LSB of ANT ID + let byte2 = hrmResponse[4]; // MSB of ANT ID + let txType = hrmResponse[5]; // Transmission Type + let hrmState = hrmResponse[6]; // HRM State + let retrievedAntId = (byte1) | (byte2 << 8) | (txType << 16); + let stateText = ["Closed", "Searching", "Synchronized", "Reserved"][hrmState & 0x03]; + log(`HRM Status: ANT ID = ${retrievedAntId}, Tx-Type = ${txType}, State = ${stateText}`); + E.showAlert(`HRM Status\nANT ID = ${retrievedAntId}\nState = ${stateText}`).then(() => E.showMenu(HRM_MENU())); + if (stateText === "Synchronized") { + return; + } else { + log(`HRM ${retrievedAntId} is not yet synchronized. Scanning again...`); + // Start scan again + writeToControlPoint(0x0D) + .then(() => writeToControlPoint(0x0A, [0xFF])) + .then(() => { + attempts++; + setTimeout(checkHRMState, delay); // Wait and retry + }) + .catch(error => { + log("Error restarting scan:", error); + }); + } + }) + .catch(error => { + log("Error checking HRM state:", error); + }); + } + log("Starting scan to synchronize HRM..."); + writeToControlPoint(0x0A, [0xFF]) // Start initial scan + .then(() => { + setTimeout(checkHRMState, delay); // Wait and check state + }) + .catch(error => { + log("Error starting initial scan:", error); + }); + } + + function scanHRM_ANT() { + E.showMenu(); + E.showMessage("Scanning for 10 seconds"); // Increased scan time + writeToControlPoint(0x0A, [0xFF]) + .then(response => { + log("Received Response for 0x0A:", response); + return new Promise(resolve => setTimeout(resolve, 10000)); // Extended scan time to 10 seconds + }) + .then(() => { + return writeToControlPoint(0x0B); // Get HRM count + }) + .then(response => { + let HRMCount = response[3]; + log("HRM Count Response:", HRMCount); + let hrmFound = []; + let promises = []; + for (let i = 0; i < HRMCount; i++) { + promises.push( + writeToControlPoint(0x0C, [i]) // Get Scanned HRM IDs + .then(hrmResponse => { + log("Response 0x0C:", hrmResponse); + let byte1 = hrmResponse[3]; // LSB + let byte2 = hrmResponse[4]; // MSB + let txType = hrmResponse[5]; // Transmission Type + let scannedAntId = (byte1) | (byte2 << 8) | (txType << 16); //3 byte ANT+ ID + log(`HRM ${i} ID Response: ${scannedAntId}`); + hrmFound.push({ antId: scannedAntId }); + }) + .catch(e => log(`Error fetching HRM ${i} ID:`, e)) + ); + } + return Promise.all(promises).then(() => { + if (hrmFound > 0) { + let submenu_scan = { + '< Back': function () { E.showMenu(buildMainMenu()); } + }; + hrmFound.forEach((hrm) => { + let id = hrm.antId; + submenu_scan[id] = function () { + E.showPrompt("Connect to\n" + id + "?", { title: "ANT+ Pairing" }).then((r) => { + if (r) { + E.showMessage("Connecting..."); + let byte1 = id & 0xFF; // LSB + let byte2 = (id >> 8) & 0xFF; // Middle byte + let byte3 = (id >> 16) & 0xFF; // Transmission Type + return clearPairedHRM_ANT(). //FIRST CLEAR ALL ANT+ HRM + then(() => { writeToControlPoint(0x02, [byte1, byte2, byte3]) }) // Pair the HRM + .then(() => { + log(`HRM ${id} added to paired list.`); + writeSettings("ANT_HRM", hrm); + E.showMenu(HRM_MENU()); + }) + .catch(e => log(`Error adding HRM ${id} to paired list:`, e)); + } + }); + }; + }); + E.showMenu(submenu_scan); + } else { + E.showAlert("No ANT+ HRM found.").then(() => E.showMenu(HRM_MENU())); + } + }); + }) + .catch(e => log("ERROR:", e)); + } + + function buildMainMenu() { + let mainmenu = { + '': { 'title': 'CORE Sensor' }, + '< Back': back, + 'Enable': { + value: !!settings.enabled, + onchange: v => { + writeSettings("enabled", v); + }, + }, + 'Widget': { + value: !!settings.widget, + onchange: v => { + writeSettings("widget", v); + }, + } + }; + if (settings.btname || settings.btid) { + let name = "Clear " + (settings.btname || settings.btid); + mainmenu[name] = function () { + E.showPrompt("Clear current device?").then((r) => { + if (r) { + writeSettings("btname", undefined); + writeSettings("btid", undefined); + writeSettings("cache", undefined); + if(gatt) gatt.disconnect(); + } + E.showMenu(buildMainMenu()); + }); + }; + if(!CORECONNECTED){ + let connect = "Connect " + (settings.btname || settings.btid); + mainmenu[connect] = function () {ConnectToDevice(settings.btname)}; + }else{ + mainmenu['HRM Settings'] = function () { E.showMenu(HRM_MENU()); }; + } + } else { + mainmenu['Scan for CORE'] = function () { ScanForCORESensor(); }; + } + mainmenu['Debug'] = function () { E.showMenu(submenu_debug); }; + return mainmenu; + } + let submenu_debug = { + '': { title: "Debug" }, + '< Back': function () { E.showMenu(buildMainMenu()); }, + 'Alert on disconnect': { + value: !!settings.warnDisconnect, + onchange: v => { + writeSettings("warnDisconnect", v); + } + }, + 'Debug log': { + value: !!settings.debuglog, + onchange: v => { + writeSettings("debuglog", v); + } + } + }; + + function HRM_MENU() { + let menu = { + '': { 'title': 'CORE: HR' }, + '< Back': function () { E.showMenu(buildMainMenu()); }, + 'Scan for ANT+': function () { scanHRM_ANT(); } + } + if (settings.btname) { + menu['ANT+ Status'] = function () { scanUntilSynchronized(10, 3000); }, + menu['Clear ANT+'] = function () { + E.showPrompt("Clear ANT+ HRs?", { title: "CLear ANT+" }).then((r) => { + if (r) { + clearPairedHRM_ANT(); + } + E.showMenu(HRM_MENU()); + }); + } + } + return menu; + } + + function ScanForCORESensor() { + E.showMenu(); + E.showMessage("Scanning for 5 seconds"); + let submenu_scan = { + '< Back': function () { E.showMenu(buildMainMenu()); } + }; + NRF.findDevices(function (devices) { + submenu_scan[''] = { title: `Scan (${devices.length} found)` }; + if (devices.length === 0) { + E.showAlert("No devices found") + .then(() => E.showMenu(buildMainMenu())); + return; + } else { + devices.forEach((d) => { + log("Found device", d); + let shown = (d.name || d.id.substr(0, 17)); + submenu_scan[shown] = function () { + E.showPrompt("Connect to\n" + shown + "?", { title: "Pairing" }).then((r) => { + if (r) { + E.showMessage("Connecting..."); + let count = 0; + const successHandler = () => { + E.showPrompt("Success!", { + buttons: { "OK": true } + }).then(() => { + writeSettings("btid", d.id); + writeSettings("btname", d.name); //Seems to only like to connect by name + E.showMenu(HRM_MENU()); + }); + }; + const errorHandler = (e) => { + count++; + log("ERROR", e); + if (count <= 10) { + E.showMessage("Error during caching\nRetry " + count + "/10", e); + return cacheDevice(d.name).then(successHandler).catch(errorHandler); + } else { + E.showAlert("Error during caching", e).then(() => { + E.showMenu(buildMainMenu()); + }); + } + }; + return cacheDevice(d.name).then(successHandler).catch(errorHandler); + } + }); + }; + }); + } + E.showMenu(submenu_scan); + }, { timeout: 5000, active: true, filters: [{ services: ["00002100-5b1e-4347-b07c-97b514dae121"] }] }); + } + + function init() { + E.showMenu(); + E.showMenu(buildMainMenu()); + } + init(); +}) \ No newline at end of file diff --git a/apps/coretemp/widget.js b/apps/coretemp/widget.js index 446325118..777d622ac 100644 --- a/apps/coretemp/widget.js +++ b/apps/coretemp/widget.js @@ -1,62 +1,54 @@ -// TODO Change to a generic multiple sensor widget? - (() => { var settings = {}; - var count = 0; - var core = 0; - + var CORESensorStatus = false; // draw your widget function draw() { - if (!settings.enabled) + if (!settings.widget) return; g.reset(); g.setFont("6x8", 1).setFontAlign(0, 0); g.setFontAlign(0, 0); g.clearRect(this.x, this.y, this.x + 23, this.y + 23); - if (count & 1) { + if (CORESensorStatus) { g.setColor("#0f0"); // green } else { g.setColor(g.theme.dark ? "#333" : "#CCC"); // off = grey } g.drawImage( - atob("DAyBAAHh0js3EuDMA8A8AWBnDj9A8A=="), - this.x+(24-12)/2,this.y+1); - - g.setColor(g.theme.fg); - g.drawString(parseInt(core)+"\n."+parseInt((core*100)%100), this.x + 24 / 2, this.y + 18); - + atob("FBSCAAAAADwAAAPw/8AAP/PD8AP/wwDwD//PAPAP/APA8D/AA//wP8AA/8A/AAAAPP8AAAD8/wAAAPz/AAAA/D8AAAAAP8AAA/A/8AAP8A/8AD/wD///z8AD///PAAA///AAAAP/wAA="), + this.x + (24 - 12) / 2, this.y + 1); g.setColor(-1); } - - // Set a listener to 'blink' - function onTemp(temp) { - count = count + 1; - core = temp.core; - WIDGETS["coretemp"].draw(); - } - // Called by sensor app to update status function reload() { settings = require("Storage").readJSON("coretemp.json", 1) || {}; - - Bangle.removeListener('CoreTemp', onTemp); - + if (!settings.widget) { + delete WIDGETS["coretemp"]; + return; + } if (settings.enabled) { WIDGETS["coretemp"].width = 24; - Bangle.on('CoreTemp', onTemp); } else { - WIDGETS["coretemp"].width = 0; - count = 0; + WIDGETS["CORESensor"].width = 0; } } + + if (Bangle.hasOwnProperty("isCORESensorConnected")) { + setInterval(function () { + if (Bangle.isCORESensorConnected() != CORESensorStatus) { + CORESensorStatus = Bangle.isCORESensorConnected(); + WIDGETS["coretemp"].draw(); + } + }, 10000); //runs every 10 seconds + } // add the widget WIDGETS["coretemp"] = { - area : "tl", - width : 24, - draw : draw, - reload : function() { + area: "tl", + width: 24, + draw: draw, + reload: function () { reload(); Bangle.drawWidgets(); // relayout all widgets } diff --git a/apps/counter/ChangeLog b/apps/counter/ChangeLog index 8402b3467..950c892dc 100644 --- a/apps/counter/ChangeLog +++ b/apps/counter/ChangeLog @@ -2,3 +2,4 @@ 0.02: Added decrement and touch functions 0.03: Set color - ensures widgets don't end up coloring the counter's text 0.04: Adopted for BangleJS 2 +0.05: Support translations diff --git a/apps/counter/counter.js b/apps/counter/counter.js index 0054ada6d..29413f600 100644 --- a/apps/counter/counter.js +++ b/apps/counter/counter.js @@ -95,9 +95,9 @@ if (BANGLEJS2) { g.clear(1).setFont("6x8"); g.setBgColor(g.theme.bg).setColor(g.theme.fg); if (BANGLEJS2) { - g.drawString('Swipe up to increase\nSwipe down to decrease\nPress button to reset.', x, 100 + y); + g.drawString([/*LANG*/"Swipe up to increase", /*LANG*/"Swipe down to decrease", /*LANG*/"Press button to reset"].join("\n"), x, 100 + y); } else { - g.drawString('Tap right or BTN1 to increase\nTap left or BTN3 to decrease\nPress BTN2 to reset.', x, 100 + y); + g.drawString([/*LANG*/"Tap right or BTN1 to increase", /*LANG*/"Tap left or BTN3 to decrease", /*LANG*/"Press BTN2 to reset"].join("\n"), x, 100 + y); } Bangle.loadWidgets(); diff --git a/apps/counter/metadata.json b/apps/counter/metadata.json index daba58d39..827caa9ec 100644 --- a/apps/counter/metadata.json +++ b/apps/counter/metadata.json @@ -1,7 +1,7 @@ { "id": "counter", "name": "Counter", - "version": "0.04", + "version": "0.05", "description": "Simple counter", "icon": "counter_icon.png", "tags": "tool", diff --git a/apps/counter2/ChangeLog b/apps/counter2/ChangeLog index 58eacf613..7db1936fa 100644 --- a/apps/counter2/ChangeLog +++ b/apps/counter2/ChangeLog @@ -2,3 +2,6 @@ 0.02: Added Settings & readme 0.03: Fix lint warnings 0.04: Fix lint warnings +0.05: Fix on not reading counter defaults in Settings +0.06: Added ability to display only one counter and fast-scrolling +0.07: Add option to keep unlocked diff --git a/apps/counter2/README.md b/apps/counter2/README.md index d57844aae..b2f48e384 100644 --- a/apps/counter2/README.md +++ b/apps/counter2/README.md @@ -11,10 +11,13 @@ The counter state gets saved. Best to use this with pattern launcher or ClockCal ## Howto - Tap top side or swipe up to increase counter - Tap bottom side or swipe down to decrease counter - - Hold (600ms) to reset to default value (configurable) - - Press button to exit + - Hold either side to quickly increase or decrease the counter. + - If the counters are not on their presets, then press the button to reset them + - If the counters are on their presets, then press the button to leave the screen + - Long press the button to leave the screen regardless of the counter values ## Configurable Features +- Display both Counters or only Counter 1 - Default value Counter 1 - Default value Counter 2 - Buzz on interact diff --git a/apps/counter2/app.js b/apps/counter2/app.js index 42b59cf5d..b8493da7e 100644 --- a/apps/counter2/app.js +++ b/apps/counter2/app.js @@ -1,20 +1,32 @@ -Bangle.loadWidgets(); - var s = Object.assign({ + display2:true, counter0:10, counter1:20, max0:15, max1:25, + fullscreen:true, buzz: true, colortext: true, + keepunlocked: false, }, require('Storage').readJSON("counter2.json", true) || {}); +var sGlob = Object.assign({ + timeout: 10, +}, require('Storage').readJSON("setting.json", true) || {}); + +const lockTimeout = s.keepunlocked ? 0 : 1000; +if (s.keepunlocked) { + Bangle.setOptions({lockTimeout}); + Bangle.setLocked(false); +} + const f1 = (s.colortext) ? "#f00" : "#fff"; const f2 = (s.colortext) ? "#00f" : "#fff"; const b1 = (s.colortext) ? g.theme.bg : "#f00"; const b2 = (s.colortext) ? g.theme.bg : "#00f"; var drag; +var dragCurr = {x:0 ,y:0 ,dx:0 ,dy:0 ,b:false}; const screenwidth = g.getWidth(); const screenheight = g.getHeight(); @@ -37,59 +49,126 @@ function saveSettings() { } let ignoreonce = false; +let fastupdateoccurring = false; var dragtimeout; function updateScreen() { - g.setBgColor(b1); - g.clearRect(0, 0, halfwidth, screenheight); - g.setBgColor(b2); - g.clearRect(halfwidth, 0, screenwidth, screenheight); - g.setFont("Vector", 60).setFontAlign(0, 0); - g.setColor(f1); - g.drawString(Math.floor(counter[0]), halfwidth * 0.5, halfheight); - g.setColor(f2); - g.drawString(Math.floor(counter[1]), halfwidth * 1.5, halfheight); + if (s.display2) { + g.setBgColor(b1); + g.clearRect(0, 0, halfwidth, screenheight); + g.setBgColor(b2); + g.clearRect(halfwidth, 0, screenwidth, screenheight); + g.setFont("Vector", 60).setFontAlign(0, 0); + g.setColor(f1); + g.drawString(Math.floor(counter[0]), halfwidth * 0.5, halfheight); + g.setColor(f2); + g.drawString(Math.floor(counter[1]), halfwidth * 1.5, halfheight); + } + else { + g.setBgColor(b2); // Using right counter's colors b/c blue looks nicer than red + g.clearRect(0, 0, screenwidth, screenheight); + g.setFont("Vector", 90).setFontAlign(0, 0); + g.setColor(f2); + g.drawString(Math.floor(counter[0]), halfwidth, halfheight); + } saveSettings(); if (s.buzz) Bangle.buzz(50,.5); - Bangle.drawWidgets(); + + Bangle.loadWidgets(); + if (s.fullscreen) { + require("widget_utils").hide(); + } + else { + Bangle.drawWidgets(); + } } +// Clearing the timer on lock is likely uneeded, but just in case +Bangle.on('lock', e => { + drag = undefined; + var timeOutTimer = sGlob.timeout * 1000; + Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout}); + if (dragtimeout) clearTimeout(dragtimeout); + fastupdateoccurring = false; +}); + Bangle.on("drag", e => { - const c = (e.x < halfwidth) ? 0 : 1; + const c = (e.x >= halfwidth && s.display2) ? 1 : 0; + dragCurr = e; if (!drag) { if (ignoreonce) { ignoreonce = false; return; } drag = { x: e.x, y: e.y }; - dragtimeout = setTimeout(function () { resetcounter(c); }, 600); //if dragging for 500ms, reset counter + dragtimeout = setTimeout(function () { fastupdatecounter(c); }, 600); //if dragging for 500ms, reset counter } else if (drag && !e.b) { // released - let adjust = 0; - const dx = e.x - drag.x, dy = e.y - drag.y; - if (Math.abs(dy) > Math.abs(dx) + 30) { - adjust = (dy > 0) ? -1 : 1; - } else { - adjust = (e.y > halfwidth) ? -1 : 1; - } - counter[c] += adjust; - updateScreen(); - drag = undefined; + if (!fastupdateoccurring) + updatecounter(c); + drag = undefined; + if (dragtimeout) { + let timeOutTimer = 1000; + Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout}); clearTimeout(dragtimeout); } + fastupdateoccurring = false; + } }); +function updatecounter(which) { + let adjust = 0; + const dx = dragCurr.x - drag.x, dy = dragCurr.y - drag.y; + if (Math.abs(dy) > Math.abs(dx) + 30) { + adjust = (dy > 0) ? -1 : 1; + } else { + adjust = (dragCurr.y > halfheight) ? -1 : 1; + } + counter[which] += adjust; + updateScreen(); +} + +function fastupdatecounter(which) { + fastupdateoccurring = true; + updatecounter(which); + Bangle.setOptions({backlightTimeout: 0, lockTimeout: 0}); + dragtimeout = setTimeout(function () { fastupdatecounter(which); }, 10); +} + + function resetcounter(which) { - counter[which] = defaults[which]; - console.log("resetting counter ", which); + // If which is null, reset all + fastupdateoccurring = false; + if (dragtimeout) { + let timeOutTimer = 1000; + Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout}); + clearTimeout(dragtimeout); + } + if (which == null) { + for (let iter = 0; iter < defaults.length; iter++) { + counter[iter] = defaults[iter]; + } + console.log("resetting all counters"); + } + else { + counter[which] = defaults[which]; + console.log("resetting counter ", which); + } updateScreen(); drag = undefined; ignoreonce = true; } - updateScreen(); setWatch(function() { + for (let which = 0; which < defaults.length; which++) { + if(counter[which] != defaults[which]) { + resetcounter(null); + return; + } + } + var timeOutTimer = sGlob.timeout * 1000; + Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout}); load(); }, BTN1, {repeat:true, edge:"falling"}); diff --git a/apps/counter2/metadata.json b/apps/counter2/metadata.json index 400abf267..85d2d1a99 100644 --- a/apps/counter2/metadata.json +++ b/apps/counter2/metadata.json @@ -1,7 +1,7 @@ { "id": "counter2", "name": "Counter2", - "version": "0.04", + "version": "0.07", "description": "Dual Counter", "readme":"README.md", "icon": "counter2-icon.png", diff --git a/apps/counter2/settings.js b/apps/counter2/settings.js index b38df1824..622c3c69e 100644 --- a/apps/counter2/settings.js +++ b/apps/counter2/settings.js @@ -1,10 +1,12 @@ (function (back) { var FILE = "counter2.json"; const defaults={ + display2:true, counter0:12, counter1:0, max0:12, max1:0, + fullscreen: true, buzz: true, colortext: true, }; @@ -14,26 +16,40 @@ require('Storage').writeJSON(FILE, settings); } - const menu = { - "": { "title": "Counter2" }, - "< Back": () => back(), - 'Default C1': { - value: settings[0], - min: -99, max: 99, - onchange: v => { - settings.max0 = v; - writeSettings(); - } - }, - 'Default C2': { - value: settings[2], - min: -99, max: 99, - onchange: v => { - settings.max1 = v; - writeSettings(); - } - }, - 'Color': { + function showMainMenu() { + let appMenu = { + "": { "title": "Counter2" }, + "< Back": () => back(), + 'Counters to Display ': { + value: settings.display2, + format: v => v?"2":"1", + onchange: v => { + settings.display2 = v; + writeSettings(); + // redisplay the menu with/without C2 setting + setTimeout(showMainMenu, 0); + } + }, + 'Default C1': { + value: settings.max0, + min: -99, max: 99, + onchange: v => { + settings.max0 = v; + writeSettings(); + } + }, + }; + if (settings.display2) { + appMenu['Default C2'] = { + value: settings.max1, + min: -99, max: 99, + onchange: v => { + settings.max1 = v; + writeSettings(); + } + }; + } + appMenu['Color'] = { value: settings.colortext, format: v => v?"Text":"Backg", onchange: v => { @@ -41,15 +57,30 @@ console.log("Color",v); writeSettings(); } - }, - 'Vibrate': { + }; + appMenu['Fullscreen'] = { + value: settings.fullscreen, + onchange: v => { + settings.fullscreen = v; + writeSettings(); + } + }; + appMenu['Vibrate'] = { value: settings.buzz, onchange: v => { settings.buzz = v; writeSettings(); - } - } - }; - // Show the menu - E.showMenu(menu); -}); + }, + }; + appMenu['Keep unlocked'] = { + value: settings.keepunlocked, + onchange: v => { + settings.keepunlocked = v; + writeSettings(); + }, + }; + E.showMenu(appMenu); + } + + showMainMenu(); + }) diff --git a/apps/cprassist/settings.js b/apps/cprassist/settings.js index 5776baa0b..5099d0b7d 100644 --- a/apps/cprassist/settings.js +++ b/apps/cprassist/settings.js @@ -61,4 +61,4 @@ } }; E.showMenu(menu); -}); +}) diff --git a/apps/crsclock/ChangeLog b/apps/crsclock/ChangeLog new file mode 100644 index 000000000..647493b2b --- /dev/null +++ b/apps/crsclock/ChangeLog @@ -0,0 +1,6 @@ +0.01: Initial release – shows CRS, Steps, Mood, LightExp +0.02: Added README.md and linked in metadata.json +0.03: Added ChangeLog and linked in metadata.json +0.04: Improved stats layout with 5px margins and truncation +0.05: Added header color strip and shadowed time display +0.06: Memory optimizations – history pruning and limited HRM sampling diff --git a/apps/crsclock/README.md b/apps/crsclock/README.md new file mode 100644 index 000000000..0f3039994 --- /dev/null +++ b/apps/crsclock/README.md @@ -0,0 +1,121 @@ +## Circadian Rhythm Clock (CRS Clock) for Bangle.js 2 + +### **Overview** + +**Circadian Rhythm Clock** is an advanced wellness clock for Bangle.js 2 that estimates and visualizes your body’s internal circadian time and alignment. It calculates a personalized **Circadian Rhythm Score (CRS)** using your recent sleep timing, physical activity patterns, and (optionally) heart rate data. The app helps users monitor their biological rhythms, optimize their sleep, and maintain healthy light/activity habits—even on a device with limited sensors. + +### **Core Features** + +#### **1. Real-Time CRS Calculation** + +* **CRS** is computed as a composite index using: + + * **Sleep Timing** (from sleep/wake detection or manual window) + * **Activity Stability** (based on step data over the last 24 hours) + * **Heart Rate Stability** (if HR sensor is enabled) + * **Light Exposure Proxy** (counts “light hours” based on daytime activity if no light sensor is present) +* **CRS** is shown directly on the main clock face, updated every minute. + +#### **2. Biological Time Display** + +* Shows the current **estimated biological time (“BioTime”)** in large, clear digits. +* BioTime is adjusted using the user’s sleep phase offset and a configurable reference point (e.g., DLMO or CBTmin). + +#### **3. Health and Circadian Stats** + +* The main screen presents: + + * **CRS:** Current circadian rhythm score (0–100) + * **Steps:** Total steps in the last 24 hours + * **Mood:** Detected from heart rate variability (HRV proxy) + * **Light:** Estimated hours of daytime activity (“light exposure”) +* All stats update automatically. + +#### **4. Trend Visualization** + +* **CRS Trend Chart:** Shows CRS for each hour over the past 8–12 hours in a bar graph (visually displays circadian stability). +* Helps users see the rhythm and recent disruptions. + +#### **5. Automatic Sleep & Wake Detection** + +* Uses step activity and (optionally) movement detection to infer sleep start/end times. +* Triggers friendly alerts when sleep or wake is detected. + +#### **6. Hydration and Wellness Reminders** + +* Optional periodic reminders to hydrate, based on a user-configurable interval. + +#### **7. Simple Settings Menu** + +* Configure: + + * Sleep window (manual entry) + * Hydration reminder interval + * Theme/color scheme + * Circadian reference (DLMO/CBTmin) + * Heart rate and sleep detection settings + +#### **8. Data Export & Reset** + +* Exports historical step, heart rate, and light proxy data as JSON for external analysis. +* Full app data reset available from the menu. + +#### **9. Efficient and Stable Operation** + +* Aggressively trims stored history to a set maximum (e.g., 200 entries) to ensure stability and prevent memory overflows. +* All heavy computations (like trend chart) are run only on-demand. + +### **Sensor/Hardware Adaptation** + +* If the **heart rate sensor** is unavailable or disabled, the app uses step/activity stability only. +* If **no light sensor** is present (default for Bangle.js 2), the app estimates “light exposure” as the number of hours the user is active during daytime, outside their sleep window. +* The app is robust to missing or partial data. + +### **User Experience** + +* **Always-on Clock:** Appears as the default watch face, with tap, button, or swipe to access stats and menu. +* **Vivid, readable interface** with color themes and a clean, minimal design. +* **Alerts** for hydration and sleep transitions are gentle and non-intrusive. + + +### **Intended Users** + +* Anyone interested in **improving sleep, productivity, or circadian health**. +* Shift workers, travelers, or students seeking to track and align their biological clocks. +* Users who want more than a step counter—actionable, science-based feedback on internal time. + +### **How It Works** + +1. **Collects step and (optionally) heart rate data** in real-time. +2. **Calculates CRS** using the variability and timing of steps, sleep, and HR (if available). +3. **Estimates light exposure** hours using step data during daytime. +4. **Presents key circadian health metrics** on the main watch face. +5. **Offers friendly reminders** and data export for deeper analysis. + +### **Technical Details** + +* **Code:** JavaScript (Espruino), optimized for Bangle.js 2 +* **Persistent storage:** Steps, heart rate, and light/“light hour” proxies saved locally, aggressively pruned for memory safety. +* **User interface:** Button/touch/swipe navigation, E.showMenu/E.showAlert for dialogs, custom clock face rendering. +* **No dependencies:** Runs entirely on the watch—no phone, no cloud required. + +## Author + +Jakub Tencl, Ph.D. +[https://ihypnosis.org.uk](https://ihypnosis.org.uk) + +## Patent and Licensing + +This app is based on methods described in UK Patent Application GB2509149.7: +**"Wearable Circadian Rhythm Score (CRS) System for Estimating Biological Time"** + +Unless otherwise stated, this project is released under the MIT license. +Use of the patented method may be subject to licensing or permission. +For inquiries, contact the author. + +Note: The patented method does not require licensing for non-commercial, research, educational, or personal use within the open-source community. Commercial or broad distribution beyond these uses may require permission or licensing. For such use cases, please contact the author. + +### **Summary** + +The Circadian Rhythm Clock transforms the Bangle.js 2 into a **bio-aware, personalized circadian dashboard**, guiding users toward better alignment with their biological clock and modern life. +It is ideal for anyone who wants to visualize and optimize their internal rhythms using open, transparent algorithms—right on their wrist. diff --git a/apps/crsclock/app-icon.js b/apps/crsclock/app-icon.js new file mode 100644 index 000000000..715f878f2 --- /dev/null +++ b/apps/crsclock/app-icon.js @@ -0,0 +1 @@ +atob("MDDE/wAA///mEGT+BhEUpeYIQwAgAGQAaUpyjAX/5RDQc4QAAAAAAAAAiAAIqrVVVVuqgACIAAAAAAAAAAAAAAAIAIqxERERERERG6gAgAAAAAAAAAAAAAAAjhERERVVVVERERHoAAAAAAAAAAAAAIAKUREV6t+Xef2uURERoAgAAAAAAAAACA1REVrXliRu5k1pfaURFdCAAAAAAAAAgKERGvkkRCT8OUJEQpmlERoIAAAAAAAIChEb2UQiQiLTOUIkQkT/sRGggAAAAACAoRGnJCIiIkTzP0Ii8kRCmhEaCAAAAAgKERp0QiIiIkTzP0JNqmIkSaERoIAAAADREalCIiIiIiLTOdRtzp1G3ZoRHQAAAIBRGnQiRCIiQkLzPyRkypQvO9mhFYgACAoRt0JCkkIiIiJkRkQtOmSTyvR+EeCAgHEVlCIk5PQiIiRNTflk3U/sqUJHUR0IgOEa9CT6EUZCQiSawzrfJJ7KkkIvoRsIBxFZQiRNUVJkIiSew8zO1mrvREIkdRFwChGvQiJClRFNQiSawzM8OmaUad1EahGgBRX0IiT5b1FU1CSewzMzPK1Nrs70SVFQcRt0JEelr/UV3USewzM8M80pvDokR+EdoRr0IvsRpk9RVGSewzPDM87y3ZYiRqEa4RQiSVEedCL1FdJqw8yn7DzWJkQiItEbUV9E/hEa1CQpUVSezDqaPDzpREIiJJUVUVdE9REdIiJCdRXdo9eswzw9IkRERHsVUblPoRFfQiIkKVFV5vrMMzM9aZmZkp4REblJ4RFZQiIiQpURFdwzMzPNKqqq6p4REblHsREdIiIiJJoREdwzMzPN3MzMyn4RUbdHsREUZCIiJGoRG6wzMzM9bd3d0p4RUVdJ4REedCIiIk+rrTwzMzw/QiZmZHsVUV9PoRERTUIiIiT9o8MzMzypQiIiRJUV4RQk8RERV9QiJCT+wzMzMzzSIkIiTSEeoRr0nhERFUkkRCSewzMzM8qUTZJCT6EagRt0R1ERER5JkiSewzMzPD0tPORkSeEXCxX0QvUREREVUiSewzMzw9JCo8qUSVFQChGvRCmhERER7USawzPMPW/0ad0kahGgCBFXQiSdqu6tlESew8w60tqpRCIklRFwgOEa9CJC2ZliRERqwzrZRJPK9CJPoR4IiIUV8kIiREREIiJN3ZlC8i08qU0nURcICAoRt0IiIiIiIkRkRkRkNCbTyvR+EaCAAIBRGnQkIiIiIiSTP0T6ypQtu9mhFQgAAABxEalCIiIiJCSTPST6ymJG3ZoRHQAAAAgEERp0QiIiJCTzMiJk5GIkSaERoIAAAACAoRGnRCIiJCTzPSJCltJCmhEaCAAAAAAIChEb/0QiRCTzPSIiRET54RGggAAAAAAAgEURWp9EQiTzPSJERGelERoIAAAAAAAACAdREVr39kRuvURvf6URFdCAAAAAAAAAAIAKERFbpPmYeZkqtRERoAgAAAAAAAAAAAAAfhEREVW+61URERHnAAAAAAAAAAAAAAAIAHpRERERERERFacAgAAAAAAAAAAAAAAAiAANq1URERW60ACAAAAAAAAA") diff --git a/apps/crsclock/crsclock.js b/apps/crsclock/crsclock.js new file mode 100644 index 000000000..87de4aac5 --- /dev/null +++ b/apps/crsclock/crsclock.js @@ -0,0 +1,804 @@ + +// --- Circadian Wellness Clock for Bangle.js 2 --- +// File: crsclock.js + +const STORE_KEY = "crswellness"; +const STEPS_KEY = "w_steps"; +const HR_KEY = "w_hr"; +const LIGHT_KEY = "w_light"; +const SLEEP_START_KEY = "w_sleepstart"; +const VERSION = "1.2"; +const storage = require("Storage"); +const MAX_HISTORY_ENTRIES = 200; +const TREND_HOURS = 12; +const WRITE_DELAY = 5 * 60 * 1000; // delay before persisting history +let writeTimers = {}; + +function scheduleHistoryWrite(key, data) { + if (writeTimers[key]) clearTimeout(writeTimers[key]); + writeTimers[key] = setTimeout(() => { + storage.writeJSON(key, data); + writeTimers[key] = undefined; + }, WRITE_DELAY); +} + +// 1. PERSISTENT SETTINGS & HISTORICAL DATA + +let S = storage.readJSON(STORE_KEY, 1) || { + phaseOffset: 0, + hydrationInterval: 2 * 3600*1000, + lastHydration: Date.now(), + sleepStart: 23, + sleepEnd: 7, + colorTheme: 0, + notifications: { + hydration: true, + sleepDetection: true, + hrLogging: true, + hrPower: true + }, + bioTimeRefType: "DLMO", + bioTimeRefHour: 21, + bioTimeRefMinute: 0 +}; + +function pruneHistory(arr, maxHours) { + let cutoff = Date.now() - maxHours * 3600*1000; + while (arr.length && arr[0].t < cutoff) arr.shift(); + while (arr.length > MAX_HISTORY_ENTRIES) arr.shift(); +} + +let stepsHist = storage.readJSON(STEPS_KEY, 1) || []; +let prevStepCount = 0; +let stepResetOffset = 0; + +for (let e of stepsHist) { + if (e.s < prevStepCount) stepResetOffset += prevStepCount; + e.c = e.s + stepResetOffset; + prevStepCount = e.s; +} +let hrHist = storage.readJSON(HR_KEY, 1) || []; +let lightHist = storage.readJSON(LIGHT_KEY, 1) || []; +let sleepStartHist = storage.readJSON(SLEEP_START_KEY, 1) || []; +pruneHistory(stepsHist, 24); +pruneHistory(hrHist, 24); +pruneHistory(lightHist, 24); +pruneHistory(sleepStartHist, 24*7); + +// 2. COLOR THEMES + +const themes = [ + { bg:"#004080", fg:"#ffffff", accent:"#00e0e0" }, + { bg:"#105c30", fg:"#ffffff", accent:"#a0ff00" }, + { bg:"#20222a", fg:"#f5f5f5", accent:"#76d6ff" } +]; +let t = themes[S.colorTheme]; + +// Default font for stats displayed on the clock +const STATS_FONT_NAME = "Vector"; +const STATS_FONT_SIZE = 16; + +// 3. HELPERS & CALCULATIONS + +function getSleepWindowStr() { + let a = ("0"+S.sleepStart).substr(-2) + ":00"; + let b = ("0"+S.sleepEnd).substr(-2) + ":00"; + return a + "-" + b; +} + +function stability(arr, key, hours) { + let cutoff = Date.now() - hours * 3600*1000; + let vals = arr.filter(e => e.t > cutoff && typeof e[key] === "number") + .map(e => e[key]); + if (!vals.length) return 0; + let sum = vals.reduce((a,b)=>a+b, 0); + let mean = sum / vals.length; + let sd = Math.sqrt(vals.reduce((a,b)=>a + (b-mean)*(b-mean), 0) / vals.length); + let cv = mean ? sd/mean : 1; + let idx = 100 - cv*100; + return Math.max(0, Math.min(100, idx)); +} + +function computeCrs(offsetMs) { + let now = Date.now() - (offsetMs || 0); + let sArr = stepsHist.filter(e => e.t <= now && e.t > now - 24*3600*1000); + let hArr = hrHist.filter(e => e.t <= now && e.t > now - 24*3600*1000); + let parts = []; + + if (sArr.length) parts.push(stability(sArr, "c", 24)); + if (hArr.length) parts.push(stability(hArr, "bpm", 24)); + if (sleepStartHist.length >= 2) parts.push(sleepTimingScore()); + + let lh = estimateLightHours(); + if (typeof lh === "number" && !isNaN(lh)) { + let lhScore = Math.min(100, Math.max(0, (lh / 12) * 100)); + parts.push(lhScore); + } + + if (!parts.length) return 0; + let avg = parts.reduce((a,b)=>a+b,0) / parts.length; + return Math.round(avg); +} + +let crsByHour = []; +let lastCrsUpdateTime = 0; +function updateCrsCache() { + if (Date.now() - lastCrsUpdateTime < 5*60*1000 && crsByHour.length === TREND_HOURS) return; + crsByHour = []; + for (let i=0; i e.t > cutoff).map(e => e.bpm); + if (!vals.length) return 3; // No Data + let mean = vals.reduce((a,b) => a+b, 0) / vals.length; + let sd = Math.sqrt(vals.reduce((a,b) => a + (b-mean)*(b-mean), 0) / vals.length); + if (sd < 2.5) return 0; // Calm + if (sd < 5) return 1; // Neutral + if (sd < 12) return 2; // Stressed + return 3; // No Data/undefined +} + +// Estimate daylight exposure in hours based solely on step data +function estimateLightHours() { + let now = Date.now(); + let start = now - 24*3600*1000; + function inSleepWindow(h) { + if (S.sleepStart < S.sleepEnd) + return h >= S.sleepStart && h < S.sleepEnd; + return h >= S.sleepStart || h < S.sleepEnd; + } + let hourMap = {}; + let count = 0; + for (let e of stepsHist) { + if (e.t < start) continue; + let d = new Date(e.t); + let hr = d.getHours(); + if (hr < 7 || hr > 19) continue; + if (inSleepWindow(hr)) continue; + let key = Math.floor(e.t / 3600000); + if (!hourMap[key]) { + hourMap[key] = true; + count++; + } + } + return count; +} + +function getStepsLast24h() { + let cutoff = Date.now() - 24*3600*1000; + let arr = stepsHist.filter(e => e.t > cutoff).map(e=>e.c); + return arr.length>1 ? (arr[arr.length-1] - arr[0]) : 0; +} + +function sleepTimingScore() { + return stability(sleepStartHist, "h", 7); +} + +let saveTimeout = null; +function saveSettings() { + if (saveTimeout) return; + saveTimeout = setTimeout(() => { + saveTimeout = null; + storage.writeJSON(STORE_KEY, S); + }, 2000); +} + +// 4. SENSORS & LOGGING (BATTERY-SAFE) + +let hrmEnabled = false; +function onHrmSample(hrm) { + if (typeof hrm.bpm === "number" && hrm.bpm > 0 && S.notifications.hrLogging) { + hrHist.push({ t: Date.now(), bpm: hrm.bpm }); + pruneHistory(hrHist, 24); + scheduleHistoryWrite(HR_KEY, hrHist); + } +} +function enableHrmIfNeeded() { + if (!hrmEnabled && S.notifications.hrPower && S.notifications.hrLogging) { + hrmEnabled = true; + Bangle.setHRMPower(1); + Bangle.on("HRM", onHrmSample); + } +} +function disableHrm() { + if (hrmEnabled) { + hrmEnabled = false; + Bangle.removeListener("HRM", onHrmSample); + Bangle.setHRMPower(0); + } +} + +// Steps +Bangle.on("step",(s) => { + if (s < prevStepCount) stepResetOffset += prevStepCount; + prevStepCount = s; + let c = s + stepResetOffset; + stepsHist.push({ t: Date.now(), s, c }); + pruneHistory(stepsHist, 24); + scheduleHistoryWrite(STEPS_KEY, stepsHist); +}); + +// Light sensor +function sampleLight() { + let env = Bangle.getHealthStatus().light; + if (env !== undefined) { + lightHist.push({ t: Date.now(), light: env }); + pruneHistory(lightHist, 24); + scheduleHistoryWrite(LIGHT_KEY, lightHist); + } +} +setInterval(sampleLight, 300*1000); +if (Bangle.isLCDOn()) sampleLight(); + +// Sleep/Wake Detection +let isSleeping = false, pendingSleepAlert = false, pendingWakeAlert = false; +function checkSleepWake() { + if (!S.notifications.sleepDetection) return; + let now = Date.now(); + let windowStart = now - 30*60*1000; // 30 min ago + let arr = stepsHist.filter(e => e.t >= windowStart).map(e => e.c); + let delta = arr.length>1 ? (arr[arr.length-1] - arr[0]) : 0; + let moving = Bangle.isMoving ? Bangle.isMoving() : true; + let asleep = (delta < 5) && !moving; + if (!isSleeping && asleep) { + isSleeping = true; + S.sleepStart = (new Date()).getHours(); + sleepStartHist.push({ t: now, h: S.sleepStart }); + pruneHistory(sleepStartHist, 24*7); + scheduleHistoryWrite(SLEEP_START_KEY, sleepStartHist); + pendingSleepAlert = true; + saveSettings(); + } else if (isSleeping && !asleep) { + isSleeping = false; + S.sleepEnd = (new Date()).getHours(); + pendingWakeAlert = true; + saveSettings(); + } +} +setInterval(() => { + if (Bangle.isLCDOn()) checkSleepWake(); +}, 15*60*1000); + +// Hydration Reminder +let pendingHydrationAlert = false; +function remindHydration() { + if (!S.notifications.hydration) return; + Bangle.buzz(); + pendingHydrationAlert = true; + S.lastHydration = Date.now(); + saveSettings(); +} +setInterval(() => { + if (Date.now() - S.lastHydration >= S.hydrationInterval) { + remindHydration(); + } +}, 60*1000); + +// LCD events +Bangle.on("lcdPower",(on) => { + if (on) { + enableHrmIfNeeded(); + drawClock(); + } else { + disableHrm(); + } +}); +if (Bangle.isLCDOn()) enableHrmIfNeeded(); + +// ----- DISPLAY HELPERS ----- +function drawStat(text, y, g) { + const left = 5; + g.drawString(text, left, y); +} + +// 5. DRAW CLOCK SCREEN + +function drawClock() { + g.clear(); + Bangle.drawWidgets(); + let w = g.getWidth(), h = g.getHeight(); + + // Alerts + if (pendingHydrationAlert) { + pendingHydrationAlert = false; + E.showAlert("Time to hydrate!").then(() => { + drawClock(); Bangle.setUI(uiOpts); + }); return; + } + if (pendingSleepAlert) { + pendingSleepAlert = false; + E.showAlert("Sleep detected at " + computeBioTime()).then(() => { + drawClock(); Bangle.setUI(uiOpts); + }); return; + } + if (pendingWakeAlert) { + pendingWakeAlert = false; + E.showAlert("Wake detected at " + computeBioTime()).then(() => { + drawClock(); Bangle.setUI(uiOpts); + }); return; + } + + // ----- HEADER STRIP ----- + let headerH = 44; + g.setColor(t.bg); + g.fillRect(0, 24, w, 24 + headerH); + + // ----- TIME ----- + g.setFont("Vector", 32); + let bt = computeBioTime(); + let tw = g.stringWidth(bt); + let xPos = (w - tw) / 2; + let yPos = 24 + (headerH - g.getFontHeight()) / 2; + // Shadow (black, offset) + g.setColor("#000"); + g.drawString(bt, xPos + 2, yPos + 2); + // Main time + g.setColor(t.fg); + g.drawString(bt, xPos, yPos); + + // ----- STATS ----- + let statsY = 24 + headerH + 8; + let crVal = computeCrs(0); + let cr = (isNaN(crVal) || crVal === null || typeof crVal === "undefined") ? "N/A" : crVal; + let stVal = getStepsLast24h(); + if (stVal <= 0 || isNaN(stVal)) stVal = null; + let emo = detectEmotion(); + let lightHoursVal = estimateLightHours(); + let lightHours = (isNaN(lightHoursVal) ? "N/A" : lightHoursVal + "h"); + let moodText = ["Calm","Neutral","Stressed","N/A"]; + + g.setFont(STATS_FONT_NAME, STATS_FONT_SIZE); + g.setColor("#000"); + let y = statsY; + drawStat("CRS: " + cr, y, g); y += 18; + if (stVal !== null) { drawStat("Steps: " + stVal, y, g); y += 18; } + drawStat("Mood: " + moodText[emo], y, g); y += 18; + drawStat("Light: " + lightHours, y, g); + + // ----- Footer & menu hint ----- + g.drawLine(0, h-20, w, h-20); + g.setFont("6x8", 1); + g.setColor("#000"); + g.drawString("Menu: btn1/tap/swipe", 10, h-18); +} + +// 6. VIEW TREND CHART + +function showTrend() { + let w = g.getWidth(), h = g.getHeight(); + g.setColor(t.bg); g.fillRect(0, 24, w, h); + g.setFont("Vector", 20); + let title = "CRS Trend (" + TREND_HOURS + "h)"; + let tw = g.stringWidth(title); + g.setColor(t.fg); + g.drawString(title, (w - tw)/2, 28); + if (!stepsHist.length && !hrHist.length) { + g.setFont("6x8", 2); + let msg = "No data to show"; + let mw = g.stringWidth(msg); + g.drawString(msg, (w - mw)/2, h/2); + g.setFont("6x8", 1); + g.drawString("Tap to return", 10, h-12); + Bangle.setUI(uiOpts); + Bangle.on('touch', function tapCB() { + Bangle.removeListener('touch', tapCB); + drawClock(); + Bangle.setUI(uiOpts); + }); + return; + } + updateCrsCache(); + let i = 0; + function drawNextBar() { + if (i >= TREND_HOURS) { + g.setColor(t.fg); + g.setFont("6x8", 1); + g.drawString("Tap to return", 10, h-12); + Bangle.setUI(uiOpts); + Bangle.on('touch', function tapCB() { + Bangle.removeListener('touch', tapCB); + drawClock(); + Bangle.setUI(uiOpts); + }); + return; + } + let barW = Math.floor(w / TREND_HOURS); + let val = crsByHour[i]; + let barH = Math.round((val/100) * (h - 60)); + let x = i * barW; + let y = h - barH - 24; + g.setColor(t.accent); + g.fillRect(x, y, x + barW - 2, h - 24); + i++; + setTimeout(drawNextBar, 0); + } + drawNextBar(); +} + +// 7. MENU & SETTINGS (no change to your logic) + +function showStats() { + let bt = computeBioTime(), + cr = computeCrs(0), + st = getStepsLast24h(), + emo = detectEmotion(), + lightH = estimateLightHours(), + moodText = ["Calm","Neutral","Stressed","N/A"]; + E.showAlert( + "BioTime: " + bt + "\n" + + "CRS: " + cr + "\n" + + "Steps: " + st + "\n" + + "Mood: " + moodText[emo] + "\n" + + "Light: " + lightH + "h", + "Today's Stats" + ).then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); +} + +function exportData() { + let exportObj = { + timestamp: new Date().toISOString(), + steps: stepsHist, + hr: hrHist, + light: lightHist, + sleepStart: sleepStartHist, + sleepWindow: { start: S.sleepStart, end: S.sleepEnd }, + phaseOffset: S.phaseOffset, + colorTheme: S.colorTheme, + notifications: S.notifications, + bioTimeRefType: S.bioTimeRefType, + bioTimeRefHour: S.bioTimeRefHour, + bioTimeRefMinute:S.bioTimeRefMinute + }; + let json = JSON.stringify(exportObj, null, 2); + let filename = "crs_export.json"; + storage.write(filename, json); + E.showAlert(`Exported to\n"${filename}"\n(${json.length} bytes)`).then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); +} + +function confirmResetAllData() { + E.showPrompt("Reset all data?").then(res => { + if (!res) { + drawClock(); + Bangle.setUI(uiOpts); + return; + } + storage.erase(STORE_KEY); + storage.erase(STEPS_KEY); + storage.erase(HR_KEY); + storage.erase(LIGHT_KEY); + storage.erase(SLEEP_START_KEY); + S = { + phaseOffset: 0, + hydrationInterval: 2 * 3600*1000, + lastHydration: Date.now(), + sleepStart: 23, + sleepEnd: 7, + colorTheme: 0, + notifications: { + hydration: true, + sleepDetection: true, + hrLogging: true, + hrPower: true + }, + bioTimeRefType: "DLMO", + bioTimeRefHour: 21, + bioTimeRefMinute: 0 + }; + // Persist defaults so they survive a restart + saveSettings(); + // Optionally bypass the delayed save + storage.writeJSON(STORE_KEY, S); + stepsHist = []; hrHist = []; lightHist = []; sleepStartHist = []; + prevStepCount = 0; stepResetOffset = 0; + t = themes[S.colorTheme]; + E.showAlert("All app data cleared").then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + }); +} + +// Menu logic: Sleep window, hydration, BT calibration, theme, notifications, bio ref, about - unchanged, use as before + +function setSleepWindow() { + let menu = { "": { title: "Select Start Hour" } }; + for (let hr = 0; hr < 24; hr++) { + let label = (hr<10?"0":"") + hr; + menu[label] = ((h) => () => { + S.sleepStart = h; + saveSettings(); + showEndHourSelector(); + })(hr); + } + menu.Back = () => { + drawClock(); + Bangle.setUI(uiOpts); + }; + E.showMenu(menu); + + function showEndHourSelector() { + let em = { "": { title: "Select End Hour" } }; + for (let eh = 0; eh < 24; eh++) { + let lab2 = (eh<10?"0":"") + eh; + em[lab2] = ((e) => () => { + S.sleepEnd = e; + saveSettings(); + E.showAlert("Sleep window set: " + getSleepWindowStr()).then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + })(eh); + } + em.Back = () => { + drawClock(); + Bangle.setUI(uiOpts); + }; + E.showMenu(em); + } +} + +function setHydrationMenu() { + let m = { "": { title: "Hydration" } }; + m["Remind Now"] = () => { + remindHydration(); + drawClock(); + Bangle.setUI(uiOpts); + }; + m["Set Interval"] = setHydrationInterval; + m.Back = () => { + drawClock(); + Bangle.setUI(uiOpts); + }; + E.showMenu(m); +} +function setHydrationInterval() { + let m = { "": { title: "Set Hydration Interval" } }; + for (let h = 1; h <= 12; h++) { + let label = h + "h"; + m[label] = ((hours) => () => { + S.hydrationInterval = hours * 3600*1000; + S.lastHydration = Date.now(); + saveSettings(); + E.showAlert("Interval set: " + label).then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + })(h); + } + m.Off = () => { + S.hydrationInterval = Infinity; + saveSettings(); + E.showAlert("Hydration off").then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + }; + m.Back = () => { + drawClock(); + Bangle.setUI(uiOpts); + }; + E.showMenu(m); +} +function calibrateBT() { + let m = { "": { title: "Calibrate BT" } }; + for (let d = 1; d <= 8; d++) { + m["+" + d + "h"] = (() => () => { + S.phaseOffset += d; + saveSettings(); + E.showAlert("Offset now: " + (S.phaseOffset>=0? "+"+S.phaseOffset : S.phaseOffset) + "h").then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + })(d); + m["-" + d + "h"] = (() => () => { + S.phaseOffset -= d; + saveSettings(); + E.showAlert("Offset now: " + (S.phaseOffset>=0? "+"+S.phaseOffset : S.phaseOffset) + "h").then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + })(d); + } + m["Reset Offset"] = () => { + S.phaseOffset = 0; + saveSettings(); + E.showAlert("Offset reset to 0h").then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + }; + m.Back = () => { + drawClock(); + Bangle.setUI(uiOpts); + }; + E.showMenu(m); +} +function setTheme() { + let m = { "": { title: "Select Theme" } }; + m.Blue = () => { S.colorTheme = 0; applyTheme(); }; + m.Green = () => { S.colorTheme = 1; applyTheme(); }; + m.Dark = () => { S.colorTheme = 2; applyTheme(); }; + m.Back = () => { + drawClock(); + Bangle.setUI(uiOpts); + }; + E.showMenu(m); + + function applyTheme() { + t = themes[S.colorTheme]; + saveSettings(); + drawClock(); + Bangle.setUI(uiOpts); + } +} +function showNotificationSettings() { + let m = { "": { title: "Notifications" } }; + m["Hydration"] = { + value: S.notifications.hydration, + format: v => v ? "On" : "Off", + onchange: v => { + S.notifications.hydration = v; + saveSettings(); + } + }; + m["Sleep Detection"] = { + value: S.notifications.sleepDetection, + format: v => v ? "On" : "Off", + onchange: v => { + S.notifications.sleepDetection = v; + saveSettings(); + } + }; + m["HR Logging"] = { + value: S.notifications.hrLogging, + format: v => v ? "On" : "Off", + onchange: v => { + S.notifications.hrLogging = v; + if (!v) disableHrm(); + saveSettings(); + } + }; + m["HR Monitoring"] = { + value: S.notifications.hrPower, + format: v => v ? "On" : "Off", + onchange: v => { + S.notifications.hrPower = v; + if (v) enableHrmIfNeeded(); + else disableHrm(); + saveSettings(); + } + }; + m.Back = () => { + showSettings(); + }; + E.showMenu(m); +} +function setBioTimeReference() { + let m = { "": { title: "BioTime Reference" } }; + m.DLMO = () => { + S.bioTimeRefType = "DLMO"; + saveSettings(); + promptRefTime(); + }; + m.CBTmin = () => { + S.bioTimeRefType = "CBTmin"; + saveSettings(); + promptRefTime(); + }; + m.Back = () => { + showSettings(); + }; + E.showMenu(m); + + function promptRefTime() { + E.showPrompt("Hour (0-23)?").then(h => { + if (h===undefined || h<0 || h>23) { + E.showAlert("Invalid hour").then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + return; + } + S.bioTimeRefHour = h; + E.showPrompt("Minute (0-59)?").then(m => { + if (m===undefined || m<0 || m>59) { + E.showAlert("Invalid minute").then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + return; + } + S.bioTimeRefMinute = m; + saveSettings(); + E.showAlert(`Reference set: ${S.bioTimeRefType} @ ${("0"+h).substr(-2)}:${("0"+m).substr(-2)}`) + .then(() => { + drawClock(); + Bangle.setUI(uiOpts); + }); + }); + }); + } +} +function showAbout() { + E.showAlert( + "Circadian Wellness Clock v" + VERSION + "\n" + + "Displays your CRS and BioTime.\n" + + "Copyright 2025" + ).then(()=>{ + drawClock(); + Bangle.setUI(uiOpts); + }); +} +function showSettings() { + const menu = { + "": { title: "Settings" }, + "Sleep Window": setSleepWindow, + "Hydration": setHydrationMenu, + "Calibrate BT": calibrateBT, + "Theme": setTheme, + "Notifications": showNotificationSettings, + "BioTime Ref": setBioTimeReference, + "About / Version": showAbout, + "Back": () => { + drawClock(); + Bangle.setUI(uiOpts); + } + }; + E.showMenu(menu); +} + +// MAIN MENU & UI HOOKUP +const menuOpts = { + "": { title: "Main Menu" }, + "Show Stats": showStats, + "View Trend": showTrend, + "Sleep Window": setSleepWindow, + "Hydration": setHydrationMenu, + "Calibrate BT": calibrateBT, + "Export Data": exportData, + "Theme": setTheme, + "About": showAbout, + "Go to Launcher": () => Bangle.showLauncher(), + "Reset All Data": confirmResetAllData, + "Exit": () => Bangle.showClock() +}; + +const uiOpts = { + mode: "custom", + clock: false, + btn: () => E.showMenu(menuOpts), + touch: () => E.showMenu(menuOpts), + swipe: () => E.showMenu(menuOpts) +}; + +// 9. INITIALIZE + +Bangle.setUI(uiOpts); +Bangle.loadWidgets(); +drawClock(); + +setInterval(() => { + if (Bangle.isLCDOn()) drawClock(); +}, 60*1000); + +// END diff --git a/apps/crsclock/icon.png b/apps/crsclock/icon.png new file mode 100644 index 000000000..231da6a33 Binary files /dev/null and b/apps/crsclock/icon.png differ diff --git a/apps/crsclock/metadata.json b/apps/crsclock/metadata.json new file mode 100644 index 000000000..631a0985a --- /dev/null +++ b/apps/crsclock/metadata.json @@ -0,0 +1,16 @@ +{ + "id": "crsclock", + "name": "Circadian Rhythm Clock", + "shortName":"Circadian", + "version": "0.06", + "description": "Shows CRS (Circadian Rhythm Score), steps, mood, and light exposure.", + "icon": "icon.png", + "type": "clock", + "tags": "clock", + "supports": ["BANGLEJS2"], + "readme": "README.md", + "storage": [ + { "name": "crsclock.app.js", "url": "crsclock.js" }, + { "name": "crsclock.img", "url":"app-icon.js","evaluate":true } + ] +} diff --git a/apps/cutelauncher/ChangeLog b/apps/cutelauncher/ChangeLog new file mode 100644 index 000000000..613cab097 --- /dev/null +++ b/apps/cutelauncher/ChangeLog @@ -0,0 +1,2 @@ +0.01: New app introduced to the app loader! +0.02: Clear cached app list when updating showClocks setting diff --git a/apps/cutelauncher/app-icon.js b/apps/cutelauncher/app-icon.js new file mode 100644 index 000000000..4798f2299 --- /dev/null +++ b/apps/cutelauncher/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("lUvwIFCjwKDj/gAgf+Agf/BQUP+f8AgXwn/AAgP4gYKBAgMAv/Ag4EBAQIECBQODDgfxAgUA/wxIAgIUD///GIX/HgUP/f8GII2B/4xDIoN/w/4JgIXB/hKCEwX/DoIEBLQQlC+B9CCgUHwAUCgJFBCgV4Cix3BCgMH74UCgfn+AUBgZZBCgIjBWoMegP+AIMHwKGBn/h8ISBgf+vAEBBQPeAgUDRQKaCv//IgIzBAgYKBAgZTCAAoA=")) \ No newline at end of file diff --git a/apps/cutelauncher/app.js b/apps/cutelauncher/app.js new file mode 100644 index 000000000..464d137b3 --- /dev/null +++ b/apps/cutelauncher/app.js @@ -0,0 +1,207 @@ +{ + let s = require('Storage'); + let settings = Object.assign( + { + showClocks: false, + scrollbar: true + }, + s.readJSON('cutelauncher.settings.json', true) || {} + ); + + // Borrowed caching from Icon Launcher, code by halemmerich. + let launchCache = s.readJSON('launch.cache.json', true) || {}; + let launchHash = s.hash(/\.info/) + JSON.stringify(settings).length; + if (launchCache.hash != launchHash) { + launchCache = { + hash: launchHash, + apps: s + .list(/\.info$/) + .map((app) => { + var a = s.readJSON(app, 1); + return a && { name: a.name, type: a.type, icon: a.icon, sortorder: a.sortorder, src: a.src }; + }) + .filter((app) => app && (app.type == 'app' || (app.type == 'clock' && settings.showClocks) || !app.type)) + .sort((a, b) => { + var n = (0 | a.sortorder) - (0 | b.sortorder); + if (n) return n; // do sortorder first + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + return 0; + }), + }; + s.writeJSON('launch.cache.json', launchCache); + } + let apps = launchCache.apps; + apps.forEach((app) => { + if (app.icon) app.icon = s.read(app.icon); + else app.icon = s.read('placeholder.img'); + }); + + require('Font8x16').add(Graphics); + Bangle.drawWidgets = () => { }; + Bangle.loadWidgets = () => { }; + + const ITEM_HEIGHT = 95; + + // Create scroll indicator overlay + const overlayWidth = 30; + const overlayHeight = 35; + const overlay = Graphics.createArrayBuffer(overlayWidth, overlayHeight, 16, { msb: true }); + + // Function to create app backdrop + function createAppBackdrop(y) { + return [ + 58, y + 5, // Top edge + 118, y + 5, + 133 - 15 * 0.7, y + 5, + 133 - 15 * 0.4, y + 5 + 15 * 0.1, + 133 - 15 * 0.1, y + 5 + 15 * 0.4, // Top right corner + 133, y + 5 + 15 * 0.7, + 133, y + 20, + 133, y + 75, // Right edge + 133, y + 90 - 15 * 0.7, + 133 - 15 * 0.1, y + 90 - 15 * 0.4, + 133 - 15 * 0.4, y + 90 - 15 * 0.1, // Bottom right corner + 133 - 15 * 0.7, y + 90, + 118, y + 90, + 58, y + 90, // Bottom edge + 43 + 15 * 0.7, y + 90, + 43 + 15 * 0.4, y + 90 - 15 * 0.1, + 43 + 15 * 0.1, y + 90 - 15 * 0.4, // Bottom left corner + 43, y + 90 - 15 * 0.7, + 43, y + 75, + 43, y + 20, // Left edge + 43, y + 5 + 15 * 0.7, + 43 + 15 * 0.1, y + 5 + 15 * 0.4, + 43 + 15 * 0.4, y + 5 + 15 * 0.1, // Top left corner + 43 + 15 * 0.7, y + 5 + ]; + } + + // Helper function for creating rounded rectangle points + function createRoundedRectPoints(x1, y1, x2, y2, r) { + return [ + x1 + r, y1, // Top edge + x2 - r, y1, + x2 - r * 0.7, y1, + x2 - r * 0.4, y1 + r * 0.1, + x2 - r * 0.1, y1 + r * 0.4, // Top right corner + x2, y1 + r * 0.7, + x2, y1 + r, + x2, y2 - r, // Right edge + x2, y2 - r * 0.7, + x2 - r * 0.1, y2 - r * 0.4, + x2 - r * 0.4, y2 - r * 0.1, // Bottom right corner + x2 - r * 0.7, y2, + x2 - r, y2, + x1 + r, y2, // Bottom edge + x1 + r * 0.7, y2, + x1 + r * 0.4, y2 - r * 0.1, + x1 + r * 0.1, y2 - r * 0.4, // Bottom left corner + x1, y2 - r * 0.7, + x1, y2 - r, + x1, y1 + r, // Left edge + x1, y1 + r * 0.7, + x1 + r * 0.1, y1 + r * 0.4, + x1 + r * 0.4, y1 + r * 0.1, // Top left corner + x1 + r * 0.7, y1 + ]; + } + + // Update initScrollIndicator to use the new function + function initScrollIndicator() { + overlay.setBgColor(g.theme.bg).clear(); + const points = createRoundedRectPoints(0, 0, overlayWidth, overlayHeight, 10); + overlay.setColor(g.theme.bgH).fillPoly(points); + + // Add horizontal lines for scroll thumb aesthetic with outlines + const lineY1 = overlayHeight / 3; + const lineY2 = overlayHeight * 2 / 3; + const lineLeft = 9; + const lineRight = overlayWidth - 9; + + // Draw inner lines (increased from ±1 to ±2) + overlay.setColor(g.theme.fg2); + overlay.fillRect(lineLeft - 2, lineY1 - 1, lineRight + 2, lineY1 + 1); + overlay.fillRect(lineLeft - 2, lineY2 - 1, lineRight + 2, lineY2 + 1); + + overlay.fillRect(lineLeft, lineY1 - 2, lineRight, lineY1 + 2); + overlay.fillRect(lineLeft, lineY2 - 2, lineRight, lineY2 + 2); + } + initScrollIndicator(); + + // Function to update scroll indicator + function updateScrollIndicator(idx) { + const marginX = 1; + const marginY = 5; + let scrollPercent = (idx) / (apps.length - 1); + let scrollableHeight = g.getHeight() - marginY * 2 - overlayHeight; + let indicatorY = scrollPercent * scrollableHeight + marginY; + + Bangle.setLCDOverlay(overlay, g.getWidth() - overlayWidth - marginX, indicatorY, { id: "scrollIndicator" }); + } + + let prev_idx = -1; + let second_call = false; + + E.showScroller({ + h: ITEM_HEIGHT, + c: apps.length, + draw: (idx, rect) => { + g.setFontAlign(0, -1, 0).setFont('8x16'); + // Calculate icon dimensions + let icon = apps[idx].icon; + let iconSize = 48; + // Define rectangle size (independent of icon size) + const rectSize = 80; + const rectX = 48; + + // Draw rounded rectangle background using the new function + const points = createAppBackdrop(rect.y); + g.setColor(g.theme.bg2).fillPoly(points); + + // Draw icon centered in the top portion + let iconPadding = 8; + // Center icon within the rectangle + let iconXInRect = rectX + (rectSize - iconSize) / 2; + g.setColor(g.theme.fg).setBgColor(g.theme.bg2).drawImage(icon, iconXInRect, rect.y + iconPadding + 8); + + // Draw app name with ellipsis if too long + const maxWidth = rectSize - 8; + let text = apps[idx].name; + let textWidth = g.stringWidth(text); + if (textWidth > maxWidth) { + const ellipsis = "..."; + const ellipsisWidth = g.stringWidth(ellipsis); + while (textWidth + ellipsisWidth > maxWidth && text.length > 0) { + text = text.slice(0, -1); + textWidth = g.stringWidth(text); + } + text = text + ellipsis; + } + let textY = rect.y + iconPadding + iconSize + 15; + g.drawString(text, rectX + rectSize / 2, textY); + if (idx != prev_idx && !second_call && settings.scrollbar) { + updateScrollIndicator(idx); + if (prev_idx == -1) second_call = true; + prev_idx = idx; + } else if (second_call) second_call = false; + }, + select: (idx) => { + // Launch the selected app + load(apps[idx].src); + }, + remove: () => { + // Remove button handler + setWatch(() => { }, BTN1); + // Remove lock handler + Bangle.removeListener('lock'); + // Clear the scroll overlay + Bangle.setLCDOverlay(); + } + }); + + setWatch(Bangle.showClock, BTN1, { debounce: 100 }); + // Add lock handler to show clock when locked + Bangle.on('lock', (on) => { if (on) Bangle.showClock(); }); +} diff --git a/apps/cutelauncher/app.png b/apps/cutelauncher/app.png new file mode 100644 index 000000000..3580b4895 Binary files /dev/null and b/apps/cutelauncher/app.png differ diff --git a/apps/cutelauncher/metadata.json b/apps/cutelauncher/metadata.json new file mode 100644 index 000000000..b9c586db8 --- /dev/null +++ b/apps/cutelauncher/metadata.json @@ -0,0 +1,38 @@ +{ + "id": "cutelauncher", + "name": "Cute Launcher", + "shortName": "Cute Launcher", + "version": "0.02", + "description": "A simple launcher app for Bangle.js 2 that makes use of the full touchscreen", + "icon": "app.png", + "type": "launch", + "tags": "tool,system,launcher", + "screenshots": [ + { + "url": "screenshot.png" + } + ], + "supports": [ + "BANGLEJS2" + ], + "storage": [ + { + "name": "cutelauncher.app.js", + "url": "app.js" + }, + { + "name": "cutelauncher.img", + "url": "app-icon.js", + "evaluate": true + }, + { + "name": "cutelauncher.settings.js", + "url": "settings.js" + } + ], + "data": [ + { + "name": "cutelauncher.settings.json" + } + ] +} diff --git a/apps/cutelauncher/screenshot.png b/apps/cutelauncher/screenshot.png new file mode 100644 index 000000000..037dd08f3 Binary files /dev/null and b/apps/cutelauncher/screenshot.png differ diff --git a/apps/cutelauncher/settings.js b/apps/cutelauncher/settings.js new file mode 100644 index 000000000..2edb56028 --- /dev/null +++ b/apps/cutelauncher/settings.js @@ -0,0 +1,38 @@ +(function (back) { + const SETTINGS_FILE = "cutelauncher.settings.json"; + + // initialize with default settings... + const storage = require('Storage'); + let settings = { + showClocks: false, + scrollbar: true + }; + let saved_settings = storage.readJSON(SETTINGS_FILE, 1) || settings; + for (const key in saved_settings) { + settings[key] = saved_settings[key]; + } + + function save() { + storage.write(SETTINGS_FILE, settings); + } + + E.showMenu({ + '': { 'title': 'Cutelauncher' }, + '< Back': back, + 'Show Clocks': { + value: settings.showClocks, + onchange: () => { + settings.showClocks = !settings.showClocks; + save(); + storage.erase("launch.cache.json"); //delete the cache app list + } + }, + 'Scrollbar': { + value: settings.scrollbar, + onchange: () => { + settings.scrollbar = !settings.scrollbar; + save(); + } + } + }); +}) diff --git a/apps/daisy/ChangeLog b/apps/daisy/ChangeLog index 3d8ef0472..0f7e01ccb 100644 --- a/apps/daisy/ChangeLog +++ b/apps/daisy/ChangeLog @@ -12,3 +12,6 @@ 0.12: Added setting to change Battery estimate to hours 0.13: Fixed Battery estimate Default to percentage and improved setting string 0.14: Use `power_usage` module +0.15: Ring can now show hours, minute, or seconds hand, day/night left, or battery; Allowed for 12hr time; Ring now goes up in 5% increments; Step goal can be changed; The info that is set on the watchface will retain when leaving the face +0.16: Ring is now dynamically-created, rather than displaying pre-rendered rings; Seconds update every second; Ability to see Day ring; Settings options moved around to avoid popping of Steps option disappearing when not used; In Sun setting, ring is fully illuminated between during all of sunrise and sunset. +0.17: Made the display show three rings with different ring displays. \ No newline at end of file diff --git a/apps/daisy/README.md b/apps/daisy/README.md index 5599d313c..66c5d4ce8 100644 --- a/apps/daisy/README.md +++ b/apps/daisy/README.md @@ -4,11 +4,10 @@ cyclic information line that includes, day, date, steps, battery, sunrise and sunset times* -Written by: [Hugh Barney](https://github.com/hughbarney) For support -and discussion please post in the [Bangle JS -Forum](http://forum.espruino.com/microcosms/1424/) +Written by: [Hugh Barney](https://github.com/hughbarney) and [David Volovskiy](https://github.com/voloved) +For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/) -* Derived from [The Ring](https://banglejs.com/apps/?id=thering) proof of concept and the [Pastel clock](https://banglejs.com/apps/?q=pastel) +* Derived from [The Ring](https://banglejs.com/apps/?id=thering) proof of concept and the [Pastel clock](https://banglejs.com/apps/?q=pastel), though all rings are dynamically created. * Includes the [Lazybones](https://banglejs.com/apps/?q=lazybones) Idle warning timer * Touch the top right/top left to cycle through the info display (Day, Date, Steps, Sunrise, Sunset, Heart Rate, Battery Estimate) * The heart rate monitor is turned on only when Heart rate is selected and will take a few seconds to settle @@ -18,9 +17,22 @@ See [#1248](https://github.com/espruino/BangleApps/issues/1248) * Uses mylocation.json from MyLocation app to calculate sunrise and sunset times for your location * If your Sunrise, Sunset times look odd make sure you have setup your location using [MyLocation](https://banglejs.com/apps/?id=mylocation) -* The screen is updated every minute to save battery power +* The screen is updated every minute to save battery power, unless a ring is set to display seconds or steps. * Uses the [BloggerSansLight](https://www.1001fonts.com/rounded-fonts.html?page=3) font, which if free for commercial use * You need to run >2V22 to show the battery estimate in hours +* In the settings, the rings can be set to: + * Hours - Displays the ring as though it's the hour hand on an analog clock. + * Minutes - Displays the ring as though it's the minute hand on an analog clock. + * Seconds - Displays the ring as though it's the seconds hand on an analog clock. This option uses far more battery than any other option as it updates the screen 60 times more often. + * Day - Displays the ring as how much of the day is left. Functionally, it fills the ring half as quickly as the Hours option. + * Steps - Displays the ring as the amount of steps taken that day out of Step Target setting. + * Battery - Displays the ring as the amount of battery percentage left. + * Sun - Displays the ring as the amount of time that has passed from sunrise to sunset in the day and the amount of time between sunset and sunrise at night. +* The rings have the following displays + * None - Don't display the ring at all. + * Full - Display a full circle, where the filled-in part of the circle's color differs with the unfilled section. + * Semi - Similar to full, but the unfilled section does not display. + * C - Displays a full circle with a notch. ## Future Development * Use mini icons in the information line rather that text @@ -30,5 +42,6 @@ See [#1248](https://github.com/espruino/BangleApps/issues/1248) ## Screenshots ![](screenshot_daisy1.png) ![](screenshot_daisy3.png) +![](screenshot_daisy4.png) It is worth looking at the real thing though as the screenshots do not do it justice. diff --git a/apps/daisy/app.js b/apps/daisy/app.js index 4aa7eb132..d3e21ecc7 100644 --- a/apps/daisy/app.js +++ b/apps/daisy/app.js @@ -1,11 +1,15 @@ var SunCalc = require("suncalc"); // from modules folder +const storage = require('Storage'); const widget_utils = require('widget_utils'); +let settings = undefined; +let location = undefined; const SETTINGS_FILE = "daisy.json"; +const global_settings = storage.readJSON("setting.json", true) || {}; const LOCATION_FILE = "mylocation.json"; const h = g.getHeight(); const w = g.getWidth(); -let settings; -let location; +const rad = h/2; +const hyp = Math.sqrt(Math.pow(rad, 2) + Math.pow(rad, 2)); // variable for controlling idle alert let lastStep = getTime(); @@ -13,12 +17,26 @@ let warned = 0; let idle = false; let IDLE_MINUTES = 26; -let pal1; // palette for 0-40% -let pal2; // palette for 50-100% -const infoLine = (3*h/4) - 6; -const infoWidth = 56; -const infoHeight = 11; +var pals = Array(3).fill().map(() => ( + { pal1: null, // palette for 0-49% + pal2: null // palette for 50-100% + })); + +let palbg; +const infoLineDefault = (3*h/4) - 6; +const infoWidthDefault = 64; +const infoHeightDefault = 8; +const ringEdge = 4; +const ringIterOffset = 10; +const ringThick = 6; +const minStepToUpdate = 10; // In number of steps as a minumum to update the text. +const minStepPctUpdateRings = 3; // If the current step is less percent than last updated, don't redraw the rings +let nextUpdateMs; var drawingSteps = false; +var innerMostRing = 0; +var outerMostRing = 0; +var prevStepDisplayed = 0; +var prevRing = Array(3).fill().map(() => ({ start: null, end: null, max: null })); function log_debug(o) { //print(o); @@ -27,12 +45,37 @@ function log_debug(o) { var hrmImg = require("heatshrink").decompress(atob("i0WgIKHgPh8Ef5/g///44CBz///1///5A4PnBQk///wA4PBA4MDA4MH/+Ah/8gEP4EAjw0GA")); // https://www.1001fonts.com/rounded-fonts.html?page=3 +//one ring Graphics.prototype.setFontBloggerSansLight46 = function(scale) { // Actual height 46 (45 - 0) this.setFontCustom(atob("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4AAAAAAAA/AAAAAAAAPwAAAAAAAD4AAAAAAAAeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAAAAAH/gAAAAAAP/wAAAAAAf/gAAAAAAf/AAAAAAA//AAAAAAB/+AAAAAAD/8AAAAAAH/4AAAAAAH/wAAAAAAP/gAAAAAAf/gAAAAAA//AAAAAAB/+AAAAAAA/8AAAAAAAP4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///8AAAAP////4AAAP/////AAAH/////4AAD+AAAB/AAA8AAAAHwAAeAAAAA+AAHgAAAAHgADwAAAAB4AA8AAAAAPAAPAAAAADwADwAAAAA8AA8AAAAAPAAPAAAAADwAB4AAAAB4AAeAAAAAeAAHwAAAAPgAA/AAAAPwAAH/////4AAA/////8AAAH////+AAAAf///+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAPAAAAAAAAHwAAAAAAAB4AAAAAAAA+AAAAAAAAfAAAAAAAAHgAAAAAAAD4AAAAAAAB8AAAAAAAAeAAAAAAAAPgAAAAAAADwAAAAAAAB//////4AAf//////AAH//////gAA//////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAD4AAHAAAAD+AAD4AAAB/gAA8AAAB/4AAfAAAA/+AAHgAAAf3gAB4AAAPx4AA8AAAH4eAAPAAAD4HgADwAAB8B4AA8AAA+AeAAPAAAfAHgADwAAPgB4AA8AAHwAeAAHgAD4AHgAB4AD8AB4AAfAB+AAeAAD8B/AAHgAAf//gAB4AAH//wAAeAAAf/wAAHgAAB/wAAA4AAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AADgAAAAPAAB4AAAADwAAeAAAAA+AAHgAAAAHgAB4ABgAB4AAeAA8AAeAAHgA/AADwAB4AfwAA8AAeAP8AAPAAHgH/AADwAB4H7wAA8AAeD48AAPAAHh8PAAHgAB5+BwAB4AAe/AeAA+AAH/AHwAfAAB/gA/AfgAAfwAH//wAAHwAA//4AAA4AAH/8AAAAAAAf4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAD+AAAAAAAD/gAAAAAAH/4AAAAAAH/+AAAAAAP/ngAAAAAP/h4AAAAAf/AeAAAAAf/AHgAAAA/+AB4AAAA/+AAeAAAB/8AAHgAAA/8AAB4AAAP4AAAeAAAB4AAAHgAAAAAAAB4AAAAAAAAeAAAAAAP///4AAAAH////AAAAA////gAAAAP///4AAAAAAB4AAAAAAAAeAAAAAAAAHgAAAAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAD4AA8AAD///gAPAAB///4AD4AAf//+AAeAAH+APAAHgAB4AHgAA4AAeAB4AAOAAHgAcAADwAB4AHAAA8AAeADwAAPAAHgAcAADwAB4AHAAA8AAeAB4AAeAAHgAeAAHgAB4AHwAD4AAeAA+AB8AAHgAP4B+AAB4AB///gAAOAAP//gAABAAA//wAAAAAAD/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/gAAAAAB///4AAAAD////wAAAD////+AAAB/////4AAA/gPgB/AAAfgDwAHwAAPgA8AA+AADwAeAAHgAB4AHgAB4AAeAB4AAfAAHgAeAADwABwAHgAA8AAcAB4AAPAAHAAeAAHwAB4AHgAB4AAeAB8AAeAAHgAPAAPgAB4AD8APwAAOAAfwP4AADgAD//8AAAAAAf/+AAAAAAB/+AAAAAAAH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAB4AAAAAAAAeAAAAAAAAHgAAAAAAAB4AAAAA4AAeAAAAB/AAHgAAAB/wAB4AAAB/4AAeAAAD/4AAHgAAD/wAAB4AAH/wAAAeAAH/gAAAHgAP/gAAAB4AP/AAAAAeAf/AAAAAHgf+AAAAAB4/+AAAAAAe/8AAAAAAH/8AAAAAAB/4AAAAAAAf4AAAAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/gAAAA/AB/+AAAA/8B//wAAA//gf/+AAAf/8PgPgAAH4fngB8AAD4B/wAPgAA8AP8AB4AAeAB+AAeAAHgAfgADwAB4ADwAA8AAcAA8AAPAAHAAPAADwAB4ADwAA8AAeAB+AAPAAHgAfgAHgAB8AP8AB4AAPgH/AA+AAD8H54AfAAAf/8fgPwAAD/+D//4AAAf/Af/8AAAB/AD/+AAAAAAAP+AAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAAAAAf/wAAAAAAf/+AAAAAAP//4AAwAAH//+AAeAAD+APwAHgAA+AA+AB4AAfAAHgAOAAHgAB4ADwAB4AAPAA8AAeAADwAPAAHgAA8ADwAB4AAPAA8AAeAADwAPAAHgAA8AHgAB8AAeAB4AAPgAHgA+AAD8ADwA/AAAfwA8A/gAAD/wef/wAAAf////4AAAB////4AAAAH///wAAAAAD/+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AB4AAAAAfgA/AAAAAH4APwAAAAB+AD4AAAAAPAAeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="), 46, atob("DRAcHBwcHBwcHBwcDQ=="), 56+(scale<<8)+(1<<16)); return this; }; +//Two Rings +Graphics.prototype.setFontBloggerSansLight42 = function() { + // Actual height 28 (31 - 4) + // 1 BPP + return this.setFontCustom( + atob('AAAAAAAAAAAAAAAAAAAAAAAAAHwAAAAAHwAAAAAHwAAAAAHwAAAAADgAAAAAAAAAAAAAwAAAAAHwAAAAA/wAAAAH+AAAAA/wAAAAH+AAAAA/wAAAAH+AAAAA/wAAAAD+AAAAADwAAAAACAAAAAAAAAAAAAAAAAAAAAAP8AAAAD//wAAAP//8AAA////AAB////gAB4AAPgADwAADwADgAAAwADAAAAwADAAAAwADAAAAwADgAAAwADwAADwAB8AAPgAB////gAA////AAAP//8AAAD//wAAAAP4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAMAAAQAAYAAAwAAYAAAwAA4AAAwAAwAAAwAB////wAD////wAD////wAD////wAAAAAAwAAAAAAwAAAAAAwAAAAAAwAAAAAAQAAAAAAQAAAAAAAAAAAAAAAAAAAAAAB8AADwAB+AAHwAD8AAPwADgAAfwADAAA7wADAABzwADAABzwADAAHjwADAAPDwADAAeDwADgA8DwAD4H4DwAB//wDwAB//gDwAA/+ADwAAP8ADwAAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAfgAB8AAfwAD8AABwADgAABwADAAAAwADADAAwADADAAwADADAAwADADAAwADAHAAwADgHgBwADwfgBwAB//4DgAB/8//gAA/4//AAAfwf+AAAAAP8AAAAABgAAAAAAAAAAAAAAAAAAADwAAAAAPwAAAAAfwAAAAA9wAAAADxwAAAAHhwAAAAeBwAAAA8BwAAADwBwAAAHgBwAAAfABwAAA8ABwAAB////wAD////wAD////wAD////wAAAABwAAAAABwAAAAABwAAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAAfgAD//AfgAD//AHwAD//ABwADwHAAwADwHAAwADwGAAwADwGAAwADwGAAwADwHAAwADwHABwADwHABwADwDgDgADwD//gADwB//AADgB/+AAAAAf8AAAAADAAAAAAAAAAAAAAAAAAAAAAAAAA//gAAAH//8AAAP//+AAAf///AAA/DAfgAB4DAHwABwHABwADgGAAwADgGAAwADAGAAwADAHAAwADAHAAwADAHgBwADgH8fgAD4D//gAD8D//AAAAA/+AAAAAf4AAAAAAAAAAAAAAAAAAAAAAAD8AAAAAD+AAAAAD8AAAAADwAAAwADwAADwADwAAPwADwAA/gADwAD8AADwAPwAADwA/AAADwD8AAADwPwAAADw/AAAADz4AAAAD/gAAAAD+AAAAAD4AAAAADgAAAAAAAAAAAAAAAAAAAAAADgAAAHgP8AAAf4f/AAA/8//gAB////gAD8/wDwADgHgBwADAHAAwADADAAwADADAAwADADAAwADAHAAwADgHgBwAB8/wDwAB////gAA/8//gAAf4f/AAAHgP8AAAAADgAAAAAAAAAAAAAAAAAD8AAAAAP/AHgAA//gPwAB//wDwAB/f4AwADwB4AwADgA4AwADAAYAwADAAYAwADAAYAwADAAYBwADgA4DwADwAwHgAB+Aw/gAB////AAA///+AAAf//4AAAD//gAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMADgAAAeAHwAAA/AHwAAA/AHwAAAeAHwAAAAABAAAAAAAAAA'), + 46, + atob("CQ0VFBQVFhUVFRUVCg=="), + 42|65536 + ); +}; + +// Three rings +Graphics.prototype.setFontBloggerSansLight38 = function() { + // Actual height 25 (28 - 4) + // 1 BPP + return this.setFontCustom( + atob('AAAAAAAAAAAAAAAAAwAAAAAeAAAAAPgAAAAD4AAAAAcAAAAAAAAAAAAYAAAAA+AAAAB/AAAAD+AAAAH8AAAAP4AAAAP4AAAAfwAAAA/gAAAAPAAAAACAAAAAAAAAAAAAAAAAAAA/4AAAB//wAAB///AAA///8AAfgA/AAPAAB4ADAAAGAAwAABgAMAAAYADAAAGAA4AABgAPAAB4AB+AD8AAP//+AAB///AAAH//gAAAP+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAACAAGAAAgABgAAYAAwAAGAAcAABgAH///4AD///+AA////gAP///4AAAAAGAAAAABgAAAAAYAAAAACAAAAAAgAAAAAAAAAAAAAAAAADgAHwAB4AD8AA+AA4AAfgAMAAG4ADAADOAAwABjgAMAA44ADAAcOAAwAeDgAOAPA4AB8/gOAAf/wDgAD/4A4AAf4AOAAB4ADgAAAAAAAAAAAAAAAAAAAAHwAH4AD8AA+AA8AABgAMAAAYADAGAGAAwBgBgAMAYAYADAGAGAAwDgBgAOA4AYAD5/AOAAf+8PAAH/n/wAA/x/4AABgP8AAAAA8AAAAAAAAAAABgAAAAA8AAAAA/AAAAAdwAAAAecAAAAPHAAAAHBwAAAHgcAAADgHAAADwBwAAB4AcAAA8AHAAA////gAP///4AD///+AAAABwAAAAAcAAAAAHAAAAABwAAAAAAAAAAAAAAAAAAAAAAAAHwAD/8B+AA//ADgAOAwAYADgMAGAA4DABgAOAwAYADgMAGAA4DABgAOA4A4ADgOAOAA4B4PAAOAf/wADgD/4AAAAf8AAAAB4AAAAAAAAAAAAAAAAA+AAAAD//AAAD//8AAB///gAA/2f8AAfBgHAAHAwA4ADgMAGAAwDABgAMAwAYADAMAGAAwDgDgAMA8B4ADwP/8AA+B//AAHgP/AAAAA/AAAAAAAAAAAAAAAAAAAAAA/AAAAAPwAAAADwAACAA4AADgAOAAD4ADgAD8AA4AD8AAOAD8AADgD8AAA4D8AAAOD8AAADj4AAAA74AAAAP4AAAAD4AAAAA4AAAAAAAAAAAAAAAAAAAAHwAAB8H/AAA/z/4AAf+//AAH/+B4ADgeAOAAwDgBgAMAwAYADAMAGAAwDABgAMA4AYADgeAOAAf/4PgAH/v/wAA/z/8AAHwP8AAAAB8AAAAAAAAAAAAAAAAfgAAAAf+A+AAP/wPgAH/8AYADwHgGAA4A4BgAMAOAYADABgGAAwAYBgAMAGA4ADgDgeAA8AwPAAH+N/wAA///4AAH//4AAAf/8AAAAfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgBwAAB8A+AAAfAPgAAHgB4AAAwAMAAAAAAAAA=='), + 46, + atob("CAwTEhITFBMTExMTCQ=="), + 38|65536 + ); +}; + Graphics.prototype.setFontRoboto20 = function(scale) { // Actual height 21 (20 - 0) this.setFontCustom(atob("AAAAAAAAAAAAAAAAAAAAAAAAH/zA/+YAAAAAAAHwAAwAAHwAA+AAAAAAAAAAAQACDAAYbADP4B/8A/zAGYZADH4A/+A/7AHYYADCAAAAAAAQAeHgH4eBzgwMMHnhw88GGBw4wHj+AcPgAAAAAAAAAAB4AA/gAGMAAwhwGMcAfuABzgABzgAc+AOMYBhBAAMYAB/AAHwAAAAAHwD5+A/8YGPDAw8YGPzA/HYD4fAADwAB/AAOYAABAAAAHwAA4AAAAAAAAAAH/gD//B8A+cAA7AADAAAAAAAYAAbwAHHgHwf/4A/8AAAAEAABiAAGwAA8AA/AAH+AAGwAByAAEAAAAAAAMAABgAAMAABgAH/wA/+AAMAABgAAMAABgAAAAAAAIAAfAADwAAAABgAAMAABgAAMAABgAAAAAAAAAAAAADAAAYAAAAAAAAADgAB8AB+AA+AA+AA/AAHAAAgAAAAAAB8AB/8Af/wHAHAwAYGADAwAYHAHAf/wB/8AAAAAAAAAAABgAAcAADAAAYAAH//A//4AAAAAAAAAAAAAAAAAAAAABwDAeA4HAPAwHYGBzAwcYHHDAfwYB8DAAAYAAAAAAABgOAcBwHADAwwYGGDAwwYHPHAf/wB58AAAAAAAAADAAB4AAfAAPYAHjAB4YA8DAH//A//4AAYAADAAAAAAAAAEMA/xwH+HAxgYGMDAxgYGODAw/4GD+AAHAAAAAAAAAf8AP/wD2HA5wYGMDAxgYGOHAA/wAD8AAAAAAAAAAAGAAAwAAGADAwB4GB+Aw+AGfAA/gAHwAAwAAAAAAADAB5+Af/wHPDAwwYGGDAwwYHPHAfvwB58AAAAAAAAAAAB+AAf4AHDjAwMYGBjAwM4HDOAf/gB/4AAAAAAAAAAAAYDADAYAAAAAAAAAAYDAfAYHwAAAABAAAcAADgAA+AAGwAB3AAMYABjgAYMAAAAAAAAAAAAAAABmAAMwABmAAMwABmAAMwABmAAMwAAiAAAAAAAAAYMADjgAMYAB3AAGwAA2AADgAAcAABAAAAAAAAAMAADgAA4AAGBzAweYGHAA/wAD8AAEAAAAwAB/4A/PwOAGDgAYYPxmH/Mw4ZmMDMxgZmM+Mx/5mHDAYAIDgDAPBwAf8AAMAAAAAAAYAAfAAPwAP4AH+AH4wA8GAH4wAP2AAPwAAfwAAfAAAYAAAAAAAAAAA//4H//AwwYGGDAwwYGGDAwwYH/HAf/wB58AAAAADAAH/AD/+AcBwHADAwAYGADAwAYGADA4A4DweAODgAAAAAAAAAAAAAAH//A//4GADAwAYGADAwAYGADAYAwD4+AP/gAfwAAAAAAAAAAAH//A//4GDDAwYYGDDAwYYGDDAwYYGCDAgAYAAAAAAAH//A//4GDAAwYAGDAAwYAGDAAwYAGAAAAAAAAAAH/AD/8AcBwHAHAwAYGADAwYYGDDA4YYDz/AOfwAAAAAAAAAAA//4H//A//4ADAAAYAADAAAYAADAAAYAADAA//4H//AAAAAAAAAAAAAAA//4H//AAAAAAAAABAAAeAAB4AADAAAYAADAAAYAAHA//wH/8AAAAAAAAAAAAAAA//4H//AAcAAPAAD4AA/wAOPADg8A4B4GAHAgAYAAAAAAAH//A//4AADAAAYAADAAAYAADAAAYAADAAAAAAAA//4H//A+AAB+AAD8AAD8AAH4AAPAAH4AH4AD8AD8AA+AAH//A//4AAAAAAAH//A//4H//AeAAB8AADwAAPgAAeAAA8AADwH//A//4AAAAAAAAAAAH/AB/8AeDwHAHAwAYGADAwAYGADA4A4DweAP/gA/4AAAAAAAAAAAH//A//4GBgAwMAGBgAwMAGBgAwcAH/AAfwAA8AAAAAA/4AP/gDgOA4A4GADAwAYGADAwAYHAHgeD+B/8wD+GAAAAAAAAAAA//4H//AwYAGDAAwYAGDgAweAHH8Afz4B8HAAAIAAYAPDwD8OA5w4GGDAwwYGHDAwYYHDnAePwBw8AAAAGAAAwAAGAAAwAAGAAA//4H//AwAAGAAAwAAGAAAwAAAAAAAAAH/4A//wAAPAAAYAADAAAYAADAAAYAAPA//wH/8AAAAAAAAgAAHAAA/AAB/AAD+AAD+AAD4AAfAAfwAfwAfwAH4AA4AAEAAA+AAH/AAH/gAD/AAD4AD+AH+AH8AA+AAH+AAD+AAD/AAD4AH/AP/AH+AA8AAAAAAAAAGADA4A4HweAPPgA/wAB8AAfwAPvgDweA8B4GADAAAIGAAA4AAHwAAPgAAfAAA/4AH/AD4AB8AA+AAHgAAwAAAAAAAAAGADAwB4GAfAwPYGDzAx4YGeDA/AYHwDA4AYGADAAAAAAAA///3//+wAA2AAGAAAGAAA+AAD8AAD8AAD4AAH4AAHgAAMAAAAwAA2AAG///3//+AAAAAAAAAAAOAAHwAD4AA8AAD8AADwAAGAAAAAAABgAAMAABgAAMAABgAAMAABgAAMAABgAAAEAAAwAADAAAIAAAAAAAAAAEeABn4Ad3ADMYAZjADMYAZmAB/4AP/AAAAAAAA//4H//ABgwAYDADAYAYDADg4AP+AA/gABwAAAAAAAAA/gAP+ADg4AYDADAYAYDADAYAOOABxwAAAAAEAAH8AB/wAcHADAYAYDADAYAcDA//4H//AAAAAAAAAAAAH8AB/wAdnADMYAZjADMYAZjAB84AHmAAMAAMAABgAB//gf/8HMAAxgAGIAAAAAAH8IB/zAcHMDAZgYDMDAZgcHcD//Af/wAAAAAAAAAAH//A//4AMAADAAAYAADAAAcAAD/4AP/AAAAAAAAAAAGf/Az/4AAAAAAAAAAMz//mf/4AAAAAAAAAAH//A//4ABwAAeAAH4ABzwAcPACAYAABAAAAAAAA//4H//AAAAAAAAAAAAf/AD/4AMAADAAAYAADAAAcAAD/4AP/ABgAAYAADAAAYAADgAAP/AA/4AAAAAAAAf/AD/4AMAADAAAYAADAAAcAAD/4AP/AAAAAAAAAAAAH8AB/wAcHADAYAYDADAYAYDADx4AP+AA/gAAAAAAAAf/8D//gYDADAYAYDADAYAcHAB/wAH8AAEAAAAAAEAAH8AB/wAcHADAYAYDADAYAYDAD//gf/8AAAAAAAAAAAf/AD/4AcAADAAAYAACAAAAEAB5wAfnADMYAZjADGYAYzADn4AOeAAAAAAAADAAAYAAf/wD//ADAYAYDAAAAAAAAD/gAf/AAA4AADAAAYAADAAAwAf/AD/4AAAAAAAAYAAD4AAP4AAP4AAPAAH4AH4AD8AAcAAAAAAQAADwAAf4AAf4AAPAAP4AP4ADwAAfgAA/gAA/AAD4AH+AD+AAeAAAAAAAAACAYAcHADzwAH8AAfAAH8ADx4AcHACAIAcAMD4BgP4MAP/AAPwAP4AP4AD4AAcAAAAAAAAADAYAYHADD4AY7ADOYAfjADwYAcDADAYAAAAADAAA4AH//B/v8cABzAACAAAH//w//+AAAAAAACAACcAAx/n+H//AA4AAHAAAAAAAAAAAAAOAADgAAYAADAAAcAABgAAGAAAwAAGAADwAAcAAAAA"), 32, atob("BQUHDQwPDQQHBwkMBAYGCQwMDAwMDAwMDAwFBAsMCwoTDg0ODgwMDg8GDA0LEg8ODQ4NDA0ODRMNDQ0GCQYJCQYLDAsMCwcMDAUFCwUSDAwMDAcLBwwKEAoKCgcFBw4A"), 21+(scale<<8)+(1<<16)); @@ -40,29 +83,84 @@ Graphics.prototype.setFontRoboto20 = function(scale) { }; function assignPalettes() { - if (g.theme.dark) { - // palette for 0-40% - pal1 = new Uint16Array([g.theme.bg, g.toColor(settings.gy), g.toColor(settings.fg), g.toColor("#00f")]); - // palette for 50-100% - pal2 = new Uint16Array([g.theme.bg, g.toColor(settings.fg), g.toColor(settings.gy), g.toColor("#00f")]); - } else { - // palette for 0-40% - pal1 = new Uint16Array([g.theme.bg, g.theme.fg, g.toColor(settings.fg), g.toColor("#00f")]); - // palette for 50-100% - pal2 = new Uint16Array([g.theme.bg, g.toColor(settings.fg), g.theme.fg, g.toColor("#00f")]); + palbg = new Uint16Array([g.toColor(g.theme.bg)]); + for (let i = 0; i < settings.rings.length; i++) { + let ring = settings.rings[i]; + if (ring.type == 'Full' && ring.color == 'Blk/Wht') { + // BLK/WHT is the outside in light mode, so all of it gets filled in. + // Using the dark theme stops it from being a one-color circle. + pals[i].pal1 = new Uint16Array([g.theme.bg, g.toColor(ring.gy), g.toColor(ring.fg), g.toColor("#00f")]); + pals[i].pal2 = new Uint16Array([g.theme.bg, g.toColor(ring.fg), g.toColor(ring.gy), g.toColor("#00f")]); + } else if (g.theme.dark) { + // palette for 0-49% + pals[i].pal1 = new Uint16Array([g.theme.bg, g.toColor(ring.gy), g.toColor(ring.fg), g.toColor("#00f")]); + // palette for 50-100% + pals[i].pal2 = new Uint16Array([g.theme.bg, g.toColor(ring.fg), g.toColor(ring.gy), g.toColor("#00f")]); + } else { + // palette for 0-49% + pals[i].pal1 = new Uint16Array([g.theme.bg, g.theme.fg, g.toColor(ring.fg), g.toColor("#00f")]); + // palette for 50-100% + pals[i].pal2 = new Uint16Array([g.theme.bg, g.toColor(ring.fg), g.theme.fg, g.toColor("#00f")]); + if (ring.type !== 'Full') pals[i].pal1 = pals[i].pal2; // In light mode, we only want the full circle's filled portion to be black + } } } +function rotate_points(end, max) { + const midH = h/2; + const midW = w/2; + const off = 5; + const points = [midW-off,0, midW+off,0, midW+off,midH, midW-off,midH]; + var rotate = (2 * Math.PI) / (max / end); + var rotated_arr = []; + for (let i = 0; i < points.length; i += 2) { + let x = points[i]; + let y = points[i + 1]; + x -= midW; + y -= midH; + let x_new = x * Math.cos(rotate) - y * Math.sin(rotate); + let y_new = x * Math.sin(rotate) + y * Math.cos(rotate); + x = x_new + midW; + y = y_new + midH; + rotated_arr.push(x); + rotated_arr.push(y); + } + return rotated_arr; +} + function setSmallFont20() { g.setFontRoboto20(); } function setLargeFont() { - g.setFontBloggerSansLight46(1); -} + switch (innerMostRing) { + case 3: + g.setFontBloggerSansLight38(); + break; + case 2: + g.setFontBloggerSansLight42(); + break; + default: + g.setFontBloggerSansLight46(1); + break; + } + } function setSmallFont() { - g.setFont('Vector', 16); + let size = 16; + if (infoMode == "ID_HRM" ) { + g.setFont('Vector', size); + return; + } + switch (innerMostRing) { + case 2: + size = 13; + break; + case 3: + size = 12; + break; + } + g.setFont('Vector', size); } function getSteps() { @@ -80,10 +178,52 @@ function getSteps() { function loadSettings() { settings = require("Storage").readJSON(SETTINGS_FILE,1)||{}; - settings.gy = settings.gy||'#020'; + settings.rings = settings.rings || [{}, {}, {}]; + + settings.rings[0].gy = settings.rings[0].gy||'#020'; + settings.rings[0].fg = settings.rings[0].fg||'#0f0'; + settings.rings[0].type = settings.rings[0].type||'Full'; + settings.rings[0].ring = settings.rings[0].ring||'Steps'; + settings.rings[0].step_target = settings.rings[0].step_target||10000; + + settings.rings[1].gy = settings.rings[1].gy||'#020'; + settings.rings[1].fg = settings.rings[1].fg||'#0f0'; + settings.rings[1].type = settings.rings[1].type||'None'; + settings.rings[1].ring = settings.rings[1].ring||'Minutes'; + settings.rings[1].step_target = settings.rings[1].step_target||10000; + + settings.rings[2].gy = settings.rings[2].gy||'#020'; + settings.rings[2].fg = settings.rings[2].fg||'#0f0'; + settings.rings[2].type = settings.rings[2].type||'None'; + settings.rings[2].ring = settings.rings[2].ring||'Hours'; + settings.rings[2].step_target = settings.rings[2].step_target||10000; + + for (let i = 0; i < settings.rings.length; i++) { + // Needed in case the user swaps themes + if (settings.rings[i].color == 'Blk/Wht') { + settings.rings[i].gy = g.theme.dark ? '#222' : '#888'; + settings.rings[i].fg = g.theme.fg; + } + } + + getInnerOuterMostRing(); + settings.color = settings.color||'Outer'; settings.fg = settings.fg||'#0f0'; + switch (settings.color) { + case 'Outer': + if (outerMostRing == 0) break; + settings.fg = settings.rings[outerMostRing - 1].fg; + break; + case 'Inner': + if (innerMostRing == 0) break; + settings.fg = settings.rings[innerMostRing - 1].fg; + break; + } + settings.idle_check = (settings.idle_check === undefined ? true : settings.idle_check); settings.batt_hours = (settings.batt_hours === undefined ? false : settings.batt_hours); + settings.hr_12 = (global_settings["12hour"] === undefined ? false : global_settings["12hour"]); + settings.idxInfo = settings.idxInfo||0; assignPalettes(); } @@ -96,23 +236,69 @@ function loadLocation() { } function extractTime(d){ - var h = d.getHours(), m = d.getMinutes(); - return(("0"+h).substr(-2) + ":" + ("0"+m).substr(-2)); + var hh = d.getHours(), mm = d.getMinutes(); + if (settings.hr_12) { + hh = hh % 12; + if (hh == 0) hh = 12; + } + return(("0"+hh).substr(-2) + ":" + ("0"+mm).substr(-2)); } var sunRise = "00:00"; var sunSet = "00:00"; var drawCount = 0; +var night; // In terms of minutes +var sunStart; // In terms of ms +var sunEnd; // In terms of minutes +var sunFull; // In terms of ms +var isDaytime = true; -function updateSunRiseSunSet(now, lat, lon, line){ +function getMinutesFromDate(date) { + return (60 * date.getHours()) + date.getMinutes(); +} + +function updateSunRiseSunSet(now, lat, lon, sunLeftCalcs){ // get today's sunlight times for lat/lon - var times = SunCalc.getTimes(new Date(), lat, lon); + var times = SunCalc.getTimes(now, lat, lon); + var dateCopy = new Date(now.getTime()); // format sunrise time from the Date object sunRise = extractTime(times.sunrise); sunSet = extractTime(times.sunset); + if (!sunLeftCalcs) return; + + let sunLeft = times.sunset - dateCopy; + if (sunLeft < 0) { // If it's already night + dateCopy.setDate(dateCopy.getDate() + 1); + let timesTmrw = SunCalc.getTimes(dateCopy, lat, lon); + isDaytime = false; + sunStart = times.sunset; + sunFull = timesTmrw.sunrise - sunStart; + sunEnd = getMinutesFromDate(timesTmrw.sunrise); + night = getMinutesFromDate(timesTmrw.sunriseEnd); + } + else { + sunLeft = dateCopy - times.sunrise; + if (sunLeft < 0) { // If it's not morning yet. + dateCopy.setDate(dateCopy.getDate() - 1); + let timesYest = SunCalc.getTimes(dateCopy, lat, lon); + isDaytime = false; + sunStart = timesYest.sunset; + sunFull = times.sunrise - sunStart; + sunEnd = getMinutesFromDate(times.sunrise); + night = getMinutesFromDate(times.sunriseEnd); + } + else { // We're in the middle of the day + isDaytime = true; + sunStart = times.sunriseEnd; + sunFull = times.sunsetStart - sunStart; + sunEnd = getMinutesFromDate(times.sunsetStart); + night = getMinutesFromDate(times.sunset); + } + } } + function batteryString(){ let stringToInsert; if (settings.batt_hours) { @@ -144,40 +330,59 @@ const infoData = { ID_DAY: { calc: () => {var d = require("locale").dow(new Date()).toLowerCase(); return d[0].toUpperCase() + d.substring(1);} }, ID_SR: { calc: () => 'SUNRISE ' + sunRise }, ID_SS: { calc: () => 'SUNSET ' + sunSet }, - ID_STEP: { calc: () => 'STEPS ' + getSteps() }, + ID_STEP: { calc: () => {var steps = getSteps(); prevStepDisplayed = steps; return 'STEPS ' + steps;}}, ID_BATT: { calc: batteryString}, ID_HRM: { calc: () => hrmCurrent } }; const infoList = Object.keys(infoData).sort(); -let infoMode = infoList[0]; -function nextInfo() { - let idx = infoList.indexOf(infoMode); +function nextInfo(idx) { if (idx > -1) { - if (idx === infoList.length - 1) infoMode = infoList[0]; - else infoMode = infoList[idx + 1]; + if (idx === infoList.length - 1) idx = 0; + else idx += 1; } - // power HRM on/off accordingly - Bangle.setHRMPower(infoMode == "ID_HRM" ? 1 : 0); - resetHrm(); + return idx; } -function prevInfo() { - let idx = infoList.indexOf(infoMode); +function prevInfo(idx) { if (idx > -1) { - if (idx === 0) infoMode = infoList[infoList.length - 1]; - else infoMode = infoList[idx - 1]; + if (idx === 0) idx = infoList.length - 1; + else idx -= 1; } - // power HRM on/off accordingly - Bangle.setHRMPower(infoMode == "ID_HRM" ? 1 : 0); - resetHrm(); + return idx; +} + +function getInfoDims() { + var line = infoLineDefault; + var width = infoWidthDefault; + var height = infoHeightDefault; + switch (innerMostRing) { + case 2: + width -= 10; + height -= 2; + line -= 7; + break; + case 3: + width -= 17; + height -= 3; + line -= 10; + break; + } + if (infoMode == "ID_HRM") { + width = 30; + height = infoHeightDefault; + } + return[line, width, height]; } function clearInfo() { + var dims = getInfoDims(); + var line = dims[0]; + var width = dims[1]; + var height = dims[2]; g.setColor(g.theme.bg); - //g.setColor(g.theme.fg); - g.fillRect((w/2) - infoWidth, infoLine - infoHeight, (w/2) + infoWidth, infoLine + infoHeight); + g.fillRect((w/2) - width, line - height, (w/2) + width, line + height); } function drawInfo() { @@ -185,18 +390,19 @@ function drawInfo() { g.setColor(g.theme.fg); setSmallFont(); g.setFontAlign(0,0); - + var dims = getInfoDims(); + var line = dims[0]; + var height = dims[2]; if (infoMode == "ID_HRM") { - clearInfo(); g.setColor('#f00'); // red - drawHeartIcon(); + drawHeartIcon(line, height); } else { - g.drawString((infoData[infoMode].calc().toUpperCase()), w/2, infoLine); + g.drawString((infoData[infoMode].calc().toUpperCase()), w/2, line); } } -function drawHeartIcon() { - g.drawImage(hrmImg, (w/2) - infoHeight - 20, infoLine - infoHeight); +function drawHeartIcon(line, height) { + g.drawImage(hrmImg, (w/2) - height - 20, line - height); } function drawHrm() { @@ -204,40 +410,152 @@ function drawHrm() { var d = new Date(); clearInfo(); g.setColor(d.getSeconds()&1 ? '#f00' : g.theme.bg); - drawHeartIcon(); + var dims = getInfoDims(); + var line = dims[0]; + var height = dims[2]; + drawHeartIcon(line, height); setSmallFont(); g.setFontAlign(-1,0); // left g.setColor(hrmConfidence >= 50 ? g.theme.fg : '#f00'); - g.drawString(hrmCurrent, (w/2) + 10, infoLine); + g.drawString(hrmCurrent, (w/2) + 10, line); } -function draw() { - if (!idle) - drawClock(); +function drawHour(date) { + // Run setLargeFont before running this function + var hh = date.getHours(); + if (settings.hr_12) { + hh = hh % 12; + if (hh == 0) hh = 12; + } + hh = hh.toString().padStart(2, '0'); + if (settings.color == 'Fullest') { + settings.fg = settings.rings[getFullestRing()].fg; + } + g.setColor(settings.fg); + g.setFontAlign(1,0); // right aligned + g.drawString(hh, (w/2) - 1, h/2); +} + +function draw(updateSeconds) { + if (!idle) { + if (updateSeconds) { + let date = new Date(); + drawAllRings(date, 'Seconds'); + if (settings.color == 'Fullest') { + let fgNew = settings.rings[getFullestRing()].fg; + if (settings.fg != fgNew) { + setLargeFont(); + drawHour(date); + } + } + } + else { + drawClock(); + } + } else drawIdle(); queueDraw(); } +function getGaugeImage(date, ringType, step_target) { + var hh = date.getHours(); + var mm = date.getMinutes(); + var ring_fill; + var invertRing = false; + var ring_max = 100; + switch (ringType) { + case 'Hours': + ring_fill = ((hh % 12) * 60) + mm; + ring_max = 12 * 60; + break; + case 'Minutes': + ring_fill = mm; + ring_max = 60; + break; + case 'Seconds': + ring_fill = date.getSeconds(); + ring_max = 60; + break; + case 'Day': + ring_fill = (hh * 60) + mm; + ring_max = 1440; + break; + case 'Steps': + ring_max = 100; + ring_fill = getSteps(); + ring_max = step_target; + break; + case 'Battery': + ring_fill = E.getBattery(); + break; + case 'Sun': + var dayMin = getMinutesFromDate(date); + if (dayMin >= sunEnd && dayMin <= night) ring_fill = ring_max; + else { + ring_fill = ring_max * (date - sunStart) / sunFull; + if (ring_fill > ring_max) { // If we're now past a sunrise of sunset + updateSunRiseSunSet(date, location.lat, location.lon, true); + ring_fill = ring_max * (date - sunStart) / sunFull; + } + } + invertRing = !isDaytime; + break; + } + var start = 0; + var end = Math.round(ring_fill); + if ((end - start) > ring_max) end = ring_max; // Capping end var so the ring doesn't need to update if already full. + if (invertRing) { + start = ring_max - end; + end = ring_max; + } + log_debug("Start: "+ start + " end: " +end); + return [start, end, ring_max]; +} + +function drawIfChanged(start, end, ring_max, idx, type) { + if (end === prevRing[idx].end && start === prevRing[idx].start && ring_max === prevRing[idx].max) return; + switch (type) { + case 'Full': + drawRing(start, end, ring_max, idx); + break; + case 'Semi': + drawSemi(start, end, ring_max, idx); + break; + case 'C': + drawC(end, ring_max, idx); + break; + } + prevRing[idx].start = start; + prevRing[idx].end = end; + prevRing[idx].max = ring_max; + log_debug("Redrew ring #" + idx); +} + +function drawAllRings(date, drawOnlyThisType) { + for (let i = 0; i < settings.rings.length; i++) { + let ring = settings.rings[i]; + if (ring.type == "None") continue; + if (drawOnlyThisType != null && ring.ring != drawOnlyThisType) continue; + var result = getGaugeImage(date, ring.ring, ring.step_target); + drawIfChanged(result[0], result[1], result[2], i, ring.type); + } +} + function drawClock() { var date = new Date(); - //var timeStr = require("locale").time(date,1); - var da = date.toString().split(" "); - //var time = da[4].substr(0,5); - var hh = da[4].substr(0,2); - var mm = da[4].substr(3,2); - var steps = getSteps(); - var p_steps = Math.round(100*(steps/10000)); + var mm = date.getMinutes(); + mm = mm.toString().padStart(2, '0'); g.reset(); g.setColor(g.theme.bg); - g.fillRect(0, 0, w, h); - g.drawImage(getGaugeImage(p_steps), 0, 0); + getInnerOuterMostRing(); + let edge = ringEdge + (innerMostRing * ringIterOffset); + g.fillEllipse(edge+ringThick,edge+ringThick,w-edge-ringThick,h-edge-ringThick); // Clears the text within the circle + drawAllRings(date, null); setLargeFont(); - g.setColor(settings.fg); - g.setFontAlign(1,0); // right aligned - g.drawString(hh, (w/2) - 1, h/2); + drawHour(date); g.setColor(g.theme.fg); g.setFontAlign(-1,0); // left aligned @@ -246,20 +564,38 @@ function drawClock() { drawInfo(); // recalc sunrise / sunset every hour - if (drawCount % 60 == 0) - updateSunRiseSunSet(new Date(), location.lat, location.lon); + if (drawCount % 60 == 0) { + let recalcSunLeft = (settings.ring == 'Sun'); + updateSunRiseSunSet(date, location.lat, location.lon, recalcSunLeft); + } drawCount++; } +function checkRedrawSteps(steps) { + var redrawText = false; + var redrawRings = false; + if (infoMode == "ID_STEP" && (minStepToUpdate <= (steps - prevStepDisplayed))) { + redrawText = true; + } + for (let i = 0; i < settings.rings.length; i++) { + let ring = settings.rings[i]; + if(ring.type == "None" || ring.ring != 'Steps') continue; + let percentChanged = 100 * ((steps - prevRing[i].end) / ring.step_target); + if(percentChanged >= minStepPctUpdateRings) { + redrawRings = true; + break; + } + } + return [redrawText, redrawRings]; +} + function drawSteps() { - if (drawingSteps) return; - drawingSteps = true; clearInfo(); + var dims = getInfoDims(); setSmallFont(); g.setFontAlign(0,0); g.setColor(g.theme.fg); - g.drawString('STEPS ' + getSteps(), w/2, (3*h/4) - 4); - drawingSteps = false; + g.drawString((infoData[infoMode].calc().toUpperCase()), w/2, dims[0]); } ///////////////// GAUGE images ///////////////////////////////////// @@ -273,7 +609,8 @@ function resetHrm() { if (infoMode == "ID_HRM") { clearInfo(); g.setColor('#f00'); // red - drawHeartIcon(); + var dims = getInfoDims(); + drawHeartIcon(dims[0], dims[2]); } } @@ -287,123 +624,118 @@ Bangle.on('HRM', function(hrm) { ///////////////// GAUGE images ///////////////////////////////////// - -// putting into 1 function like this, rather than individual variables -// reduces ram usage from 70%-13% -function getGaugeImage(p) { - // p0 - if (p < 2) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal1, - buffer : require("heatshrink").decompress(atob("AH4A/AH4ACgtVAAVUFUgpDAAdAFMEBFQ4ABqBVnLMQqLLLzWEABLgbVgohEGopYaiofDBihWVHJpYYDgYPbKx1ACJhYZIwT4OcAZWYHyRYUIgQXQH4RqOThCXUYRpCHNyQVVQQTwVQiSZWIQSEQNgSYSIYiEQQSyEUCQLDSOAyCnQiSCYQiSCYQiSCZDaDARObKuBSZwcaVzR0QFYKuZWAYNZWCJJKMoKuaWAahKBhiwTJRSudURorBFTgfMVzqjDO5DaeZ5jaeJhhiKbi4rIbT4hLqoriPI7afUpS5BbTwiKFdZgIADSmHFYIqgbgIrGcgIriEYwzHADZ7HRY4rdaYrjHADcBFYoGBFcgkEGQwAeFYqKHFbzUEcQ4AdiorwiorlEogxFAD59FWoorhoArDqArjgIr/FbYwFAEJSDFf4rXgornqgrDFUkAior/Ff4rGAYYAjKYYr/Ff4r/FbdVFdFAFYNQFcsBFf4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/FbdUFcsFFYUVFdADBFf4r/Ff4rbAYYAjKYYr/Ff4rFoArkqorCgIrnqAr/FbIEFAEBSFFf4rYqgrjgorEiormAocVAogAfEooxFFcB9EFdq1DAD9VFYkBFctQFYoGEADokHFcp8FRQoAdag7iFFb4HFioHGADYjHGY4rcPYyLHADbTHcYNQFT4iIFdZgIADKmJqrcgiorIBIIrhMKIAXUpIrBbjzaBFZAKKbS5MJFcKkJbj4fLBYLcdqorKbjzPMbjxKNMhauTURawdJJorBWDShBFZiRBWDQcOHRyuPOhorBWDIbPWDRzQSYKEYIwLLOHgSEXDIJyPQjD2SQjCCQQjSCRCYY/QN4xDRQiyCSQgjdSCqqECLCRWBYyiECISBWCYqgXCLCBWCQSYYEIhxqCeChYFThoQCKypYEIxgPPLB4cKFQZWXDoosIBhhYWcArWDKzYhHABA1EADArNoArcFhgqeWQysgLJxVfcBLWdAH4A5A")) - }; - - // p2 - if (p >= 2 && p < 4) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette: pal1, - buffer : require("heatshrink").decompress(atob("AH4A/ADNUFE8FqtVq2q1AqkFIIrDAAOAFMEBFQYrE1WgKsYrGLL4qFFY2pqDWeFZdUVkAhCAQMKFYdVLDUVFQYMHlWq0oMJKyoOJlQrCLDBWDB5clB5xWOoARMCARYWKwT4OgpYXKwY+SLChECC6A/CNRycIS6jCNIQ5uSCqqCCeCqESTKxCCQiBsCTCRDEQiCCWQigSBYaRwGQU6ESQTCESQTCESQTIbQYCJzZVwKTODjSuaOiArBVzKwDBrKwRJJRlBVzSwDUJQMMWCZKKVzqiNFYIqcD5iudUYZ3IbTzPMbTxMMMRTcXFZDafEJdVFcR5HbT6lKXILaeERQrrMBAAaUw4rBFUDcBFYzkBFcQjGGY4AbPY6LHFbrTFcY4AbgIrFAwIrkEggyGADwrFRQ4reagjiHADsVFeEVFcolEGIoAfPoq1FFcNAFYdQFccBFf4rbGAoAhKQYr/Fa8FFc9UFYYqkgEVFf4r/FYwDDAEZTDFf4r/Ff4rbqorooArBqArlgIr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rbqgrlgorCioroAYIr/Ff4r/FbYDDAEZTDFf4r/FYtAFclVFYUBFc9QFf4rZAgoAgKQor/FbFUFccFFYkVFcwFDioFEAD4lFGIorgPogrtWoYAfqorEgIrlqArFAwgAdEg4rlPgqKFADrUHcQorfA4sVA4wAbEY4zHFbh7GRY4AbaY7jBqAqfERArrMBAAZUxNVbkEVFZAJBFcJhRAC6lJFYLcebQIrIBRTaXJhIrhUhLcfD5YLBbjtVFZTceZ5jceJRpkLVyaiLWDpJNFYKwaUIIrMSIKwaDhw6OVx50NFYKwZDZ6waOaCTBQjBGBZZw8CQi4ZBOR6EYeySEYQSCEaQSITDH6BvGIaKEWQSSEEbqQVVQgRYSKwLGUQgRCQKwTFUC4RYQKwSCTDAhEONQTwULAqcNCARWVLAhGMB55YPDhQqDKy4dFFhAMMLCzgFawZWbEI4AIGogAYFZtAFbgsMFTyyGVkBZOKr7gJazoA/AHI")) - }; - - // p4 - if (p >= 4 && p < 7) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal1, - buffer : require("heatshrink").decompress(atob("AH4A/AH4ACgtVqtW1WoFUgpBFYYABwApggIqDFYmq0BVjFY2loAqjFY1VqDWeFZdUVkAhEhQrDLDcVFQYMHlQrCBhBWVHJpYYDgYPbKx1ACJhYZIwT4OgpYXKwY+SLChECC6A/CNRycIS6jCNIQ5uSCqqCCeCqESTKxCCQiBsCTCRDEQiCCWQigSBYaRwGQU6ESQTCESQTCESQTIbQYCJzZVwKTODjSuaOiArBVzKwDBrKwRJJRlBVzSwDUJQMMWCZKKVzqiNFYIqcD5iudUYZ3IbTzPMbTxMMMRTcXFZDafEJdVFcR5HbT6lKXILaeERQrrMBAAaUw4rBFUDcBFYzkBFcQjGGY4AbPY6LHFbrTFcY4AbgIrFAwIrkEggyGADwrFRQ4reagjiHADsVFeEVFcolEGIoAfPoq1FFcNAFYdQFccBFf4rbGAoAhKQYr/Fa8FFc9UFYYqkgEVFf4r/FYwDDAEZTDFf4r/Ff4rbqorooArBqArlgIr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rbqgrlgorCioroAYIr/Ff4r/FbYDDAEZTDFf4r/FYtAFclVFYUBFc9QFf4rZAgoAgKQor/FbFUFccFFYkVFcwFDioFEAD4lFGIorgPogrtWoYAfqorEgIrlqArFAwgAdEg4rlPgqKFADrUHcQorfA4sVA4wAbEY4zHFbh7GRY4AbaY7jBqAqfERArrMBAAZUxNVbkEVFZAJBFcJhRAC6lJFYLcebQIrIBRTaXJhIrhUhLcfD5YLBbjtVFZTceZ5jceJRpkLVyaiLWDpJNFYKwaUIIrMSIKwaDhw6OVx50NFYKwZDZ6waOaCTBQjBGBZZw8CQi4ZBOR6EYeySEYQSCEaQSITDH6BvGIaKEWQSSEEbqQVVQgRYSKwLGUQgRCQKwTFUC4RYQKwSCTDAhEONQTwULAqcNCARWVLAhGMB55YPDhQqDKy4dFFhAMMLCzgFawZWbEI4AIGogAYFZtAFbgsMFTyyGVkBZOKr7gJazoA/AHI")) - }; - - // p7 - if (p >= 7 && p < 10) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal1, - buffer : require("heatshrink").decompress(atob("AH4A/AH4ACgtVqtW1WoFUgpBFYYABwApggIqDFYmq0BVjFYxZfFQorGLLrWCFZbgbVgtUBQcKLD8VFQYMHlQsDKzoOJFgZYYKwYPLFgWlKzVACJgrCqBWYawgAJcAOlNBhWMCZ8qFYJYUgoqBC6ECFYJqOAApWSS4jCNQQ5uSCqqCCeCqESFQKZUIQSEQNgSYSIYiEQQSyEUCQLDSOAyCnQiSCYQiSCYQiSCZDaDARObKuBSZwcaVzR0QFYKuZWAYNZWCJJKMoKuaWAahKBhiwTJRSudURorBFTgfMVzqjDO5DaeZ5jaeJhhiKbi4rIbT4hLqoriPI7afUpS5BbTwiKFdZgIADSmHFYIqgbgIrGcgIriEYwzHADZ7HRY4rdaYrjHADcBFYoGBFcgkEGQwAeFYqKHFbzUEcQ4AdiorwiorlEogxFAD59FWoorhoArDqArjgIr/FbYwFAEJSDFf4rXgornqgrDFUkAior/Ff4rGAYYAjKYYr/Ff4r/FbdVFdFAFYNQFcsBFf4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/FbdUFcsFFYUVFdADBFf4r/Ff4rbAYYAjKYYr/Ff4rFoArkqorCgIrnqAr/FbIEFAEBSFFf4rYqgrjgorEiormAocVAogAfEooxFFcB9EFdq1DAD9VFYkBFctQFYoGEADokHFcp8FRQoAdag7iFFb4HFioHGADYjHGY4rcPYyLHADbTHcYNQFT4iIFdZgIADKmJqrcgiorIBIIrhMKIAXUpIrBbjzaBFZAKKbS5MJFcKkJbj4fLBYLcdqorKbjzPMbjxKNMhauTURawdJJorBWDShBFZiRBWDQcOHRyuPOhorBWDIbPWDRzQSYKEYIwLLOHgSEXDIJyPQjD2SQjCCQQjSCRCYY/QN4xDRQiyCSQgjdSCqqECLCRWBYyiECISBWCYqgXCLCBWCQSYYEIhxqCeChYFThoQCKypYEIxgPPLB4cKFQZWXDoosIBhhYWcArWDKzYhHABA1EADArNoArcFhgqeWQysgLJxVfcBLWdAH4A5A==")) - }; - - // p10 - if (p >= 10 && p < 20) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal1, - buffer : require("heatshrink").decompress(atob("AH4A/AH4ACgtVqtW1WoFUgpBFYYABwApggIqDFYmq0BVjFYxZfFQorGLLrWCFZbgbVgtUBQcKLD8VFQYMHlQsDKzoOJFgZYYKwYPLFgZWaoARMLDJWCawgAJcAZWYCZ6FCLCkFFQNQCZ8CFYOoFaZWSLAmAQShWQLAiESQQRtTLAOkQSdUFacK1WloCCSCaAAEFYKaQQSyEC0pvQirZTbomlIh6CYZAZFOQTBxDQhyCYOQhoPQS4bQHaBzaVwKTODjSuaOiArBVzKwDBrKwRJJRlBVzSwDUJQMMWCZKKVzqiNFYIqcD5iudUYZ3IbTzPMbTxMMMRTcXFZDafEJdVFcR5HbT6lKXILaeERQrrMBAAaUw4rBFUDcBFYzkBFcQjGGY4AbPY6LHFbrTFcY4AbgIrFAwIrkEggyGADwrFRQ4reagjiHADsVFeEVFcolEGIoAfPoq1FFcNAFYdQFccBFf4rbGAoAhKQYr/Fa8FFc9UFYYqkgEVFf4r/FYwDDAEZTDFf4r/Ff4rbqorooArBqArlgIr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rbqgrlgorCioroAYIr/Ff4r/FbYDDAEZTDFf4r/FYtAFclVFYUBFc9QFf4rZAgoAgKQor/FbFUFccFFYkVFcwFDioFEAD4lFGIorgPogrtWoYAfqorEgIrlqArFAwgAdEg4rlPgqKFADrUHcQorfA4sVA4wAbEY4zHFbh7GRY4AbaY7jBqAqfERArrMBAAZUxNVbkEVFZAJBFcJhRAC6lJFYLcebQIrIBRTaXJhIrhUhLcfD5YLBbjtVFZTceZ5jceJRpkLVyaiLWDpJNFYKwaUIIrMSIKwaDhw6OVx50NFYKwZDZ6waOaCTBQjBGBZZw8CQi4ZBOR6EYeySEYQSCEaQSITDH6BvGIaKEWQSSEEbqQVVQgRYSKwLGUQgRCQKwTFUC4RYQKwSCTDAhEONQTwULAqcNCARWVLAhGMB55YPDhQqDKy4dFFhAMMLCzgFawZWbEI4AIGogAYFZtAFbgsMFTyyGVkBZOKr7gJazoA/AHI")) - }; - - // p20 - if (p >= 20 && p < 30) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal1, - buffer : require("heatshrink").decompress(atob("AH4A/AH4ACgtVqtW1WoFUgpBFYYABwApggIqDFYmq0BVjFYxZfFQorGLLrWCFZbgbVgtUBQcKLD8VFQYMHlQsDKzoOJFgZYYKwYPLFgZWaoARMLDJWCawgAJcAZWYCZ6FCLCkFFQNQCZ8CFYOoFaZWSLAmAQShWQLAiESQQRtTLAKESFQNUFacKQiSCCoArTgCESQSyEUirZTboyCnQiSCYQiSCYQiSCZQgeAVxwqYQgSwMVwNUFbMKWBquaWCArBVzKwDbRoqaWATcKbQKuaWAbcKbQKuaWAbcKVzqwNFYIqcWATaKVziwDbhDaebhjaebhgrBbTrcCFZDafbhdVFcTcHbT7cDFY0BbT7cD0ArxgtVoArfgGq1ArHFUDcBFY0VFceqFY1UFcMKFY1VFcmAFYtQFcMCFYsBFcugFYtAFcMAFYsFFcuoFYoqigEqFeEVFcuqFYlUFccKFYlVFc2AFYdQFccCFf4AWgNVoAEGAERSDFf4rXgornqgrDFUkAior/Ff4rGAYYAjKYYr/Ff4r/FbdVFdFAFYNQFcsBFf4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/FbdUFcsFFYUVFdADBFf4r/Ff4rbAYYAjKYYr/Ff4rFoArkqorCgIrnqAr/FbIEFAEBSFFf4rYqgrjgorEiormAocVAogAfEooxFFcB9EFdq1DAD9VFYkBFctQFYoGEADokHFcp8FRQoAdag7iFFb4HFioHGADYjHGY4rcPYyLHADbTHcYNQFT4iIFdZgIADKmJqrcgiorIBIIrhMKIAXUpIrBbjzaBFZAKKbS5MJFcKkJbj4fLBYLcdqorKbjzPMbjxKNMhauTURawdJJorBWDShBFZiRBWDQcOHRyuPOhorBWDIbPWDRzQSYKEYIwLLOHgSEXDIJyPQjD2SQjCCQQjSCRCYY/QN4xDRQiyCSQgjdSCqqECLCRWBYyiECISBWCYqgXCLCBWCQSYYEIhxqCeChYFThoQCKypYEIxgPPLB4cKFQZWXDoosIBhhYWcArWDKzYhHABA1EADArNoArcFhgqeWQysgLJxVfcBLWdAH4A5A=")) - }; - - // p30 - if (p >= 30 && p < 40) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal1, - buffer : require("heatshrink").decompress(atob("AH4A/AH4ACgtVqtW1WoFUgpBFYYABwApggIqDFYmq0BVjFYxZfFQorGLLrWCFZbgbVgtUBQcKLD8VFQYMHlQsDKzoOJFgZYYKwYPLFgZWaoARMLDJWCawgAJcAZWYCZ6FCLCkFFQNQCZ8CFYOoFaZWSLAmAQShWQLAiESQQRtTLAKESFQNUFacKQiSCCoArTgCESQSyEUirZTboyCnQiSCYQiSCYQiSCZQgeAVxwqYQgSwMVwNUFbMKWBquaWCArBVzKwDbRoqaWATcKbQKuaWAbcKbQKuaWAbcKVzqwNFYIqcWATaKVziwDbhDaebhjaebhgrBbTrcCFZDafbhdVFcTcHbT7cDFY0BbT7cD0ArxgtVoArfgGq1ArHFUDcBFY0VFceqFY1UFcMKFY1VFcmAFYtQFcMCFYsBFcugFYtAFcMAFYsFFcuoFYoqigEqFeEVFcuqFYlUFccKFYlVFc2AFYdQFccCFf4rbgNVoArjgGq0Ar/FbMFFc+oFYYqkgEqFf4r/FY0VqgrlhWqFf4r/Ff4rdqorowArBqArlgQr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rbqgrlhQrCioroAYIr/Ff4r/FbcFqorllWoFf4r/FY9AFcmqFYUBFc+gFf4rZgFVqAqjgWqwAr/FbdUFccFawkVFcwFDioFEAD4lFGIorgPogrtWoYAfqorEgIrlqArFAwgAdEg4rlPgqKFADrUHcQorfA4sVA4wAbEY4zHFbh7GRY4AbaY7jBqAqfERArrMBAAZUxNVbkEVFZAJBFcJhRAC6lJFYLcebQIrIBRTaXJhIrhUhLcfD5YLBbjtVFZTceZ5jceJRpkLVyaiLWDpJNFYKwaUIIrMSIKwaDhw6OVx50NFYKwZDZ6waOaCTBQjBGBZZw8CQi4ZBOR6EYeySEYQSCEaQSITDH6BvGIaKEWQSSEEbqQVVQgRYSKwLGUQgRCQKwTFUC4RYQKwSCTDAhEONQTwULAqcNCARWVLAhGMB55YPDhQqDKy4dFFhAMMLCzgFawZWbEI4AIGogAYFZtAFbgsMFTyyGVkBZOKr7gJazoA/AHI")) - }; - - // p40 - if (p >= 40 && p < 50) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal1, - buffer : require("heatshrink").decompress(atob("AH4A/AH4ACgtVqtW1WoFUgpBFYYABwApggIqDFYmq0BVjFYxZfFQorGLLrWCFZbgbVgtUBQcKLD8VFQYMHlQsDKzoOJFgZYYKwYPLFgZWaoARMLDJWCawgAJcAZWYCZ6FCLCkFFQNQCZ8CFYOoFaZWSLAmAQShWQLAiESQQRtTLAKESFQNUFacKQiSCCoArTgCESQSyEUirZTboyCnQiSCYQiSCYQiSCZQgeAVxwqYQgSwMVwNUFbMKWBquaWCArBVzKwDbRoqaWATcKbQKuaWAbcKbQKuaWAbcKVzqwNFYIqcWATaKVziwDbhDaebhjaebhgrBbTrcCFZDafbhdVFcTcHbT7cDFY0BbT7cD0ArxgtVoArfgGq1ArHFUDcBFY0VFceqFY1UFcMKFY1VFcmAFYtQFcMCFYsBFcugFYtAFcMAFYsFFcuoFYoqigEqFeEVFcuqFYlUFccKFYlVFc2AFYdQFccCFf4rbgNVoArjgGq0Ar/FbMFFc+oFYYqkgEqFf4r/FY0VqgrlhWqFf4r/Ff4rdqorowArBqArlgQr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rbqgrlhQrCioroAYIr/Ff4r/FbcFqorllWoFf4r/FY9AFcmqFYUBFc+gFf4rZgFVqAqjgWqwAr/FbdUFccKFYkVFcwFDitVFccqFYkFFcuoFeNAFcWqFYkBFcugFYtQFUMCFYsAFcuAFYtUFcMKFY0VFcgHFitVFcMqFY0FFceoFY9AFcGqFY0BqtQFT8C1WgFeMAqtUFb8K1WAFY7cglQrIioriBI8FqtAFb2q1ArJbjzaBFZEBbj7aB0ALIFcLaHbkLaJFYbcd1QrKbjzaKbkDaLbgSwcVwLaJWD6uLFYawaVwIrMbgKwaVwLaKbgawaVwLaLbgawZQQLaLWDiuOWAaEYQQKuMWAiEXKwKuNQjUBQR6EaiqCPQjVVQSATCqtUFSZvB1WACiSEUY4KCQQgjdSCqqECLCRWBYyiECISBWCYqgXCLCBWCQSYYEIhxqCeChYFThoQCKypYEIxgPPLB4cKFQZWXDoosIBhhYWcArWDKzYhHABA1EADArNoArcFhgqeWQysgLJxVfcBLWdAH4A5A")) - }; - - // p50 - if (p >= 50 && p < 60) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal2, - buffer : require("heatshrink").decompress(atob("AH4A/AH4AChWq1WpqtUFUgpBFYYABoApggQqDFYlVqBVjFYxZfFQorGLLrWCFZbgbVguoBQcFLD8qFQYMHiosDKzoOJFgZYYKwYPLFgZWawARMLDJWCawgAJcAZWYCZ6FCLCkKFQOgCZ8BFYNUFaZWSLAlAQShWQLAiESQQRtTLAKESFQOoFacFQiSCCwArTgCESQSyEUlTZTboyCnQiSCYQiSCYQiSCZQgdAVxwqYQgSwMVwOoFbMFWBquaWCArBVzKwDbRoqaWATcKbQKuaWAbcKbQKuaWAbcKVzqwNFYIqcWATaKVziwDbhDaebhjaebhgrBbTrcCFZDafbheqFcTcHbT7cDFY0CbT7cDqArxhWqwArfgFVqgrHFUDcBFY0qFcdVFY2oFcMFFY2qFclAFYugFcMBFYsCFctQFYuAFcMAFYsKFctUFYoqigEVFeEqFctVFYmoFccFFYmqFc1AFYegFccBFf4rbgWqwArjgFVqAr/FbMKFc9UFYYqkgEVFf4r/FY0q1ArlgtVFf4r/Ff4rd1QrooArB0ArlgIr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rb1ArlgorClQroAYIr/Ff4r/FbcK1QrlitUFf4r/FY+AFclVFYUCFc9QFf4rZgGq0AqjgNVoAr/FbeoFccFFYkqFcwFDlWqFccVFYkKFctUFeOAFcVVFYkCFctQFYugFUMBFYsAFctAFYuoFcMFFY0qFcgHFlWqFcMVFY0KFcdUFY+AFcFVFY0C1WgFT8BqtQFeMA1WoFb8FqtAFY7cgiorIlQriBI8K1WAFb1VqgrJbjzaBFZECbj7aBqALIFcLaHbkLaJFYbcdqorKbjzaKbkDaLbgSwcVwLaJWD6uLFYawaVwIrMbgKwaVwLaKbgawaVwLaLbgawZQQLaLWDiuOWAaEYQQKuMWAiEXKwKuNQjSCQQjSCQQjSCRAAIrB1AqTgorBoAUQQiyCSQgjdSbISCRQgZYSKwKCSQghYQKwSCSQghYQKwSCTAAMqFYOoCJsFFQNVFShYEwARMFQRWVLAiFMQIRWWLAosKFQZWXLAosIFQZWYLAzgFawZWbAAMKFgmq1IoEAANUFTQABFZtAFbgsFFYwqeWQorFVjZZJFYhVfcAwrCazoA/AHI")) - }; - - // p60 - if (p >= 60 && p < 70) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal2, - buffer : require("heatshrink").decompress(atob("AH4A/AH4AChWq1WpqtUFUgpBFYYABoApggQqDFYlVqBVjFYxZfFQorGLLrWCFZbgbVguoBQcFLD8qFQYMHiosDKzoOJFgZYYKwYPLFgZWawARMLDJWCawgAJcAZWYCZ6FCLCkKFQOgCZ8BFYNUFaZWSLAlAQShWQLAiESQQRtTLAKESFQOoFacFQiSCCwArTgCESQSyEUlTZTboyCnQiSCYQiSCYQiSCZQgdAVxwqYQgSwMVwOoFbMFWBquaWCArBVzKwDbRoqaWATcKbQKuaWAbcKbQKuaWAbcKVzqwNFYIqcWATaKVziwDbhDaebhjaebhgrBbTrcCFZDafbheqFcTcHbT7cDFY0CbT7cDqArxhWqwArfgFVqgrHFUDcBFY0qFcdVFY2oFcMFFY2qFclAFYugFcMBFYsCFctQFYuAFcMAFYsKFctUFYoqigEVFeEqFctVFYmoFccFFYmqFc1AFYegFccBFf4rbgWqwArjgFVqAr/FbMKFc9UFYYqkgEVFf4r/FY0q1ArlgtVFf4r/Ff4rd1QrooArB0ArlgIr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rb1ArlgorClQroAYIr/Ff4r/FbcK1QrlitUFf4r/FY+AFclVFYUCFc9QFf4rZgGq0AqjgNVoAr/FbeoFccFFYkqFcwFDlWqFccVFYkKFctUFeOAFcVVFYkCFctQFYugFUMBFYsAFctAFYuoFcMFFY0qFcgHFlWqFcMVFY0KFcdUFY+AFcFVFY0C1WgFT8BqtQFeMA1WoFb8FqtAFY7cgiorIlQriBI8K1WAFb1VqgrJbjzaBFZECbj7aBqALIFcLaHbkLaJFYbcdqorKbjzaKbkDaLbgSwcVwLaJWD6uLFYawaVwIrMbgKwaVwLaKbgawaVwLaLbgawZQQLaLWDiuOWAaEYQQKuMWAelNBqCLVxqEC0oRPQS6EC0oSQQSyECFYKEVQSIABFYI/QAAcFFYJDRCgSCmYYjdSCqqYCLCRWBYyiECISBWCYqgXCLCBWCQSYYEIhxqCeChYFThoQCKypYEIxgPPLB4cKFQZWXDoosIBhhYWcArWDKzYhHABA1EADArNoArcFhgqeWQysgLJxVfcBLWdAH4A5A")) - }; - - // p70 - if (p >= 70 && p < 80) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal2, - buffer : require("heatshrink").decompress(atob("AH4A/AH4AChWq1WpqtUFUgpBFYYABoApggQqDFYlVqBVjFYxZfFQorGLLrWCFZbgbVguoBQcFLD8qFQYMHiosDKzoOJFgZYYKwYPLFgZWawARMLDJWCawgAJcAZWYCZ6FCLCkKFQOgCZ8BFYNUFaZWSLAlAQShWQLAiESQQRtTLAKESFQOoFacFQiSCCwArTgCESQSyEUlTZTboyCnQiSCYQiSCYQiSCZQgdAVxwqYQgSwMVwOoFbMFWBquaWCArBVzKwDbRoqaWATcKbQKuaWAbcKbQKuaWAbcKVzqwNFYIqcWATaKVziwDbhDaebhjaebhgrBbTrcCFZDafbheqFcTcHbT7cDFY0CbT7cDqArxhWqwArfgFVqgrHFUDcBFY0qFcdVFY2oFcMFFY2qFclAFYugFcMBFYsCFctQFYuAFcMAFYsKFctUFYoqigEVFeEqFctVFYmoFccFFYmqFc1AFYegFccBFf4rbgWqwArjgFVqAr/FbMKFc9UFYYqkgEVFf4r/FY0q1ArlgtVFf4r/Ff4rd1QrooArB0ArlgIr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rb1ArlgorClQroAYIr/Ff4r/FbcK1QrlitUFf4r/FY+AFclVFYUCFc9QFf4rZAgoAggNVoAr/FbdUFccFFYkVFcwFDioFEAD4lFGIorgPogrtWoYAfqorEgIrlqArFAwgAdEg4rlPgqKFADrUHcQorfA4sVA4wAbEY4zHFbh7GRY4AbaY7jBqAqfERArrMBAAZUxNVbkEVFZAJBFcJhRAC6lJFYLcebQIrIBRTaXJhIrhUhLcfD5YLBbjtVFZTceZ5jceJRpkLVyaiLWDpJNFYKwaUIIrMSIKwaDhw6OVx50NFYKwZDZ6waOaCTBQjBGBZZw8CQi4ZBOR6EYeySEYQSCEaQSITDH6BvGIaKEWQSSEEbqQVVQgRYSKwLGUQgRCQKwTFUC4RYQKwSCTDAhEONQTwULAqcNCARWVLAhGMB55YPDhQqDKy4dFFhAMMLCzgFawZWbEI4AIGogAYFZtAFbgsMFTyyGVkBZOKr7gJazoA/AHIA=")) - }; - - // p80 - if (p >= 80 && p < 90) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal2, - buffer : require("heatshrink").decompress(atob("AH4A/AH4AChWq1WpqtUFUgpBFYYABoApggQqDFYlVqBVjFYxZfFQorGLLrWCFZbgbVguoBQcFLD8qFQYMHiosDKzoOJFgZYYKwYPLFgZWawARMLDJWCawgAJcAZWYCZ6FCLCkKFQOgCZ8BFYNUFaZWSLAlAQShWQLAiESQQRtTLAKESFQOoFacFQiSCCwArTgCESQSyEUlTZTboyCnQiSCYQiSCYQiSCZQgdAVxwqYQgSwMVwOoFbMFWBquaWCArBVzKwDbRoqaWATcKbQKuaWAbcKbQKuaWAbcKVzqwNFYIqcWATaKVziwDbhDaebhjaebhgrBbTrcCFZDafbheqFcTcHbT7cDFY0CbT7cDqArxhWqwArfgFVqgrHFUDcBFY0qFcdVFY2oFcMFFY2qFclAFYugFcMBFYsCFctQFYuAFcMAFYsKFctUFYoqigEVFeEqFctVFYmoFccFFYmqFc1AcIdQFccBFf4rbGAoAhKQYr/Fa8FFc9UFYYqkgEVFf4r/FYwDDAEZTDFf4r/Ff4rbqorooArBqArlgIr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rbqgrlgorCioroAYIr/Ff4r/FbYDDAEZTDFf4r/FYtAFclVFYUBFc9QFf4rZAgoAgKQor/FbFUFccFFYkVFcwFDioFEAD4lFGIorgPogrtWoYAfqorEgIrlqArFAwgAdEg4rlPgqKFADrUHcQorfA4sVA4wAbEY4zHFbh7GRY4AbaY7jBqAqfERArrMBAAZUxNVbkEVFZAJBFcJhRAC6lJFYLcebQIrIBRTaXJhIrhUhLcfD5YLBbjtVFZTceZ5jceJRpkLVyaiLWDpJNFYKwaUIIrMSIKwaDhw6OVx50NFYKwZDZ6waOaCTBQjBGBZZw8CQi4ZBOR6EYeySEYQSCEaQSITDH6BvGIaKEWQSSEEbqQVVQgRYSKwLGUQgRCQKwTFUC4RYQKwSCTDAhEONQTwULAqcNCARWVLAhGMB55YPDhQqDKy4dFFhAMMLCzgFawZWbEI4AIGogAYFZtAFbgsMFTyyGVkBZOKr7gJazoA/AHIA=")) - }; - - // p90 - if (p >= 90 && p < 100) return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal2, - buffer : require("heatshrink").decompress(atob("AH4A/AH4AChWq1WpqtUFUgpBFYYABoApggQqDFYlVqBVjFYxZfFQorGLLrWCFZbgbVguoBQcFLD8qFQYMHiosDKzoOJFgZYYKwYPLFgZWawARMLDJWCawgAJcAZWYCZ6FCLCkKFQOgCZ8BFYNUFaZWSLAlAQShWQLAiESQQRtTLAKESquq1ArTgqESNgOqwArTIYKERH4KCUQigSBbKTdGCKKCVQiTCCFSyERCALBQQjAPBoArXDZ7ARObKuBSZwcaVzR0QFYKuZWAYNZWCJJKMoKuaWAahKBhiwTJRSudURorBFTgfMVzqjDO5DaeZ5jaeJhhiKbi4rIbT4hLqoriPI7afUpS5BbTwiKFdZgIADSmHFYIqgbgIrGcgIriEYwzHADZ7HRY4rdaYrjHADcBFYoGBFcgkEGQwAeFYqKHFbzUEcQ4AdiorwiorlEogxFAD59FWoorhoArDqArjgIr/FbYwFAEJSDFf4rXgornqgrDFUkAior/Ff4rGAYYAjKYYr/Ff4r/FbdVFdFAFYNQFcsBFf4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/FbdUFcsFFYUVFdADBFf4r/Ff4rbAYYAjKYYr/Ff4rFoArkqorCgIrnqAr/FbIEFAEBSFFf4rYqgrjgorEiormAocVAogAfEooxFFcB9EFdq1DAD9VFYkBFctQFYoGEADokHFcp8FRQoAdag7iFFb4HFioHGADYjHGY4rcPYyLHADbTHcYNQFT4iIFdZgIADKmJqrcgiorIBIIrhMKIAXUpIrBbjzaBFZAKKbS5MJFcKkJbj4fLBYLcdqorKbjzPMbjxKNMhauTURawdJJorBWDShBFZiRBWDQcOHRyuPOhorBWDIbPWDRzQSYKEYIwLLOHgSEXDIJyPQjD2SQjCCQQjSCRCYY/QN4xDRQiyCSQgjdSCqqECLCRWBYyiECISBWCYqgXCLCBWCQSYYEIhxqCeChYFThoQCKypYEIxgPPLB4cKFQZWXDoosIBhhYWcArWDKzYhHABA1EADArNoArcFhgqeWQysgLJxVfcBLWdAH4A5A")) - }; - - // p100 - return { - width : 176, height : 176, bpp : 2, - transparent : -1, - palette : pal2, - buffer : require("heatshrink").decompress(atob("AH4A/AH4ACgtVAAVUFUgpDAAdAFMEBFQ4ABqBVnLMQqLFjzWEABLgbVgohEGoqyaiofDBihWVHJpYYDgYPbKxz5NLDJGCfBzgDKzA+SLChECC6A/CNRycIS6jCNIQ5uSCqqCCeCqESTKxCCQiBsCTCRDEQiCCWQigSBYaRwGQU6ESQTCESQTCESQTIbQYCJzZVwKTODjSuaOiArBVzKwDBrKwRJJRlBVzSwDUJQMMWCZKKVzqiNFYIqcD5iudUYZ3IbTzPMbTxMMMRTcXFZDafEJdVFcR5HbT6lKXILaeERQrrMBAAaUw4rBFUDcBFYzkBFcQjGGY4AbPY6LHFbrTFcY4AbgIrFAwIrkEggyGADwrFRQ4reagjiHADsVFeEVFcolEGIoAfPoq1FFcNAFYdQFccBFf4rbGAoAhKQYr/Fa8FFc9UFYYqkgEVFf4r/FYwDDAEZTDFf4r/Ff4rbqorooArBqArlgIr/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4rbqgrlgorCioroAYIr/Ff4r/FbYDDAEZTDFf4r/FYtAFclVFYUBFc9QFf4rZAgoAgKQor/FbFUFccFFYkVFcwFDioFEAD4lFGIorgPogrtWoYAfqorEgIrlqArFAwgAdEg4rlPgqKFADrUHcQorfA4sVA4wAbEY4zHFbh7GRY4AbaY7jBqAqfERArrMBAAZUxNVbkEVFZAJBFcJhRAC6lJFYLcebQIrIBRTaXJhIrhUhLcfD5YLBbjtVFZTceZ5jceJRpkLVyaiLWDpJNFYKwaUIIrMSIKwaDhw6OVx50NFYKwZDZ6waOaCTBQjBGBZZw8CQi4ZBOR6EYeySEYQSCEaQSITDH6BvGIaKEWQSSEEbqQVVQgRYSKwLGUQgRCQKwTFUC4RYQKwSCTDAhEONQTwULAqcNCARWVLAhGMB55YPDhQqDKy4dFFhAMMLCzgFawZWbEI4AIGogAYFZtAFbgsMFTyyGVkBZOKr7gJazoA/AHIA=")) - }; +function addPoint(loc, max) { + var angle = ((2*Math.PI)/max) * loc; + var x = hyp * Math.sin(angle); + var y = hyp * Math.cos(angle + Math.PI); + x += rad; + y += rad; + return [Math.round(x),Math.round(y)]; } +function polyArray(start, end, max) { + const eighth = max / 8; + if (start == end) return []; // No array to draw if the points are the same. + let startOrigin = start; + let endOrigin = end; + start %= max; + end %= max; + if(start == 0 && startOrigin != 0) start = max; + if(end == 0 && endOrigin != 0) end = max; + if (start > end) end += max; + var array = [g.getHeight()/2, g.getHeight()/2]; + var pt = addPoint(start, max); + array.push(pt[0], pt[1]); + + for (let i = start + eighth; i < end; i += eighth) { + pt = addPoint(i, max); + array.push(pt[0], pt[1]); + } + pt = addPoint(end, max); + array.push(pt[0], pt[1]); + log_debug("Poly Arr: " + array); + return array; +} + +function drawRing(start, end, max, idx) { + // Create persistent `buf` inside the function scope + if (!drawRing._buf) { + drawRing._buf = Graphics.createArrayBuffer(w, h, 2, { msb: true }); + } + const buf = drawRing._buf; + let img = { width: w, height: h, transparent: 0, + bpp: 2, palette: pals[idx].pal1, buffer: buf.buffer }; + let edge = ringEdge + (idx * ringIterOffset); + buf.clear(); + buf.setColor(1).fillEllipse(edge,edge,w-edge,h-edge); + buf.setColor(0).fillEllipse(edge+ringThick,edge+ringThick,w-edge-ringThick,h-edge-ringThick); + img.palette = pals[idx].pal2; + g.drawImage(img, 0, 0); // Draws a filled-in circle + if((end - start) >= max) return; // No need to add the unfilled circle + buf.clear(); + buf.setColor(1).fillEllipse(edge,edge,w-edge,h-edge); + buf.setColor(0).fillEllipse(edge+ringThick,edge+ringThick,w-edge-ringThick,h-edge-ringThick); + buf.setColor(0).fillPoly(polyArray(start, end, max)); // Masks the filled-in part of the segment over the unfilled part + img.palette = pals[idx].pal1; + g.drawImage(img, 0, 0); // Draws the unfilled-in segment + return; +} + +function drawSemi(start, end, max, idx) { + // Create persistent `buf` inside the function scope + var fullCircle = (end - start) >= max; + if (!drawSemi._buf) { + drawSemi._buf = Graphics.createArrayBuffer(w, h, 2, { msb: true }); + } + const buf = drawSemi._buf; + let img = { width: w, height: h, transparent: 0, + bpp: 2, palette: pals[idx].pal2, buffer: buf.buffer }; + let edge = ringEdge + (idx * ringIterOffset); + buf.clear(); + buf.setColor(1).fillEllipse(edge,edge,w-edge,h-edge); + buf.setColor(0).fillEllipse(edge+ringThick,edge+ringThick,w-edge-ringThick,h-edge-ringThick); + if (fullCircle) + img.palette = pals[idx].pal2; + else + img.palette = palbg; + g.drawImage(img, 0, 0); // Draws a filled-in circle with the bg color, clearing it + if(end == start) return; //If the ring should be completely empty + if(fullCircle) return; // No need to add the unfilled circle + buf.clear(); + buf.setColor(1).fillEllipse(edge,edge,w-edge,h-edge); + buf.setColor(0).fillEllipse(edge+ringThick,edge+ringThick,w-edge-ringThick,h-edge-ringThick); + buf.setColor(0).fillPoly(polyArray(end, start, max)); // Masks the filled-in part of the segment over the unfilled part + img.palette = pals[idx].pal2; + g.drawImage(img, 0, 0); // Draws the unfilled-in segment + return; +} + +function drawC(end, max, idx) { + // Create persistent `buf` inside the function scope + if (!drawC._buf) { + drawC._buf = Graphics.createArrayBuffer(w, h, 2, { msb: true }); + } + const buf = drawC._buf; + let img = { width: w, height: h, transparent: 0, + bpp: 2, palette: pals[idx].pal2, buffer: buf.buffer }; + let edge = ringEdge + (idx * ringIterOffset); + buf.clear(); + buf.setColor(1).fillEllipse(edge,edge,w-edge,h-edge); + buf.setColor(0).fillEllipse(edge+ringThick,edge+ringThick,w-edge-ringThick,h-edge-ringThick); + img.palette = palbg; + g.drawImage(img, 0, 0); // Draws a filled-in circle with the bg color, clearing it + buf.clear(); + buf.setColor(1).fillEllipse(edge,edge,w-edge,h-edge); + buf.setColor(0).fillEllipse(edge+ringThick,edge+ringThick,w-edge-ringThick,h-edge-ringThick); + if (end > max) end = max; + var vertices = rotate_points(end, max); + buf.setColor(0).fillPoly(vertices); + img.palette = pals[idx].pal2; + g.drawImage(img, 0, 0); // Draws the unfilled-in segment + return; +} + + ///////////////// IDLE TIMER ///////////////////////////////////// function drawIdle() { @@ -455,12 +787,26 @@ BUTTON.prototype.draw = function() { g.drawRect(this.x, this.y, (this.x + this.w), (this.y + this.h)); }; +function redrawWholeFace() { + // Reset the prevRings to force all rings to update + prevRing = Array(3).fill().map(() => ({ start: null, end: null, max: null })); + g.clear(); + draw(false); +} + function dismissPrompt() { idle = false; warned = false; lastStep = getTime(); Bangle.buzz(100); - draw(); + redrawWholeFace(); +} + +function resetIdle() { + if (idle == false) return; + // redraw if we had been idle + dismissPrompt(); + idle = false; } var dismissBtn = new BUTTON("big",0, 3*h/4 ,w, h/4, "#0ff", dismissPrompt, "Dismiss"); @@ -481,20 +827,22 @@ Bangle.on('touch', function(button, xy) { // if we get a step then we are not idle Bangle.on('step', s => { lastStep = getTime(); - // redraw if we had been idle - if (idle == true) { - dismissPrompt(); - } - idle = false; + resetIdle(); warned = 0; - - if (infoMode == "ID_STEP") drawSteps(); + if (drawingSteps) return; + var steps = getSteps(); + var ret = checkRedrawSteps(steps); + if (!ret[0] && !ret[1]) return; + drawingSteps = true; + if (ret[0]) drawSteps(); + if (ret[1]) drawAllRings(new Date(), 'Steps'); + drawingSteps = false; }); function checkIdle() { log_debug("checkIdle()"); if (!settings.idle_check) { - idle = false; + resetIdle(); warned = false; return; } @@ -513,7 +861,7 @@ function checkIdle() { } idle = true; } else { - idle = false; + resetIdle(); warned = 0; } } @@ -535,25 +883,94 @@ function buzzer(n) { }, 500); } +function getDelayMs(prevDelayMs, ring_setting, now) { + // Much of the logic here is for slowing or speeding the delay on the seconds setting. + // returns [ms before next update, if only the ring should be updated] + const sec_batt = [20, 50]; + const sec_delay = [10000, 2000, 1000]; + const deadband = 5; + if (ring_setting.some(ring => ring.ring === 'Seconds')) { + const nearNextMinute = (now % 60000) >= (60000 - prevDelayMs); + if (nearNextMinute) { + let batt = E.getBattery(); + for (let i = 0; i < sec_batt.length; i++) { + if (batt <= sec_batt[i]) + return [sec_delay[i], false]; + } + // Check for coming out of the above states w/ deadband + for (let i = 0; i < sec_batt.length; i++) { + if (prevDelayMs == sec_delay[i] && batt >= (sec_batt[i] + deadband)) + return [sec_delay[i + 1], false]; + } + return [sec_delay[sec_delay.length - 1], false]; + } + else { + return [prevDelayMs, true]; + } + } + else + return [60000, false]; +} + /////////////////////////////////////////////////////////////////////////////// // timeout used to update every minute var drawTimeout; -// schedule a draw for the next minute +// schedule a draw for the next minute or every sec_update ms function queueDraw() { + let now = Date.now(); + var nextUpdateRet = getDelayMs(nextUpdateMs, settings.rings, now); + nextUpdateMs = nextUpdateRet[0]; + let delay = nextUpdateMs - (now % nextUpdateMs); if (drawTimeout) clearTimeout(drawTimeout); drawTimeout = setTimeout(function() { drawTimeout = undefined; checkIdle(); - draw(); - }, 60000 - (Date.now() % 60000)); + draw(nextUpdateRet[1]); + }, delay); +} + +function getInnerOuterMostRing() { + // Outputs 1 through 3 + let innerMost = 0; + let outerMost = 0; + for (let i = 0; i < settings.rings.length; i++) { + let j = settings.rings.length - 1 - i; + if (outerMost === 0 && settings.rings[i].type !== "None") { + outerMost = i + 1; + } + if (innerMost === 0 && settings.rings[j].type !== "None") { + innerMost = j + 1; + } + if (outerMost !== 0 && innerMost !== 0) { + break; + } + } + innerMostRing = innerMost; + outerMostRing = outerMost; +} + +function getFullestRing() { + // Outputs 0 through 2 + let largestPercent = 0; + let fullestRing = 0; + for (let i = 0; i < settings.rings.length; i++) { + if (settings.rings[i].type !== "None") { + let percent = (prevRing[i].end - prevRing[i].start) / prevRing[i].max; + if (largestPercent < percent) { + largestPercent = percent; + fullestRing = i; + } + } + } + return fullestRing; } // Stop updates when LCD is off, restart when on Bangle.on('lcdPower',on=>{ if (on) { - draw(); // draw immediately, queue redraw + draw(false); // draw immediately, queue redraw } else { // stop draw timer if (drawTimeout) clearTimeout(drawTimeout); drawTimeout = undefined; @@ -561,18 +978,27 @@ Bangle.on('lcdPower',on=>{ }); Bangle.setUI("clockupdown", btn=> { - if (btn<0) prevInfo(); - if (btn>0) nextInfo(); - draw(); + clearInfo(); // Used to clear infobox in case we're going to the HRM + if (btn<0) settings.idxInfo = prevInfo(settings.idxInfo); + if (btn>0) settings.idxInfo = nextInfo(settings.idxInfo); + // power HRM on/off accordingly + infoMode = infoList[settings.idxInfo]; + Bangle.setHRMPower(infoMode == "ID_HRM" ? 1 : 0); + resetHrm(); + log_debug("idxInfo=" + settings.idxInfo); + draw(false); + storage.write(SETTINGS_FILE, settings); // Retains idxInfo when leaving the face }); loadSettings(); loadLocation(); +var infoMode = infoList[settings.idxInfo]; +updateSunRiseSunSet(new Date(), location.lat, location.lon, true); +nextUpdateMs = getDelayMs(1000, settings.rings, Date.now())[0]; -g.clear(); Bangle.loadWidgets(); /* * we are not drawing the widgets as we are taking over the whole screen */ widget_utils.hide(); -draw(); +redrawWholeFace(); diff --git a/apps/daisy/metadata.json b/apps/daisy/metadata.json index 178cd8b20..caa66d1b7 100644 --- a/apps/daisy/metadata.json +++ b/apps/daisy/metadata.json @@ -1,8 +1,8 @@ { "id": "daisy", "name": "Daisy", - "version": "0.14", + "version": "0.17", "dependencies": {"mylocation":"app"}, - "description": "A beautiful digital clock with large ring guage, idle timer and a cyclic information line that includes, day, date, steps, battery, sunrise and sunset times", + "description": "A beautiful digital clock with large ring gauge, idle timer and a cyclic information line that includes, day, date, steps, battery, sunrise and sunset times", "icon": "app.png", "type": "clock", "tags": "clock", diff --git a/apps/daisy/screenshot_daisy4.png b/apps/daisy/screenshot_daisy4.png new file mode 100644 index 000000000..bad317df2 Binary files /dev/null and b/apps/daisy/screenshot_daisy4.png differ diff --git a/apps/daisy/settings.js b/apps/daisy/settings.js index c0a2ffeea..6a829be2f 100644 --- a/apps/daisy/settings.js +++ b/apps/daisy/settings.js @@ -1,59 +1,160 @@ (function(back) { const SETTINGS_FILE = "daisy.json"; - // initialize with default settings... - let s = {'gy' : '#020', - 'fg' : '#0f0', - 'color': 'Green', - 'check_idle' : true, - 'batt_hours' : false}; - - // ...and overwrite them with any saved values - // This way saved values are preserved if a new version adds more settings - const storage = require('Storage') - let settings = storage.readJSON(SETTINGS_FILE, 1) || s; - const saved = settings || {} - for (const key in saved) { - s[key] = saved[key] - } - - function save() { - settings = s - storage.write(SETTINGS_FILE, settings) - } - - var color_options = ['Green','Orange','Cyan','Purple','Red','Blue']; - var fg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f']; - var gy_code = ['#020','#220','#022','#202','#200','#002']; - - E.showMenu({ - '': { 'title': 'Daisy Clock' }, - '< Back': back, - 'Colour': { - value: 0 | color_options.indexOf(s.color), - min: 0, max: 5, - format: v => color_options[v], - onchange: v => { - s.color = color_options[v]; - s.fg = fg_code[v]; - s.gy = gy_code[v]; - save(); + function getDefaultSettings() { + return { + rings: [ + { + color: 'Green', + fg: '#0f0', + gy: '#020', + ring: 'Steps', + type: 'Full', + step_target: 10000, }, - }, - 'Idle Warning': { - value: !!s.idle_check, - onchange: v => { - s.idle_check = v; - save(); + { + color: 'Blk/Wht', + fg: null, + gy: null, + ring: 'Minutes', + type: 'None', + step_target: 10000, }, - }, - 'Expected Battery Life In Days Not Percentage': { - value: !!s.batt_hours, - onchange: v => { - s.batt_hours = v; - save(); + { + color: 'Green', + fg: '#0f0', + gy: '#020', + ring: 'Hours', + type: 'None', + step_target: 10000, + } + ], + color: 'Outer', + fg: '#0f0', + check_idle: true, + batt_hours: false, + idxInfo: 0, + }; +} + +let s = getDefaultSettings(); +// ...and overwrite them with any saved values +// This way saved values are preserved if a new version adds more settings +const storage = require('Storage'); +let settings = storage.readJSON(SETTINGS_FILE, 1) || s; +const saved = settings || {}; +for (const key in saved) { + s[key] = saved[key]; +} + +function save() { + settings = s; + storage.write(SETTINGS_FILE, settings); +} + + var color_options = ['Cyan','Green','Orange','Purple','Red','Blue', 'Blk/Wht']; + var fg_code = ['#0ff','#0f0','#ff0','#f0f','#f00','#00f', null]; + var gy_code = ['#022','#020','#220','#202','#200','#002', null]; + var ring_options = ['Hours', 'Minutes', 'Seconds', 'Day', 'Sun', 'Steps', 'Battery']; + var ring_types = ['None', 'Full', 'Semi', 'C']; + var step_options = [100, 1000, 5000, 10000, 15000, 20000]; + var color_options_font = ['Outer', 'Inner', 'Fullest'].concat(color_options); + var fg_code_font = [null, null].concat(color_options); + + function showRingMenu(ringIndex) { + const ring = s.rings[ringIndex]; + let ringMenu = { + '': { title: `Ring ${ringIndex + 1}` }, + '< Back': showMainMenu, + 'Type': { + value: ring_types.indexOf(ring.type), + min: 0, max: ring_types.length - 1, + format: v => ring_types[v], + onchange: v => { + let prev = ring.type; + ring.type = ring_types[v]; + save(); + if (prev != ring.type && (prev === 'None' || ring.type === 'None')) { + setTimeout(showRingMenu, 0, ringIndex); + } + } }, + }; + if (ring.type != 'None') { + ringMenu['Color'] = { + value: 0 | color_options.indexOf(ring.color), + min: 0, max: color_options.length - 1, + format: v => color_options[v], + onchange: v => { + ring.color = color_options[v]; + ring.fg = fg_code[v]; + ring.gy = gy_code[v]; + save(); + } + }; + ringMenu['Display'] = { + value: 0 | ring_options.indexOf(ring.ring), + min: 0, max: ring_options.length - 1, + format: v => ring_options[v], + onchange: v => { + let prev = ring.ring; + ring.ring = ring_options[v]; + save(); + if (prev != ring.ring && (prev === 'Steps' || ring.ring === 'Steps')) { + setTimeout(showRingMenu, 0, ringIndex); + } + }, + }; + if (ring.ring == 'Steps') { + ringMenu[/*LANG*/"Step Target"] = { + value: 0 | step_options.indexOf(ring.step_target), + min: 0, max: step_options.length - 1, + format: v => step_options[v], + onchange: v => { + ring.step_target = step_options[v]; + save(); + }, + }; + } } - }); -}) + E.showMenu(ringMenu); + } + function showMainMenu() { + let appMenu = { + '': { title: 'Daisy Clock' }, + '< Back': back, + 'Ring 1': () => showRingMenu(0), + 'Ring 2': () => showRingMenu(1), + 'Ring 3': () => showRingMenu(2), + 'Hour Color': { + value: 0 | color_options_font.indexOf(s.color), + min: 0, max: color_options_font.length - 1, + format: v => color_options_font[v], + onchange: v => { + s.color = color_options_font[v]; + s.fg = fg_code_font[v]; + save(); + }, + }, + 'Battery Life Format' : { + value: !!s.batt_hours, + format: value => value?"Days":"%", + onchange: v => { + s.batt_hours = v; + save(); + }, + }, + 'Idle Warning' : { + value: !!s.idle_check, + onchange: v => { + s.idle_check = v; + save(); + }, + }, + }; + E.showMenu(appMenu); + } + + showMainMenu(); +}) \ No newline at end of file diff --git a/apps/dane_tcr/settings.js b/apps/dane_tcr/settings.js index 46988ec26..c13a0825d 100644 --- a/apps/dane_tcr/settings.js +++ b/apps/dane_tcr/settings.js @@ -54,4 +54,4 @@ }, '< Back': back }); -}); \ No newline at end of file +}) diff --git a/apps/daymoon/ChangeLog b/apps/daymoon/ChangeLog new file mode 100644 index 000000000..a00fe7982 --- /dev/null +++ b/apps/daymoon/ChangeLog @@ -0,0 +1,5 @@ +0.01: First functional release +0.02: move moon down, rotate sunrise/sunset, shift Hours/minutes to corners +0.03: Change day and night to have different dots +0.04: Update ChangeLog, coerce dark theme +0.05: Add more screenshots, fix bug in dot colors diff --git a/apps/daymoon/README.md b/apps/daymoon/README.md new file mode 100644 index 000000000..4b43b75aa --- /dev/null +++ b/apps/daymoon/README.md @@ -0,0 +1,20 @@ +# DayMoon Circadian +This started out with a goal to recreate the Pebble [Fair Circadian watchface](https://setpebble.com/app/fair-circadian) by Matthew Clark for the Bangle.js2. +It ended up with me making a mostly new watchface that has the moon phase more prominent, but keeps the single dial 24 hour clock with daylight and sunset highlighted. + +This uses the myLocation app to get your latitude and longitude for proper daylight calculations. If your location isn't set in that app, it will default to Nashua, NH. If your sunrise/sunset times aren't making sense, check that first! + +## Future Development +Feature roadmap: + - [x] 0.01 Fix blocking widgets + - [x] 0.03 Day and Night different color markers + - [x] 0.04 Add to App Loader + - [x] 0.05 Add more screenshots with different moon phases + - [ ] 0.06 add Day of week and month display + - [ ] 0.07 Seconds display + - [ ] 0.08 Color Themes (and settings/options) + - [ ] 0.09 Moon display angle represents how it looks in the sky + - [ ] 0.10 custom/bigger/fitted time digits + - [ ] 0.20 clockinfo support? + - [ ] 0.30 Tap/swipe actions? + \ No newline at end of file diff --git a/apps/daymoon/app-icon.js b/apps/daymoon/app-icon.js new file mode 100644 index 000000000..a87dd3ee2 --- /dev/null +++ b/apps/daymoon/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEw4kA///hADBg/g/9/zuFA4Ocj+Nj+lgP4vP/o8AokAg8Ag0Ao//Mf4AptF2s+ICqNGulmkVkxF0wwsPo+EuUik13s14DBsIu1Iw4XBlGIs41BsAWKgl4vFnu1okVns+GsgyBtOZC5FkOQOHw1ItGGvGEAQWWhIuIxF2w92vAJDxGIs2JxFpC494wUos9HBQtHo2Sk+XRhFyk65ChWqqvAAoN5wUpuyMHxFos6FBCwOq5vM5sAzF3ygMCAAl3vDQBgEPCwOqr285nggFJw9IGA1os2IEIPz/QXB5m84vMGALbBNYsIBANnFwMz1Uzn/MqtbrhiBTgN2JAkHpCzBgGjmfzC4POGAmIo1nuAXEFwIHB+evmYXBrm89vM9nAhFnogvFZgNghU//8/mf69ns8vM93Ag1ovAvEAwOGUgIsB/55B9lc9ld5yRBtF2swXDw92sgXDR4P65h4B93M7gQBoyQEu0iRwKMBXwX/5p1B9nMr0Ao8ivAXDsUilAXC/4XBnQVBrncrfOgFCkUmC4eykUrC4R1B0f/O4PM53O3kAqUikIXDjci7YXB+Z3B1+qCwPsqoDBgG8kXlC4kV7x3B1//C4XMrovCO4O72NVC4fhiI6BhWqIoIXBIYPN5lc4EArtdjYXDhdd8PAC4M/18/F4PM4vF53Agsd7sQC4nB7jLBUgKOB1XFLgIAB4EBMgIzBAAUBiPBWYK+CAANc5wXCgHF8sdE4IvD5mx8JgCAAXO9neFwMAjobBI4kA2vMqOwGAnO9yoBgEF3fBroWEgHsjflWAIwD4tc6ouB5nc8sRC4sO9cd9wPBDAXlFwUO8ve8PQC4sAiPCldbAoIYB5hvC50SlfOCw0AivSkNb2IKF2Mc2Uu9YXHh0V9nrjbjEjsc3sV2qEBAAsigEe53hj3R3vbiMeitbfgK0BCAIADgQCBhtc2O7qOx8si7ns4PNqvgCAQXEDwUO93uj1c2Uilvh8vsaYIQDF4kgAgO+qsRjdSkUrjZKBCAxfEAAXt4PR5kijle5gQIABFdrxeBCBgA/ADg=")) \ No newline at end of file diff --git a/apps/daymoon/app.js b/apps/daymoon/app.js new file mode 100644 index 000000000..ce403fdfe --- /dev/null +++ b/apps/daymoon/app.js @@ -0,0 +1,260 @@ +const LOCATION_FILE = "mylocation.json"; +let location; + +var Utils = require("graphics_utils"); +var SunCalc = require("suncalc"); +var RADII = { + moon: 40, + arcMin: 48, + arcMax: 63, + dots: 55, + needle: 54, +}; +var COL = { + moon: 65535, // + txture: 33792, // 0.5 ,0.5,0 + shadow: 8196, // .125,0, .125 + day: 40159, //0.6, 0.6,1 + night: 6, // 0, 0, 0.2 + ndots: 2047, // 0, 1, 1 cyan + ddots: 0, + needle: 63488, // 1, 0, 0 red + stime: 2047 +}; +const TAU = 2.0 * Math.PI; +const MX = g.getWidth() / 2, + MY = 24 + 3 + RADII.arcMax; +const DAY_MILLIS = 86400000; +const M_POS = { + x: MX, + y: MY, + r: RADII.moon +}; +// images +const moon_texture = { + width: 80, + height: 80, + bpp: 1, + transparent: 0, + buffer: require("heatshrink").decompress(atob("ABsRqAJHkEiBA0N0uq1AIEgNVqtRqoJEgUiAAQJEioTBAAIzEl2q12oxATECQdVioJD/eqne60UCHQoADoAJBgf+xWrFIOACYUFCYo8Cj/73f70er0ROHAANUBIM//3///q1WIFAV1qtXCggJB//7CYO6keikBOHKAUDCIInClSgCgonBu4TK1W73ShBMQxkCh5OC//uFIInBi91q5PFCYISC3er//iOwXVE41UCYf+9//9AnCJopVBqEv/+/3//E4P6kUgJw4nDKAP+14TB1Xoq4hBEwYFBqgnB3Wr3e737KB/QnIqp3B32OKAYTBE4Z4BAoYnBEoRSC0fyE5ITBJ4WuCYP4J4J3CeQQFClbvBJgOqn5kBnRPKTwJMB1B4B92qEgQACJ4JTBkYnBYwOilYsBO5NUhYmB9+qxGC9TxBEYTvFqki3Y8B1Uikei3+oionIgGrO4OqwGC9H/xATK1/7E4UAnU7kATIqEAl/uE4WA12u0ATJgSgB/+ikUgnW70EFCY9AgGDE4PowEAlWowEBCZJ4BneggUgkRSBCZEAgEKJoIEBgEIAYQOCKYcVBIMqJgIEBgQSCgAQBqiJDRQIOBEwYAEMgNRiITBqKKBCYJJBE4xQGMQIABlBPHHgInDHQQjEAQJTCHgbFEABg8EBg5SDCgxNDABI=")) +}; +const needle = { + width: 23, + height: 10, + bpp: 1, + transparent: 0, + buffer: atob("//+B///D///AAAHgAADgAAHAAA9///j//+H//gA=") +}; + +/* + now use SunCalc.getMoonIllumination() + previously used these: + https://github.com/espruino/BangleApps/blob/master/apps/widmp/widget.js + https://github.com/deirdreobyrne/LunarPhase + modified to be based on millisec instead of sec, and to use tau = 2*pi +*/ + +// requires the myLocation app +function loadLocation() { + location = require("Storage").readJSON(LOCATION_FILE, 1) || { + "lat": 45, + "lon": -71.3, + "location": "Nashua" + }; //{"lat":51.5072,"lon":0.1276,"location":"London"}; +} + +function drawMoon(shadowShape) { + g.setColor(0, 0, 0).fillCircle(MX, MY, RADII.arcMax + 3); + g.setColor(COL.moon).fillCircle(MX, MY, RADII.moon - 1); + g.setColor(COL.txture).drawImage(moon_texture, MX, MY, { + rotate: 0 + }); + // TODO: can set the rotation here to the parallacticAngle from getMoonPosition + g.setColor(COL.shadow).fillPoly(shadowShape); + // TODO: set rotation of the fillPoly? parallactic-mp.angle I think. + // Use g.transformVertices to do the rotation +} + +function drawDayRing(times) { + let r_ = RADII.arcMin; + let rm = RADII.arcMax; + let rd = RADII.dots; + let radT = [tToRad(times[0]), tToRad(times[1])]; + let hhmm = [require("locale").time(times[0], 1), require("locale").time(times[1], 1)]; + g.setColor(COL.day); + Utils.fillArc(g, MX, MY, r_, rm, radT[0], radT[1]); + g.setColor(COL.night); + Utils.fillArc(g, MX, MY, r_, rm, radT[1] - TAU, radT[0]); + // write sunrise/sunset times + g.setFont('6x8').setColor(COL.stime); + g.setFontAlign(0, 1, 3).drawString(hhmm[0], MX - rm - 2, MY); + g.setFontAlign(0, 1, 1).drawString(hhmm[1], MX + rm + 2, MY); + // draw dots + let edges = []; + let isDay = false; + let flag = false; + if (radT[1] > TAU) { + edges = [radT[1] - TAU, radT[0]]; + g.setColor(COL.ddots); + isDay = true; + } else { + edges = [radT[0], radT[1]]; + g.setColor(COL.ndots); + isDay = false; + } + for (var i = 0; i < 24; i++) { + let a = i * TAU / 24; + if (!flag && a > edges[0] && a < edges[1]) { + //first cross + if (isDay) { + g.setColor(COL.ndots); + } else { + g.setColor(COL.ddots); + } + flag = true; + } else if (flag && a > edges[1]) { + //second cross + if (isDay) { + g.setColor(COL.ddots); + } else { + g.setColor(COL.ndots); + } + flag = false; + } + let dotSize = (i % 3 == 0) ? 2 : 1; + let pX = MX + Math.cos(a) * rd; + let pY = MY + Math.sin(a) * rd; + g.fillCircle(pX, pY, dotSize); + } + let labels = ['6P', '12A', '6A', '12P']; + let qX = [rd - 9, 2, 11 - rd, 2]; + let qY = [1, rd - 10, 1, 12 - rd]; + g.setFont('4x6').setFontAlign(0, 0, 0).setColor(COL.ndots); + for (var j = 0; j < 4; j++) { + g.drawString(labels[j], MX + qX[j], MY + qY[j]); + } +} + + +function drawHHMM(d) { + var HM = require("locale").time(d, 1 /*omit seconds*/ ).split(":"); + // write digital time + g.setBgColor(0, 0, 0).setColor(1, 1, 1).setFontVector(45); + g.setFontAlign(1, 1, 0).drawString(" " + HM[0], MX - 20, g.getHeight() + 3); + g.setFontAlign(-1, 1, 0).drawString(HM[1] + " ", MX + 30, g.getHeight() + 3); + // TODO: use the meridian text AM/PM or blank for 24 hr. + // var meridian = require("locale").meridian(d); +} + +function moonShade(pos, mp) { + pos = pos !== undefined ? pos : M_POS; + mp = mp !== undefined ? mp : SunCalc.getMoonIllumination(new Date()); + // pos has x,y, r for the drawing, mp is from SunCalc Moon Illumination + let k = mp.fraction; + // k is the percent along the equator of the terminator + const pts = Math.min(pos.r >> 1, 32); + // this gives r/2 pts on the way down and up, capped at 64 total for polyfill + let a = [], + b = [], + s1 = 1, + s2 = 0; + // scale s1 is 1 or -1 for fixed edge of the shadow; defined via case switches below + // scale s2 factor for the moving edge of the shadow + // need to do some computation to simplify for new/full moon if k 'close enough' to 0 or 1/-1 + // + let isWaxing = (mp.phase < 0.5); + s1 = isWaxing ? -1 : 1; + s2 = isWaxing ? 1 - 2 * k : 2 * k - 1; + let tr = (pos.r + 1); + for (var i = 0; i < pts; i++) { + // down stroke on the outer shadow + var t = i * Math.PI / (pts + 1); //pts+1 so we leave the last point for the starting of going up + let cirX = Math.sin(t) * tr; + let cirY = Math.cos(t) * tr; + a.push(pos.x + s1 * cirX); //x + a.push(pos.y + cirY); //y + b.push(pos.x + s2 * cirX); //x for shadow edge + b.push(pos.y - cirY); //y going up for shadow edge + } + return a.concat(b); +} + +function tToRad(date) { + date = (date !== undefined) ? new Date(date.getTime()) : new Date(); + let milli = date - new Date(date.setHours(0, 0, 0, 0)); + return (milli / DAY_MILLIS + 0.25) * TAU; +} + +function draw(date) { + var d = date !== undefined ? date : new Date(); + var a = tToRad(d), + shape = moonShade(M_POS, SunCalc.getMoonIllumination(d)), + sTimes = SunCalc.getTimes(d, location.lat, location.lon), + daylight = [sTimes.sunrise, sTimes.sunset]; + //clear time area + g.clearRect(Bangle.appRect); //g.setColor(0).fillRect(0, 176 - 45, 176, 176); + drawMoon(shape); + drawDayRing(daylight); + drawHHMM(d); + // draw pointer + // TODO: Maybe later make this an overlay that can be removed?? -avoid drawing so much every minute/second + g.setColor(COL.needle).drawImage(needle, MX + RADII.needle * Math.cos(a), MY + RADII.needle * Math.sin(a), { + rotate: a + }); + +} +/* +const shotTimes = [1720626960000, 1729184400000, 1738298880000, 1717575420000]; +let desc =`first quarter -2 days moon at 10:20 in the summer + jun 10 2024 10:56 +full moon at 12 noon near fall equinox + Sep 17 2024 12:00 +new moon at 11pm in winter + dec 30 2024 23:48 +3rd quarter moon at 03:17 am + May 5 2024 03:17` + +function screenshots(times) { + let d = new Date(); + for (let t of times) { + d.setTime(t); + draw(d); + g.dump(); + } +} +*/ +// Clear the screen once, at startup +g.reset(); +// requires the myLocation app +loadLocation(); +g.setBgColor(0, 0, 0).clear(); +// draw immediately at first +draw(); +// now draw every second +// eventually maybe update the moon just every hour?? +var secondInterval = setInterval(draw, 10000); //was 1000 +// Stop updates when LCD is off, restart when on +Bangle.on('lcdPower', on => { + if (secondInterval) clearInterval(secondInterval); + secondInterval = undefined; + if (on) { + secondInterval = setInterval(draw, 10000); //was 1000 + draw(); // draw immediately + } +}); +/* Show launcher when middle button pressed +This should be done *before* Bangle.loadWidgets so that +widgets know if they're being loaded into a clock app or not */ +Bangle.setUI("clock"); +// Load widgets +Bangle.loadWidgets(); +g.setTheme({ + fg: "#fff", + bg: "#000", + fg2: "#fff", + bg2: "#004", + fgH: "#fff", + bgH: "#00f", + dark: true +}); +Bangle.drawWidgets(); \ No newline at end of file diff --git a/apps/daymoon/daymoon.png b/apps/daymoon/daymoon.png new file mode 100644 index 000000000..f9cd84178 Binary files /dev/null and b/apps/daymoon/daymoon.png differ diff --git a/apps/daymoon/metadata.json b/apps/daymoon/metadata.json new file mode 100644 index 000000000..f06e216bc --- /dev/null +++ b/apps/daymoon/metadata.json @@ -0,0 +1,17 @@ +{ "id": "daymoon", + "name": "DayMoon Circadian Clock", + "version": "0.05", + "dependencies": {"mylocation":"app"}, + "description": "A 24 hour clockface showing the Moon Phase and portion of the day that the Sun is up inspired by Matthew Clark's *Fair Circadian* Pebble watchface", + "icon": "daymoon.png", + "screenshots": [{"url":"s1.png"},{"url":"s2.png"},{"url":"s3.png"},{"url":"s4.png"}], + "type": "clock", + "tags": "clock,moon,lunar", + "supports": ["BANGLEJS2"], + "allow_emulator": true, + "readme":"README.md", + "storage": [ + {"name":"daymoon.app.js","url":"app.js"}, + {"name":"daymoon.img","url":"app-icon.js","evaluate":true} + ] +} \ No newline at end of file diff --git a/apps/daymoon/s1.png b/apps/daymoon/s1.png new file mode 100644 index 000000000..cb64c2f01 Binary files /dev/null and b/apps/daymoon/s1.png differ diff --git a/apps/daymoon/s2.png b/apps/daymoon/s2.png new file mode 100644 index 000000000..22eddc14b Binary files /dev/null and b/apps/daymoon/s2.png differ diff --git a/apps/daymoon/s3.png b/apps/daymoon/s3.png new file mode 100644 index 000000000..463be5d21 Binary files /dev/null and b/apps/daymoon/s3.png differ diff --git a/apps/daymoon/s4.png b/apps/daymoon/s4.png new file mode 100644 index 000000000..6b8ce5021 Binary files /dev/null and b/apps/daymoon/s4.png differ diff --git a/apps/dejivaisu/ChangeLog b/apps/dejivaisu/ChangeLog new file mode 100644 index 000000000..62e2d0c20 --- /dev/null +++ b/apps/dejivaisu/ChangeLog @@ -0,0 +1 @@ +0.1: New App! \ No newline at end of file diff --git a/apps/dejivaisu/app-icon.js b/apps/dejivaisu/app-icon.js new file mode 100644 index 000000000..aa3f5f2b1 --- /dev/null +++ b/apps/dejivaisu/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEw4cBnnH///BIO6q2+++GoUwwmYmUkyVJAWspBhcSAgVKqOggEBA4VAwEAgnb9IRDqeQk3bvtAPAWbtv0gEP0QRCzmAFgQRDGoQEBugEB0nkUJkOxMk1IYCAAJWD7ASECIsDpILDyVgAgUB6MlhMkyEAjQxFpgEDnUoFoOQg2QgcAm3AhkAhMwCQdCNoU0kmbeYMYgKPBkwRDiQ1ByOhCIQABhuA4EELgsEwMJjmSnxrBuEGSQcgCQcNpHjxsl2XZkm44EAHAJDBtgRBtEBjlrsuS5dly4uBaoMEydtCwNog8Drcs21Zlmy8Eg3//0zdB2j0Bg3aOAQCCrgRDzFtl//pEAi1W7dt23btXIug1BmvAtf+y/9QQIRGnwyB0mSr+l/VdgPWCItIm/SQYMArt+y/r0GyCIvZg3brh6Brt1/QRIrIRBoARGywRF5IRJEYwRBI4IRCI4eSGo7FDNYdw2wRGgrFDhaPCgPSR40oYocNWYNLwCzG5TFDwEB+jOBYo/KYokAm//OIMCdItR3zFDNoMD9ADBrNlyXLsuywO1YoYACtACBhcs23LluUhuk6/8CAcAjomBgMk2Vbkmgts2ydgCIkNCIIIBI4MAjdN027CIQCCgeggFJ2AGBm3TpO17YGBg7+CgF0gUJPYNt03atOu7AMB/UpLgUOydp2matt07VtuyMBgPRkmuEgU6pk06VtmnbpM2BQMGxMkyoXBAAPpky0CyXtJoU+CIOS3YRCgbLBpMl7dsBAMB2i7CqdgggOBEYgMBRIP0CIVSpp0BNAIRC3dt2kbtsiCIVKcwoCFpAKJAVoA==")) \ No newline at end of file diff --git a/apps/dejivaisu/app.js b/apps/dejivaisu/app.js new file mode 100644 index 000000000..30193f805 --- /dev/null +++ b/apps/dejivaisu/app.js @@ -0,0 +1,192 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable no-undef */ + +const storage = require('Storage'); +require("Font8x16").add(Graphics); + +let appsettings = storage.readJSON('setting.json'); + +//MASCOT +if (appsettings.showMascot) { + var L1 = { + width : 16, height : 16, bpp : 1, + transparent : 0, + palette : new Uint16Array([65535,0]), + buffer : atob("AAAH4AgQcMiAaIDohgh4CEAQP4gpLylFGM40YlPVfn8=") + }; + var L2 = { + width : 16, height : 16, bpp : 1, + transparent : 0, + palette : new Uint16Array([65535,0]), + buffer : atob("B+AIEHDIgGiA6IYIeAhA0D8QGMgpGDnHDF0zxlKqfv4=") + }; + var R1 = { + width : 16, height : 16, bpp : 1, + transparent : 0, + palette : new Uint16Array([65535,0]), + buffer : atob("B+AIEBMOFgEXARBhEB4LAgj8ExgYlOOcujBjzFVKf34=") + }; + var R2 = { + width : 16, height : 16, bpp : 1, + transparent : 0, + palette : new Uint16Array([65535,0]), + buffer : atob("AAAH4AgQEw4WARcBEGEQHggCEfz0lKKUcxhGLKvK/n4=") + }; + + // Initial position and direction + var x = 40; + var y = 25; + var direction = 1; // 1 for right, -1 for left + var currentFrame = 0; // 0 for L1/R1, 1 for L2/R2 + var prevX = x; // Track the previous position of the sprite + + function drawSprite() { + g.clearRect(prevX, y, prevX + 32, y + 32); + if (direction === 1) { + g.drawImage(currentFrame === 0 ? R1 : R2, x, y, {scale:2}); + } else { + g.drawImage(currentFrame === 0 ? L1 : L2, x, y, {scale:2}); + } + prevX = x; + } + + function updatePosition() { + if (Math.random() < 0.3) { + direction = Math.random() < 0.5 ? -1 : 1; + } + + x += direction * 2; + + if (x > g.getWidth() - 70) { + x = g.getWidth() - 70; + direction = -1; + } else if (x < 0) { + x = 0; + direction = 1; + } + } + + function alternateFrame() { + currentFrame = 1 - currentFrame; + } +} + +//BARS + +if (appsettings.showDJSeconds) { + let barCount = 0; + let increasing = true; + + function drawBars() { + const barWidth = 5; + const barSpacing = 3; + const barHeight = 15; + const startX = (g.getWidth() - (5 * barWidth + 4 * barSpacing)) / 2 -60; + const startY = g.getHeight() / 2 + 30; + + for (let i = 0; i < barCount; i++) { + g.fillRect( + startX + i * (barWidth + barSpacing), + startY - barHeight / 2, + startX + i * (barWidth + barSpacing) + barWidth, + startY + barHeight / 2 + ); + } + } + + function updateBars() { + if (increasing) { + barCount++; + if (barCount >= 5) { + increasing = false; + } + } else { + barCount--; + if (barCount <= 0) { + increasing = true; + } + } + } +} + + +//ACTUAL WATCH + +{ +let drawTimeout; +let queueMillis = 1000; +let queueDraw = function() { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + drawWatchface(); + }, queueMillis - (Date.now() % queueMillis)); +}; +let updateState = function() { + if (Bangle.isLCDOn()) { + if (Bangle.isLocked()){ + queueMillis = 60000; + } else { + queueMillis = 1000; + } + drawWatchface(); // draw immediately, queue redraw + } else { // stop draw timer + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } +}; + +function drawWatchface() { + var date = new Date(); + var day = date.getDate(); + var month = date.getMonth() + 1; // Months are 0-indexed + var year = date.getFullYear(); + var seconds = date.getSeconds(); + + g.reset().clearRect(Bangle.appRect); + g.setFontAlign(0, 0); + g.setFontVector(60); + var timeString = require("locale").time(date, 1); + var AMPM = require("locale").meridian(new Date()).toUpperCase(); + var timeWidth = g.stringWidth(timeString)/2; + var jpclX = (g.getWidth() - timeWidth ); + var jpclY = g.getHeight() / 2; + g.drawString(timeString, jpclX, jpclY); + if (!Bangle.isLocked()) { + if (appsettings.showMascot) { + updatePosition(); + alternateFrame(); + drawSprite(); + } + if (appsettings.showDJSeconds) { + g.setFontVector(20); + g.drawString(seconds.toString().padStart(2, '0'), jpclX + timeWidth / 2+25, jpclY + 33); + updateBars(); + drawBars(); + } + g.drawString(AMPM, jpclX+60, jpclY-38); + } + queueDraw(); +} + +// Clear the screen once, at startup +g.clear(); +// Set dynamic state and perform initial drawing +updateState(); +// Register hooks for LCD on/off event and screen lock on/off event +Bangle.on('lcdPower', updateState); +Bangle.on('lock', updateState); +Bangle.setUI({ + mode: "clock", + remove: function() { + // Called to unload all of the clock app + Bangle.removeListener('lcdPower', updateState); + Bangle.removeListener('lock', updateState); + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } +}); +// Load widgets +Bangle.loadWidgets(); +Bangle.drawWidgets(); +} \ No newline at end of file diff --git a/apps/dejivaisu/app.png b/apps/dejivaisu/app.png new file mode 100644 index 000000000..c9bc5cbc2 Binary files /dev/null and b/apps/dejivaisu/app.png differ diff --git a/apps/dejivaisu/metadata.json b/apps/dejivaisu/metadata.json new file mode 100644 index 000000000..4095b3335 --- /dev/null +++ b/apps/dejivaisu/metadata.json @@ -0,0 +1,27 @@ +{ + "id": "dejivaisu", + "name": "Dejivaisu", + "version": "0.1", + "description": "A clock loosely inspired by a certain digital device. Includes an (optional) animated mascot and a seconds animation.", + "icon": "app.png", + "screenshots": [{"url":"screenshot.png"}], + "type": "clock", + "tags": "clock", + "supports": ["BANGLEJS2"], + "allow_emulator": true, + "storage": [ + { + "name": "dejivaisu.app.js", + "url": "app.js" + }, + { + "name": "dejivaisu.img", + "url": "app-icon.js", + "evaluate": true + }, + { "name":"dejivaisu.settings.js", + "url":"settings.js" + } + ], + "data": [{"name":"dejivaisu.json"}] +} diff --git a/apps/dejivaisu/screenshot.png b/apps/dejivaisu/screenshot.png new file mode 100644 index 000000000..7f465fa6e Binary files /dev/null and b/apps/dejivaisu/screenshot.png differ diff --git a/apps/dejivaisu/settings.js b/apps/dejivaisu/settings.js new file mode 100644 index 000000000..b808e47bd --- /dev/null +++ b/apps/dejivaisu/settings.js @@ -0,0 +1,28 @@ +(function back() { + const storage = require('Storage'); + // Load existing settings or initialize defaults + let settings = storage.readJSON('setting.json') || {}; + + function saveSettings() { + storage.write('setting.json', settings); + } + + E.showMenu({ + '': { 'title': 'Dejivaisu Settings' }, + 'Show Mascot': { + value: settings.showMascot, + onchange: v => { + settings.showMascot = v; + saveSettings(); + } + }, + 'Show Seconds': { + value: settings.showDJSeconds, + onchange: v => { + settings.showDJSeconds = v; + saveSettings(); + } + }, + '< Back': () => load() + }); +}) \ No newline at end of file diff --git a/apps/dejivaisu/settings.json b/apps/dejivaisu/settings.json new file mode 100644 index 000000000..09c433461 --- /dev/null +++ b/apps/dejivaisu/settings.json @@ -0,0 +1,4 @@ +{ + "showMascot": true, + "showDJSeconds": true +} diff --git a/apps/delaylock/metadata.json b/apps/delaylock/metadata.json index dff4d9219..7441d822b 100644 --- a/apps/delaylock/metadata.json +++ b/apps/delaylock/metadata.json @@ -3,7 +3,7 @@ "version":"0.01", "description": "Delay the locking of the screen to 5 seconds after the backlight turns off.", "icon": "app.png", - "tags": "settings, configuration, backlight, touchscreen, screen", + "tags": "settings,configuration,backlight,touchscreen,screen", "type": "bootloader", "supports" : ["BANGLEJS2"], "readme": "README.md", diff --git a/apps/denseclock/ChangeLog b/apps/denseclock/ChangeLog new file mode 100644 index 000000000..7ae520fa5 --- /dev/null +++ b/apps/denseclock/ChangeLog @@ -0,0 +1,3 @@ +0.01: Begin rewrite from old code. +0.02: Changed visuals: uA > mA, info order, battery state indication +0.03: Update app icon diff --git a/apps/denseclock/app-icon.js b/apps/denseclock/app-icon.js new file mode 100644 index 000000000..b8a0761f8 --- /dev/null +++ b/apps/denseclock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwcBkmSpIC/AS0nwEHCh5yBggROgP4jgROh1ICKWT4Hkz0AC4NPgFypPgAQIRDyBLBCIMAiVAgECpAGBCInwn4RBg4dBoH/yV4j+ACI0Dz05kARB8gRJgARFgYRBgEB5IRKBwICCI4/8CIdJ/kCGoP+CIMPUIIRBkgRIYop9DgJHCPowDBTwUAyAREiSkBCITCOAX4CuwE5kmT4D1BBYSMByShBhwRCgEkWYQRDUIIRCUIWfEALXBCIsDCIMf+QICvEECIILBBAV5CIUcBAYRFpEEBYIRKnARIgFyHwfk+PAGogREgQIBPQMk+EACI9J/hrCyUHCIMHCJEnwAIByEBCIJrFCI/wWYIROwP5CIShECI7FBgjFDPoTFBgTXGBYICCCI6PDAX4C/ARoA=")) diff --git a/apps/denseclock/app.js b/apps/denseclock/app.js new file mode 100644 index 000000000..62a40154e --- /dev/null +++ b/apps/denseclock/app.js @@ -0,0 +1,157 @@ +// FONTS + +/* + Share Tech Mono: https://fonts.google.com/specimen/Share+Tech+Mono + Converted with: https://www.espruino.com/Font+Converter +*/ + +Graphics.prototype.setFontShareTechMonoBig = function(scale) { + // Actual height 56 (55 - 0) + this.setFontCustom( + atob('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+AAAAAAAAB+AAAAAAAAB+AAAAAAAAB+AAAAAAAAB+AAAAAAAAB+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAHwAAAAAAAA/wAAAAAAAD/wAAAAAAAf/wAAAAAAB//gAAAAAAP/8AAAAAAA//wAAAAAAH/+AAAAAAA//4AAAAAAD//AAAAAAAf/8AAAAAAB//gAAAAAAP/8AAAAAAB//wAAAAAAH/+AAAAAAA//4AAAAAAD//AAAAAAAf/4AAAAAAB//gAAAAAAP/8AAAAAAA//wAAAAAAA/+AAAAAAAA/4AAAAAAAA/AAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf///4AAAAD/////AAAAP/////wAAAf/////4AAA//////8AAA//////8AAB/AAB/j+AAB+AAH/B+AAB8AAP8A+AAB8AA/4A+AAB8AB/gA+AAB8AH/AA+AAB8AP8AA+AAB8A/4AA+AAB8B/gAA+AAB+D/AAB+AAA//+AAP8AAA//////8AAAf/////4AAAP/////wAAAH/////gAAAB////+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPgAAAAeAAAfgAAAA+AAAfAAAAA+AAA/AAAAA+AAA+AAAAA+AAA+AAAAA+AAB+AAAAA+AAB8AAAAA+AAB//////+AAB//////+AAB//////+AAB//////+AAB//////+AAB//////+AAAAAAAAA+AAAAAAAAA+AAAAAAAAA+AAAAAAAAA+AAAAAAAAA+AAAAAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+AAB8AAAAD+AAB8AAAAP+AAB8AAAAf+AAB8AAAB/+AAB8AAAD/+AAB8AAAH/+AAB8AAAf8+AAB8AAA/4+AAB8AAD/w+AAB8AAH/A+AAB+AAf+A+AAB+AA/4A+AAA////wA+AAA////gA+AAAf//+AA+AAAP//8AA+AAAH//wAA+AAAB/+AAA+AAAAAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8AAAAA+AAB8AAAAA+AAB8AB8AA+AAB8AB8AA+AAB8AB8AA+AAB8AB8AA+AAB8AB8AA+AAB8AB8AA+AAB8AB8AA+AAB8AB8AA+AAB8AD8AA+AAB+AH+AB+AAA////gD+AAA//////8AAAf/////8AAAP//P//4AAAH/+H//wAAAA/4D//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAAAAAP/wAAAAAAD//wAAAAAB///wAAAAAf///wAAAAH////wAAAB///+HwAAAB///gHwAAAB//wAHwAAAB/4AAHwAAAB+AAAHwAAABAAAAHwAAAAAAP///+AAAAAf///+AAAAAf///+AAAAAf///+AAAAAf///+AAAAAf///+AAAAAAAHwAAAAAAAAHwAAAAAAAAHwAAAAAAAAHwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB///wAA+AAB///wAA+AAB///wAA+AAB///wAA+AAB///wAA+AAB///wAA+AAB8AHwAA+AAB8AHwAA+AAB8AHwAA+AAB8AD4AA+AAB8AD4AA+AAB8AD4AB+AAB8AD+AD+AAB8AD///8AAB8AB///8AAB8AA///4AAB8AAf//wAAB4AAP//gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAP/////gAAAf/////4AAAf/////4AAA//////8AAA/APgAD+AAB+APgAB+AAB8APgAA+AAB8APgAA+AAB8APgAA+AAB8APgAA+AAB8APgAA+AAB8APgAA+AAB8AHwAA+AAB8AHwAB+AAB8AH+AP8AAB8AH///8AAB8AD///4AAAAAB///wAAAAAA///gAAAAAAP/+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8AAAAAAAAB8AAAAAAAAB8AAAAAAAAB8AAAAAAAAB8AAAAAOAAB8AAAAD+AAB8AAAAf+AAB8AAAD/+AAB8AAA//+AAB8AAH//+AAB8AB///gAAB8AP//8AAAB8D///AAAAB8f//4AAAAB////AAAAAB///wAAAAAB//+AAAAAAB//gAAAAAAB/8AAAAAAAB/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//AAAAD/8H//wAAAP//P//4AAAf/////8AAA//////8AAA//////+AAB/AP+AB+AAB8AD8AA+AAB8AD8AA+AAB8AB8AA+AAB8AB8AA+AAB8AB8AA+AAB8AB8AA+AAB8AB8AA+AAB8AD8AA+AAB+AH+AA+AAA////AD+AAA//////8AAAf/////8AAAP//P//4AAAH/+H//wAAAA/4D//gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//4AAAAAAP//+AAAAAAf///AAAAAAf///AA+AAA////gA+AAB/AAfgA+AAB+AAPgA+AAB8AAPwA+AAB8AAHwA+AAB8AAHwA+AAB8AAHwA+AAB8AAHwA+AAB8AAHwA+AAB8AAHwB+AAB+AAHwB+AAA//////8AAA//////8AAAf/////4AAAP/////wAAAH/////gAAAB////+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+AAB+AAAAB+AAB+AAAAB+AAB+AAAAB+AAB+AAAAB+AAB+AAAAB+AAB+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'), + 46, + 32, + 60+(scale<<8)+(1<<16) + ); + return this; +}; + +Graphics.prototype.setFontShareTechMono = function(scale) { + // Actual height 38 (37 - 0) + this.setFontCustom( + atob('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHgAAAAAeAAAAAB4AAAAAHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAfAAAAAP8AAAAD/gAAAB/4AAAAf+AAAAP/AAAAH/gAAAB/4AAAA/8AAAAP/AAAAH/gAAAD/wAAAA/8AAAAP+AAAAA/gAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//4AAA///8AAP///8AA////wAHwAfvgAeAH4eABwA/A4AHAHwDgAcB+AOAB4PgB4AHj8AHgAf///+AA////wAB///+AAD///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAOAA8AAA4ADwAADgAeAAAOAB4AAA4AH////gAf///+AB////4AH////gAAAAAOAAAAAA4AAAAADgAAAAAOAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4AHAAAfgAcAAD+ABwAA/4AHAAH/gAcAA/OABwAP44AHgB+DgAfAfwOAA//8A4AD//gDgAH/4AOAAH+AA4AAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAOABwBwA4AHAHADgAcAcAOABwBwA4AHAHADgAeA+AOAB8H4B4AD////gAP///8AAf+f/gAAPgf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPgAAAAP+AAAAP/4AAAf//gAAf//OAAB//A4AAH+ADgAAcAAOAAAAH//4AAA///gAAD//+AAAP//4AAAAHgAAAAAOAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/+ADgAf/4AOAB//gA4AH/+ADgAcA4AOABwDgA4AHAPADgAcA8AeABwD//4AHAH//AAcAP/4AAAAf/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///8AAH///4AA////wAH////gAeB4AeABwHgA4AHAeADgAcB4AOABwHgA4AHAeAHgAcA//+ABwD//wAAAH/+AAAAP/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAABwAAAAAHAAAAgAcAAAeABwAAf4AHAAP/gAcAH/+ABwH/+AAHD//AAAf//AAAB//gAAAH/gAAAAfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB/gAAP+f/gAD////AAP///+AB//8B4AHgPgDgAcAcAOABwBwA4AHAHADgAcAcAOAB4D4B4AH////gAP///8AAf/f/wAAfw/+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//AAAAH/+AAAA//8A4AH4HwDgAeAHgOABwAeA4AHAB4DgAcAHgOABwAeB4AHgB4HgAf///+AA////wAB///+AAB///gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4AHgAAHgAeAAAeAB4AAB4AHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='), + 46, + 22, + 40+(scale<<8)+(1<<16) + ); + return this; +}; + +Graphics.prototype.setFontShareTechMonoSmall = function(scale) { + // Actual height 23 (22 - 0) + this.setFontCustom( + atob('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/zgP/zgP/zgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAPwAAPwAAAAAAPwAAPwAAPAAAAAAAAAAAAAAAAAAAAAAAAwYAP//gP//gP//gAwYAP//gP//gP//gAwYAAAAAAAAAAAAAAAAAB4AAD+BgH/Bg+HB8+DB8+DB8GD/gGB/AAAcAAAAAAAAAABAAH7AAP7AAMLAAMbAAP7AAHzfAAG/gAGxgAGxgAG/gAGfAAGAAAAAAAAAADz/AH//gP+DgMOBgMMBgMMBgMP/gAP/gAMAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAPwAAPwAAPgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wP//8/AA+4AAGgAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAC4AAG/AB+P//8D//wAAAAAAAAAAAAAAAAAAAAAAAADAAADuAAB+AAP4AAfwAAP8AAB+AADsAADAAAAAAAAAAAAAAAAAAAADgAADgAADgAAf8AAf8AAf8AADgAADgAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeAAD+AAD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAADgAADgAADgAADgAADgAADgAADgAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAADgAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAeAAD8AAfwAB+AAP4AA/AAH8AAfgAA8AAAwAAAAAAAAAAAAAAAD/+AH//APB/gMDxgMHBgMeBgP//gH//AD/+AAAAAAAAAAAAAAAAAGAAgGABgOABgOABgP//gP//gAABgAABgAABgAAAAAAAAAAAAAAAAAABgMAHgMAPgMA9gMB5gOHxgH/BgD+BgAABgAAAAAAAAAAAAAAAAAAAAMCBgMGBgMGBgMHBgP/DgH//gD5/AAAAAAAAAAAAAAAAAAAAAAD4AA/4AP/4APwYAMAYAAP/gAP/gAAcAAAYAAAAAAAAAAAAAAAAAAAAAP+BgP+BgMGBgMGBgMHDgMH/gMD/AAAAAAAAAAAAAAAAAAAAAD/+AH//AP//gMMBgMMBgMOBgMP/gMH/AAD+AAAAAAAAAAAAAAAAAMAAAMAAAMADgMAfgMH/AM/4AP/AAPwAAGAAAAAAAAAAAAAAAAAAAD5/AH//gP/DgMHBgMGBgMHBgP/jgH//gD5/AAAAAAAAAAAAAAAAAD+AAH/AgP/hgMBhgMBhgMBhgP//gH//AD/+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcDgAcDgAcDgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeAcD+AcD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAHgAAHgAAPwAAMwAAc4AAY4AA4cAA4cABwMAAAAAAAAAAAAAAAAAAMYAAMYAAMYAAMYAAMYAAMYAAMYAAMYAAMYAAAAAAAAAAAAAAAAABwMAA4cAA4cAAY4AAc4AAMwAAPwAAHgAAHgAAAAAAAAAAAAAAAAAAAAAMAAAMABgMDzgMHzgOeAAH8AAD4AAAAAAAAAAAAAAB/8AH//AP//gMHhgMf5gM/9gMwNgM/5gM/8gMAMAP/8AH/8AA/wAAAAAAADgAA/gAP/gD/4AP8YAPAYAP8YAD/4AAP/gAA/gAADgAAAAAAAAAAAAP//gP//gMGBgMGBgMGBgMGBgP/DgH//gD5/AAAAAAAAAAAAAAAAAB/8AH//AP//gOABgMABgMABgMABgMABgMABgAAAAAAAAAAAAAAAAP//gP//gMABgMABgMABgMABgOADgH//gH//AAAAAAAAAAAAAAAAAP//gP//gP//gMGBgMGBgMGBgMGBgMGBgMABgAAAAAAAAAAAAAAAAP//gP//gP//gMHAAMHAAMHAAMHAAMHAAMAAAAAAAAAAAAAAAAAAAD/+AH//AP//gMABgMDBgMDBgMD/gMD/gAD/gAAAAAAAAAAAAAAAAP//gP//gAHAAAHAAAHAAAHAAAHAAP//gP//gAAAAAAAAAAAAAAAAAAAAMABgMABgP//gP//gP//gMABgMABgAAAAAAAAAAAAAAAAAAAAAAAAAABgMABgMABgMABgMAHgP//AP/+AAAAAAAAAAAAAAAAAAAAAP//gP//gAPAAAfgAB/4ADw+APAfgOAHgIABgAAAAAAAAAAAAAAAAAAAAP//gP//gAABgAABgAABgAABgAABgAAAAAAAAAAAAAAAAP//gP//gPgAAP+AAB/gAAHwAB/gAP8AAPgAAP//gP//gAAAAAAAAAAAAP//gP//gPwAAP/AAA/8AAD/gAAPgP//gP//gAAAAAAAAAAAAA/8AH//AH//gOADgMABgMABgMABgOADgH//gH//AA/4AAAAAAAAAAAAAP//gP//gMDgAMDgAMDgAMDgAP/AAH/AAD+AAAAAAAAAAAAAAA/8AH//AH//gOADgMABgMABgMABgOADgH//gH//wA/4wAAAAAAAAH//gP//gP//gMDAAMDAAMDgAOD8AP//AH+PgB4DgAAAgAAAAAAAAAAAAD4AAH+BgP+BgOGBgMHBgMHBgMH/gMD/AAA+AAAAAAAAAAAAAMAAAMAAAMAAAMAAAP//gP//gP//gMAAAMAAAMAAAMAAAAAAAAAAAAAAAP//AP//gAADgAABgAABgAABgAADgP//gP//AAAAAAAAAAAAAMAAAP4AAP/wAA//AAB/gAAHgAD/gB/+AP/AAPwAAIAAAAAAAAAAAP/gAP//gAP/gAAfgAH+AAHwAAD/gAAfgAf/gP//gP8AAAAAAAAAAAAAgOADgPgPgH4+AB/4AAfwAB/4AH4/APgPgOADgAAAgAAAAAAAAMAAAPAAAPwAAD8AAA//gAP/gAf/gD8AAPwAAPAAAIAAAAAAAAAAAAAAAMADgMAPgMA/gMD5gMPhgM+BgP4BgPgBgOABgAAAAAAAAAAAAAAAAAAAAAAAA///+///+wAAGwAAGwAAGAAAAAAAAAAAAAAAAAAAAwAAA+AAAfgAAH8AAA/AAAP4AAB+AAAPwAAD8AAAeAAAGAAAAAAAAAAAAAAAAAAAAwAAGwAAGwAAG///+///+AAAAAAAAAAAAAAAAAAAAAAAAA4AAD4AAPwAAeAAAYAAAeAAAPwAAD4AAAYAAAAAAAAAAAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAAAAAAAAAAAAAAIAAAMAAAOAAAGAAACAAAAAAAAAAAAAAAAAAAAAAAAAOAAY/gAY/gAZxgAZxgAZxgAZxgAf/gAP/gAABgAAAgAAAAAAAAAAAAP//gP//gAcBgAYBgAYBgAYBgAcDgAf/gAP/AAAAAAAAAAAAAAAAAAAAAAP/AAf/gAYBgAYBgAYBgAYBgAYBgAAAAAAAAAAAAAAAAAAAAAP/AAf/gAcDgAYBgAYBgAYBgAYDgP//gP//gAAAAAAAAAAAAAAAAAP+AAf/gAf/gAYxgAYxgAYxgAfxgAPxgAHwAAAAAAAAAAAAAAAAAAYBgAYBgD//gP//gP//gMYBgMYBgMYBgMQAAAAAAAAAAAAAAAAAAAPwGAf/GAYfGAYfGAYfGAYfGAY7mAf7+Afx8AAAAAAAAAAAAAAAAP//gP//gAcAAAYAAAYAAAYAAAcAAAf/gAP/gAAAAAAAAAAAAAAAAAYAAAYAAAYAAMf/gOf/gMf/gAABgAABgAABgAAAAAAAAAAAAAAAAAAAAAAAGAYAGAYAGAYAGMf/+Of/+Mf/8AAAAAAAAAAAAAAAAAAAAP//gP//gP//gADwAAH8AAefAAcHgAYDgAQAgAAAAAAAAAAAAEAAAMAAAMAAAMAAAP//AP//gAADgAABgAABgAABgAAAgAAAAAAAAAf/gAf/gAYAAAYAAAf/gAf/gAf/gAYAAAYAAAf/gAP/gAAAAAAAAAAAAAf/gAf/gAcAAAYAAAYAAAYAAAcAAAf/gAP/gAAAAAAAAAAAAAAAAAP/AAf/gAcDgAYBgAYBgAYBgAcDgAf/gAP/AAAAAAAAAAAAAAAAAAf/+Af/+AcBgAYBgAYBgAYBgAcDgAf/gAP/AAAAAAAAAAAAAAAAAAP/AAf/gAcDgAYBgAYBgAYBgAYDgAf/+Af/+AAAAAAAAAAAAAAAAAYBgAYBgAf/gAf/gAcBgAYBgAYBgAYAAAYAAAAAAAAAAAAAAAAAAAAAAAPhgAfxgAZxgAYxgAYxgAY/gAYfAAAAAAAAAAAAAAAAAAAAAAYAAAYAAAYAAD//AD//gAYBgAYBgAYBgAYBgAAAAAAAAAAAAAAAAAf+AAf/gAf/gAABgAABgAABgAf/gAf/gAf/gAAAAAAAAAAAAAQAAAeAAAf4AAH/AAAfgAADgAAfgAH/AAf4AAeAAAQAAAAAAAAAAAfAAAf/AAD/gAAPgAD/gAH4AAH/gAAPgAD/gAf+AAfAAAAAAAAAAAAAAAYBgAcHgAfPAAH+AAD4AAH+AAfPgAcDgAQBgAAAAAAAAAAAAAQAAAeAAAfwGAH+GAA/uAAD+AAf8AH/AAf4AAeAAAQAAAAAAAAAAAAAAAABgAYHgAYPgAY/gAZ5gAfxgAfBgAeBgAYAAAAAAAAAAAAAAAAAAAAAAADgAADgAf//8/+/+4AAGwAAGwAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//+///+f//+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAGwAAG4AAG/+/+f//8ADgAADgAAAAAAAAAAAAAAAAAAAAAADgAADAAADAAADAAADAAADgAABgAADgAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'), + 32, + atob("DQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0H"), + 24+(scale<<8)+(1<<16) + ); + return this; +}; + +{ + + // VARS + + let FONT_NAME = "ShareTechMono"; + let BIG_FONT_HEIGHT = 60; + //let NORMAL_FONT_HEIGHT = 40; + let SMALL_FONT_HEIGHT = 24; + + let timeDrawTimeout; + let infoDrawTimeout; + let lockState = Bangle.isLocked(); + let pressure; + + + + // LISTENERS + + Bangle.on('lock', function(isLocked) { + lockState = isLocked; + timeDraw(); + infoDraw(); + }); + + + + // DRAW FUNCTIONS + + let timeDraw = function() { + g.reset(); + g.clearRect(Bangle.appRect.x, Bangle.appRect.y, Bangle.appRect.x2, Bangle.appRect.y + BIG_FONT_HEIGHT); + + var date = new Date(); + var timeArray = [date.getHours().toString().padStart(2, "0"), + date.getMinutes().toString().padStart(2, "0")]; + if (!lockState) timeArray.push(date.getSeconds().toString().padStart(2, "0")); + var timeString = timeArray.join(":"); + g.setFontAlign(0, 0).setColor(g.theme.fg).setFont(FONT_NAME + (lockState ? "Big" : "")); + g.drawString(timeString, Bangle.appRect.x2/2, Bangle.appRect.y + BIG_FONT_HEIGHT/2); + + if (timeDrawTimeout) clearTimeout(timeDrawTimeout); + timeDrawTimeout = setTimeout(function() { + timeDrawTimeout = undefined; + timeDraw(); + }, (lockState ? 10000 - (Date.now() % 10000) : 1000 - (Date.now() % 1000))); // if locked, every clock's 10s, otherwise every 1s + }; + + let infoDraw = function() { + g.reset(); + + var date = new Date(); + var dateString = [date.getFullYear().toString().padStart(4,"0"), + (date.getMonth()+1).toString().padStart(2,"0"), + date.getDate().toString().padStart(2,"0")].join("-"); + + var tzOffset = -(date.getTimezoneOffset())/60; + var tzOffsetString = (tzOffset >= 0 ? "+" + tzOffset : tzOffset); + + var batteryString = (Bangle.isCharging() ? "+" : "") + E.getBattery() + "%"; + + var pressureString = (pressure ? pressure + "hPa" : "(hPa)"); + + var powerString = (E.getPowerUsage().total / 1000) + "mA"; + + var stepsString = Bangle.getHealthStatus("day").steps + "ST"; + + var bluetoothStatus = NRF.getSecurityStatus(); + var bluetoothString = (bluetoothStatus.connected ? bluetoothStatus.connected_addr.split(" ")[0].substr(-5) : "N/C"); + + var infoMatrix = [ + [dateString + tzOffsetString ], + [batteryString, pressureString], + [powerString ], + [stepsString, bluetoothString ] + ]; + + g.clearRect(Bangle.appRect.x, Bangle.appRect.y + BIG_FONT_HEIGHT, Bangle.appRect.x2, Bangle.appRect.y2); + g.setFontAlign(0, -1).setColor(g.theme.fg2).setFont(FONT_NAME+"Small"); + + infoMatrix.forEach((lineArray, lineNumber) => { + g.drawString(lineArray.join(" "), Bangle.appRect.x2/2, Bangle.appRect.y + BIG_FONT_HEIGHT + SMALL_FONT_HEIGHT*lineNumber); + }); + + Bangle.getPressure().then(baroValue => { pressure=Math.round(baroValue.pressure); }); + + if (infoDrawTimeout) clearTimeout(infoDrawTimeout); + infoDrawTimeout = setTimeout(function() { + infoDrawTimeout = undefined; + infoDraw(); + }, (lockState ? 60000 : 10000)); // if locked, a minute from now, otherwise in 10s + }; + + + + // DRAW CALLS + + g.clear(); + + Bangle.setUI({ + mode: "clock", + remove: function() { + if (timeDrawTimeout) clearTimeout(timeDrawTimeout); + timeDrawTimeout = undefined; + if (infoDrawTimeout) clearTimeout(infoDrawTimeout); + infoDrawTimeout = undefined; + + delete Graphics.prototype.setFontShareTechMono; + delete Graphics.prototype.setFontShareTechMonoBig; + delete Graphics.prototype.setFontShareTechMonoSmall; + }}); + + Bangle.loadWidgets(); + Bangle.drawWidgets(); + + timeDraw(); + infoDraw(); +} diff --git a/apps/denseclock/app.png b/apps/denseclock/app.png new file mode 100644 index 000000000..4f27b473c Binary files /dev/null and b/apps/denseclock/app.png differ diff --git a/apps/denseclock/metadata.json b/apps/denseclock/metadata.json new file mode 100644 index 000000000..c361313ff --- /dev/null +++ b/apps/denseclock/metadata.json @@ -0,0 +1,18 @@ +{ "id": "denseclock", + "name": "Dense Clock", + "shortName":"Dense Clock", + "version":"0.03", + "description": "A clockface dense with text-only information. Switches between showing seconds and minutes when unlocked/locked, in the interest of saving power.", + "icon": "app.png", + "type": "clock", + "tags": "clock", + "supports" : ["BANGLEJS2"], + "storage": [ + {"name":"denseclock.app.js","url":"app.js"}, + {"name":"denseclock.img","url":"app-icon.js","evaluate":true} + ], + "screenshots": [ + {"url":"screenshot_locked.png"}, + {"url":"screenshot_unlocked.png"} + ] +} diff --git a/apps/denseclock/screenshot_locked.png b/apps/denseclock/screenshot_locked.png new file mode 100644 index 000000000..61a05ca44 Binary files /dev/null and b/apps/denseclock/screenshot_locked.png differ diff --git a/apps/denseclock/screenshot_unlocked.png b/apps/denseclock/screenshot_unlocked.png new file mode 100644 index 000000000..f1af09cba Binary files /dev/null and b/apps/denseclock/screenshot_unlocked.png differ diff --git a/apps/dinoClock/metadata.json b/apps/dinoClock/metadata.json index a61ce122b..1455e84a6 100644 --- a/apps/dinoClock/metadata.json +++ b/apps/dinoClock/metadata.json @@ -6,7 +6,7 @@ "icon": "app.png", "version": "0.01", "type": "clock", - "tags": "clock, weather, dino, trex, chrome", + "tags": "clock,weather,dino,trex,chrome", "supports": ["BANGLEJS2"], "allow_emulator": true, "readme": "README.md", diff --git a/apps/doztime/ChangeLog b/apps/doztime/ChangeLog index dc73a3c23..0af4145d7 100644 --- a/apps/doztime/ChangeLog +++ b/apps/doztime/ChangeLog @@ -7,3 +7,4 @@ now supports Adjust Clock widget, if installed 0.06: Minor code improvements 0.07: Bangle2: Shift the position of one line on the screen +0.08: Bangle1: fix scoping of variables `time` and `wait` diff --git a/apps/doztime/app-bangle1.js b/apps/doztime/app-bangle1.js index a176ef270..b9681ad91 100644 --- a/apps/doztime/app-bangle1.js +++ b/apps/doztime/app-bangle1.js @@ -28,6 +28,7 @@ let addTimeDigit = false; let dateFormat = false; let lastX = 999999999; let res = {}; +let calenDef; //var last_time_log = 0; var drawtime_timeout; @@ -60,7 +61,7 @@ g.flip = function() setWatch(function(){ modeTime(); }, BTN1, {repeat:true} ); setWatch(function(){ Bangle.showLauncher(); }, BTN2, { repeat: false, edge: "falling" }); -setWatch(function(){ modeWeather(); }, BTN3, {repeat:true}); +//setWatch(function(){ modeWeather(); }, BTN3, {repeat:true}); // TODO: `modeWeather` is not yet implemented. setWatch(function(){ toggleTimeDigits(); }, BTN4, {repeat:true}); setWatch(function(){ toggleDateFormat(); }, BTN5, {repeat:true}); @@ -122,7 +123,7 @@ function formatDate(res,dateFormat){ } function writeDozTime(text,def){ - let pts = def.pts; + //let pts = def.pts; let x=def.pt0[0]; let y=def.pt0[1]; g_t.clear(); @@ -138,7 +139,7 @@ function writeDozTime(text,def){ function writeDozDate(text,def,colour){ dateColour = colour; - let pts = def.pts; + //let pts = def.pts; let x=def.pt0[0]; let y=def.pt0[1]; g_d.clear(); @@ -159,20 +160,22 @@ function drawTime() let date = ""; let timeDef; let x = 0; + let time; + let wait; dt.setDate(dt.getDate()); if(addTimeDigit){ x = 10368*dt.getHours()+172.8*dt.getMinutes()+2.88*dt.getSeconds()+0.00288*dt.getMilliseconds(); let msg = "00000"+Math.floor(x).toString(12); - let time = msg.substr(-5,3)+"."+msg.substr(-2); //TODO: should `time` and `wait` have been defined outside the if block? - let wait = 347*(1-(x%1)); + time = msg.substr(-5,3)+"."+msg.substr(-2); + wait = 347*(1-(x%1)); timeDef = time6; } else { x = 864*dt.getHours()+14.4*dt.getMinutes()+0.24*dt.getSeconds()+0.00024*dt.getMilliseconds(); let msg = "0000"+Math.floor(x).toString(12); - let time = msg.substr(-4,3)+"."+msg.substr(-1); - let wait = 4167*(1-(x%1)); + time = msg.substr(-4,3)+"."+msg.substr(-1); + wait = 4167*(1-(x%1)); timeDef = time5; } if(lastX > x){ res = getDate(dt); } // calculate date once at start-up and once when turning over to a new day diff --git a/apps/doztime/metadata.json b/apps/doztime/metadata.json index 407b474ca..f0bb84a8b 100644 --- a/apps/doztime/metadata.json +++ b/apps/doztime/metadata.json @@ -2,7 +2,7 @@ "id": "doztime", "name": "Dozenal Digital Time", "shortName": "Dozenal Digital", - "version": "0.07", + "version": "0.08", "description": "A dozenal Holocene calendar and dozenal diurnal digital clock", "icon": "app.png", "type": "clock", diff --git a/apps/dragboard/settings.js b/apps/dragboard/settings.js index 59a13c443..2aac13b28 100644 --- a/apps/dragboard/settings.js +++ b/apps/dragboard/settings.js @@ -45,4 +45,4 @@ }; E.showMenu(appMenu); -}); \ No newline at end of file +}) diff --git a/apps/draguboard/settings.js b/apps/draguboard/settings.js index ff4ede637..58634b1b3 100644 --- a/apps/draguboard/settings.js +++ b/apps/draguboard/settings.js @@ -41,4 +41,4 @@ }; E.showMenu(appMenu); -}); \ No newline at end of file +}) diff --git a/apps/drained/ChangeLog b/apps/drained/ChangeLog index 3767ad71e..af1ee299b 100644 --- a/apps/drained/ChangeLog +++ b/apps/drained/ChangeLog @@ -5,3 +5,5 @@ 0.04: Enhance menu: enable bluetooth, visit settings & visit recovery 0.05: Enhance menu: permit toggling bluetooth 0.06: Display clock in green when charging, with "charging" text +0.07: Correctly restore full power when the charged threshold is reached +0.08: Redisplay immediately on changes to charging status diff --git a/apps/drained/app.js b/apps/drained/app.js index deafe7d68..9f8f6988f 100644 --- a/apps/drained/app.js +++ b/apps/drained/app.js @@ -58,6 +58,7 @@ var draw = function () { }, 60000 - (date.getTime() % 60000)); }; var reload = function () { + var scroller; var showMenu = function () { var menu = { "Restore to full power": drainedRestore, @@ -69,9 +70,12 @@ var reload = function () { menu["Settings"] = function () { return load("setting.app.js"); }; menu["Recovery"] = function () { return Bangle.showRecoveryMenu(); }; menu["Exit menu"] = reload; + if (scroller) { + menu[""] = { selected: scroller.scroll }; + } if (nextDraw) clearTimeout(nextDraw); - E.showMenu(menu); + (scroller = E.showMenu(menu).scroller); }; Bangle.setUI({ mode: "custom", @@ -88,7 +92,7 @@ var reload = function () { }; reload(); Bangle.emit("drained", E.getBattery()); -var _a = require("Storage").readJSON("".concat(app, ".setting.json"), true) || {}, _b = _a.keepStartup, keepStartup = _b === void 0 ? true : _b, _c = _a.restore, restore = _c === void 0 ? 20 : _c, _d = _a.exceptions, exceptions = _d === void 0 ? ["widdst.0"] : _d; +var _a = require("Storage").readJSON("".concat(app, ".setting.json"), true) || {}, _b = _a.keepStartup, keepStartup = _b === void 0 ? true : _b, _c = _a.restore, restore = _c === void 0 ? 20 : _c, _d = _a.exceptions, exceptions = _d === void 0 ? ["widdst.0"] : _d, _e = _a.interval, interval = _e === void 0 ? 10 : _e; function drainedRestore() { if (!keepStartup) { try { @@ -110,8 +114,11 @@ var checkCharge = function () { if (Bangle.isCharging()) checkCharge(); Bangle.on("charging", function (charging) { + if (drainedInterval) + drainedInterval = clearInterval(drainedInterval); if (charging) - checkCharge(); + drainedInterval = setInterval(checkCharge, interval * 60 * 1000); + draw(); }); if (!keepStartup) { var storage = require("Storage"); diff --git a/apps/drained/app.ts b/apps/drained/app.ts index a779a8660..57c71e727 100644 --- a/apps/drained/app.ts +++ b/apps/drained/app.ts @@ -78,8 +78,9 @@ const draw = () => { }; const reload = () => { + let scroller: MenuInstance["scroller"] | undefined; const showMenu = () => { - const menu: { [k: string]: () => void } = { + const menu: Menu = { "Restore to full power": drainedRestore, }; @@ -92,8 +93,12 @@ const reload = () => { menu["Recovery"] = () => Bangle.showRecoveryMenu(); menu["Exit menu"] = reload; + if(scroller){ + menu[""] = { selected: scroller.scroll }; + } + if(nextDraw) clearTimeout(nextDraw); - E.showMenu(menu); + ({ scroller } = E.showMenu(menu)); }; Bangle.setUI({ @@ -115,7 +120,7 @@ reload(); Bangle.emit("drained", E.getBattery()); // restore normal boot on charge -const { keepStartup = true, restore = 20, exceptions = ["widdst.0"] }: DrainedSettings +const { keepStartup = true, restore = 20, exceptions = ["widdst.0"], interval = 10 }: DrainedSettings = require("Storage").readJSON(`${app}.setting.json`, true) || {}; // re-enable normal boot code when we're above a threshold: @@ -142,7 +147,11 @@ if (Bangle.isCharging()) checkCharge(); Bangle.on("charging", charging => { - if(charging) checkCharge(); + if(drainedInterval) + drainedInterval = clearInterval(drainedInterval) as undefined; + if(charging) + drainedInterval = setInterval(checkCharge, interval * 60 * 1000); + draw(); // redraw to update charging status on screen }); if(!keepStartup){ diff --git a/apps/drained/metadata.json b/apps/drained/metadata.json index a5389a91b..8aaec1220 100644 --- a/apps/drained/metadata.json +++ b/apps/drained/metadata.json @@ -1,12 +1,14 @@ { "id": "drained", "name": "Drained", - "version": "0.06", + "version": "0.08", "description": "Switches to displaying a simple clock when the battery percentage is low, and disables some peripherals", "readme": "README.md", "icon": "icon.png", "supports": ["BANGLEJS2"], "allow_emulator": true, + "type": "clock", + "tags": "clock", "storage": [ {"name":"drained.boot.js","url":"boot.js"}, {"name":"drained.app.js","url":"app.js"}, diff --git a/apps/drained/settings.js b/apps/drained/settings.js index ce72f215f..d82a9f6d4 100644 --- a/apps/drained/settings.js +++ b/apps/drained/settings.js @@ -87,4 +87,4 @@ }); }; updateAndRedraw(); -}); +}) diff --git a/apps/drinkcounter/settings.js b/apps/drinkcounter/settings.js index 336229b73..8353103e3 100644 --- a/apps/drinkcounter/settings.js +++ b/apps/drinkcounter/settings.js @@ -55,4 +55,4 @@ E.showMenu(mainmenu); -}); +}) diff --git a/apps/dsky_clock/ChangeLog b/apps/dsky_clock/ChangeLog new file mode 100644 index 000000000..707d483e1 --- /dev/null +++ b/apps/dsky_clock/ChangeLog @@ -0,0 +1,3 @@ +0.01: Initial commit +0.02: Added Alt modes +0.03: Fix display misalignment \ No newline at end of file diff --git a/apps/dsky_clock/README.md b/apps/dsky_clock/README.md new file mode 100644 index 000000000..d85f826ea --- /dev/null +++ b/apps/dsky_clock/README.md @@ -0,0 +1,38 @@ +# DSKY Clock + +This is a clockface inspired by the Apollo DSKY interface. + +## Features +- battery level indicator (PROG indicator) +- month (VERB indicator) +- date (NOUN indicator) +- Current local time (DATA 1) +- UTC time (DATA 2) +- Step counter (DATA 3) + +Indicator lights are: +- COMP ACTY (GPS/HRM active) +- MSG (Messages waiting) +- LOCK (Screen is locked) +- BT (Bluetooth is disconnected) +- BATT (Low battery or battery charging) +- ALARM (Alarm is set) +- STEP (Reached STEP goal)) + +---- +## Alt Modes +Swipe left/right to switch between different PROGRAM modes. + +- HRM (BPM/Confidence) +- GPS (Latitude/Longitude/Speed) +- Weather (Humidity/Rain/Temperature/Wind/Condition Code) +- Accelerometer (X/Y/Z) +- Compass (HEADING) + +In the interests of usability these change the "LIGHT" on the left side to show the current mode. + +---- +This is my first watch face, may add features and customization later. + +## Creator +Written by Carl Chan | [github](https://github.com/carlchan) diff --git a/apps/dsky_clock/app-icon.js b/apps/dsky_clock/app-icon.js new file mode 100644 index 000000000..12249608f --- /dev/null +++ b/apps/dsky_clock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwkIkQAFkIEDiQMGABUAiQtIu1nu9wgETC40QDIIAHu4ABC4MCkURiVCAAMimQXJswABAgMDC4IADLIQLBBAYcHF4QXSg4XDiEBgIXCkIXCAQgADgwvFBwIXFF4sGuwXHI4cxCIQ4CF5gXCR4ZfJF5SPXI4S4EFgQGBsAvMdAikCAwJ5BF5YXJu7vMI4RABI4gvCmQXJDIQEIL5YRBgxHDAgR3D7vd6gCB6QXEHwIXDCoQGBC4YACC4sGs5fDAgQvE6lEpvd6YXECwkGAgQvFrovDU4QXJL4pHIRQtnR4oXGkIlCAAK6BDwgvPgwEDSIgXLgynBAYhHMC4UHOQIWBAIMHBAIXCmXdqioBC4UyIoYXBeQNmCoJOCF4VVCwJHGH4UHGAQXEF4JHFF4ZHEAYJHEU5RCBI4SoBC4JHFpoBCC4jWDdoaPFiIADiS/FABIXIL4QvCRwK/IisAiEAgIXBL4ZzCPIZfDCAIVBAAIXCU4gXEX4xfJBwNmXoS/GC40yd4hcCIoa/EF40xdYS9BMQNnC5ovER4JFDU6K/NgJHHXoQBBSQbzCI5C/Cg9mAAQaBAYSnNNwJcBMANwAIQXKlS/EbIIBDC4UDa5gvBMAYvFAAsQI4bsCPQYFBC5MAC4RcCCgZiCBQNTXAIXEiMikJOCiBUEBAcTA=")) \ No newline at end of file diff --git a/apps/dsky_clock/app-icon.png b/apps/dsky_clock/app-icon.png new file mode 100644 index 000000000..be7195743 Binary files /dev/null and b/apps/dsky_clock/app-icon.png differ diff --git a/apps/dsky_clock/app.js b/apps/dsky_clock/app.js new file mode 100644 index 000000000..3dc3d2ad5 --- /dev/null +++ b/apps/dsky_clock/app.js @@ -0,0 +1,381 @@ +//Init +var Layout = require("Layout"); +require("Font7x11Numeric7Seg").add(Graphics); +require("FontTeletext5x9Ascii").add(Graphics); + +const Light_on='#fff'; +const Light_off='#554'; +const Light_warn='#f90'; +const Light_COMPACTY='#0F0'; +const Light_width=43; +const Light_height=25; +const EL7_height=30; +const LightFont='Teletext5x9Ascii'; +const DataFont='7x11Numeric7Seg:2'; +var mode = 0; + +if (global.WIDGETS) {require("widget_utils").swipeOn();} // If `dsky_clock` was fast loaded into we seemingly need to hide the widgets before setting the layout so elements are not moved down. + +var layout = new Layout( + {type:"h", c:[ + {type:"",width:6}, + { type:"v", c: [ + {type:"txt", font:LightFont, col:"#000", bgCol:"#555", id:'L1', label:"UPLINK\nACTY", width:Light_width, height:Light_height}, + {type:"txt", font:LightFont, col:"#000", bgCol:"#555", id:'L2', label:"TEMP", width:Light_width, height:Light_height }, + {type:"txt", font:LightFont, col:"#000", bgCol:"#555", id:'L3', label:"GIMBAL\nLOCK", width:Light_width, height:Light_height }, + {type:"txt", font:LightFont, col:"#000", bgCol:"#555", id:'L4', label:"STBY", width:Light_width, height:Light_height }, + {type:"txt", font:LightFont, col:"#000", bgCol:"#555", id:'L5', label:"PROG", width:Light_width, height:Light_height }, + {type:"txt", font:LightFont, col:"#000", bgCol:"#eee", id:'L6', label:"OPR ERR", width:Light_width, height:Light_height }, + ]}, + { type:"", width:25}, + { type:"v", c: [ + {type:"",height:2}, + {type:"h", c: [ + {type:"", width:50},{type:"txt", font:"6x8", col:"#000",bgCol:"#0F0", label:"PROG", width:25, height:10}, + ]}, + {type:"h", c: [ + {type:"",width:10}, + {type:"txt", font:"6x8", col:"#000", bgCol:"#000", id:"COMPACTY", label:"COMP\nACTY", width:26, height:26 }, + {type:"",width:17}, + {type:"txt", font:DataFont, col:"#0F0", bgCol:"#000",label:"00", id:"PROG", fillx:1, height:EL7_height }, + ]}, + {type:"",height:1}, + {type:"h", c: [ + {type:"txt", font:"6x8", col:"#000", bgCol:"#0F0",label:"VERB", width:25, height:10}, + {type:"",width:30}, + {type:"txt", font:"6x8", col:"#000",bgCol:"#0F0",label:"NOUN", width:25, height:10}, + ]}, + {type:"h", c: [ + {type:"txt", font:DataFont, col:"#0F0", bgCol:"#000", label:"00", id:"VERB", fillx:1, height:EL7_height}, + {type:"txt", font:DataFont, col:"#0F0", bgCol:"#000", label:"00", id:"NOUN", fillx:1, height:EL7_height}, + ]}, + { type:"",bgCol:'#070', width:80, height:2 }, + {type:"txt", font:DataFont, col:"#0F0", bgCol:"#000", label:"00000", id:"R1", halign:1, fillx:1, height:EL7_height}, + {type:"txt", font:DataFont, col:"#0F0", bgCol:"#000", label:"00000", id:"R2", halign:1, fillx:1, height:EL7_height}, + {type:"txt", font:DataFont, col:"#0F0", bgCol:"#000", label:"00000", id:"R3", halign:1, fillx:1, height:EL7_height}, + ]}, + {type:"",width:5}, + ], + lazy:true}, + {btns:[ + {label:"", cb: Bangle.showLauncher} + ], lazy:true}); +layout.update(); + +//support functioe_ns + +function getWeather() { + var weather = {}; + try { + weather = require("Storage").readJSON('weather.json', 1).weather; + } catch(e) { + return {}; + } + return weather; +} + +function getdatetime(){ + var datetime = []; + var d = new Date(); +// var offsets = require("Storage").readJSON("worldclock.settings.json") || []; +// var meridian = require("locale").meridian(d); + datetime.clock = require("locale").time(d, 1); + datetime.month = d.getMonth()+1; + datetime.day = d.getDate(); + datetime.localtime=String(d.getHours()).padStart(2,'0')+String(d.getMinutes()).padStart(2,'0'); + let utchour=((d.getHours()+(Math.round(d.getTimezoneOffset()/60))) % 24); + datetime.utctime=String(utchour).padStart(2,'0')+String(d.getMinutes()).padStart(2,'0'); + return datetime; +} + +function getSteps(){ + let steps=Bangle.getHealthStatus("day").steps; + steps = typeof steps !== 'undefined' ? steps:0; + return steps; +} + +function getStepGoal(){ + let stepGoal = (require("Storage").readJSON("health.json",1)||10000).stepGoal; + stepGoal = typeof stepGoal !== 'undefined' ? stepGoal:10000; + return stepGoal; +} + +function isAlarmSet(){ + let alarmStatus = (require('Storage').readJSON('sched.json',1)||[]).some(alarm=>alarm.on); + return alarmStatus; +} + +function isMessagesNotify(){ + if (require("Storage").read("messages.json")!==undefined) { + return true; + } else { + return false; + } +} + +function getHRM(){ + let hrm=Bangle.getHealthStatus('last'); + hrm = typeof hrm !== 'undefined' ? hrm:0; + return hrm; +} + +function isBTConnected(){ + return NRF.getSecurityStatus().connected; +} + +function getBattery(){ + let battlevel = E.getBattery(); + if (Bangle.isCharging()) { + battlevel = -1; + } else if (battlevel >= 100) { + battlevel = 99; + } + battlevel=String(battlevel); + return battlevel; +} + +function isActive(){ + if (Bangle.isCompassOn() || Bangle.isGPSOn() || Bangle.isHRMOn() || Bangle.isBarometerOn() ) { + return true; + } else { + return false; + } +} + +function setLight(id,label,check,onColour,offColour){ + // print('setlight:',id); //debug + layout.clear(layout[id]); + onColour = typeof onColour !== 'undefined' ? onColour:Light_on; + offColour = typeof offColour !== 'undefined' ? offColour:Light_off; + if (label !== '') { + layout[id].label=label; + } + if (check) { + layout[id].bgCol=onColour; + } else { + layout[id].bgCol=offColour; + } + layout.render(layout[id]); +} + +function setDATA(id,label) { + layout.clear(layout[id]); + let data='-----'; + let sign=''; + try { + if (!isNaN(label)) { + if (label < 0) { + label=Math.abs(label); + sign='-'; + } + data=String(String(label).toString(16)).toUpperCase().padStart(5,'0').substring(0,5); + data=sign+data; + } + } catch(e) { + data='-----'; + } + layout[id].label=data; + layout.render(layout[id]); +} + +function setWORD(id,label){ + layout.clear(layout[id]); + let data='--'; + if (!isNaN(label)) { + data=String(String(label).toString(16)).toUpperCase().padStart(2,'0').substring(0,2); + } + // print(id, data); //debug + layout[id].label=data; + layout.render(layout[id]); +} + +function draw_bg(){ + g.setColor('#666'); + g.fillRect(0,0,176,176); + g.setColor('#000'); + g.fillRect(69,2,172,174); + g.fillCircle(59,10,5); + g.fillCircle(59,166,5); +} + +// actual display +function drawMain(){ + let datetime=getdatetime(); + + setDATA('R1',datetime.localtime); + setDATA('R2',datetime.utctime); + setDATA('R3',getSteps()); + + setWORD('PROG',getBattery()); + setWORD('VERB',datetime.month); + setWORD('NOUN',datetime.day); + + setLight('COMPACTY','',isActive(),Light_COMPACTY); + setLight('L1','MSG',isMessagesNotify()); + setLight('L2','LOCK',Bangle.isLocked()); + setLight('L3','BT',!isBTConnected(),Light_warn); + setLight('L4','BATT',(getBattery()<=20),Light_warn); + setLight('L5','ALARM',isAlarmSet(),Light_warn); + setLight('L6','STEP',(getSteps()>=getStepGoal()),'#0a0'); + +// layout.setUI(); + layout.forgetLazyState(); + layout.render(); + queueDraw(); +} + +////// ALT modes ///// +var AltDrawTimer; +function drawAlt(mode) { + if (AltDrawTimer) clearTimeout(AltDrawTimer); + mode = typeof mode !== 'undefined' ? mode:0; + mode=Math.abs(mode); + // print('drawAlt: ', mode); // debug + // Show mode in PROG + setWORD('PROG',mode); + setWORD('NOUN',''); + setWORD('VERB',''); + // Disable Battery warning light in to show PROG no longer shows battery level + setLight('L4','BATT',false); + setDATA('R1'); + setDATA('R2'); + setDATA('R3'); + switch (mode) { + case 1: + setLight('L6','HRM',true); + mode_HRM(); + break; + case 2: + setLight('L6','TEMP',true); + mode_weather(); + break; + case 3: + setLight('L6','GPS',true); + mode_GPS(); + break; + case 4: + setLight('L6','ACCEL',true); + mode_accel(); + break; + case 5: + setLight('L6','HDG',true); + mode_compass(); + break; + default: + drawMain(); + } + layout.render(); +} + +function mode_HRM() { + setLight('COMPACTY','',true,Light_COMPACTY); + AltDrawTimer = setTimeout( function() { + Bangle.setHRMPower(true, 'dsky_clock'); + let hrm=getHRM(); + setDATA('R1',hrm.bpm); + setDATA('R2',hrm.bpmConfidence); + setDATA('R3',getSteps()); + mode_HRM(); + }, 5000); + Bangle.setHRMPower(false); +} + +function mode_weather() { + let weather=getWeather(); + try { + weather.temp = Math.round(weather.temp-273.15); + setDATA('R1',weather.temp); + setDATA('R2',weather.hum); + setDATA('R3',weather.code); + setWORD('NOUN',weather.hum); + setWORD('VERB',weather.rain); + } catch(e) { + setDATA('R1','-----'); + setDATA('R2','-----'); + setDATA('R3','-----'); + setDATA('R1','--'); + setDATA('R1','--'); + } +} + +function mode_compass() { + AltDrawTimer = setTimeout ( function() { + setLight('COMPACTY','',true,Light_COMPACTY); //isCompassOn seems to be incorrect? + Bangle.setCompassPower(1); + let compass=Bangle.getCompass(); + setDATA('R1',compass.heading); + setDATA('R2'); + setDATA('R3'); + mode_compass(); + }, 200); + Bangle.setCompassPower(0); +} + +function mode_GPS() { + setLight('COMPACTY','',true,Light_COMPACTY); + AltDrawTimer = setTimeout( function() { + Bangle.setGPSPower(1,'dsky_clock'); + let gps=Bangle.getGPSFix(); + setWORD('NOUN',gps.fix); + setWORD('VERB',gps.satellites); + setDATA('R1',gps.lat); + setDATA('R2',gps.lon); + setDATA('R3',gps.speed); + mode_GPS(); + }, 5000); + Bangle.setGPSPower(0); +} + +function mode_accel() { + AltDrawTimer = setTimeout( function() { + setLight('COMPACTY','',isActive(),Light_COMPACTY); + let accel=Bangle.getAccel(); + setDATA('R1',accel.x); + setDATA('R2',accel.y); + setDATA('R3',accel.z); + mode_accel(); + }, 100); +} + +//////////// Main + +var drawTimeout; +// schedule a draw for the next minute +function queueDraw() { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + mode = 0; + if (AltDrawTimer) clearTimeout(AltDrawTimer); + drawMain(); + }, 60000 - (Date.now() % 60000)); +} + +Bangle.on('lock',on=>{ + mode = 0; + drawMain(); // draw immediately + }); +Bangle.on("message",function() { setLight('COMPACTY','',isActive(),Light_COMPACTY);}); +Bangle.on('charging',drawMain); +NRF.on('connect',function() { setLight('L3','BT',!isBTConnected(),Light_warn); }); +NRF.on('disconnect',function() { setLight('L3','BT',!isBTConnected(),Light_warn); }); + +Bangle.on('swipe', function(directionLR) { + if (directionLR == 1) { + mode=mode-1; + } + if (directionLR == -1) { + mode=mode+1; + } + if (mode < 0 ) { mode=5; } + mode=(mode % 6); + drawAlt(mode); +}); + +g.clear(); +draw_bg(); +drawMain(); + +Bangle.CLOCK = 1; +Bangle.loadWidgets(); // loading widgets after drawing the layout in `drawMain()` to display the app UI ASAP. +require("widget_utils").swipeOn(); // hide widgets, make them visible with a swipe diff --git a/apps/dsky_clock/metadata.json b/apps/dsky_clock/metadata.json new file mode 100644 index 000000000..564f54d45 --- /dev/null +++ b/apps/dsky_clock/metadata.json @@ -0,0 +1,16 @@ +{ "id": "dsky_clock", + "name": "DSKY Clock", + "icon": "app-icon.png", + "screenshots": [{"url":"screenshot1.png"}], + "version": "0.03", + "description": "A clockface inspired by the Apollo DSKY interface.", + "tags": "clock", + "type": "clock", + "supports":["BANGLEJS2"], + "readme": "README.md", + "allow_emulator": true, + "storage": [ + {"name":"dsky_clock.app.js","url":"app.js"}, + {"name":"dsky_clock.img","url":"app-icon.js","evaluate":true} + ] + } diff --git a/apps/dsky_clock/screenshot1.png b/apps/dsky_clock/screenshot1.png new file mode 100644 index 000000000..949199a69 Binary files /dev/null and b/apps/dsky_clock/screenshot1.png differ diff --git a/apps/dtlaunch/ChangeLog b/apps/dtlaunch/ChangeLog index 5cac5770e..847699189 100644 --- a/apps/dtlaunch/ChangeLog +++ b/apps/dtlaunch/ChangeLog @@ -30,3 +30,9 @@ when moving pages. Add caching for faster startups. 0.23: Bangle 1: Fix issue with missing icons, added touch screen interactions 0.24: Add buzz-on-interaction setting 0.25: Minor code improvements +0.26: Bangle 2: Postpone loading icons that are not needed initially. +0.27: Bangle 2: Add setting to remember and present the last open page between instances of dtlaunch. +0.28: Bangle 2: Fix showClocks and showLaunchers settings not taking effect by + clearing cache when changing those settings. + Bangle 2: Use a separate cache file from the standard launcher. + Bangle 2: Don't leave cache file after uninstalling the app. diff --git a/apps/dtlaunch/README.md b/apps/dtlaunch/README.md index ff562d9db..276e62358 100644 --- a/apps/dtlaunch/README.md +++ b/apps/dtlaunch/README.md @@ -17,7 +17,9 @@ Bangle 2: ![shot3](https://user-images.githubusercontent.com/89286474/146471760-5497fd1b-8e82-4fd5-a4e3-4734701a7dbd.png) -## Controls- Bangle +## Controls + +### Bangle 1 **BTN1** - move backward through app icons on a page @@ -35,10 +37,28 @@ Bangle 2: **Touch Middle(1+2) area** - run the selected app -## Controls- Bangle 2 +### Bangle 2 **Touch** - icon to select, second touch launches app **Swipe Left/Up** - move to next page of app icons **Swipe Right/Down** - move to previous page of app icons + +## Settings + +**Show clocks** + +**Show launchers** + +### Only Bangle 2 + +**Direct launch** - launch on first touch. + +**Swipe Exit** - Swipe left to exit. + +**Time Out** - Return to clock after a short while. + +**Interaction buzz** + +**Remember Page** - Remember page when leaving and coming back to the launcher. diff --git a/apps/dtlaunch/app-b2.js b/apps/dtlaunch/app-b2.js index 2108910fc..c674c3773 100644 --- a/apps/dtlaunch/app-b2.js +++ b/apps/dtlaunch/app-b2.js @@ -11,18 +11,19 @@ swipeExit: false, timeOut: "Off", interactionBuzz: false, + rememberPage: false, }, require('Storage').readJSON("dtlaunch.json", true) || {}); let s = require("Storage"); // Borrowed caching from Icon Launcher, code by halemmerich. - let launchCache = s.readJSON("launch.cache.json", true)||{}; + let launchCache = s.readJSON("dtlaunch.cache.json", true)||{}; let launchHash = require("Storage").hash(/\.info/); if (launchCache.hash!=launchHash) { launchCache = { hash : launchHash, apps : s.list(/\.info$/) .map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}) - .filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || !app.type)) + .filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || (app.type=="launch" && settings.showLaunchers) || !app.type)) .sort((a,b)=>{ var n=(0|a.sortorder)-(0|b.sortorder); if (n) return n; // do sortorder first @@ -30,25 +31,34 @@ if (a.name>b.name) return 1; return 0; }) }; - s.writeJSON("launch.cache.json", launchCache); + s.writeJSON("dtlaunch.cache.json", launchCache); } let apps = launchCache.apps; - apps.forEach(app=>{ - if (app.icon) - app.icon = s.read(app.icon); // should just be a link to a memory area - }); + let page = 0; + let initPageAppZeroth = 0; + let initPageAppLast = 3; + if (settings.rememberPage) { + page = (global.dtlaunch&&global.dtlaunch.handlePagePersist()) ?? + (parseInt(s.read("dtlaunch.page")) ?? 0); + initPageAppZeroth = page*4; + initPageAppLast = Math.min(page*4+3, apps.length-1); + } + + for (let i = initPageAppZeroth; i <= initPageAppLast; i++) { // Initially only load icons for the current page. + if (apps[i].icon) + apps[i].icon = s.read(apps[i].icon); // should just be a link to a memory area + } let Napps = apps.length; let Npages = Math.ceil(Napps/4); let maxPage = Npages-1; let selected = -1; //let oldselected = -1; - let page = 0; const XOFF = 24; const YOFF = 30; let drawIcon= function(p,n,selected) { - let x = (n%2)*72+XOFF; + let x = (n%2)*72+XOFF; let y = n>1?72+YOFF:YOFF; (selected?g.setColor(g.theme.fgH):g.setColor(g.theme.bg)).fillRect(x+11,y+3,x+60,y+52); g.clearRect(x+12,y+4,x+59,y+51); @@ -99,7 +109,31 @@ Bangle.drawWidgets(); // To immediately update widget field to follow current theme - remove leftovers if previous app set custom theme. Bangle.loadWidgets(); - drawPage(0); + drawPage(page); + + for (let i = 0; i < apps.length; i++) { // Load the rest of the app icons that were not initially. + if (i >= initPageAppZeroth && i <= initPageAppLast) continue; + if (apps[i].icon) + apps[i].icon = s.read(apps[i].icon); // should just be a link to a memory area + } + + if (!global.dtlaunch) { + global.dtlaunch = {}; + global.dtlaunch.handlePagePersist = function(page) { + // Function for persisting the active page when leaving dtlaunch. + if (page===undefined) {return this.page||0;} + + if (!this.killHandler) { // Only register kill listener once. + this.killHandler = () => { + s.write("dtlaunch.page", this.page.toString()); + }; + E.on("kill", this.killHandler); // This is intentionally left around after fastloading into other apps. I.e. not removed in uiRemove. + } + + this.page = page; + }; + global.dtlaunch.handlePagePersist(page); + } let swipeListenerDt = function(dirLeftRight, dirUpDown){ updateTimeoutToClock(); @@ -137,6 +171,7 @@ drawIcon(page,selected,false); } else { buzzLong(); + global.dtlaunch.handlePagePersist(page); load(apps[page*4+i].src); } } @@ -157,7 +192,10 @@ back : Bangle.showClock, swipe : swipeListenerDt, touch : touchListenerDt, - remove : ()=>{if (timeoutToClock) clearTimeout(timeoutToClock);} + remove : ()=>{ + if (timeoutToClock) {clearTimeout(timeoutToClock);} + global.dtlaunch.handlePagePersist(page); + } }); // taken from Icon Launcher with minor alterations @@ -166,10 +204,9 @@ if (settings.timeOut!="Off"){ let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt if (timeoutToClock) clearTimeout(timeoutToClock); - timeoutToClock = setTimeout(Bangle.showClock,time*1000); + timeoutToClock = setTimeout(Bangle.showClock,time*1000); } }; updateTimeoutToClock(); } // end of app scope - diff --git a/apps/dtlaunch/metadata.json b/apps/dtlaunch/metadata.json index bac0ed369..941c88944 100644 --- a/apps/dtlaunch/metadata.json +++ b/apps/dtlaunch/metadata.json @@ -1,7 +1,7 @@ { "id": "dtlaunch", "name": "Desktop Launcher", - "version": "0.25", + "version": "0.28", "description": "Desktop style App Launcher with six (four for Bangle 2) apps per page - fast access if you have lots of apps installed.", "screenshots": [{"url":"shot1.png"},{"url":"shot2.png"},{"url":"shot3.png"}], "icon": "icon.png", @@ -16,5 +16,8 @@ {"name":"dtlaunch.settings.js","url":"settings-b2.js", "supports": ["BANGLEJS2"]}, {"name":"dtlaunch.img","url":"app-icon.js","evaluate":true} ], - "data": [{"name":"dtlaunch.json"}] + "data": [ + {"name":"dtlaunch.json"}, + {"name":"dtlaunch.cache.json"} + ] } diff --git a/apps/dtlaunch/settings-b2.js b/apps/dtlaunch/settings-b2.js index 6a50f90d4..b297e17d8 100644 --- a/apps/dtlaunch/settings-b2.js +++ b/apps/dtlaunch/settings-b2.js @@ -8,6 +8,7 @@ swipeExit: false, timeOut: "Off", interactionBuzz: false, + rememberPage: false, }, require('Storage').readJSON(FILE, true) || {}); function writeSettings() { @@ -16,6 +17,10 @@ const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"]; + function clearCache() { + require("Storage").erase("dtlaunch.cache.json") + } + E.showMenu({ "" : { "title" : "Desktop launcher" }, /*LANG*/"< Back" : () => back(), @@ -24,6 +29,7 @@ onchange: v => { settings.showClocks = v; writeSettings(); + clearCache(); } }, /*LANG*/'Show launchers': { @@ -31,6 +37,7 @@ onchange: v => { settings.showLaunchers = v; writeSettings(); + clearCache(); } }, /*LANG*/'Direct launch': { @@ -64,5 +71,12 @@ writeSettings(); } }, + /*LANG*/'Remember Page': { + value: settings.rememberPage, + onchange: v => { + settings.rememberPage = v; + writeSettings(); + } + }, }); -}); +}) diff --git a/apps/dutchclock/ChangeLog b/apps/dutchclock/ChangeLog new file mode 100644 index 000000000..8efcb9edb --- /dev/null +++ b/apps/dutchclock/ChangeLog @@ -0,0 +1 @@ +0.20: First release \ No newline at end of file diff --git a/apps/dutchclock/README.md b/apps/dutchclock/README.md new file mode 100644 index 000000000..787bcce1b --- /dev/null +++ b/apps/dutchclock/README.md @@ -0,0 +1,22 @@ +# Dutch Clock +This clock shows the time, in words, the way a Dutch person might respond when asked what time it is. Useful when learning Dutch and/or pretending to know Dutch. + +Dedicated to my wife, who will sometimes insist I tell her exactly what time it says on the watch and not just an approximation. + +## Options +- Three modes: + - exact time ("zeven voor half zes / twee voor tien") + - approximate time, rounded to the nearest 5-minute mark ("bijna vijf voor half zes / tegen tienen") (the default) + - hybrid mode, rounded when close to the quarter marks and exact otherwise ("zeven voor half zes / tegen tienen") +- Option to turn top widgets on/off (on by default) +- Option to show digital time at the bottom (off by default) +- Option to show the date at the bottom (on by default) + +The app respects top and bottom widgets, but it gets a bit crowded when you add the time/date and you also have bottom widgets turned on. + +When you turn widgets off, you can still see the top widgets by swiping down from the top. + +## Screenshots +![](screenshotbangle1-2.png) +![](screenshotbangle2.png) +![](screenshotbangle1.png) \ No newline at end of file diff --git a/apps/dutchclock/app-icon.js b/apps/dutchclock/app-icon.js new file mode 100644 index 000000000..7d6e655e8 --- /dev/null +++ b/apps/dutchclock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwgP/AE0/Ao/4sccAoX79NtAofttIFD8dsAof3t1/GZ397oGE/YLE6IFDloFE1vbAoeNAondAon/z4FE356U/nNxhZC/drlpLDscNAoX4ue9C4f3L4oAKt4FEQ4qxE/0skIGDtg7DAoNtAocsAogAX94POA")) \ No newline at end of file diff --git a/apps/dutchclock/app.js b/apps/dutchclock/app.js new file mode 100644 index 000000000..588692a2b --- /dev/null +++ b/apps/dutchclock/app.js @@ -0,0 +1,260 @@ +// Load libraries +const storage = require("Storage"); +const locale = require('locale'); +const widget_utils = require('widget_utils'); + +// Define constants +const DATETIME_SPACING_HEIGHT = 5; +const TIME_HEIGHT = 8; +const DATE_HEIGHT = 8; +const BOTTOM_SPACING = 2; + +const MINS_IN_HOUR = 60; +const MINS_IN_DAY = 24 * MINS_IN_HOUR; + +const VARIANT_EXACT = 'exact'; +const VARIANT_APPROXIMATE = 'approximate'; +const VARIANT_HYBRID = 'hybrid'; + +const DEFAULTS_FILE = "dutchclock.default.json"; +const SETTINGS_FILE = "dutchclock.json"; + +// Load settings +const settings = Object.assign( + storage.readJSON(DEFAULTS_FILE, true) || {}, + storage.readJSON(SETTINGS_FILE, true) || {} +); + +// Define global variables +const textBox = {}; +let date, mins; + +// Define functions +function initialize() { + // Reset the state of the graphics library + g.clear(true); + + // Tell Bangle this is a clock + Bangle.setUI("clock"); + + // Load widgets + Bangle.loadWidgets(); + + // Show widgets, or not + if (settings.showWidgets) { + Bangle.drawWidgets(); + } else { + widget_utils.swipeOn(); + } + + const dateTimeHeight = (settings.showDate || settings.showTime ? DATETIME_SPACING_HEIGHT : 0) + + (settings.showDate ? DATE_HEIGHT : 0) + + (settings.showTime ? TIME_HEIGHT : 0); + + Object.assign(textBox, { + x: Bangle.appRect.x + Bangle.appRect.w / 2, + y: Bangle.appRect.y + (Bangle.appRect.h - dateTimeHeight) / 2, + w: Bangle.appRect.w - 2, + h: Bangle.appRect.h - dateTimeHeight + }); + + // draw immediately at first + tick(); + + // now check every second + let secondInterval = setInterval(tick, 1000); + + // Stop updates when LCD is off, restart when on + Bangle.on('lcdPower',on=>{ + if (secondInterval) clearInterval(secondInterval); + secondInterval = undefined; + if (on) { + secondInterval = setInterval(tick, 1000); + draw(); // draw immediately + } + }); +} + +function tick() { + date = new Date(); + const m = (date.getHours() * MINS_IN_HOUR + date.getMinutes()) % MINS_IN_DAY; + + if (m !== mins) { + mins = m; + draw(); + } +} + +function draw() { + // work out how to display the current time + const timeLines = getTimeLines(mins); + const bottomLines = getBottomLines(); + + g.reset().clearRect(Bangle.appRect); + + // draw the current time (4x size 7 segment) + setFont(timeLines); + + g.setFontAlign(0,0); // align center top + g.drawString(timeLines.join("\n"), textBox.x, textBox.y, false); + + if (bottomLines.length) { + // draw the time and/or date, in a normal font + g.setFont("6x8"); + g.setFontAlign(0,1); // align center bottom + // pad the date - this clears the background if the date were to change length + g.drawString(bottomLines.join('\n'), Bangle.appRect.w / 2, Bangle.appRect.y2 - BOTTOM_SPACING, false); + } +} + +function setFont(timeLines) { + const size = textBox.h / timeLines.length; + + g.setFont("Vector", size); + + let width = g.stringWidth(timeLines.join('\n')); + + if (width > textBox.w) { + g.setFont("Vector", Math.floor(size * (textBox.w / width))); + } +} + +function getBottomLines() { + const lines = []; + + if (settings.showTime) { + lines.push(locale.time(date, 1)); + } + + if (settings.showDate) { + lines.push(locale.date(date)); + } + + return lines; + } + +function getTimeLines(m) { + switch (settings.variant) { + case VARIANT_EXACT: + return getExactTimeLines(m); + case VARIANT_APPROXIMATE: + return getApproximateTimeLines(m); + case VARIANT_HYBRID: + return distanceFromNearest(15)(m) < 3 + ? getApproximateTimeLines(m) + : getExactTimeLines(m); + default: + console.warn(`Error in settings: unknown variant "${settings.variant}"`); + return getExactTimeLines(m); + } +} + +function getExactTimeLines(m) { + if (m === 0) { + return ['middernacht']; + } + + const hour = getHour(m); + const minutes = getMinutes(hour.offset); + + const lines = minutes.concat(hour.lines); + if (lines.length === 1) { + lines.push('uur'); + } + + return lines; +} + +function getApproximateTimeLines(m) { + const roundMinutes = getRoundMinutes(m); + + const lines = getExactTimeLines(roundMinutes.minutes); + + return addApproximateDescription(lines, roundMinutes.offset); +} + +function getHour(minutes) { + const hours = ['twaalf', 'een', 'twee', 'drie', 'vier', 'vijf', 'zes', 'zeven', 'acht', 'negen', 'tien', 'elf']; + + const h = Math.floor(minutes / MINS_IN_HOUR), m = minutes % MINS_IN_HOUR; + + if (m <= 15) { + return {lines: [hours[h % 12]], offset: m}; + } + + if (m > 15 && m < 45) { + return { + lines: ['half', hours[(h + 1) % 12]], + offset: m - (MINS_IN_HOUR / 2) + }; + } + + return {lines: [hours[(h + 1) % 12]], offset: m - MINS_IN_HOUR}; +} + +function getMinutes(m) { + const minutes = ['', 'een', 'twee', 'drie', 'vier', 'vijf', 'zes', 'zeven', 'acht', 'negen', 'tien', 'elf', 'twaalf', 'dertien', 'veertien', 'kwart']; + + if (m === 0) { + return []; + } + + return [minutes[Math.abs(m)], m > 0 ? 'over' : 'voor']; +} + +function getRoundMinutes(m) { + const nearest = roundTo(5)(m); + + return { + minutes: nearest % MINS_IN_DAY, + offset: m - nearest + }; +} + +function addApproximateDescription(lines, offset) { + if (offset === 0) { + return lines; + } + + if (lines.length === 1 || lines[1] === 'uur') { + const singular = lines[0]; + const plural = getPlural(singular); + return { + '-2': ['tegen', plural], + '-1': ['iets voor', singular], + '1': ['iets na', plural], + '2': ['even na', plural] + }[`${offset}`]; + } + + return { + '-2': ['bijna'].concat(lines), + '-1': ['rond'].concat(lines), + '1': ['iets na'].concat(lines), + '2': lines.concat(['geweest']) + }[`${offset}`]; +} + +function getPlural(h) { + return { + middernacht: 'middernacht', + een: 'enen', + twee: 'tweeën', + drie: 'drieën', + vijf: 'vijven', + zes: 'zessen', + elf: 'elven', + twaalf: 'twaalven' + }[h] || `${h}en`; +} + +function distanceFromNearest(x) { + return n => Math.abs(n - roundTo(x)(n)); +} + +function roundTo(x) { + return n => Math.round(n / x) * x; +} + +// Let's go +initialize(); \ No newline at end of file diff --git a/apps/dutchclock/app.png b/apps/dutchclock/app.png new file mode 100644 index 000000000..94d35b0c5 Binary files /dev/null and b/apps/dutchclock/app.png differ diff --git a/apps/dutchclock/default.json b/apps/dutchclock/default.json new file mode 100644 index 000000000..cfe5d34a4 --- /dev/null +++ b/apps/dutchclock/default.json @@ -0,0 +1,6 @@ +{ + "variant": "approximate", + "showWidgets": true, + "showTime": false, + "showDate": true +} \ No newline at end of file diff --git a/apps/dutchclock/metadata.json b/apps/dutchclock/metadata.json new file mode 100644 index 000000000..d336023f8 --- /dev/null +++ b/apps/dutchclock/metadata.json @@ -0,0 +1,28 @@ +{ + "id": "dutchclock", + "name": "Dutch Clock", + "shortName":"Dutch Clock", + "icon": "app.png", + "version":"0.20", + "description": "A clock that displays the time the way a Dutch person would respond when asked what time it is.", + "type": "clock", + "tags": "clock,dutch,text", + "supports": ["BANGLEJS", "BANGLEJS2"], + "allow_emulator": true, + "screenshots": [ + {"url":"screenshotbangle1-2.png"}, + {"url":"screenshotbangle2.png"}, + {"url":"screenshotbangle1.png"} + ], + "storage": [ + {"name":"dutchclock.app.js","url":"app.js"}, + {"name":"dutchclock.settings.js","url":"settings.js"}, + {"name":"dutchclock.default.json","url":"default.json"}, + {"name":"dutchclock.img","url":"app-icon.js","evaluate":true} + ], + "data": [ + {"name":"dutchclock.json"} + ], + "readme":"README.md" +} + \ No newline at end of file diff --git a/apps/dutchclock/screenshotbangle1-2.png b/apps/dutchclock/screenshotbangle1-2.png new file mode 100644 index 000000000..08bf31939 Binary files /dev/null and b/apps/dutchclock/screenshotbangle1-2.png differ diff --git a/apps/dutchclock/screenshotbangle1.png b/apps/dutchclock/screenshotbangle1.png new file mode 100644 index 000000000..49ba895f4 Binary files /dev/null and b/apps/dutchclock/screenshotbangle1.png differ diff --git a/apps/dutchclock/screenshotbangle2.png b/apps/dutchclock/screenshotbangle2.png new file mode 100644 index 000000000..48b3fd501 Binary files /dev/null and b/apps/dutchclock/screenshotbangle2.png differ diff --git a/apps/dutchclock/settings.js b/apps/dutchclock/settings.js new file mode 100644 index 000000000..146df5395 --- /dev/null +++ b/apps/dutchclock/settings.js @@ -0,0 +1,73 @@ +(function(back) { + const storage = require("Storage"); + + const VARIANT_EXACT = 'exact'; + const VARIANT_APPROXIMATE = 'approximate'; + const VARIANT_HYBRID = 'hybrid'; + + const DEFAULTS_FILE = "dutchclock.default.json"; + const SETTINGS_FILE = "dutchclock.json"; + + // Load settings + const settings = Object.assign( + storage.readJSON(DEFAULTS_FILE, true) || {}, + storage.readJSON(SETTINGS_FILE, true) || {} + ); + + function writeSettings() { + require('Storage').writeJSON(SETTINGS_FILE, settings); + } + + function writeSetting(setting, value) { + settings[setting] = value; + writeSettings(); + } + + function writeOption(setting, value) { + writeSetting(setting, value); + showMainMenu(); + } + + function getOption(label, setting, value) { + return { + title: label, + value: settings[setting] === value, + onchange: () => { + writeOption(setting, value); + } + }; + } + + // Show the menu + function showMainMenu() { + const mainMenu = [ + getOption('Exact', 'variant', VARIANT_EXACT), + getOption('Approximate', 'variant', VARIANT_APPROXIMATE), + getOption('Hybrid', 'variant', VARIANT_HYBRID), + { + title: 'Show widgets?', + value: settings.showWidgets, + onchange: v => writeSetting('showWidgets', v) + }, + { + title: 'Show time?', + value: settings.showTime, + onchange: v => writeSetting('showTime', v) + }, + { + title: 'Show date?', + value: settings.showDate, + onchange: v => writeSetting('showDate', v) + } + ]; + + mainMenu[""] = { + title : "Dutch Clock", + back: back + }; + + E.showMenu(mainMenu); + } + + showMainMenu(); + }) \ No newline at end of file diff --git a/apps/edgeclk/ChangeLog b/apps/edgeclk/ChangeLog index b96d7207d..34caa2d6a 100644 --- a/apps/edgeclk/ChangeLog +++ b/apps/edgeclk/ChangeLog @@ -1,3 +1,6 @@ 0.01: Initial release. 0.02: Fix reset of progress bars on midnight. Fix display of 100k+ steps. 0.03: Added option to display weather. +0.04: Added option to display live updates of step count. +0.05: Reset graphics before initial clearing of the screen. Helps in some + situations if using fastload utils. diff --git a/apps/edgeclk/README.md b/apps/edgeclk/README.md index 90f6443fc..51747780f 100644 --- a/apps/edgeclk/README.md +++ b/apps/edgeclk/README.md @@ -20,12 +20,13 @@ The appearance is highly configurable. In the settings menu you can: - Set the daily step goal. - En- or disable the individual progress bars. - Set if your week should start with Monday or Sunday (for week progress bar). +- Toggle live step count updates.* -*) Hiding seconds should further reduce power consumption as the draw interval is prolonged as well. +*) Hiding seconds and leaving live steps off should further reduce power consumption as the draw interval is prolonged as well. The clock implements Fast Loading for faster switching to and fro. ## Contributors - [tinxx](https://github.com/tinxx) - [peerdavid](https://github.com/peerdavid) - \ No newline at end of file + diff --git a/apps/edgeclk/app.js b/apps/edgeclk/app.js index f9d5f803b..b67018917 100644 --- a/apps/edgeclk/app.js +++ b/apps/edgeclk/app.js @@ -14,6 +14,7 @@ weekBar: true, mondayFirst: true, dayBar: true, + liveSteps: false, }, require('Storage').readJSON('edgeclk.settings.json', true) || {}); /* Runtime Variables @@ -279,6 +280,9 @@ drawLower(); }; + const onStep = function () { + drawSteps(); + } /* Lifecycle Functions ------------------------------------------------------------------------------*/ @@ -298,6 +302,9 @@ // Charging event signals when charging status changes: Bangle.on('charging', onCharging); + + // Continously update step count when they happen: + if (settings.redrawOnStep) Bangle.on('step', onStep); }; const deregisterEvents = function () { @@ -306,6 +313,7 @@ Bangle.removeListener('health', onHealth); Bangle.removeListener('lock', onLock); Bangle.removeListener('charging', onCharging); + if (settings.redrawOnStep) Bangle.removeListener('step', onStep); }; const startTimers = function () { @@ -328,7 +336,7 @@ /* Startup Process ------------------------------------------------------------------------------*/ - g.clear(); + g.clear(1); drawAll(); startTimers(); registerEvents(); diff --git a/apps/edgeclk/metadata.json b/apps/edgeclk/metadata.json index 0d53cd008..f7af147da 100644 --- a/apps/edgeclk/metadata.json +++ b/apps/edgeclk/metadata.json @@ -2,7 +2,7 @@ "id": "edgeclk", "name": "Edge Clock", "shortName": "Edge Clock", - "version": "0.03", + "version": "0.05", "description": "Crisp clock with perfect readability.", "readme": "README.md", "icon": "app.png", diff --git a/apps/edgeclk/settings.js b/apps/edgeclk/settings.js index 6f38e774c..81a7acc5b 100644 --- a/apps/edgeclk/settings.js +++ b/apps/edgeclk/settings.js @@ -14,6 +14,7 @@ weekBar: true, mondayFirst: true, dayBar: true, + redrawOnStep: false, }; const saved_settings = storage.readJSON(SETTINGS_FILE, true); @@ -121,5 +122,12 @@ save(); }, }, + 'Live steps': { + value: settings.redrawOnStep, + onchange: () => { + settings.redrawOnStep = !settings.redrawOnStep; + save(); + }, + }, }); }) diff --git a/apps/elapsed_t/ChangeLog b/apps/elapsed_t/ChangeLog index 6a72c2590..26fbf5ff0 100644 --- a/apps/elapsed_t/ChangeLog +++ b/apps/elapsed_t/ChangeLog @@ -1,3 +1,4 @@ 0.01: New App! 0.02: Handle AM/PM time in the "set target" menu. Add yesterday/today/tomorrow when showing target date to improve readability. 0.03: Add option to set clock as default, handle DST in day/month/year mode +0.04: Use new pickers from the more_pickers library, add settings to display seconds never/unlocked/always diff --git a/apps/elapsed_t/README.md b/apps/elapsed_t/README.md index dc2173409..9e361be59 100644 --- a/apps/elapsed_t/README.md +++ b/apps/elapsed_t/README.md @@ -1,7 +1,10 @@ # Elapsed Time Clock A clock that calculates the time difference between now (in blue/cyan) and any given target date (in red/orange). -The results is show in years, months, days, hours, minutes, seconds. To save battery life, the seconds are shown only when the watch is unlocked, or can be disabled entirely. +The results is show in years, months, days, hours, minutes, seconds. The seconds can be shown: +- always +- when the watch is unlocked +- never. The time difference is positive if the target date is in the past and negative if it is in the future. diff --git a/apps/elapsed_t/app.js b/apps/elapsed_t/app.js index 13fbca2cd..910ff85f3 100644 --- a/apps/elapsed_t/app.js +++ b/apps/elapsed_t/app.js @@ -24,13 +24,20 @@ var now = new Date(); var settings = Object.assign({ // default values - displaySeconds: true, + displaySeconds: 1, displayMonthsYears: true, dateFormat: 0, time24: true }, require('Storage').readJSON(APP_NAME + ".settings.json", true) || {}); -var temp_displaySeconds = settings.displaySeconds; +function writeSettings() { + require('Storage').writeJSON(APP_NAME + ".settings.json", settings); +} + +if (typeof settings.displaySeconds === 'boolean') { + settings.displaySeconds = 1; + writeSettings(); +} var data = Object.assign({ // default values @@ -49,17 +56,12 @@ function writeData() { require('Storage').writeJSON(APP_NAME + ".data.json", data); } -function writeSettings() { - require('Storage').writeJSON(APP_NAME + ".settings.json", settings); - temp_displaySeconds = settings.temp_displaySeconds; -} - let inMenu = false; Bangle.on('touch', function (zone, e) { if (!inMenu && e.y > 24) { if (drawTimeout) clearTimeout(drawTimeout); - E.showMenu(menu); + showMainMenu(); inMenu = true; } }); @@ -112,115 +114,151 @@ function formatDateTime(date, dateFormat, time24, showSeconds) { return formattedDateTime; } -function formatHourToAMPM(h){ +function formatHourToAMPM(h) { var ampm = (h >= 12 ? 'PM' : 'AM'); var h_ampm = h % 12; h_ampm = (h_ampm == 0 ? 12 : h_ampm); - return `${h_ampm} ${ampm}` + return `${h_ampm}\n${ampm}`; } -function howManyDaysInMonth(month, year) { - return new Date(year, month, 0).getDate(); -} +function getDatePickerObject() { + switch (settings.dateFormat) { + case 0: + return { + back: showMainMenu, + title: "Date", + separator_1: "/", + separator_2: "/", -function handleExceedingDay() { - var maxDays = howManyDaysInMonth(data.target.M, data.target.Y); - menu.Day.max = maxDays; - if (data.target.D > maxDays) { - menu.Day.value = maxDays; - data.target.D = maxDays; + value_1: data.target.D, + min_1: 1, max_1: 31, step_1: 1, wrap_1: true, + + value_2: data.target.M, + min_2: 1, max_2: 12, step_2: 1, wrap_2: true, + + value_3: data.target.Y, + min_3: 1900, max_3: 2100, step_3: 1, wrap_3: true, + + format_1: function (v_1) { return (pad2(v_1)); }, + format_2: function (v_2) { return (pad2(v_2)); }, + onchange: function (v_1, v_2, v_3) { data.target.D = v_1; data.target.M = v_2; data.target.Y = v_3; setTarget(true); } + }; + + case 1: + return { + back: showMainMenu, + title: "Date", + separator_1: "/", + separator_2: "/", + + value_1: data.target.M, + min_1: 1, max_1: 12, step_1: 1, wrap_1: true, + + value_2: data.target.D, + min_2: 1, max_2: 31, step_2: 1, wrap_2: true, + + value_3: data.target.Y, + min_3: 1900, max_3: 2100, step_3: 1, wrap_3: true, + + format_1: function (v_1) { return (pad2(v_1)); }, + format_2: function (v_2) { return (pad2(v_2)); }, + onchange: function (v_1, v_2, v_3) { data.target.M = v_1; data.target.D = v_2; data.target.Y = v_3; setTarget(true); } + }; + + case 2: + return { + back: showMainMenu, + title: "Date", + separator_1: "-", + separator_2: "-", + + value_1: data.target.Y, + min_1: 1900, max_1: 2100, step_1: 1, wrap_1: true, + + value_2: data.target.M, + min_2: 1, max_2: 12, step_2: 1, wrap_2: true, + + value_3: data.target.D, + min_3: 1, max_3: 31, step_3: 1, wrap_3: true, + + format_1: function (v_1) { return (pad2(v_1)); }, + format_2: function (v_2) { return (pad2(v_2)); }, + onchange: function (v_1, v_2, v_3) { data.target.Y = v_1; data.target.M = v_2; data.target.D = v_3; setTarget(true); } + }; } } -var menu = { - "": { - "title": "Set target", - back: function () { - E.showMenu(); - Bangle.setUI("clock"); - inMenu = false; - draw(); - } - }, - 'Day': { - value: data.target.D, - min: 1, max: 31, wrap: true, - onchange: v => { - data.target.D = v; - } - }, - 'Month': { - value: data.target.M, - min: 1, max: 12, noList: true, wrap: true, - onchange: v => { - data.target.M = v; - handleExceedingDay(); - } - }, - 'Year': { - value: data.target.Y, - min: 1900, max: 2100, - onchange: v => { - data.target.Y = v; - handleExceedingDay(); - } - }, - 'Hours': { - value: data.target.h, - min: 0, max: 23, wrap: true, - onchange: v => { - data.target.h = v; - }, - format: function (v) {return(settings.time24 ? pad2(v) : formatHourToAMPM(v))} - }, - 'Minutes': { - value: data.target.m, - min: 0, max: 59, wrap: true, - onchange: v => { - data.target.m = v; - }, - format: function (v) { return pad2(v); } - }, - 'Seconds': { - value: data.target.s, - min: 0, max: 59, wrap: true, - onchange: v => { - data.target.s = v; - }, - format: function (v) { return pad2(v); } - }, - 'Save': function () { - E.showMenu(); - inMenu = false; - Bangle.setUI("clock"); - setTarget(true); - writeSettings(); - temp_displaySeconds = settings.displaySeconds; - updateQueueMillis(settings.displaySeconds); - draw(); - }, - 'Reset': function () { - E.showMenu(); - inMenu = false; - Bangle.setUI("clock"); - setTarget(false); - updateQueueMillis(settings.displaySeconds); - draw(); - }, - 'Set clock as default': function () { - setClockAsDefault(); - E.showAlert("Elapsed Time was set as default").then(function() { - E.showMenu(); - inMenu = false; - Bangle.setUI("clock"); - draw(); - }); - } -}; +function getTimePickerObject() { + var timePickerObject = { + back: showMainMenu, + title: "Time", + separator_1: ":", + separator_2: ":", -function setClockAsDefault(){ + value_1: data.target.h, + min_1: 0, max_1: 23, step_1: 1, wrap_1: true, + + value_2: data.target.m, + min_2: 0, max_2: 59, step_2: 1, wrap_2: true, + + value_3: data.target.s, + min_3: 0, max_3: 59, step_3: 1, wrap_3: true, + + format_2: function (v_2) { return (pad2(v_2)); }, + format_3: function (v_3) { return (pad2(v_3)); }, + onchange: function (v_1, v_2, v_3) { data.target.h = v_1; data.target.m = v_2; data.target.s = v_3; setTarget(true); }, + }; + + if (settings.time24) { + timePickerObject.format_1 = function (v_1) { return (pad2(v_1)); }; + } else { + timePickerObject.format_1 = function (v_1) { return (formatHourToAMPM(v_1)); }; + } + + return timePickerObject; +} + +function showMainMenu() { + E.showMenu({ + "": { + "title": "Set target", + back: function () { + E.showMenu(); + Bangle.setUI("clock"); + inMenu = false; + draw(); + } + }, + 'Date': { + value: formatDateTime(target, settings.dateFormat, settings.time24, true).date, + onchange: function () { require("more_pickers").triplePicker(getDatePickerObject()); } + }, + 'Time': { + value: formatDateTime(target, settings.dateFormat, settings.time24, true).time, + onchange: function () { require("more_pickers").triplePicker(getTimePickerObject()); } + }, + 'Reset': function () { + E.showMenu(); + inMenu = false; + Bangle.setUI("clock"); + setTarget(false); + draw(); + }, + 'Set clock as default': function () { + setClockAsDefault(); + E.showAlert("Elapsed Time was set as default").then(function () { + E.showMenu(); + inMenu = false; + Bangle.setUI("clock"); + draw(); + }); + } + }); +} + +function setClockAsDefault() { let storage = require('Storage'); - let settings = storage.readJSON('setting.json',true)||{clock:null}; + let settings = storage.readJSON('setting.json', true) || { clock: null }; settings.clock = "elapsed_t.app.js"; storage.writeJSON('setting.json', settings); } @@ -238,26 +276,21 @@ function setTarget(set) { data.target.isSet = true; } else { target = new Date(); + target.setSeconds(0); Object.assign( data, { target: { isSet: false, - Y: now.getFullYear(), - M: now.getMonth() + 1, // Month is zero-based, so add 1 - D: now.getDate(), - h: now.getHours(), - m: now.getMinutes(), + Y: target.getFullYear(), + M: target.getMonth() + 1, // Month is zero-based, so add 1 + D: target.getDate(), + h: target.getHours(), + m: target.getMinutes(), s: 0 } } ); - menu.Day.value = data.target.D; - menu.Month.value = data.target.M; - menu.Year.value = data.target.Y; - menu.Hours.value = data.target.h; - menu.Minutes.value = data.target.m; - menu.Seconds.value = 0; } writeData(); @@ -267,8 +300,8 @@ var target; setTarget(data.target.isSet); var drawTimeout; -var queueMillis = 1000; - +var temp_displaySeconds; +var queueMillis; function queueDraw() { if (drawTimeout) clearTimeout(drawTimeout); @@ -283,27 +316,25 @@ function queueDraw() { }, delay); } -function updateQueueMillis(displaySeconds) { +function updateQueueMillisAndDraw(displaySeconds) { + temp_displaySeconds = displaySeconds; if (displaySeconds) { queueMillis = 1000; } else { queueMillis = 60000; } + draw(); } Bangle.on('lock', function (on, reason) { - if (inMenu) { // if already in a menu, nothing to do + if (inMenu || settings.displaySeconds == 0 || settings.displaySeconds == 2) { // if already in a menu, or always/never show seconds, nothing to do return; } if (on) { // screen is locked - temp_displaySeconds = false; - updateQueueMillis(false); - draw(); + updateQueueMillisAndDraw(false); } else { // screen is unlocked - temp_displaySeconds = settings.displaySeconds; - updateQueueMillis(temp_displaySeconds); - draw(); + updateQueueMillisAndDraw(true); } }); @@ -335,18 +366,21 @@ function diffToTarget() { var end; if (now > target) { - start = target; - end = now; + start = new Date(target.getTime()); + end = new Date(now.getTime()); } else { - start = now; - end = target; + start = new Date(now.getTime()); + end = new Date(target.getTime()); } + // Adjust for DST + end.setMinutes(end.getMinutes() + end.getTimezoneOffset() - start.getTimezoneOffset()); + diff.Y = end.getFullYear() - start.getFullYear(); diff.M = end.getMonth() - start.getMonth(); diff.D = end.getDate() - start.getDate(); diff.hh = end.getHours() - start.getHours(); - diff.mm = end.getMinutes() - start.getMinutes() + end.getTimezoneOffset() - start.getTimezoneOffset(); + diff.mm = end.getMinutes() - start.getMinutes(); diff.ss = end.getSeconds() - start.getSeconds(); // Adjust negative differences @@ -372,7 +406,6 @@ function diffToTarget() { diff.Y--; } - } else { var timeDifference = target - now; timeDifference = Math.abs(timeDifference); @@ -491,4 +524,14 @@ Bangle.loadWidgets(); Bangle.drawWidgets(); Bangle.setUI("clock"); -draw(); +switch (settings.displaySeconds) { + case 0: // never + updateQueueMillisAndDraw(false); + break; + case 1: // unlocked + updateQueueMillisAndDraw(Bangle.isBacklightOn()); + break; + case 2: // always + updateQueueMillisAndDraw(true); + break; +} diff --git a/apps/elapsed_t/metadata.json b/apps/elapsed_t/metadata.json index fa0674e0b..2515e0e79 100644 --- a/apps/elapsed_t/metadata.json +++ b/apps/elapsed_t/metadata.json @@ -3,7 +3,7 @@ "name": "Elapsed Time Clock", "shortName": "Elapsed Time", "type": "clock", - "version":"0.03", + "version":"0.04", "description": "A clock that calculates the time difference between now and any given target date.", "tags": "clock,tool", "supports": ["BANGLEJS2"], diff --git a/apps/elapsed_t/settings.js b/apps/elapsed_t/settings.js index d3a7cb357..4726516d5 100644 --- a/apps/elapsed_t/settings.js +++ b/apps/elapsed_t/settings.js @@ -4,7 +4,7 @@ // Load settings var settings = Object.assign({ // default values - displaySeconds: true, + displaySeconds: 1, displayMonthsYears: true, dateFormat: 0, time24: true @@ -14,18 +14,26 @@ require('Storage').writeJSON(FILE, settings); } + if (typeof settings.displaySeconds === 'boolean') { + settings.displaySeconds = 1; + writeSettings(); + } + var dateFormats = ["DD/MM/YYYY", "MM/DD/YYYY", "YYYY-MM-DD"]; + var displaySecondsFormats = ["Never", "Unlocked", "Always"]; // Show the menu E.showMenu({ "" : { "title" : "Elapsed Time" }, "< Back" : () => back(), 'Show\nseconds': { - value: !!settings.displaySeconds, + value: settings.displaySeconds, + min: 0, max: 2, wrap: true, onchange: v => { settings.displaySeconds = v; writeSettings(); - } + }, + format: function (v) {return displaySecondsFormats[v];} }, 'Show months/\nyears': { value: !!settings.displayMonthsYears, diff --git a/apps/eliteclock/ChangeLog b/apps/eliteclock/ChangeLog new file mode 100644 index 000000000..52f6f5685 --- /dev/null +++ b/apps/eliteclock/ChangeLog @@ -0,0 +1 @@ +0.01: initial import diff --git a/apps/eliteclock/README.md b/apps/eliteclock/README.md new file mode 100644 index 000000000..0b32015e6 --- /dev/null +++ b/apps/eliteclock/README.md @@ -0,0 +1,5 @@ +# Elite clock ![](app.png) + +Simple binary clock for leet haxorz. + +Written by: [Pavel Machek](https://github.com/pavelmachek) diff --git a/apps/eliteclock/app-icon.js b/apps/eliteclock/app-icon.js new file mode 100644 index 000000000..bc7850c4f --- /dev/null +++ b/apps/eliteclock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwgIspiEPgEeAoU/4F/wGAiEAsEA4AFImAHBAolj/gRD4YFEC4UPwEfgAFC4EfF5IpHAp4dC4EQv/A/+AHYJlDnjY/AH4AJ")) diff --git a/apps/eliteclock/app.png b/apps/eliteclock/app.png new file mode 100644 index 000000000..10c6e078c Binary files /dev/null and b/apps/eliteclock/app.png differ diff --git a/apps/eliteclock/eliteclock.app.js b/apps/eliteclock/eliteclock.app.js new file mode 100644 index 000000000..daf9fb567 --- /dev/null +++ b/apps/eliteclock/eliteclock.app.js @@ -0,0 +1,86 @@ +// Bangle.js 2 - Binary Leet ClockZ +/* + +bangle.js2: create binary 'leet clock' where the time is shown as text +"leet clockz" with binary 0 being normal character and binary one +being leet translation. Be careful to only update time on minute +boundaries. + +So yeah — 1337 c10ckZ = certified leetspeak 😎 + +ChatGPT said: +Alright, here’s a hardcore hacker variant of elite clock in full-on aggressive leetspeak: + +£|173 ¢|_0¢| + binMask[i] === '1' ? (LEET[ch] || ch) : ch + ).join(""); +} + +function draw() { + g.reset().clear(); + const now = new Date(); + const bin = getBinaryFromTime(now); + const txt = getDisplayText(bin); + + const w = 0; + g.setFont("Vector", 47).setFontAlign(0,0); + + g.drawString(txt, (g.getWidth() - w) / 2, (g.getHeight() - 0) / 2); +} + +function scheduleNextDraw() { + const now = new Date(); + const msToNextMin = 60000 - (now.getSeconds() * 1000 + now.getMilliseconds()); + setTimeout(() => { + draw(); + scheduleNextDraw(); + }, msToNextMin); +} + +// Init +draw(); +scheduleNextDraw(); +//Bangle.loadWidgets(); +//Bangle.drawWidgets(); diff --git a/apps/eliteclock/metadata.json b/apps/eliteclock/metadata.json new file mode 100644 index 000000000..91f9c0013 --- /dev/null +++ b/apps/eliteclock/metadata.json @@ -0,0 +1,14 @@ +{ "id": "eliteclock", + "name": "Elite clock", + "version": "0.01", + "description": "Simple binary clock for leet haxorz", + "icon": "app.png", + "readme": "README.md", + "supports" : ["BANGLEJS2"], + "type": "clock", + "tags": "clock", + "storage": [ + {"name":"eliteclock.app.js","url":"eliteclock.app.js"}, + {"name":"eliteclock.img","url":"app-icon.js","evaluate":true} + ] +} diff --git a/apps/exactwords/0100.png b/apps/exactwords/0100.png new file mode 100644 index 000000000..dc7ffb279 Binary files /dev/null and b/apps/exactwords/0100.png differ diff --git a/apps/exactwords/0634.png b/apps/exactwords/0634.png new file mode 100644 index 000000000..e04ffa9ce Binary files /dev/null and b/apps/exactwords/0634.png differ diff --git a/apps/exactwords/1200.png b/apps/exactwords/1200.png new file mode 100644 index 000000000..a7f67a1b6 Binary files /dev/null and b/apps/exactwords/1200.png differ diff --git a/apps/exactwords/1517.png b/apps/exactwords/1517.png new file mode 100644 index 000000000..357e0a144 Binary files /dev/null and b/apps/exactwords/1517.png differ diff --git a/apps/exactwords/1616.png b/apps/exactwords/1616.png new file mode 100644 index 000000000..8f9d301b8 Binary files /dev/null and b/apps/exactwords/1616.png differ diff --git a/apps/exactwords/2020.png b/apps/exactwords/2020.png new file mode 100644 index 000000000..70296db5c Binary files /dev/null and b/apps/exactwords/2020.png differ diff --git a/apps/exactwords/2358.png b/apps/exactwords/2358.png new file mode 100644 index 000000000..8163f59b2 Binary files /dev/null and b/apps/exactwords/2358.png differ diff --git a/apps/exactwords/ChangeLog b/apps/exactwords/ChangeLog new file mode 100644 index 000000000..189c6233b --- /dev/null +++ b/apps/exactwords/ChangeLog @@ -0,0 +1 @@ +0.1: New App! Need to work out locale settings diff --git a/apps/exactwords/README.md b/apps/exactwords/README.md new file mode 100644 index 000000000..e9b360df6 --- /dev/null +++ b/apps/exactwords/README.md @@ -0,0 +1,38 @@ +# Exact Words + +This is a clock for expressing the time in exact words. Each minute of +the day has a different phrase. + +Ranging from "Twelve" to "Coming up to midnight" to "A little after +twenty-five past four in the early hours" + +Screenshots best demonstrate + +![1200.png](1200.png) +![2358.png](2358.png) +![1616.png](1616.png) +![0634.png](0634.png) +![1517.png](1517.png) +![2020.png](2020.png) + + +"just gone " - as in Just gone quarter past four is 16:16 + +"a little after ", as in A little after quarter past three is 15:17 + +"coming up to ", as in Coming up to midnight is 23:58 + +"almost " as in Almost twenty-five to seven is 06:34 + +## To Do + +Add localisation. + +## Requests + +Written by: [Brendan Sleight](https://github.com/bmsleight/) For support and discussion please post in the Bangle JS Forum + + +## Creator + +[Brendan Sleight](https://github.com/bmsleight/) diff --git a/apps/exactwords/app-icon.js b/apps/exactwords/app-icon.js new file mode 100644 index 000000000..a6e8dee5a --- /dev/null +++ b/apps/exactwords/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwgJC/AAMEjtogFQgEMjIFB6EAh0d/eH7dwAoNrx/X4Eaju7g/boAoKkACFh9f23BzswAoO38P/0EP78/wN/0EO70WwPf2EGDYKNCguAgFAlAFDgAFBg/d3F4v3ggvz/F8lXgg/x3F8nXAPBkHEgQABn+Xs1MAoN9393/wFBqu+r++AoN021W9ytYQIQACv3/j/bz+cv+/j/0/8cgECI4MQPYWUqoYCgP//4fDiAQCAAoA=")) diff --git a/apps/exactwords/app.js b/apps/exactwords/app.js new file mode 100644 index 000000000..e3547aa1d --- /dev/null +++ b/apps/exactwords/app.js @@ -0,0 +1,225 @@ +// timeout used to update every minute +var drawTimeout; + +// https://www.espruino.com/Bangle.js+Locale + +// schedule a draw for the next minute +function queueDraw() { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); +} + +function wordsFromTime(h, m) +{ + + // Tests +/* +// Example 12:00 = Twelve +// h = 12; +// m = 0; + // Example 23:58 = Coming up to midnight +// h = 23; +// m = 58; + // Example 12:15 = Quarter past twelve +// h = 12; +// m = 15; + // Example 04:16 = Just gone quarter past four +// h = 16; +// m = 16; + // Example 01:00 = One at night +// h = 1; +// m = 0; + // Example 17:01 = Just gone five in the afternoon +// h = 17; +// m = 1; + // Example 05:25 = Twenty-five past five in the early hours +// h = 23; +// m = 33; + // Example 22:33 = coming up to eleven at night + // max + //words = "a little after twenty-five past four in the early hours"; +// h = 04; +// m = 27; +*/ + + + const HOUR_WORD_ARRAY = [ + "midnight", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "one", "two", "three", + "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", + "midnight"]; + const PART_DAY_WORD_ARRAY = ["", + " at night", + " in the early hours", + " in the early hours", + " in the early hours", + " in the early hours", + " in the morning", + " in the morning", + " in the morning", + " in the morning", + " in the morning", + " in the morning", + "", + " in the afternoon", + " in the afternoon", + " in the afternoon", + " in the afternoon", + " in the afternoon", + " in the evening", + " in the evening", + " in the evening", + " in the evening", + " at night", + " at night", + ""]; + const MINUTES_ROUGH_ARRAY = ["", + "five past ", + "ten past ", + "quarter past ", + "twenty past ", + "twenty-five past ", + "half past ", + "twenty-five to ", + "twenty to ", + "quarter to ", + "ten to ", + "five to ", + ""]; + const MINUTES_ACCURATE_ARRAY = ["", "just gone ", "a little after ", "coming up to ", "almost "]; + + var hourAdjusted = h; + var words = " ", hourWord = " ", partDayWord = " ", minutesRough = " ", minutesAccurate = " "; + + // At 33 past the hours we start referign to the next hour + if (m > 32) { + hourAdjusted = (h+ 1) % 24; + } else { + hourAdjusted = h; + } + + hourWord = HOUR_WORD_ARRAY[hourAdjusted]; + partDayWord = PART_DAY_WORD_ARRAY[Math.round(hourAdjusted)]; + minutesRough = MINUTES_ROUGH_ARRAY[Math.round((m + 0 ) / 5)]; + minutesAccurate = MINUTES_ACCURATE_ARRAY[m % 5]; + + words = minutesAccurate + minutesRough + hourWord + partDayWord; + words = words.charAt(0).toUpperCase() + words.slice(1); + return words; +} + +function wordsFromDayMonth(day, date, month) +{ + // Tests + +// Example 12:00 = Twelve +// New Year's Day +// date = 1; +// month = 0; +// on the Ides of March +// date = 15; +// month = 2; +// , ERROR C Nonsense in BASIC +// date = 1; +// month = 3; +// - O'Canada +// date = 1; +// month = 6; +// - on Halloween +// date = 31; +// month = 9; +// - Christmas Eve +// date = 24; +// month = 11; +// - Christmas Day +// date = 25; +// month = 11; +// - Boxing day +// date = 26; +// month = 11; +// New Year's eve +// date = 31; +// month = 11; +// longest +// date = 29; +// month = 10; + + + const DAY_WORD_ARRAY = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; + const DATE_WORD_ARRAY = ["zero", "first", "second", "third", "fourth", "fifth", "sixth", "seventh","eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth","sixteenth", "seventeenth", "eighteenth", "nineteenth", "twentieth", "twenty-first", "twenty-second", "twenty-third","twenty-fourth", "twenty-fifth", "twenty-sixth", "twenty-seventh", "twenty-eighth", "twenty-ninth", "thirtieth", "thirty-first"]; + const MONTH_WORD_ARRAY = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + var words = " "; + words = DAY_WORD_ARRAY[day] + ", " + DATE_WORD_ARRAY[date] + " of " + MONTH_WORD_ARRAY[month]; + if ((date == 1) && (month == 0)) { + words = "New Year's Day"; + } else if ((date == 15) && (month == 2)) { + words = DAY_WORD_ARRAY[day] + " on the Ides of March"; + } else if ((date == 1) && (month == 3)) { + words = DAY_WORD_ARRAY[day] + ", ERROR C Nonsense in BASIC"; + } else if ((date == 1) && (month == 6)) { + words = DAY_WORD_ARRAY[day] + " - O'Canada"; + } else if ((date == 31) && (month == 9)) { + words = DAY_WORD_ARRAY[day] + " - on Halloween"; + } else if ((date == 24) && (month == 11)) { + words = "Christmas Eve"; + } else if ((date == 25) && (month == 11)) { + words = "Christmas Day"; + } else if ((date == 26) && (month == 11)) { + words = "Boxing Day"; + } else if ((date == 31) && (month == 11)) { + words = "New Year's eve"; + } + return words; +} + +function draw() { + var x = g.getWidth()/2; + var y = g.getHeight()/2; + g.reset(); + + var d = new Date(); + var h = d.getHours(); + var m = d.getMinutes(); + var day = d.getDay(); + var date = d.getDate(); + var month = d.getMonth(); + + var timeStr = wordsFromTime(h,m); + var dateStr = wordsFromDayMonth(day, date, month); + + // draw time + g.setBgColor(g.theme.bg); + g.setColor(g.theme.fg); + g.clear(); + g.setFontAlign(0,0).setFont("Vector",24); + g.drawString(g.wrapString(timeStr, g.getWidth()).join("\n"),x,y-24*0); + // draw date + + g.setFontAlign(0,0).setFont("Vector",12); + g.drawString(g.wrapString(dateStr, g.getWidth()).join("\n"),x,y+12*6); + // queue draw in one minute + queueDraw(); +} + +// Clear the screen once/, at startup +g.clear(); +// draw immediately at first, queue update +draw(); +// Stop updates when LCD is off, restart when on +Bangle.on('lcdPower',on=>{ + if (on) { + draw(); // draw immediately, queue redraw + } else { // stop draw timer + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } +}); + +// Show launcher when middle button pressed +Bangle.setUI("clock"); +// Load widgets +Bangle.loadWidgets(); +Bangle.drawWidgets(); diff --git a/apps/exactwords/app.png b/apps/exactwords/app.png new file mode 100644 index 000000000..24c06208c Binary files /dev/null and b/apps/exactwords/app.png differ diff --git a/apps/exactwords/metadata.json b/apps/exactwords/metadata.json new file mode 100644 index 000000000..428572632 --- /dev/null +++ b/apps/exactwords/metadata.json @@ -0,0 +1,22 @@ +{ "id": "exactwords", + "name": "Exact Words Clock", + "shortName":"Exact Words", + "version":"0.1", + "description": "Each minute of the day has a different phrase. ", + "icon": "app.png", + "screenshots" : [ { "url":"1517.png" }, + { "url":"0634.png" }, + { "url":"1200.png" }, + { "url":"1517.png" }, + { "url":"1616.png" }, + { "url":"2020.png" }, + { "url":"2358.png" } ], + "tags": "clock", + "type": "clock", + "supports" : ["BANGLEJS2"], + "readme": "README.md", + "storage": [ + {"name":"exactwords.app.js","url":"app.js"}, + {"name":"exactwords.img","url":"app-icon.js","evaluate":true} + ] +} diff --git a/apps/factclock/ChangeLog b/apps/factclock/ChangeLog new file mode 100644 index 000000000..09953593e --- /dev/null +++ b/apps/factclock/ChangeLog @@ -0,0 +1 @@ +0.01: New Clock! diff --git a/apps/factclock/README.md b/apps/factclock/README.md new file mode 100644 index 000000000..83b590c0b --- /dev/null +++ b/apps/factclock/README.md @@ -0,0 +1,5 @@ +# Fact Clock + +A clock that displays a random fact alongside the time. + +This uses `text_facts` for the list of facts, but you can implement new apps that provide the `textsource` module (see the readme for the `text_facts` app) to make this clock display different information. \ No newline at end of file diff --git a/apps/factclock/app-icon.js b/apps/factclock/app-icon.js new file mode 100644 index 000000000..6eb4bb2a5 --- /dev/null +++ b/apps/factclock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwcF23btoCV7QfBrYRM2kAhMkgEtCJegiwDBgBBLtAMCoA3BCwQRHoADCNIUCKxMDAYPAPgZcICIWwRwgRI6ARBwAREhYRIjYRBgVggEDCJOACIO07dsgETtsBCJcTsEGBIORCJRHCmwJB2LRHg0DGQIFC7ZKBNwnRkmSm0ACIsAgO2yRcCwIRDhgRILgWJCIMWgENR4fbhuBCINBMgMJCJNt2YLBoEtCIcGwEN2wRE3+kCI1C4DpDR4WdGoIRFpHYCIUBR4XtCJFYCIacBtgRIpKECCIdnpJZHpMhZIRcB7c7AwIRHkktEYNN23ZaYQRIwDhDrwRLyUCBoOXCoYRJpMgIgIIECJMkEAKwBCJ41OCMoFECJlpNaJZ0I/0BCKEACIsAn//AAX0yUQCIQAGFQ2QCJMACIuAlu2wASIAAkBJYPQBIsF0AHFhZgEARoA==")) \ No newline at end of file diff --git a/apps/factclock/app.js b/apps/factclock/app.js new file mode 100644 index 000000000..6ae457d4e --- /dev/null +++ b/apps/factclock/app.js @@ -0,0 +1,110 @@ +Graphics.prototype.setFontBebasNeue = function() { + // Actual height 31 (32 - 2) + // 1 BPP + return this.setFontCustom( + atob('AAAAAAAAAAAAAAAAAAAPgAAAAAD4AAAAAA+AAAAAAPgAAAAAD4AAAAAAAAAAAAAAgAAAAAA4AAAAAB+AAAAAD/gAAAAD/4AAAAH/4AAAAH/4AAAAP/wAAAAP/wAAAAf/gAAAAf/gAAAA//AAAAA/+AAAAAP+AAAAAD8AAAAAA8AAAAAAIAAAAAAAAAAAAAAAAAAAAAAf//8AAAf///wAAP///+AAH////wAD////+AA/////gAPgAAD4AD4AAA+AA+AAAPgAPgAAD4AD////+AAf////AAH////wAA////4AAH///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAADwAAAAAA8AAAAAAfAAAAAAHwAAAAAD////4AB////+AA/////gAP////4AD////+AA/////gAAAAAAAAAAAAAAAAAcAAHgAB/gA/4AA/4A/+AAf+Af/gAP/gP/4AD/wH/+AA+AD+PgAPgD+D4AD4B/A+AA+B/gPgAP//wD4AD//4A+AAf/8APgAD/8AD4AAf8AAeAAAAAAAAAAAAAAAAADgAfAAAH4AH8AAD+AB/wAB/gAf8AA/4AH/gAPwPgH4AD4D4A+AA+A+APgAPgPwD4AD8H+B+AA/////gAH////wAB//f/8AAP/j/+AAA/gf+AAAAAAAAAAAAAHgAAAAAP8AAAAAP/AAAAAP/wAAAAf/8AAAAf//AAAA//HwAAA/+B8AAA/+AfAAA/+AHwAAP////4AD////+AA/////gAP////4AD////+AAAAAHwAAAAAB8AAAAAAAAAAAAAAAAAAAAh4AAD//4fwAA//+H+AAP//h/wAD//4f+AA//+B/gAPgeAD4AD4PAA+AA+DwAPgAPh+AD4AD4f//+AA+D///gAPg///wAD4H//4AA8A//8AAAAAAAAAAAAAAAAAA///gAAB////AAA////4AAf////AAP////4AD////+AA+A8APgAPgfAD4AD4HwA+AA+B8APgAP8f//4AD/H//+AAfx///AAD8P//gAAfB//wAAAAB/AAAAAAAAAAAAAAAAAA8AAAAAAPgAAAAAD4AAACAA+AAAHgAPgAAf4AD4AA/+AA+AD//gAPgH//4AD4P//wAA+///gAAP//+AAAD//8AAAA//wAAAAP/AAAAAD+AAAAAAAAAAAAAAAAAAAAAH4D/gAAH/j/+AAD/9//wAB////8AA/////gAP9/4H4AD4D8A+AA+A+APgAPgPgD4AD4D8A+AA/////gAP////4AB////8AAP/3/+AAB/4f/AAAAAA+AAAAAAAAAAAAAAAAAAH/wHAAAH//B8AAH//4fwAB///H8AA///x/gAPwH8H4AD4AfA+AA+AHwPgAPgB4D4AD4A+B+AA/////gAH////wAB////8AAP///+AAA///+AAAAAAAAAAAAAAAAAAAAAAAAAAPgA+AAAD4APgAAA+AD4AAAPgA+AAAD4APgAAAAAAAAA'), + 46, + atob("CBIRDxEREhESERIRCA=="), + 44|65536 + ); +}; + +{ + // the font we're using + const factFont = "6x15"; + // swap every 10 minutes + const minsPerFact = 5; + // timeout used to update every minute + let drawTimeout; + // the fact we're going to display (pre-rendered with a border) + let factGfx; + // how long until the next fact? + let factCounter = minsPerFact; + // the gfx we use for the time so we can gat a shadow on it + let timeGfx = Graphics.createArrayBuffer(g.getWidth()>>1, 48, 2, {msb:true}); + timeGfx.transparent = 0; + timeGfx.palette = new Uint16Array([ + 0, g.toColor(g.theme.bg), 0, g.toColor(g.theme.fg) + ]); + + + let getNewFact = () => { + let fact = require("textsource").getRandomText(); + // wrap to fit the screen + let lines = g.setFont(factFont).wrapString(fact.txt, g.getWidth()-10); + let txt = lines.join("\n"); + // allocate a gfx for this + factGfx = Graphics.createArrayBuffer(g.getWidth(), g.stringMetrics(txt).height+4, 2, {msb:true}); + factGfx.transparent = 0; + factGfx.setFont(factFont).setFontAlign(0,-1).setColor(3).drawString(txt, factGfx.getWidth()/2, 2); + if (factGfx.filter) factGfx.filter([ // add shadow behind text + 0,1,1,1,0, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,0, + ], { w:5, h:5, div:1, max:1, filter:"max" }); + factGfx.palette = new Uint16Array([ + 0, g.toColor(g.theme.bg), 0, g.toColor(g.theme.fg) + ]); + }; + getNewFact(); + + // schedule a draw for the next minute + let queueDraw = function() { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); + }; + + let draw = function() { + // queue next draw in one minute + queueDraw(); + // new fact? + if (--factCounter < 0) { + factCounter = minsPerFact; + getNewFact(); + } + // Work out where to draw... + g.reset(); + require("clockbg").fillRect(Bangle.appRect); + // work out locale-friendly date/time + var date = new Date(); + var timeStr = require("locale").time(date,1); + var dateStr = require("locale").date(date,1); + // draw time to buffer + timeGfx.clear(1); + timeGfx.setFontAlign(0,-1).setFont("BebasNeue"); + timeGfx.drawString(timeStr,timeGfx.getWidth()/2,2); + timeGfx.setFontAlign(0,1).setFont("6x8"); + timeGfx.drawString(dateStr,timeGfx.getWidth()/2,timeGfx.getHeight()-2); + // add shadow to buffer and render + if (timeGfx.filter) timeGfx.filter([ // add shadow behind text + 0,1,1,1,0, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,0, + ], { w:5, h:5, div:1, max:1, filter:"max" }); + var y = (Bangle.appRect.y+g.getHeight()-(factGfx.getHeight()+timeGfx.getHeight()*2))>>1; + g.drawImage(timeGfx,0, y, {scale:2}); + // draw the fact + g.drawImage(factGfx,0, g.getHeight()-factGfx.getHeight()); + }; + + // Show launcher when middle button pressed + Bangle.setUI({mode:"clock", remove:function() { + // free any memory we allocated to allow fast loading + delete Graphics.prototype.setFontBebasNeue; + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + require('widget_utils').show(); // re-show widgets + }}); + // Load widgets + Bangle.loadWidgets(); + require("widget_utils").swipeOn(); + // draw immediately at first, queue update + draw(); +} \ No newline at end of file diff --git a/apps/factclock/icon.png b/apps/factclock/icon.png new file mode 100644 index 000000000..3186d0a96 Binary files /dev/null and b/apps/factclock/icon.png differ diff --git a/apps/factclock/metadata.json b/apps/factclock/metadata.json new file mode 100644 index 000000000..35b13f393 --- /dev/null +++ b/apps/factclock/metadata.json @@ -0,0 +1,17 @@ +{ "id": "factclock", + "name": "Fact Clock", + "shortName":"Facts", + "version":"0.01", + "description": "A clock that displays a random fact alongside the time", + "icon": "icon.png", + "screenshots": [{"url":"screenshot.png"}], + "type": "clock", + "tags": "clock", + "supports" : ["BANGLEJS2"], + "dependencies" : { "textsource":"module", "clockbg":"module" }, + "readme": "README.md", + "storage": [ + {"name":"factclock.app.js","url":"app.js"}, + {"name":"factclock.img","url":"app-icon.js","evaluate":true} + ] +} diff --git a/apps/factclock/screenshot.png b/apps/factclock/screenshot.png new file mode 100644 index 000000000..e52590491 Binary files /dev/null and b/apps/factclock/screenshot.png differ diff --git a/apps/ffcniftyb/settings.js b/apps/ffcniftyb/settings.js index da350edd8..8c3bb6e4d 100644 --- a/apps/ffcniftyb/settings.js +++ b/apps/ffcniftyb/settings.js @@ -28,4 +28,4 @@ }); E.showMenu(menu); -}); +}) diff --git a/apps/fileman/ChangeLog b/apps/fileman/ChangeLog index cc1456b31..ad2f4c4fe 100644 --- a/apps/fileman/ChangeLog +++ b/apps/fileman/ChangeLog @@ -1,4 +1,5 @@ 0.01: New app! 0.02: Improve handling of large amounts of files (fix #579) 0.03: Update RegExp use (Was using backreference instead of character code) +0.04: Add submenu to display free space and to allow quick navigation with many files diff --git a/apps/fileman/fileman.app.js b/apps/fileman/fileman.app.js index 5baae298b..bb0f00e40 100644 --- a/apps/fileman/fileman.app.js +++ b/apps/fileman/fileman.app.js @@ -15,7 +15,7 @@ function delete_file(fn) { } else STOR.erase(fn); } - }).then(function() { filed=[];files=get_pruned_file_list(); }).then(drawMenu); + }).then(function() { files=get_pruned_file_list(); }).then(drawMenu); } function get_length(fn) { @@ -65,6 +65,30 @@ function visit_file(fn) { E.showMenu(menu); } +function showFree() { + var free = (require("Storage").getFree() / (1024*1024)).toFixed(2) + " MB\n"; + E.showAlert(free).then( function() { drawMenu(); } ); +} + +function jumpTo(v) { + nstart = Math.round((v/100)*files.length); + if (nstart >= files.length) { nstart = 0; } + drawMenu(); +} + +function drawUtilMenu() { + var menu = { + '' : {'title' : "Utils"} + }; + menu['Show free'] = showFree; + for (let i=0; i<10; i++) { + let v = i*10; + menu['Jump to '+v+'%'] = function() { jumpTo(v); }; + } + menu['< Back'] = drawMenu; + E.showMenu(menu); +} + function drawMenu() { nend = (nstart+n0 ? files.length-n : 0; menu = {}; drawMenu(); - } - for (var i=nstart; i next"] = function() { if (nstart+n Right` and `Right > Left` are currently unsupported.) +- 12 different colors + +## Controls + +BTN to go to launcher. No other mappings. + +## Requests + +If you have a feature request or a bug, please message me at [sossinaydev@gmail.com](mailto:sossinaydev@gmail.com "Click to send an email"). + +## Creator + +Yanis Ocaña, sossinay +[pixelnet.ocaña.ch](https://pixelnet.ocaña.ch) + +## Known issues +- When loading the app in the first 2 seconds of a minute, the numbers fly in from a seemingly random position +- `Left > Right` and `Right > Left` are currently unsupported \ No newline at end of file diff --git a/apps/flux/app-icon.js b/apps/flux/app-icon.js new file mode 100644 index 000000000..c52f0f9be --- /dev/null +++ b/apps/flux/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwcBpMkyQCHzdt23bAQPTBYc0CIdN23QEwmaEA+TtMkyAREGRGSsEEJQsDpOkCJMJBAQRCEZRKBLIOgCJGTCIYICCJIjECK5ZFkwjcBwanDLMALCEbrjBCIdoCJE2XIO26dpX4W2CIRiBGpSSBEY1Nf4IAGCI9oCJBHHsARRghHGoARJMoQCDR4YICCINAgAjJhIICgECj/wIwwIBn4GDh/4CJPx/4AECJQjBCKEHCAf+BAQRIBCIjRCKBrR+O/8AGCv6PMUKIRjI6LFVCLwGELJYRabQIRPOYoACCI6SBCI+AFgwRSACA")) \ No newline at end of file diff --git a/apps/flux/app.js b/apps/flux/app.js new file mode 100644 index 000000000..f0ee77dd4 --- /dev/null +++ b/apps/flux/app.js @@ -0,0 +1,316 @@ +const font = { + "0": [ + [[0,0],[1,0]], + [[1,0],[1,1]], + [[1,1],[0,1]], + [[0,1],[0,0]] + ], + + "1": [ + [[1,0],[1,1]] + ], + + "2": [ + [[0,0],[1,0]], + [[1,0],[1,0.5]], + [[1,0.5],[0,0.5]], + [[0,0.5],[0,1]], + [[0,1],[1,1]] + ], + + "3": [ + [[0,0],[1,0]], + [[1,0],[1,1]], + [[0,0.5],[1,0.5]], + [[0,1],[1,1]] + ], + + "4": [ + [[0,0],[0,0.5]], + [[1,0],[1,1]], + [[0,0.5],[1,0.5]] + ], + + "5": [ + [[1,0],[0,0]], + [[0,0],[0,0.5]], + [[0,0.5],[1,0.5]], + [[1,0.5],[1,1]], + [[1,1],[0,1]] + ], + + "6": [ + [[1,0],[0,0]], + [[0,0],[0,1]], + [[0,1],[1,1]], + [[1,1],[1,0.5]], + [[1,0.5],[0,0.5]] + ], + + "7": [ + [[0,0],[1,0]], + [[1,0],[1,1]] + ], + + "8": [ + [[0,0],[1,0]], + [[1,0],[1,1]], + [[1,1],[0,1]], + [[0,1],[0,0]], + [[0,0.5],[1,0.5]] + ], + + "9": [ + [[0,0],[1,0]], + [[0,0],[0,0.5]], + [[0,0.5],[1,0.5]], + [[1,0],[1,1]] + ], + + "NaN": [ + [[],[]] + ] +}; + +const corner_base_positions = [ + [[10, 10], [78, 78]], // top-left (unchanged) + [[93, 10], [165, 78]], // top-right (x + 5) + [[10, 93], [78, 165]], // bottom-left (y + 5) + [[93, 93], [165, 165]] // bottom-right (x + 5, y + 5) +]; + +let corner_positions = []; +let previous_corner_positions = []; + +const padding = 10; +const width = 175; +const height = 175; + +const colors = { + "Black": [0,0,0], + "White": [1,1,1], + "Red": [1,0,0], + "Blue": [0,0,1], + "Green": [0,1,0], + "Yellow": [1,1,0], + "Orange": [1,0.6,0], + "Purple": [0.7,0,1], + "Lime": [0,1,0.5], + "Cyan": [0, 1, 1], + "Light Blue": [0,0.5,1], + "Pink": [1,0.5,1] +}; + +let bg_color = [0,0,0]; +let fg_color = [1,1,1]; +let bg_color_topo = [1,0,0.5]; +let fg_color_topo = [0,1,0.5]; + +function randomize_numbers(){ + previous_corner_positions = JSON.parse(JSON.stringify(corner_positions)); + corner_positions = JSON.parse(JSON.stringify(corner_base_positions)); + + if (!previous_corner_positions || previous_corner_positions.length === 0) { + previous_corner_positions = JSON.parse(JSON.stringify(corner_positions)); + } + + // Your offsets and modifications follow here as before + let x_offset = Math.floor(Math.random() * 61) - 30; + let left_y_offset = Math.floor(Math.random() * 61) - 30; + let right_y_offset = Math.floor(Math.random() * 61) - 30; + + [0,1,2,3].forEach(function(i) { + let min_x = corner_positions[i][0][0]; + let min_y = corner_positions[i][0][1]; + let max_x = corner_positions[i][1][0]; + let max_y = corner_positions[i][1][1]; + + if (min_x !== padding) { + min_x += x_offset; + } + if (max_x !== width - padding) { + max_x += x_offset; + } + + let yoff = (i % 2) > 0 ? right_y_offset : left_y_offset; + + if (min_y !== padding) { + min_y += yoff; + } + if (max_y !== height - padding) { + max_y += yoff; + } + + // Update corner_positions with new offsets + corner_positions[i][0][0] = min_x; + corner_positions[i][0][1] = max_x; + corner_positions[i][1][0] = min_y; + corner_positions[i][1][1] = max_y; + }); +} + +function drawThickLine(x1, y1, x2, y2, width, topoY) { + let half = Math.floor(width / 2); + + // Expand to thickness by offsetting both ends + if (x1 === x2) { + // Vertical line + x1 -= half; + x2 += half; + } else if (y1 === y2) { + // Horizontal line + y1 -= half; + y2 += half; + } else { + // Diagonal fallback + for (let i = -half; i <= half; i++) { + g.drawLine(x1 + i, y1, x2 + i, y2); + } + return; + } + + // Order the coordinates for fillRect + let left = Math.min(x1, x2); + let right = Math.max(x1, x2); + let top = Math.min(y1, y2); + let bottom = Math.max(y1, y2); + + // Split based on topoY (topographic height) + if (top < topoY && bottom > topoY) { + // Split into two regions + g.setColor(fg_color_topo[0], fg_color_topo[1], fg_color_topo[2]); + g.fillRect(left, top, right, topoY); + + g.setColor(fg_color[0], fg_color[1], fg_color[2]); + g.fillRect(left, topoY + 1, right, bottom); + } else if (bottom <= topoY) { + // Entire line is above topo + g.setColor(fg_color_topo[0], fg_color_topo[1], fg_color_topo[2]); + g.fillRect(left, top, right, bottom); + } else { + // Entire line is below topo + g.setColor(fg_color[0], fg_color[1], fg_color[2]); + g.fillRect(left, top, right, bottom); + } +} + + + + +function draw_numbers(transition_value, topo_position){ + //console.log(previous_corner_positions); + topo_position *= height; + let d = new Date(); + + let hour = d.getHours(); + let padded = ("0" + hour).slice(-2); + + let tl = padded[0]; + let tr = padded[1]; + + let min = d.getMinutes(); + padded = ("0" + min).slice(-2); + + + let bl = padded[0]; + let br = padded[1]; + + g.clear(); + g.setColor(bg_color_topo[0],bg_color_topo[1],bg_color_topo[2]); + g.fillRect(0,0,width,topo_position); + g.setColor(bg_color[0],bg_color[1],bg_color[2]); + g.fillRect(0,topo_position,width,height); + + [tl,tr,bl,br].forEach(function(corner, i) { + let path = font[corner]; + path.forEach(function(line){ + let pcp = previous_corner_positions[i].slice(); + let ccp = corner_positions[i].slice(); + + let x1 = (ccp[0][0] - pcp[0][0]) * transition_value + pcp[0][0]; + let x2 = (ccp[0][1] - pcp[0][1]) * transition_value + pcp[0][1]; + let y1 = (ccp[1][0] - pcp[1][0]) * transition_value + pcp[1][0]; + let y2 = (ccp[1][1] - pcp[1][1]) * transition_value + pcp[1][1]; + + + + let point_1 = [line[0][0]*(x2-x1) + x1, line[0][1]*(y2-y1) + y1]; + let point_2 = [line[1][0]*(x2-x1) + x1, line[1][1]*(y2-y1) + y1]; + + drawThickLine(point_1[0], point_1[1], point_2[0], point_2[1], 10, topo_position); + }); + }); +} + +let powersaver = false; +let update_timeout = null; + +let prev_min = -1; +function update_clock() { + let d = new Date(); + let min = d.getMinutes(); + + if (min != prev_min) { + randomize_numbers(); + prev_min = min; + } + + if (powersaver) { + if (direction == 1) { + draw_numbers(1, 2); + } + else if (direction == 0) { + draw_numbers(1, 0); + } + update_timeout = setTimeout(update_clock, 5000); + } + else { + let seconds = d.getSeconds() + d.getMilliseconds() / 1000; + if (direction == 1) { + draw_numbers(Math.min(seconds, 1) / 1, 1.00-(seconds/60)); + } + else if (direction == 0) { + draw_numbers(Math.min(seconds, 1) / 1, seconds / 60); + } + if (seconds < 1.5) { + update_timeout = setTimeout(update_clock, 50); + } else { + update_timeout = setTimeout(update_clock, 1000); + } + } +} + +let settings = require("Storage").readJSON("flux.settings.json", 1) || {}; +console.log(settings); +let direction = settings.direction || 0; +bg_color = colors[settings.bg || "Black"]; +fg_color = colors[settings.fg || "White"]; +bg_color_topo = colors[settings.bg2 || "Green"]; +fg_color_topo = colors[settings.fg2 || "Black"]; +if (direction == 1) { + let temp = bg_color; + bg_color = bg_color_topo; + bg_color_topo = temp; + + temp = fg_color; + fg_color = fg_color_topo; + fg_color_topo = temp; +} + + +update_clock(); + +Bangle.on('backlight', function(isOn) { + if (isOn) { + powersaver = false; + clearTimeout(update_timeout); + update_clock(); + } else { + powersaver = true; + let d = new Date(); + let seconds = d.getSeconds() + d.getMilliseconds() / 1000; + draw_numbers(Math.min(seconds, 1) / 1, 0); + } +}); + +Bangle.setUI("clock"); diff --git a/apps/flux/app.png b/apps/flux/app.png new file mode 100644 index 000000000..6821f409d Binary files /dev/null and b/apps/flux/app.png differ diff --git a/apps/flux/metadata.json b/apps/flux/metadata.json new file mode 100644 index 000000000..57925d20d --- /dev/null +++ b/apps/flux/metadata.json @@ -0,0 +1,42 @@ +{ + "id": "flux", + "name": "Flux Watchface", + "shortName": "Flux", + "version": "0.01", + "description": "A really simple imitation of Apples \"Flux\" Watchface, with different colors.", + "icon": "app.png", + "tags": "clock", + "type": "clock", + "supports": [ + "BANGLEJS2" + ], + "screenshots": [ + { + "url": "screenshot_1.png" + }, + { + "url": "screenshot_2.png" + } + ], + "readme": "README.md", + "storage": [ + { + "name": "flux.app.js", + "url": "app.js" + }, + { + "name": "flux.settings.js", + "url": "settings.js" + }, + { + "name": "flux.img", + "url": "app-icon.js", + "evaluate": true + } + ], + "data": [ + { + "name": "flux.settings.json" + } + ] +} \ No newline at end of file diff --git a/apps/flux/screenshot_1.png b/apps/flux/screenshot_1.png new file mode 100644 index 000000000..c58d27b11 Binary files /dev/null and b/apps/flux/screenshot_1.png differ diff --git a/apps/flux/screenshot_2.png b/apps/flux/screenshot_2.png new file mode 100644 index 000000000..02d7e1323 Binary files /dev/null and b/apps/flux/screenshot_2.png differ diff --git a/apps/flux/settings.js b/apps/flux/settings.js new file mode 100644 index 000000000..ec3cfd59b --- /dev/null +++ b/apps/flux/settings.js @@ -0,0 +1,83 @@ +(function(back) { + const FILE = "flux.settings.json"; + + // Color list shared across fields + const COLORS = [ + "White", "Black", "Red", "Blue", "Green", + "Yellow", "Orange", "Purple", "Lime", + "Cyan", "Pink", "Light Blue" + ]; + + const directions = [ + "Up > Down", + "Down > Up" + ]; + + function colorIndex(name) { + let i = COLORS.indexOf(name); + return i >= 0 ? i : 0; + } + + // Load existing settings with defaults + let settings = Object.assign({ + direction: 0, + bg: "Black", + fg: "White", + bg2: "Lime", + fg2: "Black" + }, require("Storage").readJSON(FILE, true) || {}); + + function writeSettings() { + require("Storage").writeJSON(FILE, settings); + } + + E.showMenu({ + "": { title: "Flux Watchface" }, + "< Back": back, + "Direction": { + value: settings.direction, + min: 0, max: 1, + format: i => directions[i], + onchange: i => { + settings.direction = i; + writeSettings(); + } + }, + "BG Color": { + value: colorIndex(settings.bg), + min: 0, max: COLORS.length - 1, + format: i => COLORS[i], + onchange: i => { + settings.bg = COLORS[i]; + writeSettings(); + } + }, + "FG Color": { + value: colorIndex(settings.fg), + min: 0, max: COLORS.length - 1, + format: i => COLORS[i], + onchange: i => { + settings.fg = COLORS[i]; + writeSettings(); + } + }, + "BG Highlight": { + value: colorIndex(settings.bg2), + min: 0, max: COLORS.length - 1, + format: i => COLORS[i], + onchange: i => { + settings.bg2 = COLORS[i]; + writeSettings(); + } + }, + "FG Highlight": { + value: colorIndex(settings.fg2), + min: 0, max: COLORS.length - 1, + format: i => COLORS[i], + onchange: i => { + settings.fg2 = COLORS[i]; + writeSettings(); + } + }, + }); +}) diff --git a/apps/folderlaunch/app.ts b/apps/folderlaunch/app.ts index aff8e5c7e..5140919db 100644 --- a/apps/folderlaunch/app.ts +++ b/apps/folderlaunch/app.ts @@ -174,7 +174,7 @@ * @param _button 1 for left half, 2 for right half * @param xy postion on screen */ - let onTouch = function (_button: number, xy: { x: number, y: number } | undefined) { + let onTouch = function (_button, xy) { // Determine which grid cell was tapped let x: number = Math.floor((xy!.x - 12) / ((g.getWidth() - 24) / config.display.rows)); if (x < 0) x = 0; @@ -206,7 +206,7 @@ break; } } - } + } satisfies TouchCallback; let page: number = 0; let nPages: number; // Set when setting folder diff --git a/apps/folderlaunch/settings.js b/apps/folderlaunch/settings.js index b589bb3f7..98720a1db 100644 --- a/apps/folderlaunch/settings.js +++ b/apps/folderlaunch/settings.js @@ -248,4 +248,4 @@ }); }; showMainMenu(); -}); +}) diff --git a/apps/followtherecipe/metadata.json b/apps/followtherecipe/metadata.json index 0c1de0817..59fabc8c5 100644 --- a/apps/followtherecipe/metadata.json +++ b/apps/followtherecipe/metadata.json @@ -6,7 +6,7 @@ "version": "0.02", "description": "Follow The Recipe (FTR) is a bangle.js app to follow a recipe step by step", "type": "app", - "tags": "tool, tools, cook", + "tags": "tool,tools,cook", "supports": [ "BANGLEJS2" ], diff --git a/apps/fontext/ChangeLog b/apps/fontext/ChangeLog index 1ba08319d..689986121 100644 --- a/apps/fontext/ChangeLog +++ b/apps/fontext/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! -0.02: Corrected formatting of punctuation \ No newline at end of file +0.02: Corrected formatting of punctuation +0.03: Extend range slightly to include Ukrainian fonts diff --git a/apps/fontext/font.pbf b/apps/fontext/font.pbf index 7abe4236d..05c46fcd0 100644 Binary files a/apps/fontext/font.pbf and b/apps/fontext/font.pbf differ diff --git a/apps/fontext/metadata.json b/apps/fontext/metadata.json index 7088fa3cc..c39da573a 100644 --- a/apps/fontext/metadata.json +++ b/apps/fontext/metadata.json @@ -1,6 +1,6 @@ { "id": "fontext", "name": "Fonts (150+ languages)", - "version":"0.02", + "version":"0.03", "description": "Installs a font containing 1000 Unifont characters, which should handle the majority of non-Chinese/Japanese/Korean languages (only 20kb)", "icon": "app.png", "tags": "font,fonts,language", diff --git a/apps/fwupdate/bootloader_espruino_2v25_banglejs2.hex b/apps/fwupdate/bootloader_espruino_2v25_banglejs2.hex new file mode 100644 index 000000000..7ee39eaf2 --- /dev/null +++ b/apps/fwupdate/bootloader_espruino_2v25_banglejs2.hex @@ -0,0 +1,1526 @@ +:02000002F0000C +:10700000F0FF032089730F00B1730F00B3730F00FB +:10701000B5730F00B7730F00B9730F0000000000C5 +:10702000000000000000000000000000FDC30F0091 +:10703000BD730F0000000000BF730F00C1730F008D +:10704000C3730F00C3730F00C3730F00C3730F002C +:10705000C3730F00C3730F00C3730F00C3730F001C +:10706000C3730F00C3730F00C3730F00C3730F000C +:10707000C3730F00C3730F00C3730F00C3730F00FC +:1070800011C40F00D1C10F00C3730F00C3730F00F1 +:10709000C3730F00C3730F006DC30F00C3730F00E2 +:1070A000C3730F00C3730F00C3730F00C3730F00CC +:1070B000C3730F00C3730F00000000000000000046 +:1070C000C3730F00C3730F00C3730F00C3730F00AC +:1070D000C3730F00C3730F00C3730F00C3730F009C +:1070E000C3730F00C3730F00C3730F0000000000D1 +:1070F00000000000C3730F0000000000C3730F0006 +:10710000000000000000000000000000000000007F +:10711000000000000000000000000000000000006F +:10712000000000000000000000000000000000005F +:10713000000000000000000000000000000000004F +:10714000000000000000000000000000000000003F +:10715000000000000000000000000000000000002F +:10716000000000000000000000000000000000001F +:10717000000000000000000000000000000000000F +:1071800000000000000000000000000000000000FF +:1071900000000000000000000000000000000000EF +:1071A00000000000000000000000000000000000DF +:1071B00000000000000000000000000000000000CF +:1071C00000000000000000000000000000000000BF +:1071D00000000000000000000000000000000000AF +:1071E000000000000000000000000000000000009F +:1071F000000000000000000000000000000000008F +:107200000348044B834202D0034B03B11847704735 +:10721000E0570020E0570020000000000548064B22 +:107220001B1AD90F01EBA301491002D0034B03B184 +:1072300018477047E0570020E0570020000000008A +:1072400010B5064C237843B9FFF7DAFF044B13B1AE +:107250000448AFF300800123237010BDF8570020CD +:1072600000000000B8CD0F0008B5054B1BB1054963 +:107270000548AFF30080BDE80840FFF7CFBF00BF6F +:1072800000000000FC570020B8CD0F00A3F5803AA5 +:10729000704700BF174B002B08BF134B9D46FFF7ED +:1072A000F5FF00218B460F461348144A121A00F0CE +:1072B00061F80E4B002B00D098470D4B002B00D0EF +:1072C00098470020002104000D000D48002802D03E +:1072D0000C48AFF3008000F029F82000290004F0EA +:1072E00053FC00F011F800BF00000800000000008F +:1072F00000000000F0FF0320F8570020707A002003 +:10730000000000000000000008B5064B044613B161 +:107310000021AFF30080044B1B6803B1984720465F +:1073200000F030F8000000001458002070B50D4D3A +:107330000D4C641BA4100026A64209D10B4D0C4C29 +:1073400005F00AFA641BA4100026A64205D170BD00 +:1073500055F8043B98470136EEE755F8043B98474B +:107360000136F2E7D8570020D8570020D857002020 +:10737000DC57002002440346934200D1704703F8D3 +:10738000011BF9E7FEE700BF0649074A074B9B1AB6 +:1073900003DD043BC858D050FBDC04F023FFFFF7AB +:1073A00079FF000054CE0F00B8570020F857002096 +:1073B000FEE7FEE7FEE7FEE7FEE7FEE7FEE7FEE7A5 +:1073C000FEE7FEE7012351B91F2886BF094A00F0F6 +:1073D0001F004FF0A0428340C2F80C3570471F28B1 +:1073E00086BF044A00F01F004FF0A0428340C2F85D +:1073F000083570470003005010B50446FFF7E2FF60 +:107400001F2C86BF04F01F04044B4FF0A04304F56B +:10741000E074032243F8242010BD00BF0003005095 +:1074200010B50B234B4303EBE003094C00F00700BE +:1074300001228240E05C0243E254064B1A688A4211 +:10744000C8BF1960044B1A688A42B8BF196010BDE2 +:10745000A8760020A4760020D457002030B507235A +:107460004FF0A0424FF080614FF00064C2F80C155D +:1074700000BF00BF00BF00BF40FA03F5ED074CBFDF +:10748000C2F80845C2F80C4500BF00BF00BF00BFEE +:10749000C2F8081500BF00BF00BF00BF013BE5D226 +:1074A00030BD00002DE9F84F284F294ED7F800A035 +:1074B000D6F80080C24547DC01210520FFF782FF96 +:1074C0000AFA01F202F10309224B0B22A9F102058B +:1074D00002FB0A3B9020FFF7C1FF2846FFF7BEFFE3 +:1074E0000024E11004F007001BF80110014111F025 +:1074F000010F0CBFFF2000200134FFF7AFFF582C15 +:10750000EFD101354D45E5D10AF1010AD04505F12C +:107510000209D9DA0020FFF7A1FFFFF79FFF01461C +:107520001B20FFF74FFF1A20FFF766FF0520FFF72C +:1075300049FF094B1978062081F001011970FFF706 +:1075400041FF00233C603360BDE8F88FA476002043 +:10755000D4570020A8760020A0760020BFF34F8FDC +:107560000549064BCA6802F4E0621343CB60BFF3DF +:107570004F8F00BFFDE700BF00ED00E00400FA05FB +:107580004FF0A043D3F810056FEA504000F001001F +:107590007047704708B5FFF7E1FF0000014B01227B +:1075A0001A707047C5740020024B800143F001033C +:1075B000184700BF90CD0F004FF0A0434FF400429A +:1075C00070B50144C3F80C254FF48036082400221E +:1075D000C3F80865D3F81055C3F80C65C5F34035FA +:1075E000013C45EA4202F3D100F8012B8142EDD182 +:1075F00070BDF0B501444FF0A0434FF400444FF488 +:10760000803510F8016B072246FA02F7FF074CBFDE +:10761000C3F80845C3F80C45013AC3F80855C3F848 +:107620000C55F1D28842ECD1F0BD38B54FF0A044F2 +:107630004FF48045C4F80C55FFF7DBFFC4F808553C +:1076400038BD37B54FF0A04405234FF480458DF881 +:1076500007300DF10700C4F80C550121FFF7C9FFF1 +:107660000DF107000121FFF7A7FFC4F808559DF8A9 +:10767000070003B030BD07B5AB230DF107000121B2 +:107680008DF80730FFF7D1FF322003B05DF804EB2F +:10769000FFF78ABFF7B501210E20FFF7ADFE0F20DF +:1076A000FFF7AAFE1020FFF7A7FE4FF0A0430C2221 +:1076B000C3F834276420FFF777FF6623012101A870 +:1076C0008DF80430FFF7B1FF9923012101A88DF84F +:1076D0000430FFF7AAFF3220FFF766FFFFF7CBFF6A +:1076E000FFF7C9FFFFF7C7FFFFF7C5FF0424062612 +:1076F00001274FF47A75FFF7A4FF83070AD401210D +:1077000001A88DF80460FFF790FF0A20FFF74CFFF7 +:10771000013DF0D10A20FFF747FF022101A8ADF893 +:107720000470FFF782FF0A20FFF73EFF013C05D1FE +:10773000054803B0BDE8F040FFF736BFFFF781FF13 +:1077400010F01C0FD5D1F3E7A0860100F7B5032395 +:107750008DF804304FF0A0460B0C49BAADF8061076 +:107760004FF48047042115468DF805300446C6F8CD +:107770000C750DEB0100FFF73CFF29462046FFF793 +:107780001BFFC6F8087503B0F0BD38B50D462022C2 +:10779000014604462846FFF7D9FF2B685A1C09D03A +:1077A00023F07F4320341819B0F1C14F8CBF002063 +:1077B000012038BD0020FCE70000000000000000B0 +:1077C000C3F10803DB0070B501330446002003A5B4 +:1077D0005B1920C940CAAD1920C4184720C940CA46 +:1077E000754120C420C940CA754120C420C940CA7F +:1077F000754120C420C940CA754120C420C940CA6F +:10780000754120C420C940CA754120C420C940CA5E +:10781000754120C4404170BD000000000000000020 +:10782000C3F10803DB0070B50133002403A500BFDA +:107830005B1920C940CAAD1B20C0184720C940CAE7 +:10784000B54120C020C940CAB54120C020C940CAA6 +:10785000B54120C020C940CAB54120C020C940CA96 +:10786000B54120C020C940CAB54120C020C940CA86 +:10787000B54120C06441B4FA84F0400970BD00BF36 +:107880002DE9F041013B00249B0025462646274672 +:107890005FF0000C03E05FEA070CBCEB030CB7EBF6 +:1078A0000C0E52F80E8051F80CE0AEFB08E814EB19 +:1078B0000E0455EB080556F100061CF1040C9C451E +:1078C00001DCBC45EBDDC4512C46354600260437AF +:1078D0009F42DDDDB7EB430FDDDDC451BDE8F08134 +:1078E00021EAE17292000021FFF744BD10B50023A8 +:1078F0001A465CB2A14203DCB2FA82F0400910BD24 +:1079000050F8234001332243F3E74A11012350F892 +:10791000220001F01F018B40184070474B1E10B52C +:107920005BB2041D1A0603D45A1E54F8221061B12A +:1079300001335BB25BB103F18042013A50F822207F +:10794000B2FA82F2C2EB431010BD1346EAE71846C2 +:10795000FAE710B500235CB2A24200DC10BD51F87A +:10796000234040F823400133F5E710B5013A52B205 +:10797000130601D5002010BD50F8224051F82230E6 +:107980009C4205D802F1FF32F2D24FF0FF30F2E70D +:107990000120F0E700EB81010023884200D370470B +:1079A00051F8042D43EA52030B60D307F5E770B595 +:1079B0009DF910601D4633460446FFF701FF30B9BC +:1079C000324621462846FFF7D0FF012807D033462C +:1079D0002A4621462046BDE87040FFF721BF70BD12 +:1079E00070B59DF910601D4633460446FFF718FF39 +:1079F00038B133462A4621462046BDE87040FFF79D +:107A0000DFBE70BD2DE9F04FA5B01D4604ABCDE93A +:107A100002310190294610461746FFF77FFFC0EB61 +:107A2000851424B2002C2646B8BF04F11F06634219 +:107A300046F3471603F01F0304F01F09314658BFF1 +:107A4000C3F1000914A8FFF74BFFB9F1000F4FEA8B +:107A500086062DDD14AB00221E44C9F1200C13460E +:107A60009D421AD814AB03EB850300936F1E24AB21 +:107A70004FEA45084FEA8509012603EB8707002CEA +:107A800053DA24AB03EB8606019856F8881C2A4685 +:107A9000FFF75FFF25B0BDE8F08F57F8230000FA2D +:107AA00009F10A4346F8042B013320FA0CF2D7E718 +:107AB00014AB2A4639469819FFF74BFFD2E75AF81C +:107AC000883C53F8202024AB03EB80030CF1010C1D +:107AD00053F8403C0B44D31A34BF4FF0010B4FF026 +:107AE000000B9A425EF8882C42F8203018BF5946A5 +:107AF0004FFA8CF04045E2DB731A5E42294614A827 +:107B00005E41FFF747FF09F190036B44009853F87B +:107B1000402C57F8403C294643EAC273013C47F8E1 +:107B2000403C24B2FFF736FFA9E724AB4FF0000C2E +:107B300086F0010E614603EB860A03EB8E0ED7E753 +:107B400030B51C4691B0054693F900306846FFF702 +:107B500097FE0146D4F8B0302846984711B030BDA2 +:107B600013460A46FFF7ECBF70B5036813F0010631 +:107B70000546144605D013460A460146FFF720FE87 +:107B8000064621462846FFF705FF46B104F180422C +:107B9000013A55F8223043F0004345F8223070BDD9 +:107BA000F0B50F46A1B006461946384615461C46A4 +:107BB000FFF79CFE28B1304621B0BDE8F040FFF74A +:107BC0008FBE224639466846FFF7C3FE294608A8FD +:107BD000FFF7BFFE214610A8FFF782FE01232146D2 +:107BE00018A81093FFF77CFE224608A96846FFF705 +:107BF000BCFE30B9224610A93046FFF7AAFE21B0DC +:107C0000F0BD009BDA0709D421466846FFF7C2FEA3 +:107C10002246294610A8FFF7A7FFE5E7089BDB07E8 +:107C200007D4214608A8FFF7B5FE2246294618A822 +:107C3000F1E7002823461CDD08AA69466846FFF7DD +:107C4000EFFD21466846FFF7A5FE224618A910A8B9 +:107C5000FFF78BFE002805DA10A923462A460846BE +:107C6000FFF7AEFD10A9234618AA0846FFF7D8FD76 +:107C7000CEE76A4608A8FFF7D3FD214608A8FFF71C +:107C800089FE224610A918A8FFF76FFE002805DA22 +:107C900018A923462A460846FFF792FD18A923464D +:107CA00010AA0846FFF7BCFDBFE72DE9F04793F99E +:107CB000006092B0044689461046314615461F467C +:107CC000FFF714FE002840F091803A4649460AA882 +:107CD000FFF746FF3B460AAA214602A8FFF730FFFE +:107CE0000AA908463A46FFF73BFF3B462A46494663 +:107CF0004846FFF725FF07F104083A46294628467B +:107D0000FFF72EFF43462A46214620460096FFF7FE +:107D10004EFE43462A46294628460096FFF747FE70 +:107D200043462A46214628460096FFF759FE3B4621 +:107D30002A4621462046FFF703FF434622462146B6 +:107D400028460096FFF733FE434600962A46214612 +:107D50002046FFF72CFE2368DB074AD53346424610 +:107D600021462046FFF72CFD314682462046FFF78C +:107D700011FE06F18043013B54F8232042EACA7207 +:107D800044F823203A4621462846FFF7E9FE4346B9 +:107D900002AA294628460096FFF722FE434602AA79 +:107DA000294628460096FFF71BFE02A908464346CF +:107DB0002A460096FFF714FE3B4602AA21462046BB +:107DC000FFF7BEFE0AAA4346104621460096FFF77B +:107DD00007FE324629462046FFF7BBFD49462846A6 +:107DE000FFF7B7FD0AA94846FFF7B3FD12B0BDE89B +:107DF000F08731462046FFF7CDFDC3E72DE9F0417E +:107E000015468AB004460E461C22002103A8FFF73F +:107E1000B1FA2F1D95F9008003232A4631462046EA +:107E20000293FFF79DFE3B4602AA21462046CDF86D +:107E30000080FFF7D5FD2B46324621462046FFF74E +:107E40007FFECDF800803B4605F1840221462046A6 +:107E5000FFF7ADFD0AB0BDE8F081F0B591B00D4679 +:107E60001C220021064609A8FFF784FA01241C22DF +:107E7000002101A80894FFF77DFA294608AA11F904 +:107E8000047B00943B461046FFF79AFC394608A84D +:107E9000FFF744FD441E24B2012C06DC3A46694635 +:107EA0003046FFF756FD11B0F0BD694668462A46D8 +:107EB000FFF756FE214608A8FFF727FD28B12B46FD +:107EC000324669466846FFF73BFE013CE3E70000A7 +:107ED00000487047E8CB0F00F0B5082289B0FFF7E3 +:107EE00038FDCB6A03930B6B04934B6B05938B6B41 +:107EF0000693CB6B07930C4606460027134669464C +:107F00006A466846CDE901770097FFF759FC0823D8 +:107F100005466A4631463046FFF752FC236B039311 +:107F2000636B0493A36B0593E36B0544CDE90637BC +:107F30006A46082369466846FFF742FC0823054461 +:107F40006A4631463046FFF73BFC236A0093636A7A +:107F50000193A36A0293A36B0693E36B0793054413 +:107F600008236A4631463046CDE904770397FFF788 +:107F700027FC636A0093A36AA26B0193E36A0293EE +:107F80000492636BE26B0393CDE90523236A0793A5 +:107F9000054408236A4631463046FFF711FCE36A80 +:107FA0000093236B0193636B0293236A0693A36A86 +:107FB0000793054408236A4631463046CDE90477E5 +:107FC0000397FFF72DFC236B0093636B0193A36B67 +:107FD0000293E36B0393636A0693E36A07932D1A94 +:107FE00008236A4631463046CDE90477FFF718FC8E +:107FF000636B0093A36B0193E36B0293236A039378 +:10800000636A0493A36ACDE90537236B07932D1A9E +:1080100008236A4631463046FFF702FCA36B009303 +:10802000E36BCDE90137636A0393A36A0493E36AC0 +:10803000CDE90537636B07932D1A08236A4631464D +:108040003046FFF7EDFB2D1A0D4C0FD435B9082241 +:1080500031462046FFF789FC01280FD0082322462D +:1080600031463046FFF7DCFB2D1AEFE708232246A6 +:1080700031463046FFF7A4FB2D18F7D409B0F0BD08 +:10808000ECCB0F00F0B5154689B01C4607460E46EE +:108090001A4629466846FFF763FD23466A46394675 +:1080A0003846FFF74DFD23462A4669466846FFF7E6 +:1080B00047FD23466A4631463046FFF741FD09B089 +:1080C000F0BD2DE9F0478AB01446DDF848A05546CA +:1080D0001F4615F9046B0096804689462B460246DA +:1080E000214602A8FFF77CFC02A952460846FFF78A +:1080F00037FD534602AA41464046FFF721FD53464D +:1081000002AA21462046FFF71BFD2B464A46394668 +:1081100038460096FFF764FC5246394602A8FFF73E +:108120001FFD02A92B46424608460096FFF758FC61 +:1081300002A92B46224608460096FFF751FC2B4623 +:108140004246214620460096FFF74AFC5346224607 +:1081500049464846FFF7F4FC2B4602AA4146204612 +:108160000096FFF73DFC5346224639463846FFF756 +:10817000E7FC2B464A46394638460096FFF730FC66 +:10818000324602A92046FFF7E4FB0AB0BDE8F087BB +:10819000F8B50E46D11C48BF911D144641F3870126 +:1081A0000546671EFFF79CFB002042B2A24200F189 +:1081B000010000DBF8BDBB1A23F00301B25C03F041 +:1081C0000303DB009A406B5813436B50EDE700004C +:1081D0002DE9F04FC9B008AA01F1400514464B78CB +:1081E0000E781B0443EA0663CE7833438E7804315D +:1081F00043EA06238D4244F8043BF0D11024916BEE +:1082000016464FEAF14383EA714383EA9123716A88 +:10821000366852F8045F31440B444FEAB54181EAB5 +:10822000F51181EAD50101340B44402CD363E6D12A +:10823000D0E914E30093836D0193C36D0293036E41 +:108240000393436E0493836E0593C36E0693DDE937 +:10825000057ADDE9031CDDE901592B4B009E0793EC +:1082600074464FF00008079A08AB52F804BB53F865 +:10827000283007924FEAF12282EAB1129B4482EA47 +:1082800071625A4427EA010301EA0C0B83EA0B03EB +:108290001A44524486EA05034FEA743A06EA050B8B +:1082A0008AEAB40A23408AEAB45A83EA0B0308F143 +:1082B00001085344B8F1400F02EB090B1344A946DF +:1082C000BA4619D173440365009B23444365019B5F +:1082D00033448365029B2B44C365039B5B44036665 +:1082E000049B0B444366059B63448366069B3B44A7 +:1082F000C36649B0BDE8F08F674635468C462646D2 +:1083000059461C46AFE700BFE8CA0F000E490F4AA6 +:10831000034630B500240025C3E91445C3E916120D +:108320000B4C0C4A0C4DC3E918420C4AC3E91A52D3 +:108330000B4A1A6702F17452A2F523020020A2F63A +:10834000924298645A6730BD67E6096A85AE67BB9A +:1083500072F36E3C3AF54FA57F520E518C68059B27 +:10836000ABD9831FF8B504460D4608302AB9AE18BC +:108370000027B54205D10020F8BD0029F7D10E2015 +:10838000FAE7A36C15F8011BE2180133402B1172B8 +:10839000A364EED10146FFF71BFFD4E9143213F5B5 +:1083A000007342F10002C4E91432A764E1E74068B7 +:1083B0004B6898428CBF00200120704730B53AB11D +:1083C0001368DB430A4D0144884204D1D84330BDD1 +:1083D0004FF0FF33F6E710F8012B5340082213F05B +:1083E000010418BF2C46013A84EA5303F7D1EBE7A6 +:1083F0002083B8ED50E8022FC2EA224240E802236F +:10840000002BF7D1704737B550E8013F9DB2C489C2 +:1084100025448489A54228BF2D1B0489A54202BF9B +:10842000BFF32F8F002207E0C5EA030540E801549F +:10843000002CE9D14FF001028DF803200193019A3D +:108440000A609DF8031001F0FF0321B1006810FAE3 +:1084500082F003B030BD1846FBE737B550E8023F65 +:108460001FFAA3F5C488A54202BFBFF32F8F0022D5 +:108470000DE0C48925448489A54228BF2D1BC3EA89 +:10848000054540E80254002CE8D14FF001028DF878 +:1084900003200193019A0A609DF8031001F0FF0385 +:1084A00021B1006800EB124003B030BD1846FBE775 +:1084B000014B436000207047DCCA0F00084670473C +:1084C00000207047024B1868003818BF0120704721 +:1084D000F86F002029DF704728DF704770B5066805 +:1084E000B36886B004460D4673B114220021684675 +:1084F000FEF740FFA36805932379019533B1012B63 +:108500000ED0B3686846984706B070BD01238DF859 +:10851000003023690293E368039363690493F0E7EF +:1085200002238DF80030E3681B030293F5E7000097 +:108530000D4B10B5012143600C4B53E8002F42EA6C +:10854000010043E8000494F0000FF6D14AB908494D +:1085500009781974074B08499A60C3E90012074A61 +:10856000DA60002010BD00BFDCCA0F00E46F0020FD +:10857000ED6D0020D06F0020F06D0020DC011C00AC +:108580000846704700207047024B187A003818BF21 +:1085900001207047E46F0020034B187A0122B0FAE3 +:1085A00080F05A7440097047E46F0020436843B17B +:1085B000026891680B4443605268934204BF0023F1 +:1085C000436070474FF08053D3F83021082A03BF2F +:1085D000D3F83401B0FA80F0400900207047000061 +:1085E0000A4B0222C3F80425BFF36F8FBFF34F8FEE +:1085F000C3F80805D3F80024002AFBD00022C3F8F2 +:108600000425BFF36F8FBFF34F8F704700E0014029 +:108610000F4B30B50124C3F80445BFF36F8FBFF390 +:108620004F8F01EB8202401A914207D10022C3F81A +:108630000425BFF36F8FBFF34F8F30BD441851F83F +:10864000045B2560D3F80044002CFBD0ECE700BFAE +:1086500000E0014010DF704711DF704713B50C4B8D +:108660000C4A00930C4B934208BF0023044601932D +:10867000019808B902B010BDD0E9003120469847F2 +:1086800018B16846FFF792FFF2E71120F2E700BF4A +:10869000D0CA0F0044CE0F003CCE0F0013B50A4BDA +:1086A0000A4A00930A4B934208BF002304460193F1 +:1086B000019B0BB902B010BD2046D3E900219047C1 +:1086C0006846FFF773FFF3E7C4CA0F002CCE0F0014 +:1086D00024CE0F0060DF704769DF704761DF7047AD +:1086E00070B5104A104C114EC6B0944208BF002419 +:1086F0004FF486750DF1020103A8ADF80250FFF7A3 +:10870000EDFF60B9CDE90164029B002BF2D003A814 +:10871000D3E90021904701A8FFF748FFF4E746B0EE +:1087200070BD00BF24CE0F001CCE0F00A8CA0F00E2 +:10873000024B1B780BB1FFF7D3BF7047DF6D0020F2 +:108740004BDF704730B50D4A0D4C0E4D85B094424D +:1087500008BF002401A8FFF7F3FF60B9CDE9025478 +:10876000039B002BF6D00198D3E90021904702A883 +:10877000FFF71CFFF4E705B030BD00BF4CCE0F0083 +:1087800044CE0F009CCA0F00013A024401398242D4 +:1087900000D2704711F8013F02F80139F7E70023D2 +:1087A000C0E90232C0E900118B781A44026191F9E4 +:1087B00003301A4442610878003818BF012070471E +:1087C00010B542681178034641B102F10C014160D5 +:1087D000117B29B9C2680168FFF7E1FF002010BDD5 +:1087E0005078117900F03004302C1BD1547B04F008 +:1087F0003004302C1ED190781969091A19610021B2 +:10880000507810F0300F02BF986801309860907B6C +:10881000084419690144196192F90F201144596102 +:108820000120DCE700F0F004202C03D1507910FB8C +:1088300001F1E5E700F0C000802808BF0421DFE770 +:1088400043681A44426011B101399A4201D10120B2 +:10885000704713F8010B01F8010FF6E730B5044635 +:1088600085B01546A9B90268114B9A4211D0102D56 +:1088700006D82A4669462046FFF7F0FF05B030BD0E +:10888000102269462046FFF7E9FF0028F6D0103D88 +:10889000EDE7A368AB4201D20020EFE723682A4648 +:1088A000204698470028F7D0A3685B1BA360E5E744 +:1088B00041880F0010B5836804460BB9002010BD35 +:1088C0000368012298470028F8D0A368013BA36001 +:1088D000F5E72DE9F3410F460DF107018046FFF75B +:1088E000E9FF054620B90025284602B0BDE8F08121 +:1088F0009DF907309DF80740002B13DA04F07F0440 +:1089000007260DF107014046FFF7D4FF0028EAD003 +:108910009DF8072002F07F03B3401C43130606F1C5 +:10892000070601D43C60DFE7232EEAD1DBE72DE91F +:10893000F341002506460F46A8462C460DF10701D7 +:108940003046FFF7B7FFC0B19DF807C0A4F1200380 +:108950000CF07F02C4F1200102FA03F322FA01F1C4 +:108960000B43A2401CF0800F45EA020543EA0808C9 +:1089700004F1070404D1C7E9005802B0BDE8F08152 +:10898000462CDBD10020F8E713B50446052921D891 +:10899000DFE801F0030F1720201E012201A9204665 +:1089A000FFF75CFF18B19DF90430002BF5DB02B036 +:1089B00010BD08220021204602B0BDE81040FFF79C +:1089C0004DBF01A9FFF785FF0028F0D0019AF1E71C +:1089D0000422EFE70020EAE773B50D4601A904463B +:1089E000FFF777FF064618B90026304602B070BD83 +:1089F00094E80F0085E80F0001998A42F4D3A9603A +:108A0000A3685B1AA360F0E737B50D4669461446C4 +:108A1000FFF78DFF30B12B79082BDDE9001203D170 +:108A2000C4E9001203B030BD022B4FEAE1700FD051 +:108A3000042B03D0012B0FD00020F3E721600B465D +:108A40000246824208BF8B420CBF01200020E9E7AA +:108A50000BB22380DA17F4E74BB22370FAE737B58D +:108A60000D4669461446FFF762FFA8B12B79013B1A +:108A7000072B20D8DFE803F01A161F121F1F1F0450 +:108A8000DDE90032C4E90032DDE90001914208BFAE +:108A900098420CBF0120002003B030BD009B236032 +:108AA0000022F1E7009B23809BB2F9E7009B237033 +:108AB00003F0FF03F4E70020EEE773B50E466946C6 +:108AC0001546FFF734FFA8B1DDE900245308D207AB +:108AD000327943EAC47302F1FF324FEA540444BFCF +:108AE000DB43E443072A05D8DFE802F01814040A40 +:108AF00004040407002002B070BDC5E90034FAE7A1 +:108B00002B601A46D917A14208BF9A420CBF012018 +:108B10000020F0E71AB22A80D117F4E75AB22A707F +:108B2000FAE713B5144604220DEB0201FFF796FE97 +:108B300008B1019B236002B010BD13B5144669460D +:108B40000822FFF78BFE18B1DDE90023C4E90023FA +:108B500002B010BD73B50D4601A906461446FFF7D5 +:108B6000B8FEA8B1019AFF2A12D86B7803F0C003AF +:108B7000802B02F101010BD02B798B4208D32146C7 +:108B8000304601F8012B02B0BDE87040FFF766BE29 +:108B9000002002B070BD2DE9F3410F4601A98046C7 +:108BA0001646FFF796FEA0B1019C621C4FF000052F +:108BB00004D27B7803F0C003802B01D1284608E063 +:108BC0003B799342FAD3224631464046FFF746FEB0 +:108BD000355502B0BDE8F0816CDF70476DDF70473E +:108BE00072DF704773DF704774DF704775DF70475F +:108BF00076DF70477ADF70477CDF70477DDF704734 +:108C00007FDF704786DF70478FDF704790DF7047E8 +:108C1000A8DF7047AADF7047ADDF7047AEDF70474F +:108C2000B0DF7047B1DF7047B5DF704762DF704774 +:108C300066DF704713DF704770B518228CB00021D3 +:108C40000DEB0200FEF796FB2823089316231F4C1A +:108C5000ADF806300023CDF80E30CDF81230ADF867 +:108C60001630022309260622237023715923012579 +:108C7000A27063710322FE230DF10601A0198DF885 +:108C800018508DF82D500294ADF80C606570E270AC +:108C9000A371FFF7B3FFB8B9BDF8063026725A19B1 +:108CA000E271BDF80C200A4C134402A906AA204622 +:108CB000ADF80C30FFF794FF30B92078FFF794FF40 +:108CC00020782946FFF78EFF0CB070BDC06D0020E4 +:108CD000BC57002038B1054B0360054B43600123AE +:108CE0000372002070470E20704700BF558D0F00A3 +:108CF000F58C0F0069B10B78022B0CD1022804D03F +:108D0000032814BF08201120704703230B70002094 +:108D100070470E2070470820704743690BB1C06848 +:108D20001847704737B50546044804680093E4685F +:108D300013460A462946A04703B030BDE05700203D +:108D400018DF7047014B06201B6818476C70002025 +:108D500029DF704770B504460D4601B30B78012B2F +:108D600006D01ED9033B012B94BF0820112070BDF3 +:108D70000D4ED6F89C3190B1013312D1002218214A +:108D80000430FFF71BFB07222060214606F5CE705A +:108D9000FFF7DEFF0028EAD102232B70E7E70E2061 +:108DA000E5E70820E3E700BF00F00F004FF4405371 +:108DB000054A5968914203BF986800F6FF706FF347 +:108DC0000B004FF480507047DBE5B15108B5FFF759 +:108DD000EDFF044B9B69184400F6FF706FF30B0026 +:108DE00008BD00BFC87400205B689A68054B9A42B2 +:108DF00007D1D0E90123044901320A60034A013B4B +:108E000013607047D0C90F00B4690020B06900201A +:108E100041DF704700B10047704700000A4AD2F8AE +:108E200000347BB109480023D2F80815D940C9079E +:108E300048BF03F5C07103F1010348BF42F82100A8 +:108E4000072BF1D1704700BF000001403546526E3C +:108E5000024B1B780BB1FFF7E1BF70474069002060 +:108E600010B5064C014622681AB11046FFF79FFA6A +:108E700010B90A60216010BD1446F4E7C4680020F0 +:108E800038B50E4B1B780446ABB1A0B1037D93B14E +:108E9000D0E903309847A3685BB1227D02F0FF055B +:108EA0003AB16268134463602046FFF7D9FF284651 +:108EB00038BD002323750025F9E700BF1C70002092 +:108EC0002DE9F0430368D3F8042185B00546002A54 +:108ED00074D12B68D3F840216AB10026C3F84061F1 +:108EE000D3F84031754C0293029B23681BB1206874 +:108EF000FFF7C6FF26607248704E724C03A9FFF759 +:108F0000ACFA00287DD1DFF8BC816C4CD8F8003079 +:108F1000002B00F0CC805A6823685B68216861B13F +:108F20002168002900F0C0809A4280F0BD8023684B +:108F30001B7D13B12068FFF793FFD8F8007017B1BD +:108F40003B68C8F80030DFF88C917E68D9F80030B3 +:108F50004FF48032C3F80823C3F848230022C3F833 +:108F60004021D3F84021039226F07F46039AD3F89C +:108F70004025C3F84065D3F80435D31A23F07F4366 +:108F8000012B05D1504B4FF4046043F00103984787 +:108F9000D9F800204FF48033C2F84433D2F80435B6 +:108FA000F61A310226F07F4372D543F07F4313F562 +:108FB0007A7F6FDD3846FFF763FFA7E70022C3F82B +:108FC0000421D3F804313D4A0193019B13682BB16E +:108FD00013685B68126823F07F435360394B1C6849 +:108FE000002C3FF476AF6368B3F1807F04D2204653 +:108FF000FFF746FF2468F3E7636823F07F4363606D +:10900000F8E70378012B2DD0022B07D1002223682B +:10901000002B39D0196821601A75F8E7A3B94368A5 +:109020001A7D8AB901221A75436829685A68D1F8ED +:109030000415521A25498A4282BF5A6822F07F429B +:109040005A604068FFF70CFFBDF80C20BDF80E30E9 +:109050009A4202D11A48FFF7CDF903A91848FFF741 +:10906000FCF94EE7336842689A4204BF002333603C +:1090700023682146002BE7D09A4202D113680B6087 +:10908000E2E719461B68F5E7114B01221A70DBE78E +:10909000022B8FDD4FF48033C2F80433236813B9F9 +:1090A0002B6801221A60276005B0BDE8F0832368B1 +:1090B000002BF9D12B6801225A60F5E718700020C7 +:1090C00008700020C468002090CD0F0017FCFF003E +:1090D0001C700020C45700202DE9F041134D0646B6 +:1090E0001C462846124B6B600F469046FFF70EF960 +:1090F00080B9104B2B60B6B12FB923681F2B0BD84A +:1091000048F2145006E03A4631462846FFF72AF95D +:109110000028F2D0BDE8F081224641460348BDE870 +:10912000F04100F0D1BE48F21050F3E7906B002000 +:1091300048CA0F006E5246482DE9F04FC24EC34B4D +:1091400032689A42ADF5137D044640F0D2817368CF +:109150005A79202A40F0D0819B68DFF8FC9298472A +:109160007668BB4996F805A0A24528BFA2460546E9 +:1091700052460AA8FFF708FBB64C767921463246DC +:1091800062A8FFF701FBA11932463044FFF7FCFA51 +:10919000B5F9023095F9004013F11F0648BF03F1FD +:1091A0003E0646F3471606F1FF3B52AF2AAA0023BC +:1091B00042F82B3047F82B3092AA95F9018002EB48 +:1091C0008B02494642F8E03C72A84246FEF7E0FFB7 +:1091D000A300049372AB03EB84031846424609EBE9 +:1091E00008010593FEF7D4FF424662A93846FEF710 +:1091F000CFFF424662AB99185AA8FEF7C9FF214635 +:109200003846FEF773FB20B95AA8FEF76FFB80467D +:1092100030B148F2425840460DF5137DBDE8F08F5D +:1092200005F124033246394618460393FEF79DFBA9 +:109230000128EED1039832465AA9FEF796FB012881 +:10924000E7D112AF039A334622A8FEF7A9FC47F8EC +:109250002B80B5F9023013F11F0B48BF03F13E0B11 +:10926000DA1D48BF03F10E02D21052454FEA6B1BC4 +:1092700028BF52464FFA8BFA914651463846FEF7C0 +:109280002FFB0AA94A463846FEF782FFB5F90210BD +:10929000B1EBC90F4FEAC90315D25B1A07EB8B0B71 +:1092A0004FF0000CC3F120005F45C0F0C18003986F +:1092B00052463946FEF759FB012804D0039A53461B +:1092C0003846FEF7ADFA0DF5027A39465046334678 +:1092D00022AAFEF7D5FA51463846039A3346FEF7DE +:1092E00091FB5046334622AA52A9FEF7C9FA3346EB +:1092F0005146039A1AA8FEF785FB2246504672A9EA +:10930000FEF727FB049B05990AEB030B5846FEF773 +:1093100020FB05F1440319463AA89946FEF719FBCC +:10932000049B42A809EB0301FEF713FB2B1D5146DA +:109330003AAA22A800940593FEF752FB5B465246D8 +:1093400042A93AA80095FEF7BCFE22A9084623468A +:109350002A1DFEF725FC22AA594650462B46FEF749 +:1093600091FE0023CDE90639314672AB3846CDE98E +:10937000083AFEF7D3FA314681461AA8FEF7CEFA2C +:109380008145B8BF81461FFA89F909F1FF3A0FFA02 +:109390008AFA51463846FEF7B8FA514607461AA8E7 +:1093A000FEF7B3FA031E18BF0123381E18BF0120B1 +:1093B00040EA43000DF1180B0DF1A80A5BF82010EC +:1093C00022465046FEF7C5FA049B32A81944FEF720 +:1093D000C0FA214622A8FEF783FA01232293A9F1BD +:1093E00002090FFA89F9B9F1000F37DA22A9084604 +:1093F000059A2346FEF7D4FB2B4622AA32A95046F3 +:10940000FEF740FE039832465146FEF7AEFA0128B9 +:1094100004D0039A33465046FEF702FA013C64B288 +:1094200052AA23065CD5B8F1000F3FF4F4AEF0E683 +:109430005BF8041D21FA03F242EA0C02CBF800208B +:1094400001FA00FC30E700BF207000207052464D4A +:1094500008690020C8680020287000202B4622AA36 +:10946000D5F8A47032A95046B847494612A8FEF76D +:109470004CFA494607461AA8FEF747FA031E18BFDA +:109480000123381E18BF012040EA430006AB53F801 +:10949000201011B322463AA8FEF75BFA049B42A8BB +:1094A0001944FEF756FA01462B4622AA3AA8FEF7BF +:1094B000E9FD059B00943AAA51464AA8FEF790FAA6 +:1094C00032AB524642A93AA80095FEF7FAFD22A90E +:1094D0002B464AAA0846FEF733FB09F1FF3980E71D +:1094E0005AF8243052F824104B4048EA0308013C53 +:1094F00097E748F240588EE648F211588BE600BFD5 +:1095000030B40546044803681C690A46A446294647 +:10951000002330BC604700BFE057002070B5EFF378 +:10952000108672B60C4A9468012384B993600B4B81 +:109530000B4DD3F8801029401160C3F88050D3F848 +:10954000841051604FF0FF32C3F88420234603702B +:1095500006B962B670BD00BFE06D002000E100E01A +:10956000FC06FFBD10B5064B002253E8001F01EAC0 +:10957000020043E8000494F0000FF6D110BD00BFD4 +:10958000F86F002008B5FFF7EDFF002008BD0000D0 +:109590002DE9F0431D4687B0144B80460F46164612 +:1095A0004FF0010953E8004F44EA090243E8002163 +:1095B00091F0000FF6D1BCB9AA0831463846FFF742 +:1095C00027F8FFF7CFFFD8F808304BB10E9A8DF887 +:1095D0000090CDE90147CDE90365059268469847BB +:1095E000204607B0BDE8F0831124F9E7F86F0020AA +:1095F0002DE9F04115461F4686B0164B80460E46B3 +:10960000012253E8004F44EA020143E8001090F0C1 +:10961000000FF6D1E4B921468D4213D1FFF7A2FF26 +:10962000D8F8083053B102228DF800200022CDE98D +:109630000126CDE90325059768469847204606B0E0 +:10964000BDE8F08106EB0130FEF7CAFF0131E3E728 +:109650001124F3E7F86F0020F8B5094E094CA41B5C +:109660000746E40800250436A54200D1F8BD56F8A7 +:109670003530384698470028F8D10135F4E700BF67 +:10968000F4CD0F00FCCD0F00062810B5044602D122 +:109690000020FFF7E1FF044B1B681BB12046BDE82B +:1096A0001040184710BD00BF787000207FB5002320 +:1096B000CDF80B308DF80F300A4BADF806109B89B2 +:1096C000ADF8083001238DF80A300DF10603CDE91D +:1096D0000430054B02A91888FFF7A0FA07B05DF81F +:1096E00004FB00BFA06D0020BA57002010B504464F +:1096F00086B01122002101A8FDF73CFE2378082B3B +:109700000BD1364A364913880988013B9BB2138036 +:10971000D1B1CBB9032311802370627823788DF8FF +:1097200005306021012A8DF804108DF806200DD037 +:109730000B2A11D12B4B00211A788DF807201970B4 +:10974000042101A8FFF7B2FF06B010BD062B05D01B +:10975000082B29D0032B27D00321F2E7E1688DF8ED +:109760000710D4E90123080A8DF80800080C090E37 +:109770008DF80A10110A8DF80B208DF80C10110CC1 +:10978000120E8DF80E201A0A8DF80F308DF8102069 +:109790001A0C1B0E8DF80D108DF809008DF8112094 +:1097A0008DF812300F21CCE7D4E90123110A8DF88E +:1097B00007208DF80810110C120E8DF80A201A0AD5 +:1097C0008DF80B308DF80C201A0C1B0E8DF809103B +:1097D0008DF80D208DF80E300B21B2E7BE6D002004 +:1097E000BC6D002069700020914209D150E8012F22 +:1097F000C2EA024240E80123002BF7D10120704762 +:109800000020704710B5084B9A685AB150B9EFF371 +:10981000108172B6054A1C6814605C6854609860D8 +:1098200001B962B610BD00BFE06D002000E100E0AC +:1098300037B51C4D012300202B70FEF70FFF1128B8 +:1098400028D00020FEF72AFF0DF10700FFF766FE83 +:1098500015491648FEF7FEFE154B0446B0FA80F097 +:10986000400918709DF80700FFF7CCFF9CB911491B +:109870002C7091F8162313235209D340DB0706D42A +:109880000D4B9A6852B11A6842F480021A600120A6 +:10989000FEF704FF0024204603B030BD4FF48003E0 +:1098A0000B60F4E7EC6D002093750F00B4CA0F0055 +:1098B000ED6D002000E100E0E06D002037B5174DB0 +:1098C00001202870FEF7CAFE11281CD00220FEF7E6 +:1098D000E5FE0DF10700FFF721FEFEF7BDFE104B80 +:1098E000044600229DF807001A70FFF78BFF5CB951 +:1098F0000C4B2C709A6852B11A6822F480021A60DC +:109900000320FEF7CBFE0024204603B030BD064BFB +:109910004FF48002C3F88020F2E700BFEC6D002016 +:10992000ED6D0020E06D002000E100E038B5174942 +:109930000B68024613F0010025D01548824221D061 +:10994000144A10884FF6FF72904216D043F0040379 +:109950000B601321FFF74CF9A8B90F4DC82445F04F +:1099600001054FF47A40A847013CFAD10B4B1B7814 +:1099700053B1BDE83840FFF7A1BF094B1878FFF796 +:1099800033F9F3E7002038BD0820FCE7B46D002070 +:10999000F4CD0F00BA57002090CD0F00ED6D0020E0 +:1099A000BC57002038B52A4C237A002B4ED0022B0E +:1099B00009D1032833D0274B00221B68E2601A79B3 +:1099C00042B1012A25D0637C002B31D1BDE838405B +:1099D00000F050B8D3E905128D1A142D94BF521916 +:1099E00014329A619142EED102284FF0000308BF71 +:1099F00019462372174B18BF0D211868FEF76EFD2C +:109A0000154B1A885B889A42DDD11448FEF7F2FCA8 +:109A1000D9E71A6901321A615B699A42E3E7E368A0 +:109A20000133082B01D8E360CDE70023E360DBE7D7 +:109A30000B4B1B7853B10B4B1B781BB1BDE8384067 +:109A4000FFF73CBFBDE83840FFF7F2BE38BD00BFAE +:109A5000E46F0020E06F0020CC6F0020D06F00206A +:109A6000EC6D0020ED6D0020831E012B01D8FFF767 +:109A700099BF704738B5244C244D237A3BB924490B +:109A80002448FEF7EAFC286008B9606038BD02236C +:109A900023722B681A7992B1012A26D028680321F3 +:109AA000FEF71CFD002323726360194B1A885B8844 +:109AB0009A42EBD1BDE838401648FEF79BBCD3E98B +:109AC0000520121A142AD3E9031328BF142292087E +:109AD000012A014438BF01221844FEF7FBFC50B1B3 +:109AE0001128DBD101232372D0E7D3E90303184403 +:109AF000FEF7F2FCF3E7237C002BC7D1BDE838402A +:109B00000220FFF74FBF00BFE46F0020E06F00208E +:109B1000CC6F0020D06F002010B40A4B012253E814 +:109B2000001F41EA020043E8000494F0000FF6D160 +:109B300029B95B7B1BB95DF8044BFFF79BBF5DF850 +:109B4000044B7047E86F002000F0FD03012B08D1A3 +:109B5000044B00225A74421E504250411874FFF7C1 +:109B600089BF7047E46F002013B504460DF107006C +:109B7000FFF7D4FC074A9DF807001368591C1160D1 +:109B8000054AA41AE4091C7002B0BDE81040FFF7B2 +:109B900039BE00BFBC68002018580020FFF7E4BFA2 +:109BA00037B505460C460F4801A9FEF72CFCB0B1AD +:109BB00005704460BDF80620BDF804100948FFF7A1 +:109BC00013FE60B1084B93F9043001215A0903F0E8 +:109BD0001F03994002F14003044A42F8231003B0E6 +:109BE00030BD00BF08700020C457002000E100E035 +:109BF000084B99420DD8084B02611B68D3F8043515 +:109C00000B444360836803B1816001460020FFF785 +:109C1000C7BF704717FCFF00C457002008B5FDF709 +:109C2000AFFC0B4A60B910600A4B0B4AC3F8002620 +:109C3000BDE808400948002240F6CD41FFF7D8BFF3 +:109C4000136801330A2B1360EEDDFDF787FC00BFBC +:109C50009C760020000001403546526E847600203C +:109C6000F8B50E4641490B780546174613BB4FF031 +:109C70008043D3F81824D00337D53D4B3D4A1A60B2 +:109C80003D4C3E480022C3E901223D4ADA60637937 +:109C90003C4A42F823003C4800EBC3031B795BB30A +:109CA0003A4A3B4BD360002090603A4AD36001238C +:109CB00093600B7000242C7529460120FFF770FF7C +:109CC000002E51D04FF4004C21464FF4FA704FF45F +:109CD0007A720023E6FB0C0102F0C6FB3A4601460D +:109CE0002846BDE8F840FFF783BF01229A60D3F809 +:109CF0001824D203FBD5C0E72268C2F8083594F9CE +:109D00000430002B27DA244A03F00F0C62444FF092 +:109D1000E00C82F818C003F01F025B099B0003F1FE +:109D200060434FF0010C03F561430CFA02F2C3F8F3 +:109D300080211A60637900EBC30240F83340236846 +:109D400082F804C00222C3F84423C3F80423134B4F +:109D500083F800C0A4E703F1604202F561424FF0CE +:109D6000E00C82F800C3D6E7F8BD00BF9C69002074 +:109D70000870002044690020C4570020C18E0F00E5 +:109D80005800080004700020FC6F00207C70002048 +:109D9000158E0F0028690020FCEC00E01C700020EC +:109DA000042810B5044608D802280BD8094B1B68B4 +:109DB0007BB12046BDE810401847831F012BF5D822 +:109DC000FDF7CCFB044A054847F23051FFF748FF46 +:109DD000ECE710BD8076002095750F007C700020A8 +:109DE00070B5134DD5F80034EBB1D5F80445114BDF +:109DF000640904EB440449F63F46B4428CBF002298 +:109E000001221A70FFF70AF8B44203D9D5F80C35CD +:109E1000DB0704D5084A0948A108FFF721FF084BD2 +:109E20004FF480321A60074B01221A7070BD00BFD8 +:109E30000000014040690020518E0F002869002079 +:109E400000E100E0C474002008B54FF472720948C4 +:109E50000021FDF78FFA084A02231360074A1360B6 +:109E6000074B00221A60074B57221A60BDE80840D2 +:109E7000FDF718BBA8760020D0570020CC57002053 +:109E8000A4760020D457002008B500210520FDF756 +:109E9000B3FA01211A20FDF7AFFA1B20FDF7ACFA47 +:109EA0000720FDF7A9FA0620FDF7A6FA044B05489E +:109EB0000B439847FFF7C8FFBDE80840FFF7C4BF52 +:109EC00090CD0F0000C409002DE9F04113681F2B4D +:109ED00004460D4616465ED900295FD0876CC3192B +:109EE0008022372F00F108081A7207F1090040D8C4 +:109EF000C7F1370200212044FDF73CFAD4E91423CE +:109F00000821E7FB0123C4E9142312BA626423FA8F +:109F100001F284F8433084F842201A0C1B0E84F8B6 +:109F20004030414684F841204046FEF751F9691E11 +:109F30000023626FDA4001F8012F226FDA400A71C4 +:109F4000E26EDA400A72A26EDA400A73626EDA409A +:109F50000A74226EDA400A75E26DDA400A76A26D62 +:109F6000DA400833202B0A77E3D133600020BDE8C4 +:109F7000F0817B1C402BC7F13F024FF0000188BFEE +:109F800000222044FDF7F6F941464046FEF720F94D +:109F900038220021B0E748F21450E8E70E20E6E747 +:109FA00007B5142200211148FDF7E4F9104B53E8DE +:109FB000021FD888B1EB314F4FF0000217BF89B2B2 +:109FC00040EA004041EA004004E05968B1EB314FFB +:109FD00008BF012243E802010029E8D18DF80720DB +:109FE0009DF80730002003B05DF804FBE46F00200B +:109FF000D06F00202DE9F34180460F46114801A99A +:10A0000016461D46FEF7FFF90446C0B1182200218E +:10A010000430FDF7AFF9089BBDF80620BDF8041029 +:10A02000A360C4E903670748C4F800806561FFF7CF +:10A03000DBFBFFF771FD002002B0BDE8F0810420DA +:10A04000FAE700BFD06F00202DE9F34180460D46AE +:10A05000114801A916461F46FEF7D5F90446C8B1B6 +:10A06000172200210530FDF785F92D0B0123BDF8DE +:10A070000620BDF8041023710748C4F80080A760CB +:10A08000E5606661FFF7B0FBFFF746FD002002B018 +:10A09000BDE8F0810420FAE7D06F0020034A0023D6 +:10A0A000C0E9003383601363704700BFC8740020A9 +:10A0B0002DE9F04FDFF8F880DFF8F89085B0461E04 +:10A0C00016F8013F13B905B0BDE8F08F2E2BD8F874 +:10A0D0000040D9F8005053D02B2B53D0602B01D91E +:10A0E000203BDBB2303B5E2B2CD8052293FBF2F2F7 +:10A0F00002EB82029A1A294F9B1A07EB43076B1D4A +:10A100000193631C0293A31C02EB420B29460393A9 +:10A1100037F8023B43FA0BFA1AF0040F02D020463C +:10A12000FDF77EF91AF0020F02D00298FDF778F9D8 +:10A130001AF0010F02D00398FDF772F9019B01316B +:10A140009942E5D133780A2B1ED1AB1D532BC9F8A8 +:10A150000030B5DD12494FF45C72A1F1580002F0F5 +:10A1600065F958220F480021FDF704F90E4B002233 +:10A170001A600E4B023D5722C9F800501A609FE743 +:10A180005C23AFE74023ADE70D2B0BBF0223043464 +:10A19000C8F80030C8F8004092E700BF28CD0F0093 +:10A1A00000770020187A0020A4760020D4570020E1 +:10A1B000D0570020CC5700201FB547F630020023AF +:10A1C000CDE901230DF10501CDF80B301C2220FA59 +:10A1D00002F303F00F042346092C94BF30333733C6 +:10A1E000043A01F8013F131DF1D101A8FFF760FF08 +:10A1F00004B010BD08B5FFF75BFF0348FFF758FF39 +:10A20000BDE80840FDF74EB970C70F0008B5072834 +:10A210001CD8DFE800F0041517191B131B130C489A +:10A220000C4BC3600022012340F6CD418360FFF751 +:10A23000DFFC0948BDE80840FFF7DCBF0748F9E745 +:10A240000748F7E70748F5E70748F3E708BD00BF09 +:10A25000847600201D9C0F0073C70F0087C70F0076 +:10A2600090C70F008DC70F001BC90F002DE9F04FDD +:10A27000ADF5157D10220146044608A8FDF766FAE3 +:10A28000089F7A1C4DD0099E002E4AD0B048FFF797 +:10A29000B1FF3846FFF790FFAE48FFF7ABFF3046FF +:10A2A000FFF78AFFAC48FFF7A5FFDDF828B0584656 +:10A2B000FFF782FFA948FFF79DFF0B98FFF77CFF90 +:10A2C000A748FFF797FFB7F5772F2AD2BB19B3F549 +:10A2D000772F019325D8A34804F1100AFFF78AFFCE +:10A2E000354653464FF00008002DCDF814801CDC95 +:10A2F000C34537D09C48FFF77DFF9C48FFF77AFFA6 +:10A300004046FFF759FF9A48FFF774FF9848FFF758 +:10A3100071FF0023974A984998485493549B93425D +:10A320001ADD0DF5157DBDE8F08FB5F5807FA946E6 +:10A3300028BF4FF4807919464A4614A80093FDF7C8 +:10A3400005FA05AA494614A8FEF738F8009B80468E +:10A350004B44A5EB0905C7E7C1F80006549B013340 +:10A360005493DBE78648FFF745FF8648FFF742FF37 +:10A370003D465146B346BBF5807FD94628BF4FF4D2 +:10A38000807954A84A460091FDF7E0F9009954A855 +:10A3900009EB050C2B7810F8012B93426DD07A480D +:10A3A00000930292FFF784FE2846FFF705FF7048EE +:10A3B000FFF720FF029A1046FFF7FEFE7348FFF7F3 +:10A3C00077FE009B1846FFF7F7FE6948FFF712FF7C +:10A3D00000256F48FFF70EFF062301210CA88DF81A +:10A3E00030301C3CFDF721F900230693069BB3F5A2 +:10A3F0007A7F4CDB02238DF830300021230C1C22A5 +:10A4000064BA0DA88DF83130ADF83240FCF7B2FFD8 +:10A4100020210CA8FDF709F9FDF713F9C307FBD4B8 +:10A42000002D40F08D805B48FFF7E4FE5A48FFF7AF +:10A43000E1FE72B6594CDFF844914F483346022290 +:10A440000021002B26DC3D465146B346BBF1000FF0 +:10A450003ADC5348FFF7CEFE002307AA31463846C0 +:10A460000793FDF7ABFF444B07904045C3F80096B8 +:10A4700061D04C48FFF7BEFEDFE70135654589D165 +:10A48000BBEB090B49447FF476AF0125A1E7069B9E +:10A490000133AAE7019DC4F80425ED1AD4F800C4DD +:10A4A000BCF1000FFAD0C4F80855D4F80054002DC0 +:10A4B000FBD0C4F80415D4F80054002DFBD0A3F54C +:10A4C0008053C0F80096BCE7BBF5807F5A4654A87D +:10A4D00028BF4FF48072CDE90212FDF737F9039AD5 +:10A4E000029954A82B4600904FF0010E5519C4F85C +:10A4F00004E5D4F800C4BCF1000FFAD0009850F87D +:10A5000004CB0090C3F800C0D4F800C4BCF1000F25 +:10A51000FAD00020C4F80405D4F800C4BCF1000F40 +:10A52000FAD004339D42E2D1134B1144ABEB020B42 +:10A53000C3F800968AE71248FFF75CFEFDF70EF8B5 +:10A5400019480DF5157DBDE8F04FFFF753BE00BF6C +:10A5500098C70F00A5C70F00ABC70F00B1C70F000A +:10A56000B6C70F00BFC70F00CBC70F00D8C70F007B +:10A5700072C70F003F4B4C00000001403546526E41 +:10A58000E5C70F00ECC70F00F7C70F0000C80F00AA +:10A5900004C80F0013C80F0027C80F0000E00140D7 +:10A5A00033C80F003DC80F004DC80F0008B5104656 +:10A5B0001A4601F03BFF002008BD08B510461A46B8 +:10A5C00001F034FF002008BD70B54268527802F0F7 +:10A5D0000F01082986B003461ED103691C680026B6 +:10A5E0000CB906B070BD23686568267399682A4661 +:10A5F0006846FEF7D4F804F10C0305934B780495F4 +:10A6000003F0C003802B08BF231D684608BF0493D6 +:10A61000FFF7DAFFA468E3E73F2A28D802F0300109 +:10A62000102911D14269002111705A6818695378B4 +:10A63000946803F00F03072B0CD10146204606B0A7 +:10A64000BDE8704000F01FB89106EED543690022C6 +:10A650001A70C6E71279214624B106B0BDE87040F1 +:10A6600001F0E4BE06B0BDE87040FCF783BE02F026 +:10A67000C0018029B5D1006900210160920644BF64 +:10A680005B691970ADE77FB50A4601466846FEF77B +:10A6900086F830B16846FFF797FF6846FEF790F8F6 +:10A6A000F7E707B05DF804FB2DE9F043D2F804C0EA +:10A6B0009CF8013013F0C00E89B006460C461546D2 +:10A6C00004D0BEF1400F6BD0002445E003F00F0230 +:10A6D000604903F03003202B51F8227023D007D8B3 +:10A6E000DBB92A6961463B4609B0BDE8F04318472B +:10A6F000302BE9D16B699CF800101970072A0AD138 +:10A700006B6828691A797146FCF734FE6B68296911 +:10A710009868FFF7B8FF2A693FE06B6901221A7059 +:10A720002A696968DFE7022CD5F8148027D1042A4A +:10A7300025D804A9FEF750F904460028C4D0069B8A +:10A740002BB1696898F800304A799A4208D8059B7D +:10A750007360069B002BB7D1204609B0BDE8F0839B +:10A7600008792A6900FB032204A8B84728B198F8A1 +:10A770000030013388F80030E1E70446E7E798F855 +:10A7800000309CF805209A429ED92A699CF8041052 +:10A79000581C88F8000001FB032269683046A2E7D4 +:10A7A000D2F81080474657F8043B23B909B0BDE8FA +:10A7B000F043FEF7E9B8022914D104A9FEF70CF919 +:10A7C000002881D0D8F8003069683A4604A8984734 +:10A7D000044600283FF478AF069B002BF2D1059B7E +:10A7E0007360B9E7012925D005292BD000297FF412 +:10A7F0006BAF0DF1040901340B2C3FF465AF01225E +:10A8000049463046FEF72AF800283FF45DAF19F9B3 +:10A81000013B002BEFDB104B049301ABCDE905347A +:10A8200000230793D8F8003069683A4604A898478F +:10A83000044691E7082201A9FEF710F80824002831 +:10A84000E9D141E704220DEB0201FEF707F80424E9 +:10A85000F5E700BF78CA0F0041880F002DE9F047E7 +:10A860008EB00446002702A8CDE90077FDF797FFD8 +:10A87000A3683BB108A92046FEF72BF840BBA368AC +:10A88000002B52D1DDE9033402A85D78FDF798FF73 +:10A890000028F7D115F0300F03D1039B1B7803B1CB +:10A8A0000134002C6CD0630969460022934261D1C7 +:10A8B0000EAA02EB830304F01F0453F8383CC4F1E2 +:10A8C00020044FF0FF30E040C31A584258412DE0B9 +:10A8D000089D002DD6D0039E4FEAD50805F0070548 +:10A8E000039B1A78904504D15B7803F00F02082A85 +:10A8F00064D102A8FDF764FF039B9E42F0D1474557 +:10A900000DD8039A537803F00F03082B3AD002A80E +:10A91000FDF756FF039B9E42F3D14FF0FF372946C8 +:10A920002046FEF731F80028A2D100200EB0BDE885 +:10A93000F08799680B7898453ED1D6F804A008A80E +:10A940005246FDF72CFF06F10C030D934B78CDF822 +:10A9500030A003F0C003802B04BF331D0C930123F0 +:10A96000337308AA29462046FFF79EFE22E0994548 +:10A97000D5D07DE751F8040B0130D6D1013295E7EF +:10A980000120D3E717784745C9D8069BD4F808902B +:10A990001E68A368002EEAD099457FF469AF33683A +:10A9A000D3F800A0BAF1000FC3D02B46424631467F +:10A9B0002046D0470028B8D0B668EAE713F0300F39 +:10A9C0000FD1049A3F2A0CD851090EAB03EB810139 +:10A9D00002F01F020123934051F8382C134341F831 +:10A9E000383CE66826B102AB2A4641462046B047CD +:10A9F00002AA29462046FFF757FE94E7F0B585B036 +:10AA00008F680E46694605461446FDF7E5FF88B196 +:10AA1000B06878B1737803F03003202B03D121465E +:10AA20003846FFF730FE224639466846FFF716FFE4 +:10AA3000019B6B6005B0F0BD70B50E4B0E4C9A6B70 +:10AA40000E4E0F4D0F4921605C33C4E901320E4BAD +:10AA50000E4AE360002313600D4A31462846136016 +:10AA6000FFF711FE324629462046BDE87040FFF749 +:10AA7000F5BE00BFC8740020A0690020086C00204B +:10AA8000ACC90F0041880F00E98D0F00B4690020A8 +:10AA9000B06900202DE9F3477C4ED6E90E329A4288 +:10AAA00040F0EE80DFF8208298F8003053B1FEF7D6 +:10AAB0008DF9774B726A1860764B1A60012002B0EC +:10AAC000BDE8F087FFF7B8FF28B1734B93F89C50AF +:10AAD0001DB91A780AB90520F1E7DFF8B491DFF85B +:10AAE000B4A10022C9F80020CAF800204DB16B4D76 +:10AAF00093F83871A5F199042023019325B9132007 +:10AB0000DDE7674C2F46F7E70FBB66496648674AA3 +:10AB10000968006801ABFEF7DFFAB0B92B78402B6B +:10AB200013D1634A6B1C413553F8041B42F8041BD4 +:10AB3000AB42F9D10198FEF7FFFA05460028CAD1C9 +:10AB400094F858302BB90F20B9E70A20B7E7162040 +:10AB5000B5E794F859100329F5D894F87130032B10 +:10AB600040F09080237B002BEDD02369342B40F004 +:10AB70008B804FF44052237D50684E4A904235D12D +:10AB800083B1A26972B14FF44052908904F114026A +:10AB900052F804CF84451BD00137FFB2BB42F7D136 +:10ABA00012208CE791B9012B12D9A26982B94FF416 +:10ABB000405204F1140097890A4650F804CFBC456E +:10ABC00006D00132D2B29342F7D1E9E70129E7D0AA +:10ABD00023799BB10129A36894BFB268F2689A42B5 +:10ABE0008CBF0023012393B9102068E713B1A36938 +:10ABF000002BD5D12379002BEAD1D1E70129A2D1AD +:10AC000088F8001094F85A3053B3E56D28E001231A +:10AC100088F8003011BB94F868300BB3E56E002D56 +:10AC200091D0CAF80050FEF7D1F8234C201A854283 +:10AC300007D9FEF7BBF8241AA5421DD81F48FFF715 +:10AC40002DFA002201231E48C6E90423FFF726FA45 +:10AC50007562FEF7BBF8C9F800002FE7C807D1D42A +:10AC60008907DCD594F86030002BD8D0154B626E84 +:10AC7000C3F57E239A4201D9042020E71544CEE78C +:10AC800008201CE714201AE7112018E7C8740020D8 +:10AC90007470002070700020086C0020416D00204E +:10ACA0000C6C0020B0690020B46900200869002005 +:10ACB000C8680020DBE5B15100400F00E0740020BF +:10ACC000EC74002000700F00687000202DE9F04740 +:10ACD000A64E3368DA0790B000F14681A44BA54A2E +:10ACE0001860A54B136020231168481C10600B707E +:10ACF000013BDBB2FF2BF7D10023CDE90A331371FF +:10AD000004930C9309A802230993FEF719F804464B +:10AD100040B99A48FDF78EFF044618B9984B1B7846 +:10AD200023B10824204610B0BDE8F087FEF780FD6F +:10AD300004460028F6D10125CDE90900914A0B907F +:10AD4000062309A920200492ADF828308DF824505C +:10AD50008DF82650FDF7C0FC4FF48173049A0B94D4 +:10AD600009A94020CDE90944ADF826308DF82550D9 +:10AD7000FDF7B2FC8323049A0B9409A92320CDE9A3 +:10AD80000944ADF826308DF82450FDF7A5FC049A4F +:10AD90000B9409A92846CDE909448DF82450FDF704 +:10ADA0009BFC4FF4B063049A099309A9A120CDE953 +:10ADB0000A44FDF791FC049A0B9409A9A020CDE95F +:10ADC0000944FDF789FC04A8FDF784FC044600282B +:10ADD000A8D16D4B024618216C481D70FDF7EEFAA4 +:10ADE0006B4AD2F89C31984212D16A4C02F5CE736C +:10ADF00002F5DA7218685968254603C5083393428C +:10AE00002C46F7D118682860336843F0020333609A +:10AE1000112309A88DF81030FDF7E0FE0446002844 +:10AE200080D19DF8253009A801338DF82530FDF734 +:10AE3000D3FE044600287FF475AF33689B074BBFF1 +:10AE4000544955498A69072248BF043192B204A87F +:10AE5000FDF7D2FE044600287FF464AF4F48FDF7AB +:10AE6000C9FE044600287FF45DAF4D4BDFF8388102 +:10AE70004FF6FF724FF001091A8002A94FF659638D +:10AE8000424648468DF80A90ADF80830FDF7C0FEFE +:10AE9000044600287FF446AF424808F10201FDF75E +:10AEA000C5FE044600287FF43DAF01461C2209A8D8 +:10AEB000FCF760FA9DF82430089443F004038DF801 +:10AEC00024300223ADF80C3098F802308DF80E30A3 +:10AED00003238DF806308023CDE90644ADF81C30FD +:10AEE00043464FF4885A33F8040BADF804A003AF7F +:10AEF00001AD04AA09A904970595FDF78BFE044648 +:10AF000000287FF40FAF01461C2209A8FCF732FA93 +:10AF100018238DF8243098F802308DF80E30132362 +:10AF20008DF806301723CDE90644ADF81C304346B2 +:10AF300004AA33F80C0B089409A9CDE90475ADF8FF +:10AF40000C90ADF804A0FDF765FE044600287FF4E0 +:10AF5000E9AEFDF771FE044600287FF4E3AE3368E6 +:10AF600043EA09033360DDE60024DBE6B46D00202C +:10AF7000B86D0020BC6800209868002000700F00A9 +:10AF8000ED6D0020B8570020DF6D0020A0F10F000C +:10AF900000F00F00846D00205DC80F0070CA0F0024 +:10AFA000BA57002060CA0F00A06D002070B5244B76 +:10AFB0004FF0FF324FF00051C3F88020C3F88021DA +:10AFC000C3F88420C3F884214FF4805388B00B6009 +:10AFD000EFF30580D3E90014002383F3148883F38F +:10AFE000108883F3118883F31388C0F3080028B90D +:10AFF00081F308889646204708B070BDCDE900333C +:10B00000CDE90233CDE904324FF080730793A1F10B +:10B01000200306946D461C4608AE2A4603CAB24277 +:10B0200020606160154604F10804F6D183F30888B6 +:10B030004FF0FF339E466FF006031847DCE700BF72 +:10B0400000E100E073B506460DF107000D46FEF77E +:10B0500065FA224B224A2348197800881478E3B213 +:10B06000844238BF0133C9B234BFDBB200239942F6 +:10B070002CD014781178CBB2884286BF0133DBB272 +:10B080000023E4B213709DF80700FEF7BBFB4FF6F8 +:10B09000FF739C421FD0144B1B6843F8345003EBE2 +:10B0A000C402B6B1114B1988114B1B68304604FB22 +:10B0B000013306F1180150F8044B43F8044B884261 +:10B0C000F9D118239380002002B070BD4FF6FF74B1 +:10B0D000D9E79680F7E70420F6E700BF98700020D4 +:10B0E0009970002094700020A070002096700020BD +:10B0F0009C70002070B50388232B8AB0044635D895 +:10B100000F2B04D8012B00F006810AB070BD103B54 +:10B11000132BFAD801A252F823F000BF9DB10F0003 +:10B12000BBB10F000BB10F00C1B20F0011B40F0083 +:10B130000BB10F000BB10F000BB10F000BB10F00E3 +:10B140000BB10F0023B40F000BB10F000BB10F00B8 +:10B150000BB10F000BB10F00E5B20F000BB10F00E8 +:10B16000EFB20F000BB10F00B1B20F00503B9AB21B +:10B17000062ACAD8062BC8D801A252F823F000BF6D +:10B18000E1B10F0027B30F0023B40F000BB10F0084 +:10B190000BB10F0077B20F00FFB20F00A54D8388EF +:10B1A0002B80A54B1B680BB101209847A349288829 +:10B1B0000AB0BDE87040FDF719BD9E4B4FF6FF7217 +:10B1C0001A809F4B1B68590701D4FDF735FD9A4B38 +:10B1D0001B68002B99D002200AB0BDE870401847C8 +:10B1E000984EE288B3889A428FD104A8FEF796F968 +:10B1F000954A964B1168994233D9481E106011F850 +:10B20000011C934D213305EBC1151B1A1179DBB2DB +:10B21000994200D213719DF81000FEF7F3FA002D49 +:10B220003FF473AF228A04F11201284601F0FEF8C0 +:10B230001822002104A8FCF79DF808238DF810308F +:10B24000844B0693844B0596CDE90735238AADF8E8 +:10B250002430824B1B88172B05D82846FEF784FC28 +:10B2600053E70025D7E77E4904A8FFF7EBFE002847 +:10B270003FF44BAFF1E7E188822917D8CB1E9A073C +:10B280000DD0CB1F9BB2013B5A4202F0030203F0E8 +:10B29000030301F1FF3158BF5342C91A89B2654B0C +:10B2A00018880AB0BDE87040FDF7BEBC8321F6E700 +:10B2B000002204A98088CDE90422FDF7A7FC24E739 +:10B2C0005C4C0223049304AA02AB2088059342F647 +:10B2D0000521FDF7A1FC002320881A468521FDF7F2 +:10B2E0008FFC12E7534B00F10801188860E7002338 +:10B2F00004A98088ADF81030FDF786FC05E7A37936 +:10B30000002B7FF402AF4B4B188813210AB0BDE825 +:10B310007040FDF76DBC474B188800210AB0BDE8AE +:10B320007040FDF785BCA379002B3FF4EEAE022BF5 +:10B330007FF4EBAE434D2189AA8991427FF4E5AEBB +:10B34000A27B012A7FF4E1AE4FF480320592228A7B +:10B35000384EADF81820628AADF81A2004F11402B4 +:10B36000049307920293298A308801AB02AA0393BF +:10B37000FDF752FC60B9BDF804303088DB0707D414 +:10B3800040F2FD1304A9ADF81430FDF749FCBCE60A +:10B39000002304A93088ADF81430FDF741FC0146C4 +:10B3A00000287FF4B2AE182204A8FBF7E3FF237D48 +:10B3B000284A8DF81030022B0595069221D0062BD5 +:10B3C0000FD0012B10D0069B002B3FF49EAE234BD9 +:10B3D0001B88172B7FF699AE214904A8FFF732FE90 +:10B3E00093E6637D0893EEE71E48FEF735F91E4BA2 +:10B3F0001A881E4B1A80637D0893D4F8163009937F +:10B40000E1E7194AB4F815301380184A1380DAE7D7 +:10B41000002380881A4619460AB0BDE87040FDF73F +:10B42000F1BB0023A0881A4619460AB0BDE8704057 +:10B43000FDF7F8BBBA570020B86D002070CA0F00A6 +:10B44000B46D0020A06D0020BC680020986800202A +:10B4500018580020ED960F009D9B0F00967000205D +:10B4600001B80F00F4CD0F00BC6D0020BE6D0020B0 +:10B4700038B5154D154904464FF4DC72284600F0E6 +:10B48000E3FF18B904B1A047002006E00F480121EE +:10B49000FEF736F8024608B1032038BD5821281DB2 +:10B4A000FCF78CFF4FF4DC7228602946084800F056 +:10B4B000BDFF0749054823464FF4DC72FDF732FC17 +:10B4C0000028E1D0E8E700BFC874002000F00F00BA +:10B4D000B869002081422DE9F74F04460F46154612 +:10B4E00004D10023184603B0BDE8F08F1F4B1B7832 +:10B4F0000E1A02F6FF78360B4FEA18380BB9FEF732 +:10B500006FFC082E28BF08263303DFF864B00193D0 +:10B51000002DE6D046452CBFC246B24651462046D5 +:10B5200034BFDDF80490A946FDF7EAFF0346002882 +:10B53000D8D109F1030222F0030239462046FDF773 +:10B54000F1FB03460028CDD1DBF830304B44CBF87B +:10B550003030FFF78DFFA8EB0A08A5EB09054C4436 +:10B560004F4403460028D3D0BCE700BFC47400207A +:10B57000C874002008B5104B996C01F50052506852 +:10B580000E4A904213D1D3E90C02904212D0121A03 +:10B5900002F6FF7201446FF30B0200F58050FFF7D3 +:10B5A00099FF034620B9BDE80840FFF761BF0323B8 +:10B5B000184608BD0023FBE7C8740020DBE5B15145 +:10B5C00030B5114B1148DA6A5C6A9D6CAC2A02BF37 +:10B5D0005B6BED18E41A85B02246294600F034FF73 +:10B5E00080B10B4BD3F800340BB1FDF717FC1022E0 +:10B5F00000216846FBF7BEFEA40868460195029448 +:10B60000FDF79EFB05B030BDC874002000700F0030 +:10B61000000001402DE9F047684D694C88B00746AD +:10B620000026641B1423B4FBF3F4A64211D11822A4 +:10B63000002102A8FBF79EFE0423624C8DF808301F +:10B64000614BD3F80090236D4B4517D001250024A2 +:10B650005DE02B6813B901361435E6E7DB6928464F +:10B6600098470028F7D0594B1B88172B59D95849B0 +:10B67000384608B0BDE8F047FFF7E4BC554BD3F8B7 +:10B680000080554B93F89C2003F10805A433002A51 +:10B6900018BF1D464FF0200A504ACDF804A001AB58 +:10B6A00049464046FDF718FD064620B117254C488F +:10B6B000FEF7F4FC13E04948524605F16F0100F033 +:10B6C000C3FE0028F2D195F855306BBB01222362EE +:10B6D0006B68E262A360A36CC4E909930125202290 +:10B6E00000214048FBF746FEF4223F48FF21FBF7CC +:10B6F00041FE0A2D4FF00003236388BF3B4BC4F883 +:10B70000488088BF0C223A4C84BF1A700B25D7E9B9 +:10B7100001138DF8095002A8984714B12046FFF78D +:10B72000A7FE08B0BDE8F08703F00201DB073FD5B4 +:10B7300008F50052DFF8C4C05068AB6D60453AD1DF +:10B7400003F5FF5C03F6FF73C3F30B030CF11F0C4F +:10B75000ACEB030C936863452DD34FF4405CDCF8ED +:10B760000430834213D19CF80030142B82BFDCF8E4 +:10B7700014302048B3FBF0F3107898BF002314284E +:10B7800082BF56691B4AB6FBF2F6B3420CD091B1A8 +:10B790001948FEF783FCAC23E362AB6D63630029B9 +:10B7A00099D06B68E36096E70029F4D1A523F3E70D +:10B7B000AA23E362F3E7052579E700BFE0570020FD +:10B7C000F4570020C874002070700020967000208C +:10B7D00015B60F0074700020086C0020706B0020FC +:10B7E000EC74002000750020247500206970002092 +:10B7F000458D0F0040420F00E0740020DBE5B151A1 +:10B800002DE9F041044686B0162200210DF1020018 +:10B81000FBF7B0FD25788DF8005001238DF801303D +:10B820000C2D00F2AA81DFE815F0660074001F00FD +:10B8300074007400A80174006B00740069000D00AE +:10B840002C006F004FF08053D3F800210192D3F801 +:10B8500004210292D3F80C2192020492D3F8102111 +:10B86000920203921B690593D4E901136846984735 +:10B870009DF80130012B00F074819B4B05201B6863 +:10B880006EE14FF44053994D58682A6A98498842AE +:10B890000CBF02230123012A227C08BF013352B9C5 +:10B8A00002238DF80430EB680293924B0393C3F5A7 +:10B8B0007E230493D8E7012A10D188420ED14FF499 +:10B8C00040531A78142A8CBF5B69002302934FF40B +:10B8D000805303934FF440539B68EAE79A4209D29E +:10B8E00001238DF80430AB680293FDF75FFAAB6972 +:10B8F0000390DEE7FF238DF80430B5E7237CFAE7F9 +:10B90000238AADF80430AFE7774B07201B689847D0 +:10B91000AAE7062D784B01D0012D01D122691A70BA +:10B920001E78012E04D0022E7CD000221A70C1E0B5 +:10B930006B1E072B98D801A252F823F05DB90F00B7 +:10B9400069B80F0019BA0F00E3B90F0069B80F000A +:10B9500013BA0F0069B80F0093B90F00624B0320B0 +:10B960001B689847676987B1B7F5807F0FD85F4E2E +:10B97000624B00211C2206F13C0019703163FBF779 +:10B98000F9FCB7638DF801506EE70325FAE704254B +:10B99000F8E7564DA78AE86BAB6B3A189A421ED867 +:10B9A000D4F810805C303A464146284400F03EFD11 +:10B9B000EB6B05F140023B4439464046EB63FCF734 +:10B9C000FDFC2864EB6B01932B6C0293E3688DF80C +:10B9D0000160002B3FF448AF2069984744E70326F5 +:10B9E000F0E7FFF757F80A2806D9454B0B381870CF +:10B9F0000B238DF8013037E701288DF801007FF423 +:10BA000033AF0020FFF734FD00283FF42DAF0A23A9 +:10BA1000EFE74FF480730393344BDA6B1B6C0192A6 +:10BA2000029321E7013D072D3FF61EAF01A353F816 +:10BA300025F000BF55BA0F0069B80F0031BB0F00E9 +:10BA40003DBB0F0069B80F0069BB0F0069B80F005C +:10BA5000B9BA0F00294B1B780BB90823C9E76269F3 +:10BA60000AB90323C5E7C2F30B0333B11F4B2549C2 +:10BA70005B6D096813448B42F3D1B2F5805F01D945 +:10BA80000423B6E7194B1F49586D096815188D42F4 +:10BA9000E3D85A64DA6C186518639A641A4B6169C2 +:10BAA0001B6801F6FF71090B1844FDF729FD0028FA +:10BAB0003FF4DAAE05239CE7104B1B78002BCCD06B +:10BAC0000A4DA28AD5E914315B1A696C13448B4282 +:10BAD000C7D80D4B2E6B1868D4E903313044FDF7FD +:10BAE00021F998B1E36877E76C700020C8740020F2 +:10BAF000DBE5B15100700F00B857002068700020DE +:10BB0000697000207070002074700020A28A2B6B76 +:10BB100013442B63A68A2B6D1E442E65A18A2069CF +:10BB200005F14802FCF74AFCCDE90160A8649BE6F8 +:10BB3000134B9A6C1B6D0292019395E6104BD3E95F +:10BB40001402596C821A8A4287D19A6C5865002176 +:10BB500020465964DA64FFF75DFD0A4B1B68042038 +:10BB6000984706B0BDE8F081054B9A6C1B6D0193B8 +:10BB70004FF480530292039376E6022339E700BF25 +:10BB8000C87400206C7000202DE9F04F4FF0A043E6 +:10BB90000C22C3F844278BB000211320FBF72CFCA8 +:10BBA0001D20FBF729FC1520FBF726FCFEF76CF99E +:10BBB000A948FEF71FFB4FF08043D3F8004414F070 +:10BBC0000B0F48D114F00F063CD0FBF7D9FC00282E +:10BBD00041D1002E3FD131460820FBF70DFC072054 +:10BBE000FBF70AFCFBF756FDB923012102A88DF8EB +:10BBF0000830FBF71AFD0220FBF7D6FC01211320C9 +:10BC0000FBF7FAFBFBF7BCFC01460028FAD1132036 +:10BC1000FBF7D8FB4FF0A043904AC3F84427D3F872 +:10BC2000442722F44032C3F84427D3F8442742F48F +:10BC30004032C3F844274FF080430122DA67C3F84B +:10BC40000025FEE74FF47A754FF47A70FBF7ACFCF1 +:10BC5000013DF9D1B9E7FEF717F9814D2B78002B9B +:10BC600075D14FF080434FF0FF327E48C3F8002477 +:10BC7000FEF7C0FAFBF784FC044668B97A48FEF781 +:10BC8000B9FAFBF707FD02A92046FBF77EFD002865 +:10BC900068D17648FEF7AEFA7548764FFBF784FC1C +:10BCA000754B764A1A600021754B3B603846FCF7AD +:10BCB000FFFB0546002840F0C980724C72494FF4E2 +:10BCC000DC72204600F0B2FB2668721C00F0B080E7 +:10BCD0002A465821201DFCF771FB864240F0A880BF +:10BCE000E36AAA2B00F0278100F29780012B00F075 +:10BCF000D980A52B00F01A81FBF742FC236A064687 +:10BD0000002B40F01B816148FEF774FA002E00F012 +:10BD100044815F48DFF88881FEF7CAF9FBF7C2FB70 +:10BD20004FF42066FBF72CFC002800F02C81002E3D +:10BD300000F0078140F2E730FBF736FC730604D1D0 +:10BD40004046FEF7B5F9FBF7ADFB013EEAE7E10738 +:10BD500002D52846FEF74EFA641015F8013B002B79 +:10BD6000FBD17BE74B4F4CF25236013E01D14A48A2 +:10BD700090E79DF80C302E2B2AD19DF80D30662BC4 +:10BD800026D19DF80E30692B22D19DF80F30722BF1 +:10BD90001ED19DF810306D2B1AD19DF81130772BE4 +:10BDA00016D19DF81230612B12D19DF81330722BF1 +:10BDB0000ED19DF81430652B0AD19DF815303BB992 +:10BDC0003648FEF717FA04F12000FEF74FFA63E752 +:10BDD000029D25F07F452335254425F00308A04525 +:10BDE000FFF457AF08F12003B3F1C14F3FF651AF55 +:10BDF00002A94046FBF7C9FC68B93D4005F58058EB +:10BE0000B8F1C14FBFF445AF02A94046FBF7BDFCF6 +:10BE100000283FF43EAF4446A7E7AC2B7FF46CAF5D +:10BE2000FFF7A8FB002840F08380FFF7C9FB7FE005 +:10BE300014484FF4DC720021FBF79CFA0123002028 +:10BE40006360FFF715FB00283FF44AAFFFF7AEF839 +:10BE500000200BB0BDE8F08F65C80F000C00030098 +:10BE600096CD0F0088C80F0091C80F009FC80F0023 +:10BE700020A10700E0570020807600200DA20F00CF +:10BE8000E8CC0F00C874002000F00F00C7C80F00F6 +:10BE9000D5C80F0000F0FFFFA9C80F00B8C80F00F9 +:10BEA00015C90F00FCF782FFD4F84880226B666A40 +:10BEB0000346984508EB0201104414BFB21A002251 +:10BEC000FFF708FB804660B9FCF770FF4246314639 +:10BED000FCF774FAA36A984203D10123C4E907036B +:10BEE000A6614FF000089448FEF7D8F8934B9448A9 +:10BEF00000221A70FFF7BCFA06460028A6D1B8F156 +:10BF0000000F11D0236A012B0ED1D4F81C80B8F198 +:10BF1000000F00F0C780FCF749FFA1693246FCF72B +:10BF20004DFA804500F0BE80FBF718FBFFF722FBBF +:10BF30004FF00108D7E7FFF743FBD2E700287FF473 +:10BF4000E8AE8048FEF756F97F48FBF72DFB7F4BA4 +:10BF500001214FF42032C3F80C15C3F80425D3F89F +:10BF600008250A43C3F80825794A1960C3F8002652 +:10BF7000D4F85C31D4F89C211340013340F0D280D6 +:10BF8000FFF714F862E7002EDBD0FDF75DFF714884 +:10BF9000FEF730F97048FEF72DF947F230516F4B3C +:10BFA0001B781BB90191FDF71BFF01996C4BDFF862 +:10BFB0001082DFF81092C8F800306A4A6A4EDFF843 +:10BFC00008A2DFF808B2694803F58473C9F80030A5 +:10BFD0000023137033701823AAF800302023ABF825 +:10BFE00000304FF08043D3F81C2512F0B10F1EBF74 +:10BFF000D3F81C2502F04E02C3F81C255C4AFDF75D +:10C000002FFE5C4B5C4A1A600020FDF73DFB5B4A4B +:10C010005B4B9B1ADB089D4247D15A4B5A483B6009 +:10C020000021FCF785FA054600287FF40FAFA36BCB +:10C03000002B46D10023554C554F2370554B012200 +:10C040001A70554ABF1AFF08BD4243D102221A7026 +:10C05000524D534900232B602022524B6B6005F157 +:10C060000800FCF791FB5049202205F12800FCF75D +:10C070008BFB4E4B2B602378002B34D14C4B4D4A1D +:10C080001A604D4B314C00221A70D4F800340BB1B9 +:10C09000FCF7C4FE334B32781B789A4228D1FCF768 +:10C0A000B7FEF2E742F2107179E752F835104148D5 +:10C0B0000193884700287FF4C9AE019B2F4A0135C0 +:10C0C000A9E7FEF7B9FC0028B4D0636A003B18BFAB +:10C0D0000123B0E752F8351088470028B8D12D4B1E +:10C0E0002D4A0135B0E7FEF7D5FC0128C6D0ADE6F4 +:10C0F0003378D8F80020BAF80050D9F8000002EBE5 +:10C10000C30103FB050052F8332089889047327839 +:10C11000BBF80010D3B2914286BF0133DBB20023DB +:10C120003370B7E74FF47F20FCF75AFA23495722C0 +:10C13000FCF76EFA24E700BFEC740020C574002001 +:10C140009D750F0023C90F00A0860100000001406B +:10C150003546526E88C80F0017C90F00C4740020FE +:10C16000A470002099700020987000207C7000203E +:10C1700095750F0078700020A19D0F00F4CD0F0081 +:10C18000FCCD0F0008CD0F00E057002068700020A4 +:10C19000F4CD0F001D700020F4CD0F0020700020A2 +:10C1A0009CCC0F00DCCC0F00BCCC0F007052464D75 +:10C1B0006C70002089960F0069700020C874002000 +:10C1C000A07000209C7000209670002094700020C9 +:10C1D000024B034A1B681068184700BF0470002018 +:10C1E000FC6F002008B54FF080430022C3F80C21FB +:10C1F000C3F81021C3F838254FF0805203F54043AF +:10C20000D2F80414C3F82015D2F80814C3F8241582 +:10C21000D2F80C14C3F82815D2F81014C3F82C1552 +:10C22000D2F81414C3F83015D2F81814C3F8341522 +:10C23000D2F81C14C3F84015D2F82014C3F84415E2 +:10C24000D2F82414C3F84815D2F82814C3F84C15B2 +:10C25000D2F82C14C3F85015D2F83014C3F8541582 +:10C26000D2F83414C3F86015D2F83814C3F8641542 +:10C27000D2F83C14C3F86815D2F84014C3F86C1512 +:10C28000D2F84424C3F87025FCF79CF918B12F4B61 +:10C290002F4AC3F88C26FCF795F918B12D4BFB22D9 +:10C2A000C3F81825FCF78EF958B14FF080424FF0D3 +:10C2B0008051D2F8E43ED1F8581261F30303C2F87A +:10C2C000E43EFCF77FF920B1234B4FF40072C3F832 +:10C2D00040264FF08043D3F80024D20744BF6FF0CC +:10C2E0000102C3F800241D4AD2F8883043F47003D9 +:10C2F000C2F88830BFF34F8FBFF36F8F4FF010231A +:10C30000D3F80C32DB071DD5154B0122C3F80425E9 +:10C31000D3F80024002AFBD04FF01022D2F80C32C0 +:10C3200023F00103C2F80C320D4BD3F80024002A8D +:10C33000FBD00022C3F80425D3F80024002AFBD048 +:10C34000FBF70CF9074B084A1A6008BD0050004083 +:10C350004881030000F000400090024000ED00E042 +:10C3600000E00140C05700200090D00307B50A4B01 +:10C370000A4A00930A4B934208BF00230193019B92 +:10C3800013B903B05DF804FBD3E900209047684679 +:10C39000FCF70CF9F3E700BFB8CA0F003CCE0F0062 +:10C3A0002CCE0F0070B58169124B134A11F8025C54 +:10C3B0000446D21A45B900690C21B2FBF1F2002102 +:10C3C0008A4204D1012010E04FF0FF30F4E71E68EC +:10C3D000AE420CD1461C02D05E68864207D19D68F1 +:10C3E000D4E90001D4E90223A847206070BD0131DF +:10C3F0000C33E5E710CE0F001CCE0F001EF0040F2B +:10C400000CBFEFF30880EFF30980FFF7CBBF00BF4D +:10C41000054B002282B0C3F80021D3F8003101930C +:10C42000019B02B0704700BF000001400A449142E6 +:10C4300000F1FF3300D1704710B511F8014B03F83C +:10C44000014F9142F9D110BD10B50139024490421B +:10C4500001D1002005E0037811F8014FA34201D07B +:10C46000181B10BD0130F2E753B94AB9002908BFC3 +:10C4700000281CBF4FF0FF314FF0FF3000F06AB9C9 +:10C48000ADF1080C6DE904CE00F006F8DDF804E02B +:10C49000DDE9022304B070472DE9F047089D0E4600 +:10C4A00004460F46002B4AD194468C45B2FA82F2DC +:10C4B00060D942B1C2F12003974020FA03F30CFA8D +:10C4C00002FC1F4394404FEA1C4E1FFA8CF6B7FB48 +:10C4D000FEF1230C0EFB117743EA074301FB06F044 +:10C4E00098420AD91CEB030301F1FF3780F0158154 +:10C4F000984240F21281023963441B1AA4B2B3FB82 +:10C50000FEF00EFB103344EA034400FB06F6A6429D +:10C510000AD91CEB040400F1FF3380F00081A6422D +:10C5200040F2FD806444023840EA0140A41B00212F +:10C530001DB1D4400023C5E90043BDE8F0878B421C +:10C5400005D90DB1C5E9000100210846F5E7B3FAA8 +:10C5500083F1002946D1B34202D3824200F2F58032 +:10C56000841A66EB030201201746002DE5D0C5E9C9 +:10C570000047E2E7002A40F09380A1EB0C034FEA6A +:10C580001C471FFA8CFE0121B3FBF7F607FB1630A0 +:10C59000230C43EA00430EFB06F0984208D91CEB3B +:10C5A000030306F1FF3802D2984200F2D0804646DB +:10C5B0001B1AA4B2B3FBF7F007FB103344EA0344A1 +:10C5C0000EFB00FEA64508D91CEB040400F1FF3366 +:10C5D00002D2A64500F2B6801846A4EB0E0440EA4B +:10C5E0000640A5E7C1F120078B4022FA07FC4CEA80 +:10C5F000030C06FA01FE20FA07F426FA07F344EAD0 +:10C600000E0400FA01F84FEA1C404FEA1449B3FB4C +:10C61000F0FE1FFA8CF600FB1E3349EA03430EFBC3 +:10C6200006F9994502FA01F20BD91CEB03030EF14E +:10C63000FF3A80F08580994540F28280AEF1020E8B +:10C640006344A3EB0909A4B2B9FBF0F300FB13990F +:10C6500044EA094403FB06F6A64208D91CEB04048D +:10C6600003F1FF3068D2A64266D9023B644443EA34 +:10C670000E40A41BA0FB02E6B4427346B14652D35F +:10C680004FD05DB1B8EB030264EB090404FA07F77D +:10C6900022FA01F31F43CC40C5E9007400214CE7A6 +:10C6A000C2F1200120FA01F30CFA02FC26FA01F192 +:10C6B000964033434FEA1C471FFA8CFEB1FBF7F05C +:10C6C00007FB1016190C41EA064100FB0EF68E42DC +:10C6D00004FA02F408D91CEB010100F1FF382DD255 +:10C6E0008E422BD902386144891B9BB2B1FBF7F60D +:10C6F00007FB161143EA014306FB0EF1994208D9E4 +:10C700001CEB030306F1FF3814D2994212D9023E02 +:10C7100063445B1A46EA004136E73946EDE61846BF +:10C7200002E7F045ADD2BEEB020366EB0C06013822 +:10C73000B146A6E74646ECE7034698E74046D3E70E +:10C74000D6467EE76444023847E708460DE7023ED6 +:10C7500063442DE7704700BFF8B500BFF8BC08BCC4 +:10C760009E467047F8B500BFF8BC08BC9E467047AF +:10C770000D0A000A484F4C442042544E20544F208A +:10C780005245424F4F54004552524F520044495374 +:10C79000434F4E4E45435400464C41534820484574 +:10C7A00041444552002041444452002053495A45D7 +:10C7B0000020435243002056455253494F4E0043F8 +:10C7C000524320544553542E2E2E00435243204DA5 +:10C7D00049534D41544348004E4F5420464C415319 +:10C7E00048494E4700435243204F4B005445535451 +:10C7F000494E472E2E2E00444946462041542000E3 +:10C800002056200052454D4F56452048454144454D +:10C81000522E004649524D57415245204449464602 +:10C820004552454E542E00464C415348494E472EE2 +:10C830002E2E0043524320434845434B004352436E +:10C84000204641494C212052455452590042494EFC +:10C85000415259204D4154434845532E004466757A +:10C8600054617267000A2020484F4C4420425554BE +:10C87000544F4E2032205345430D0A2020544F2060 +:10C880005455524E204F4E00424C20327632350ADB +:10C8900000434845434B2053544F52414745004EB7 +:10C8A0004F204E455720465700544F4F204D414E84 +:10C8B000592046494C455300464F554E4420464961 +:10C8C000524D574152450042414E4B3020494E5641 +:10C8D000414C49440052454C454153452042544E39 +:10C8E00020464F52204446550D0A484F4C442042A2 +:10C8F000544E20544F20424F4F540D0A0D0A3C20F5 +:10C900002020202020202020202020202020202027 +:10C9100020203E0D003D00444655205354415254C2 +:10C920004544000D0A424F4F54494E472E2E2E00CB +:10C93000010700009800000060C90F00020100001C +:10C94000010000000000000003050000410000009D +:10C9500000000000000000000000000000000000D7 +:10C96000011101FF0100000000000000021702FE9B +:10C9700094000000D0C90F0000000000000000007B +:10C9800000000000000000000101000001000000A4 +:10C99000000000000205000021000000000000006F +:10C9A000000000000000000000000000011704FC6F +:10C9B0009800000060C90F00021704FCDC000000B2 +:10C9C00030C90F000000000000000000000000005F +:10C9D000011104FC0400000000000000021104FC2E +:10C9E0000400000000000000032104FC041000000B +:10C9F00000000000041101FF010000000000000021 +:10CA0000051102FE0400000000000000061104FCF5 +:10CA10000400000000000000071104FC04000000F6 +:10CA200000000000081701FF2200000088C90F0065 +:10CA3000091001FF0100000084C90F000000000080 +:10CA400000000000000000000D830F0065830F0050 +:10CA5000C99E0F00200000007800000000000000C8 +:10CA600050EADA308883B89F604F15F30000C98E12 +:10CA70000600180000005802098A0F005F8A0F00A4 +:10CA8000BB8A0F00238B0F003B8B0F00558B0F00D1 +:10CA9000978B0F00FDA90F000000000044CE0F008F +:10CAA0004CCE0F00080000001CCE0F0024CE0F005B +:10CAB00008000000001002002CCE0F003CCE0F003A +:10CAC0000800000024CE0F002CCE0F00080000004C +:10CAD0003CCE0F0044CE0F00080000000010000004 +:10CAE0000400000001000000982F8A429144377131 +:10CAF000CFFBC0B5A5DBB5E95BC25639F111F159E1 +:10CB0000A4823F92D55E1CAB98AA07D8015B831222 +:10CB1000BE853124C37D0C55745DBE72FEB1DE80CE +:10CB2000A706DC9B74F19BC1C1699BE48647BEEFFD +:10CB3000C69DC10FCCA10C246F2CE92DAA84744A88 +:10CB4000DCA9B05CDA88F97652513E986DC631A8FE +:10CB5000C82703B0C77F59BFF30BE0C64791A7D5DD +:10CB60005163CA0667292914850AB72738211B2E65 +:10CB7000FC6D2C4D130D385354730A65BB0A6A764D +:10CB80002EC9C281852C7292A1E8BFA24B661AA859 +:10CB9000708B4BC2A3516CC719E892D1240699D669 +:10CBA00085350EF470A06A1016C1A419086C371EE2 +:10CBB0004C774827B5BCB034B30C1C394AAAD84EC0 +:10CBC0004FCA9C5BF36F2E68EE828F746F63A578FB +:10CBD0001478C8840802C78CFAFFBE90EB6C50A48E +:10CBE000F7A3F9BEF27871C608200001FFFFFFFF2E +:10CBF000FFFFFFFFFFFFFFFF00000000000000003D +:10CC00000000000001000000FFFFFFFF512563FC52 +:10CC1000C2CAB9F3849E17A7ADFAE6BCFFFFFFFFB7 +:10CC2000FFFFFFFF00000000FFFFFFFF96C298D844 +:10CC30004539A1F4A033EB2D817D0377F240A46345 +:10CC4000E5E6BCF847422CE1F2D1176BF551BF374E +:10CC50006840B6CBCE5E316B5733CE2B169E0F7C21 +:10CC60004AEBE78E9B7F1AFEE242E34F4B60D227EE +:10CC70003E3CCE3BF6B053CCB0061D65BC869876E4 +:10CC800055BDEBB3E7933AAAD835C65AAB7C0F0033 +:10CC90005B7E0F00FD7D0F00D97E0F004901B95268 +:10CCA000C5EF41DE27476A5527B31CE72D1ECB0F82 +:10CCB000A00C3792BE6AB2E99B2403956593690B79 +:10CCC0005EF09CFDA5C02CEEF1ECA5A1470A9B3FB0 +:10CCD000814C5FD407D8A31404C609D328004800A8 +:10CCE00000204000D17E0F00B1840F0085950F0019 +:10CCF000ADA50F0091950F00F1950F00BD840F00B9 +:10CD0000C1840F00C5840F0031850F00A19F0F0063 +:10CD1000BBA50F00F59F0F0049A00F0081850F00F4 +:10CD200085850F0089850F00D75D7552957C151399 +:10CD3000FF1DFF7F645ABF7EA91ABF7E4040922E1E +:10CD40000011922E6040823C554BF94D504B423DB4 +:10CD5000FE572559F57B255B3E577F594A798A79DD +:10CD60004A59775F9E656D5BAD6B2D5B15577B5B9D +:10CD7000545B527B5175D655ED076D049204150531 +:10CD8000D5270000000000000000000000000000A7 +:10CD90000338FDD8704750494E005741544348442A +:10CDA0004F47005357205245534554004C4F434B77 +:10CDB0005550004F464600001000000000000000E3 +:10CDC000017A5200027C0E011B0C0D0020000000B5 +:10CDD00018000000000000009A00000000410E0C46 +:10CDE00086018502840302470A41C6C5C4410B007F +:04CDF000000000003F +:08CDF400CDAC0F002D990F00DA +:10CDFC00BC68002098680020B968002018580020F2 +:04CE0C0080000000A2 +:0CCE10000000000003000000D58C0F00A3 +:08CE1C00F5B00F00000000005A +:08CE2400499B0F000000000013 +:10CE2C0045870F000000000031870F000000000054 +:08CE3C0099850F0000000000C1 +:08CE4400699A0F0000000000D4 +:08CE4C0040A4FF7F010000007B +:10CE54000100FFFFFF0000000090D003001001401C +:10CE6400110004000200000002000000570000004E +:08CE740069720F0041720F000A +:10CE7C0000000000000000001B8D0F0000100000DF +:04CE8C000000100092 +:020000020000FC +:020000041000EA +:0410140000700F0059 +:0410180000E00F00E5 +:04000003F00073890D +:00000001FF diff --git a/apps/fwupdate/custom.html b/apps/fwupdate/custom.html index 606e59d89..86b8615e8 100644 --- a/apps/fwupdate/custom.html +++ b/apps/fwupdate/custom.html @@ -16,8 +16,9 @@ The DFU (bootloader) rarely changes, so it does not have to be the same version as your main firmware.

-

+
@@ -106,7 +108,10 @@ function onInit(device) { else if (crcs[0] == 3816337552) version = "2v21"; else if (crcs[0] == 3329616485) version = "2v22"; else if (crcs[0] == 1569433504) version = "2v23"; - else if (crcs[0] == 680675961) version = "2v24"; + else if (crcs[0] == 680675961) version = "2v24"; + else if (crcs[0] == 4148062987 || crcs[0] == 3675049818) version = "2v25"; + else if (crcs[0] == 2489937616) version = "2v26"; + else if (crcs[0] == 3325639688) version = "2v27"; else { // for other versions all 7 pages are used, check those var crc = crcs[1]; if (crc==1339551013) { version = "2v10.219"; ok = false; } @@ -127,7 +132,7 @@ function onInit(device) { } document.getElementById("boot-version").innerHTML = version; var versionNumber = parseFloat(version.replace(".","").replace("v",".")); - if (versionNumber>=2.20) + if (versionNumber>=2.25) document.getElementById("fw-old-bootloader-msg").style.display = "none"; }); } @@ -385,6 +390,7 @@ function createJS_bootloader(binary, startAddress, endAddress) { for (var i=startAddress;i { Bangle.on('touch', drawMenu); }, 300); // Touch the screen to go back to the image menu (300ms timeout to allow user to lift finger) - Bangle.setOptions({ // Disable display power saving while showing the image - lockTimeout: 0, - lcdPowerTimeout: 0, - backlightTimeout: 0 - }); + if (disablePowerSaving) { + Bangle.setOptions({ + lockTimeout: 0, + lcdPowerTimeout: 0, + backlightTimeout: 0 + }); + } Bangle.setLCDBrightness(1); // Full brightness - image = eval(storage.read(fileName)); // Sadly, the only reasonable way to do this g.clear().reset().setBgColor(0).setColor("#fff").drawImage(image, 88, 88, { rotate: angle }); } diff --git a/apps/gallery/metadata.json b/apps/gallery/metadata.json index 00ac42075..4672c71c5 100644 --- a/apps/gallery/metadata.json +++ b/apps/gallery/metadata.json @@ -1,7 +1,7 @@ { "id": "gallery", "name": "Gallery", - "version": "0.03", + "version": "0.04", "description": "A gallery that lets you view images uploaded with the IDE (see README)", "readme": "README.md", "icon": "icon.png", @@ -22,6 +22,10 @@ "name": "gallery.img", "url": "icon.js", "evaluate": true + }, + { "name":"gallery.settings.js", + "url":"settings.js" } - ] + ], + "data": [{"name":"gallery.json"}] } diff --git a/apps/gallery/settings.js b/apps/gallery/settings.js new file mode 100644 index 000000000..1f87b93ba --- /dev/null +++ b/apps/gallery/settings.js @@ -0,0 +1,22 @@ +(function back() { + const storage = require('Storage'); + // Load existing settings or initialize defaults + let settings = storage.readJSON('setting.json') || {}; + settings.disablePowerSaving = settings.disablePowerSaving || false; // Default to false if not set + + function saveSettings() { + storage.write('setting.json', settings); + } + + E.showMenu({ + '': { 'title': 'Gallery Settings' }, + 'Disable Power Saving': { + value: settings.disablePowerSaving, + onchange: v => { + settings.disablePowerSaving = v; + saveSettings(); + } + }, + '< Back': () => load() + }); +}) \ No newline at end of file diff --git a/apps/gallery/settings.json b/apps/gallery/settings.json new file mode 100644 index 000000000..8326cd172 --- /dev/null +++ b/apps/gallery/settings.json @@ -0,0 +1,3 @@ +{ + "disablePowerSaving": true +} diff --git a/apps/gassist/metadata.json b/apps/gassist/metadata.json index 995c44adb..bd38cdfb8 100644 --- a/apps/gassist/metadata.json +++ b/apps/gassist/metadata.json @@ -5,7 +5,7 @@ "description": "A simple way to initiate Google Assistant on Android. Intents must be enabled in Gadgetbridge.", "icon": "app.png", "type": "app", - "tags": "tool, voice, tasker", + "tags": "tool,voice,tasker", "supports": ["BANGLEJS","BANGLEJS2"], "allow_emulator": false, "storage": [ diff --git a/apps/gassist/settings.js b/apps/gassist/settings.js index 20634ed5e..0b54c350f 100644 --- a/apps/gassist/settings.js +++ b/apps/gassist/settings.js @@ -29,4 +29,4 @@ } // Initially show the menu showMenu(); -}); +}) diff --git a/apps/gbdiscon/ChangeLog b/apps/gbdiscon/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/gbdiscon/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/gbdiscon/app-icon.js b/apps/gbdiscon/app-icon.js new file mode 100644 index 000000000..81bf14884 --- /dev/null +++ b/apps/gbdiscon/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwYHEgMkyVAkmQDJYREyQRRoARQpARQpIRRkARNggRBkgRNgARCwARNiQRBSRIREgQRBSRIREgARCSRARFhKSKCIoFCSRAjISQ0BAQJZHCI6ZBTwKPEI44tBTIMSYoZ9IBIYyEWZCHEKwbXIDwZ6MBghjBWBR7DIQbmJAAJ7BexYRHGZZHEchRrGNJYRIRpARJWI7XDCIrVHLIeACIpuIgKwBR4RcQyDLFCJbLGCJcAZZgLEiRcLCIkCZZYvFCKAjDI6BZOPqD+PWaUJa6ARCTxARICBQRFPRIRHPRIRHBg4A=")) diff --git a/apps/gbdiscon/app.js b/apps/gbdiscon/app.js new file mode 100644 index 000000000..1652ac506 --- /dev/null +++ b/apps/gbdiscon/app.js @@ -0,0 +1,7 @@ +{ +Bangle.setUI({mode:"custom",remove:()=>{}});"Bangle.loadWidgets"; // Allow fastloading. + +Bluetooth.println(JSON.stringify({t:"intent", action:"nodomain.freeyourgadget.gadgetbridge.BLUETOOTH_DISCONNECT", extra:{EXTRA_DEVICE_ADDRESS:NRF.getAddress()}})); + +Bangle.showClock(); +} diff --git a/apps/gbdiscon/app.png b/apps/gbdiscon/app.png new file mode 100644 index 000000000..f942c9ba0 Binary files /dev/null and b/apps/gbdiscon/app.png differ diff --git a/apps/gbdiscon/metadata.json b/apps/gbdiscon/metadata.json new file mode 100644 index 000000000..904b4c6a2 --- /dev/null +++ b/apps/gbdiscon/metadata.json @@ -0,0 +1,13 @@ +{ "id": "gbdiscon", + "name": "Disconnect from Gadgetbridge", + "shortName":"Disconnect Gadgetbridge", + "version":"0.01", + "description": "Disconnect from your android device by running this app. The app will forward you to your clock face immediately after triggering the command. (Gadgetbridge nightly required until version 82 is released)", + "icon": "app.png", + "tags": "android,gadgetbridge,bluetooth,bt", + "supports" : ["BANGLEJS", "BANGLEJS2"], + "storage": [ + {"name":"gbdiscon.app.js","url":"app.js"}, + {"name":"gbdiscon.img","url":"app-icon.js","evaluate":true} + ] +} diff --git a/apps/gbmusic/ChangeLog b/apps/gbmusic/ChangeLog index 90e5ed857..433c58368 100644 --- a/apps/gbmusic/ChangeLog +++ b/apps/gbmusic/ChangeLog @@ -10,4 +10,6 @@ 0.10: Simplify touch events Remove date+time 0.11: Use default Bangle formatter for booleans -0.12: Issue newline before GB commands (solves issue with console.log and ignored commands) \ No newline at end of file +0.12: Issue newline before GB commands (solves issue with console.log and ignored commands) +0.13: Upgrade to new translation system +0.14: Fix auto-start saved state; fix clearing track number; allow widget clicks diff --git a/apps/gbmusic/app.js b/apps/gbmusic/app.js index 7f5aad8f3..31e56ec39 100644 --- a/apps/gbmusic/app.js +++ b/apps/gbmusic/app.js @@ -91,8 +91,7 @@ function rScroller(l) { const w = g.stringWidth(l.label)+40, y = l.y+l.h/2; l.offset = l.offset%w; - g.setClipRect(l.x, l.y, l.x+l.w-1, l.y+l.h-1) - .setColor(l.col).setBgColor(l.bgCol) // need to set colors: iScroll calls this function outside Layout + g.setColor(l.col).setBgColor(l.bgCol) // need to set colors: iScroll calls this function outside Layout .setFontAlign(-1, 0) // left center .clearRect(l.x, l.y, l.x+l.w-1, l.y+l.h-1) .drawString(l.label, l.x-l.offset+40, y) @@ -128,57 +127,8 @@ function rInfo(l) { .setFontAlign(0, -1) // center top .drawString(l.label, l.x+l.w/2, l.y); } -/** - * Render icon - * @param l - */ -function rIcon(l) { - const x2 = l.x+l.w-1, - y2 = l.y+l.h-1; - switch(l.icon) { - case "pause": { - const w13 = l.w/3; - g.drawRect(l.x, l.y, l.x+w13, y2); - g.drawRect(l.x+l.w-w13, l.y, x2, y2); - break; - } - case "play": { - g.drawPoly([ - l.x, l.y, - x2, l.y+l.h/2, - l.x, y2, - ], true); - break; - } - case "previous": { - const w15 = l.w*1/5; - g.drawPoly([ - x2, l.y, - l.x+w15, l.y+l.h/2, - x2, y2, - ], true); - g.drawRect(l.x, l.y, l.x+w15, y2); - break; - } - case "next": { - const w45 = l.w*4/5; - g.drawPoly([ - l.x, l.y, - l.x+w45, l.y+l.h/2, - l.x, y2, - ], true); - g.drawRect(l.x+w45, l.y, x2, y2); - break; - } - default: { // red X - console.log(`Unknown icon: ${l.icon}`); - g.setColor("#f00") - .drawRect(l.x, l.y, x2, y2) - .drawLine(l.x, l.y, x2, y2) - .drawLine(l.x, y2, x2, l.y); - } - } -} + + let layout; function makeUI() { Bangle.loadWidgets(); @@ -417,7 +367,7 @@ function handleButton2Press() { let tCommand = {}; /** * Send command and highlight corresponding control - * @param {string} command - "play"/"pause"/"next"/"previous"/"volumeup"/"volumedown" + * @param {"play"|"pause"|"playpause"|"next"|"previous"|"volumeup"|"volumedown"} command */ function sendCommand(command) { Bluetooth.println(""); @@ -433,15 +383,21 @@ function sendCommand(command) { drawControls(); } +function handleTouch(btn, pos) { + if (pos === undefined || pos.y >= Bangle.appRect.y) { + togglePlay(); + } +} + function togglePlay() { - sendCommand(stat==="play" ? "pause" : "play"); + sendCommand("playpause"); } /** * Setup touch+swipe for Bangle.js 1 */ function touch1() { - Bangle.on("touch", togglePlay); + Bangle.on("touch", handleTouch); Bangle.on("swipe", dir => { sendCommand(dir===1 ? "previous" : "next"); }); @@ -450,7 +406,7 @@ function touch1() { * Setup touch+swipe for Bangle.js 2 */ function touch2() { - Bangle.on("touch", togglePlay); + Bangle.on("touch", handleTouch); // swiping let drag; Bangle.on("drag", e => { @@ -483,10 +439,9 @@ function startLCDWatch() { Bangle.on("lcdPower", (on) => { if (on) { // redraw and resume scrolling - tick(); layout.render(); fadeOut(); - if (offset.offset!==null) { + if (layout.title.offset!==null) { // Making an assumption about what offset.offset was supposed to be if (!iScroll) { iScroll = setInterval(scroll, 200); } diff --git a/apps/gbmusic/boot.js b/apps/gbmusic/boot.js index 154f85c2b..2f1c09d8a 100644 --- a/apps/gbmusic/boot.js +++ b/apps/gbmusic/boot.js @@ -1,6 +1,6 @@ setTimeout( // make other boot code run first, so we override e.g. android.boot.js GB () => { - const APP = global.__FILE__==="gbmusic.app.js", + const APP = globalThis.__FILE__==="gbmusic.app.js", a = !!(require("Storage").readJSON("gbmusic.json", 1) || {}).autoStart; let s, i; // state, info @@ -10,7 +10,7 @@ setTimeout( // make other boot code run first, so we override e.g. android.boot. * Only runs while other apps are loaded */ function check() { - if (s!=="play" || !i || !a || !Bangle.CLOCK) return; // only launch app if we know which song we are playing, and autoLoad is enabled + if ((!s || s.state!=="play") || !i || !a || !Bangle.CLOCK) return; // only launch app if we know which song we are playing, and autoLoad is enabled delete (i.t); // store info and launch music app require("Storage").writeJSON("gbmusic.load.json", { @@ -20,18 +20,19 @@ setTimeout( // make other boot code run first, so we override e.g. android.boot. load("gbmusic.app.js"); } - global.GB = (_GB => e => { + + globalThis.GB = (_GB => e => { // we eat music events! switch(e.t) { case "musicinfo": i = e; - return APP ? info(e) : check(); + return APP ? globalThis.info(e) : check(); case "musicstate": - s = e.state; - return APP ? state(e) : check(); + s = e; + return APP ? globalThis.state(e) : check(); default: // pass on other events if (_GB) setTimeout(_GB, 0, e); } - })(global.GB); + })(globalThis.GB); }, 1); diff --git a/apps/gbmusic/metadata.json b/apps/gbmusic/metadata.json index 0c73548cb..a463e6ea0 100644 --- a/apps/gbmusic/metadata.json +++ b/apps/gbmusic/metadata.json @@ -2,7 +2,7 @@ "id": "gbmusic", "name": "Gadgetbridge Music Controls", "shortName": "Music Controls", - "version": "0.12", + "version": "0.14", "description": "Control the music on your Gadgetbridge-connected phone", "icon": "icon.png", "screenshots": [{"url":"screenshot_v1_d.png"},{"url":"screenshot_v1_l.png"}, diff --git a/apps/gbmusic/settings.js b/apps/gbmusic/settings.js index 6619eab1c..70d96c1e9 100644 --- a/apps/gbmusic/settings.js +++ b/apps/gbmusic/settings.js @@ -3,8 +3,7 @@ */ (function(back) { const SETTINGS_FILE = "gbmusic.json", - storage = require("Storage"), - translate = require("locale").translate; + storage = require("Storage"); // initialize with default settings... let s = { @@ -28,15 +27,15 @@ let menu = { "": {"title": "Music Control"}, }; - menu[translate("< Back")] = back; - menu[translate("Auto start")] = { + menu["< Back"] = back; + menu[/*LANG*/"Auto start"] = { value: !!s.autoStart, onchange: save("autoStart"), }; - menu[translate("Simple button")] = { + menu[/*LANG*/"Simple button"] = { value: !!s.simpleButton, onchange: save("simpleButton"), }; E.showMenu(menu); -}); +}) diff --git a/apps/getaddr/ChangeLog b/apps/getaddr/ChangeLog new file mode 100644 index 000000000..af7f83942 --- /dev/null +++ b/apps/getaddr/ChangeLog @@ -0,0 +1 @@ +0.01: Initial release diff --git a/apps/getaddr/README.md b/apps/getaddr/README.md new file mode 100644 index 000000000..a80486da4 --- /dev/null +++ b/apps/getaddr/README.md @@ -0,0 +1,24 @@ +# Get Address App +This app uses the GPS and compass capabilities of the Bangle.js 2 watch to display your current location and direction. + +The app uses the Nominatim API to reverse geocode your location and display the street and house number. It also uses the compass to display your current direction. + +## Screenshots +![](image1.png) +![](image2.png) + +## Requirements +To run this app, you will need to meet the following requirements: + +1. Android Integration app or iOS integration app must be installed. +2. In Bangle.js Gadgetbridge connect the watch, then navigate to the **Gear icon** and enable "Use GPS data from phone". +3. In the same settings dialog scroll down and enable "Allow internet access". +4. Under **System** > **Settings** > **General Settings**, press "Get location" once and wait until it finds a location +5. In the same settings dialog enable "Keep location up to date". +7. The watch must have a clear view of the sky to receive GPS signals. +8. The compass must be calibrated by moving the watch in a figure-eight motion. + +Note: This app requires an active internet connection to function. It uses the Nominatim API to reverse geocode your location, and it may not work in areas with limited or no internet connectivity. + + +by [Online Speech to Text Cloud](https://www.speech-to-text.cloud/) diff --git a/apps/getaddr/getaddr-icon.js b/apps/getaddr/getaddr-icon.js new file mode 100644 index 000000000..b2f820e48 --- /dev/null +++ b/apps/getaddr/getaddr-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwYcZhMkyVACBkSpIRBpMgCBUEBwIRCkmACBEBBwYCDIhYRFJRAOFAQVICA0CCJFJNBYCFNwwOHCJpBCCgiMJQY6SECIeQBAYRMBBosVMRAR/CMR9NUKLFVdJpQDyVIAwIFCMRQCICIsSCJMgCK8CCJIQFCKRlFOIwAFhIRHoARZVoi5GAAwRGbogRXdgjmHbRYQKZArCGCK7IECBbIEYRC2IWBC2ICBqkCTxSkGTxYAOA")) diff --git a/apps/getaddr/getaddr.app.js b/apps/getaddr/getaddr.app.js new file mode 100644 index 000000000..93215c491 --- /dev/null +++ b/apps/getaddr/getaddr.app.js @@ -0,0 +1,157 @@ +// Set the API endpoint and parameters +const nominatimApi = 'https://nominatim.openstreetmap.org'; +const locale = require('locale'); +let lang = locale.name; + +if (lang.toLowerCase() === 'system') { + lang = 'en'; +} else { + lang = lang.substring(0, 2); +} + +const params = { + format: 'json', + addressdetails: 1, + zoom: 18, + extratags: 1 +}; + +// Function to break a string into lines +function breakStringIntoLines(str, maxWidth) { + const words = str.split(' '); + const lines = []; + let currentLine = ''; + for (const word of words) { + if (currentLine.length + word.length + 1 > maxWidth) { + lines.push(currentLine); + currentLine = word; + } else { + if (currentLine!== '') { + currentLine +=' '; + } + currentLine += word; + } + } + lines.push(currentLine); + return lines; +} + +// Function to clear the screen and display a message +function showMessage(address, error, dir) { + g.clear(); + g.reset(); + g.setFontVector(16); + const addressLines = breakStringIntoLines(address, 20); + let y = 20; + for (const line of addressLines) { + g.drawString(line, 10, y); + y += 20; + } + if (error) { + y += 10; + const errorLines = breakStringIntoLines(error, 20); + for (const line of errorLines) { + g.drawString(line, 10, y); + y += 20; + } + } + g.drawString(`Direction: ${dir}`, 10, 150); + g.flip(); +} + +// Function to get the compass direction +function getCompassDirection() { + const compass = Bangle.getCompass(); + if (compass && compass.heading) { + const direction = Math.floor(compass.heading); + const directions = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW']; + const index = Math.floor(((direction % 360) + 22.5) / 45) % 8; + if (index >= 0 && index < directions.length) { + return directions[index]; + } else { + return 'Invalid index'; + } + } else { + return 'No compass data'; + } +} + +// Variable to store the current address and error +let currentAddress = 'Getting address...'; +let currentError = ''; +let lastUpdateTime = 0; + +// Function to get the current location +function getCurrentLocation() { + Bangle.setGPSPower(1); + Bangle.setCompassPower(1); + Bangle.on('GPS', (gps) => { + if (gps.fix) { + const now = Date.now(); + if (now - lastUpdateTime < 30000) return; + lastUpdateTime = now; + getStreetAndHouseNumber(gps.lat, gps.lon); + } else { + currentAddress = 'No GPS signal'; + currentError = `Sats: ${gps.satellites}`; + showMessage(currentAddress, currentError, getCompassDirection()); + } + }); +} + +// Function to get the street and house number +function getStreetAndHouseNumber(lat, lon) { + const url = `${nominatimApi}/reverse`; + const paramsStr = Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&'); + const fullUrl = `${url}?${paramsStr}&lat=${lat}&lon=${lon}&accept-language=${lang}&format=json`; + + Bangle.http(fullUrl).then(data => { + try { + const jsonData = JSON.parse(data.resp); + if (jsonData && jsonData.address) { + let street = jsonData.address.road; + if (street.includes('Straße')) { + street = street.replace('Straße', 'Str.'); + } else if (street.includes('Street')) { + street = street.replace('Street', 'St.'); + } + const houseNumber = jsonData.address.house_number; + const newAddress = `${street} ${houseNumber}`; + if (newAddress!== currentAddress) { + currentAddress = newAddress; + currentError = ''; + } + } else { + const newAddress = 'No address'; + if (newAddress!== currentAddress) { + currentAddress = newAddress; + currentError = ''; + } + } + } catch (err) { + const newError = `Error: ${err}`; + if (newError!== currentError) { + currentError = newError; + } + } + showMessage(currentAddress, currentError, getCompassDirection()); + }).catch(err => { + const newError = `Error: ${err}`; + if (newError!== currentError) { + currentError = newError; + } + showMessage(currentAddress, currentError, getCompassDirection()); + }); +} + +// Main function +function main() { + showMessage('Getting address...', '', getCompassDirection()); + getCurrentLocation(); + setInterval(() => { + showMessage(currentAddress, currentError, getCompassDirection()); + }, 1000); +} + +// Call the main function +main(); diff --git a/apps/getaddr/getaddr.png b/apps/getaddr/getaddr.png new file mode 100644 index 000000000..6dc5cc94d Binary files /dev/null and b/apps/getaddr/getaddr.png differ diff --git a/apps/getaddr/image1.png b/apps/getaddr/image1.png new file mode 100644 index 000000000..a0bbf50ef Binary files /dev/null and b/apps/getaddr/image1.png differ diff --git a/apps/getaddr/image2.png b/apps/getaddr/image2.png new file mode 100644 index 000000000..112fb8c5a Binary files /dev/null and b/apps/getaddr/image2.png differ diff --git a/apps/getaddr/metadata.json b/apps/getaddr/metadata.json new file mode 100644 index 000000000..f176a83d1 --- /dev/null +++ b/apps/getaddr/metadata.json @@ -0,0 +1,17 @@ +{ + "id": "getaddr", + "name": "Get Addr", + "version": "0.01", + "description": "An app that shows the address of the current location", + "readme": "README.md", + "icon": "getaddr.png", + "screenshots": [{"url":"image1.png"}, {"url":"image2.png"}], + "type": "app", + "tags": "gps,outdoors,tools", + "supports": ["BANGLEJS2"], + "dependencies" : {}, + "storage": [ + {"name":"getaddr.app.js","url":"getaddr.app.js"}, + {"name":"getaddr.img","url":"getaddr-icon.js","evaluate":true} + ] + } diff --git a/apps/getup/settings.js b/apps/getup/settings.js index f34262f2a..db84fd84d 100644 --- a/apps/getup/settings.js +++ b/apps/getup/settings.js @@ -45,4 +45,4 @@ }, }; E.showMenu(menu); -}); +}) diff --git a/apps/gipy/ChangeLog b/apps/gipy/ChangeLog index 79b3a7615..17a701de4 100644 --- a/apps/gipy/ChangeLog +++ b/apps/gipy/ChangeLog @@ -135,5 +135,11 @@ * Fix for files converted from maps2gpx : path was not reduced in size correctly * Experimental ski mode : have a ski slopes map * Fix for path projection display when lost and zoomed out + 0.25: Minor code improvements + 0.26: Add option to plot openstmap if installed + +0.27: Support for large paths (grid sizes > 65k) + +0.28: Avoid crash on negative array access diff --git a/apps/gipy/app.js b/apps/gipy/app.js index 4d0838282..7127ab132 100644 --- a/apps/gipy/app.js +++ b/apps/gipy/app.js @@ -34,6 +34,7 @@ var settings = Object.assign( power_lcd_off: false, powersave_by_default: false, sleep_between_waypoints: false, + keep_gps_alive: true }, s.readJSON("gipy.json", true) || {} ); @@ -95,7 +96,7 @@ function compute_eta(hour, minutes, approximate_speed, remaining_distance) { } class TilesOffsets { - constructor(filename, offset) { + constructor(filename, offset, bytes_per_tile_index) { let header = E.toArrayBuffer(s.read(filename, offset, 4)); let type_size = Uint8Array(header, 0, 1)[0]; offset += 1; @@ -105,26 +106,30 @@ class TilesOffsets { offset += 2; let bytes = (type_size==24)?3:2; - let buffer = E.toArrayBuffer(s.read(filename, offset, 2*non_empty_tiles_number+bytes*non_empty_tiles_number)); - this.non_empty_tiles = Uint16Array(buffer, 0, non_empty_tiles_number); - offset += 2 * non_empty_tiles_number; + let buffer = E.toArrayBuffer(s.read(filename, offset, bytes_per_tile_index*non_empty_tiles_number)); + if (bytes_per_tile_index == 2) { + this.non_empty_tiles = Uint16Array(buffer, 0, non_empty_tiles_number); + } else { + this.non_empty_tiles = Uint24Array(buffer, 0, non_empty_tiles_number); + } + offset += bytes_per_tile_index * non_empty_tiles_number; + let tile_buffer = E.toArrayBuffer(s.read(filename, offset, bytes*non_empty_tiles_number)); if (type_size == 24) { this.non_empty_tiles_ends = Uint24Array( - buffer, - 2*non_empty_tiles_number, + tile_buffer, + 0, non_empty_tiles_number ); - offset += 3 * non_empty_tiles_number; } else if (type_size == 16) { this.non_empty_tiles_ends = Uint16Array( - buffer, - 2*non_empty_tiles_number, + tile_buffer, + 0, non_empty_tiles_number ); - offset += 2 * non_empty_tiles_number; } else { throw "unknown size"; } + offset += bytes * non_empty_tiles_number; return [this, offset]; } tile_start_offset(tile_index) { @@ -179,7 +184,8 @@ class Map { offset += 8; // tiles offsets - let res = new TilesOffsets(filename, offset); + let bytes_per_tile_index = (this.grid_size[0] * this.grid_size[1] > 65536)?3:2; + let res = new TilesOffsets(filename, offset, bytes_per_tile_index); this.tiles_offsets = res[0]; offset = res[1]; @@ -250,6 +256,7 @@ class Map { add_to_tile_image(img, absolute_tile_x, absolute_tile_y) { let tile_x = absolute_tile_x - this.first_tile[0]; let tile_y = absolute_tile_y - this.first_tile[1]; + if (tile_x < 0 || tile_y < 0) return; // FIXME: Negative Array index let side = img.getWidth() - 6; let thick = this.color[0] == 1; @@ -314,7 +321,8 @@ class Interests { this.side = side_array[0]; offset += 8; - let res = new TilesOffsets(filename, offset); + let bytes_per_tile_index = (this.grid_size[0] * this.grid_size[1] > 65536)?3:2; + let res = new TilesOffsets(filename, offset, bytes_per_tile_index); offset = res[1]; this.offsets = res[0]; let end = this.offsets.end_offset(); @@ -603,16 +611,16 @@ class Status { ); // disable gps when far from next point and locked - // if (Bangle.isLocked() && !settings.keep_gps_alive) { - // let time_to_next_point = - // (this.distance_to_next_point * 3.6) / settings.max_speed; - // if (time_to_next_point > 60) { - // Bangle.setGPSPower(false, "gipy"); - // setTimeout(function () { - // Bangle.setGPSPower(true, "gipy"); - // }, time_to_next_point); - // } - // } + if (Bangle.isLocked() && !settings.keep_gps_alive) { + let time_to_next_point = + (this.distance_to_next_point * 3.6) / settings.max_speed; + if (time_to_next_point > 60) { + Bangle.setGPSPower(false, "gipy"); + setTimeout(function () { + Bangle.setGPSPower(true, "gipy"); + }, time_to_next_point); + } + } let reaching_waypoint = this.path.is_waypoint(next_point); if (this.distance_to_next_point <= 100) { if (reaching_waypoint || !settings.sleep_between_waypoints) { diff --git a/apps/gipy/metadata.json b/apps/gipy/metadata.json index 5819f2d4c..04ff05caf 100644 --- a/apps/gipy/metadata.json +++ b/apps/gipy/metadata.json @@ -2,7 +2,7 @@ "id": "gipy", "name": "Gipy", "shortName": "Gipy", - "version": "0.26", + "version": "0.28", "description": "Follow gpx files using the gps. Don't get lost in your bike trips and hikes.", "allow_emulator":false, "icon": "gipy.png", diff --git a/apps/gipy/pkg/gps.d.ts b/apps/gipy/pkg/gps.d.ts index 6e2c14f5a..ebf3c8456 100644 --- a/apps/gipy/pkg/gps.d.ts +++ b/apps/gipy/pkg/gps.d.ts @@ -1,5 +1,5 @@ /* tslint:disable */ - +/* eslint-disable */ /** * @param {Gps} gps */ @@ -80,11 +80,11 @@ export interface InitOutput { readonly __wbindgen_malloc: (a: number) => number; readonly __wbindgen_realloc: (a: number, b: number, c: number) => number; readonly __wbindgen_export_2: WebAssembly.Table; - readonly wasm_bindgen__convert__closures__invoke1_mut__hc18aa489d857d6a0: (a: number, b: number, c: number) => void; + readonly wasm_bindgen__convert__closures__invoke1_mut__h175ee3b9ff4e5b4c: (a: number, b: number, c: number) => void; readonly __wbindgen_add_to_stack_pointer: (a: number) => number; readonly __wbindgen_free: (a: number, b: number) => void; readonly __wbindgen_exn_store: (a: number) => void; - readonly wasm_bindgen__convert__closures__invoke2_mut__h41c3b5af183df3b2: (a: number, b: number, c: number, d: number) => void; + readonly wasm_bindgen__convert__closures__invoke2_mut__h41622a4cb7018e76: (a: number, b: number, c: number, d: number) => void; } export type SyncInitInput = BufferSource | WebAssembly.Module; diff --git a/apps/gipy/pkg/gps.js b/apps/gipy/pkg/gps.js index 0f8b74804..d98a5c05b 100644 --- a/apps/gipy/pkg/gps.js +++ b/apps/gipy/pkg/gps.js @@ -98,6 +98,14 @@ function takeObject(idx) { return ret; } +const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +function getStringFromWasm0(ptr, len) { + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); +} + function addHeapObject(obj) { if (heap_next === heap.length) heap.push(heap.length + 1); const idx = heap_next; @@ -107,14 +115,6 @@ function addHeapObject(obj) { return idx; } -const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -function getStringFromWasm0(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); -} - function debugString(val) { // primitive types const type = typeof val; @@ -205,7 +205,7 @@ function makeMutClosure(arg0, arg1, dtor, f) { return real; } function __wbg_adapter_24(arg0, arg1, arg2) { - wasm.wasm_bindgen__convert__closures__invoke1_mut__hc18aa489d857d6a0(arg0, arg1, addHeapObject(arg2)); + wasm.wasm_bindgen__convert__closures__invoke1_mut__h175ee3b9ff4e5b4c(arg0, arg1, addHeapObject(arg2)); } function _assertClass(instance, klass) { @@ -389,7 +389,7 @@ function handleError(f, args) { } } function __wbg_adapter_86(arg0, arg1, arg2, arg3) { - wasm.wasm_bindgen__convert__closures__invoke2_mut__h41c3b5af183df3b2(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); + wasm.wasm_bindgen__convert__closures__invoke2_mut__h41622a4cb7018e76(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); } /** @@ -464,10 +464,6 @@ function getImports() { imports.wbg.__wbindgen_object_drop_ref = function(arg0) { takeObject(arg0); }; - imports.wbg.__wbindgen_object_clone_ref = function(arg0) { - const ret = getObject(arg0); - return addHeapObject(ret); - }; imports.wbg.__wbindgen_string_new = function(arg0, arg1) { const ret = getStringFromWasm0(arg0, arg1); return addHeapObject(ret); @@ -476,6 +472,10 @@ function getImports() { const ret = fetch(getObject(arg0)); return addHeapObject(ret); }; + imports.wbg.__wbindgen_object_clone_ref = function(arg0) { + const ret = getObject(arg0); + return addHeapObject(ret); + }; imports.wbg.__wbg_signal_31753ac644b25fbb = function(arg0) { const ret = getObject(arg0).signal; return addHeapObject(ret); @@ -695,8 +695,8 @@ function getImports() { const ret = wasm.memory; return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper2356 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 293, __wbg_adapter_24); + imports.wbg.__wbindgen_closure_wrapper2375 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 301, __wbg_adapter_24); return addHeapObject(ret); }; diff --git a/apps/gipy/pkg/gps_bg.wasm b/apps/gipy/pkg/gps_bg.wasm index c9e212a13..cfdf4be5f 100644 Binary files a/apps/gipy/pkg/gps_bg.wasm and b/apps/gipy/pkg/gps_bg.wasm differ diff --git a/apps/gipy/pkg/gps_bg.wasm.d.ts b/apps/gipy/pkg/gps_bg.wasm.d.ts index 5b84a9229..b6f04ad71 100644 --- a/apps/gipy/pkg/gps_bg.wasm.d.ts +++ b/apps/gipy/pkg/gps_bg.wasm.d.ts @@ -1,5 +1,5 @@ /* tslint:disable */ - +/* eslint-disable */ export const memory: WebAssembly.Memory; export function __wbg_gps_free(a: number): void; export function disable_elevation(a: number): void; @@ -14,8 +14,8 @@ export function gps_from_area(a: number, b: number, c: number, d: number, e: num export function __wbindgen_malloc(a: number): number; export function __wbindgen_realloc(a: number, b: number, c: number): number; export const __wbindgen_export_2: WebAssembly.Table; -export function wasm_bindgen__convert__closures__invoke1_mut__hc18aa489d857d6a0(a: number, b: number, c: number): void; +export function wasm_bindgen__convert__closures__invoke1_mut__h175ee3b9ff4e5b4c(a: number, b: number, c: number): void; export function __wbindgen_add_to_stack_pointer(a: number): number; export function __wbindgen_free(a: number, b: number): void; export function __wbindgen_exn_store(a: number): void; -export function wasm_bindgen__convert__closures__invoke2_mut__h41c3b5af183df3b2(a: number, b: number, c: number, d: number): void; +export function wasm_bindgen__convert__closures__invoke2_mut__h41622a4cb7018e76(a: number, b: number, c: number, d: number): void; diff --git a/apps/gipy/settings.js b/apps/gipy/settings.js index e3b00359c..ccc129ce5 100644 --- a/apps/gipy/settings.js +++ b/apps/gipy/settings.js @@ -11,6 +11,7 @@ power_lcd_off: false, powersave_by_default: false, sleep_between_waypoints: false, + keep_gps_alive: true }, require("Storage").readJSON(FILE, true) || {} ); @@ -97,6 +98,13 @@ settings.sleep_between_waypoints = v; writeSettings(); } - } + }, + "keep gps alive": { + value: !!settings.keep_gps_alive, // !! converts undefined to false + onchange: (v) => { + settings.keep_gps_alive = v; + writeSettings(); + }, + }, }); -}); +}) diff --git a/apps/golfview/metadata.json b/apps/golfview/metadata.json index bc3a00f90..cf77f3a26 100644 --- a/apps/golfview/metadata.json +++ b/apps/golfview/metadata.json @@ -3,9 +3,9 @@ "version": "0.03", "description": "This app will provide you with on course data to support your golf game!", "icon": "golfview.png", - "tags": "outdoors, gps", + "tags": "outdoors,gps", "allow_emulator": true, - "supports" : ["BANGLEJS2"], + "supports" : ["BANGLEJS2"], "readme": "README.md", "custom": "custom.html", "storage": [ diff --git a/apps/gpsinfo/gps-info-icon.js b/apps/gpsinfo/gps-info-icon.js index b3f2dd3d4..a07d14ebd 100644 --- a/apps/gpsinfo/gps-info-icon.js +++ b/apps/gpsinfo/gps-info-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("mEwghC/AH4AKg9wC6t3u4uVC6wWBI6t3uJeVuMQCqcBLisAi4XLxAABFxAXKgc4DBAuBRhQXEDAq7MmYXEwBHEXZYXFGAOqAAKDMmczC4mIC62CC50PC4JIBkQABiIvRmURAAUSjQXSFwMoxGKC6CRFwUSVYgXLPIgXXwMYegoXLJAYXCGBnzGA0hPQIwMgYwGC6gwCC4ZIMC4gYBC604C4ZISmcRVgapQAAMhC6GIJIwXCMBcIxGDDBAuLC4IwGAARGMAAQWGmAXPJQoWMC4pwCCpoXJAB4XXAH4A/ABQA=")) +require("heatshrink").decompress(atob("mEw4UA///31lAQM0hRL/ACED4ALJh4LKn4jK/iMLBRMMCxQuFgNUFxMFqtALoXwBYklqoYCNI0pqtVGpALCoE/Og2pBYNU/4uFgGqBYNVBZV/BZG//4ABBY+f6oYBHY2q0okBvpTG1RICvp6CAAcqHgQLJyoLBqALHGAN9VYgABhQwCuqSGBYIwBBY8CBYOVBYI8FBYWl+oLGMAIABBYJIGBYQjBBY1aEgQLHqwYCBY0BqtqBYOpHYoLBDAYiFgqaBpWq0ALILgwLZAH4AFA")) diff --git a/apps/gpsnav/README.md b/apps/gpsnav/README.md index 2b67799b8..5d1851b77 100644 --- a/apps/gpsnav/README.md +++ b/apps/gpsnav/README.md @@ -1,6 +1,6 @@ ## gpsnav - navigate to waypoints -The app is aimed at small boat navigation although it can also be used to mark the location of your car, bicycle etc and then get directions back to it. Please note that it would be foolish in the extreme to rely on this as your only boat navigation aid! +The app is aimed at small boat navigation, although it can also be used to mark the location of your car, bicycle etc and then get directions back to it. Please note that it would be foolish in the extreme to rely on this as your only boat navigation aid! The app displays direction of travel (course), speed, direction to waypoint (bearing) and distance to waypoint. The screen shot below is before the app has got a GPS fix. @@ -13,11 +13,11 @@ The large digits are the course and speed. The top of the display is a linear co ![](waypoint_screen.jpg) -The display shows that Stone Henge is 108.75Km from the location where I made the screenshot and the direction is 255 degrees - approximately west. The display shows that I am currently moving approximately north - albeit slowly!. The position of the blue circle indicates that I need to turn left to get on course to Stone Henge. When the circle and red triangle line up you are on course and course will equal bearing. +The display shows that Stone Henge is 108.75km from the location where I made the screenshot and the direction is 255 degrees - approximately west. The display shows that I am currently moving approximately north - albeit slowly! The position of the blue circle indicates that I need to turn left to get on course to Stone Henge. When the circle and red triangle line up you are on course and course will equal bearing. ### Marking Waypoints -The app lets you mark your current location as follows. There are vacant slots in the waypoint file which can be allocated a location. In the distributed waypoint file these are labelled WP0 to WP4. Select one of these - WP2 is shown below. +The app lets you mark your current location as follows. There are vacant slots in the waypoint file which can be allocated a location. In the distributed waypoint file, these are labelled WP0 to WP4. Select one of these - WP2 is shown below. ![](select_screen.jpg) @@ -25,7 +25,7 @@ Bearing and distance are both zero as WP1 has currently no GPS location associat ![](marked_screen.jpg) -The app indicates that WP2 is now marked by adding the prefix @ to it's name. The distance should be small as shown in the screen shot as you have just marked your current location. +The app indicates that WP2 is now marked by adding the prefix @ to it's name. The distance should be small as shown in the screen shot, as you have just marked your current location. ### Waypoint JSON file @@ -60,6 +60,6 @@ You add and delete entries using the Web IDE to load and then save the file from ### Waypoint Editor -Clicking on the download icon of gpsnav in the app loader invokes the waypoint editor. The editor downloads and displays the current `waypoints.json` file. Clicking the `Edit` button beside an entry causes the entry to be deleted from the list and displayed in the edit boxes. It can be restored - by clicking the `Add waypoint` button. A new markable entry is created by using the `Add name` button. The edited `waypoints.json` file is uploaded to the Bangle by clicking the `Upload` button. +Clicking on the download icon of gpsnav in the app loader invokes the waypoint editor. The editor downloads and displays the current `waypoints.json` file. Clicking the `Edit` button beside an entry causes the entry to be deleted from the list and displayed in the edit boxes. It can be restored - by clicking the `Add waypoint` button. A new markable entry is created by using the `Add name` button. The edited `waypoints.json` file is uploaded to the Bangle by clicking the `Upload` button. *Please report bugs etc. by raising an issue [here](https://github.com/jeffmer/JeffsBangleAppsDev). * \ No newline at end of file diff --git a/apps/gpsrec/settings.js b/apps/gpsrec/settings.js index 23a58d58f..287073b0c 100644 --- a/apps/gpsrec/settings.js +++ b/apps/gpsrec/settings.js @@ -1,4 +1,4 @@ (function(back) { - // just go right to our app - we need all the memory + // just go right to our app - we need all the memory */ load("gpsrec.app.js"); -})(); +})() diff --git a/apps/gpssetup/ChangeLog b/apps/gpssetup/ChangeLog index e57d53d8e..f627c37fd 100644 --- a/apps/gpssetup/ChangeLog +++ b/apps/gpssetup/ChangeLog @@ -1,2 +1,4 @@ 0.01: First version of GPS Setup app 0.02: Created gppsetup module +0.03: Added support for Bangle.js2 +0.04: Added adaptive option for PSMOO with Bangle.js2 diff --git a/apps/gpssetup/README.md b/apps/gpssetup/README.md index 8c9445ec9..ad08f4aa4 100644 --- a/apps/gpssetup/README.md +++ b/apps/gpssetup/README.md @@ -48,13 +48,18 @@ used. These settings will remain for all apps that use the GPS. the interval the more time the GPS will spend sleeping in low power mode (7mA) between obtaining fixes (35mA). For walking in open country an update once every 60 seconds is adequate to put - you within a 6 digit grid refernce sqaure. + you within a 6 digit grid refernce sqaure. + + **Note:** For the Bangle.js2, the GPS module does not have a PSMOO mode, and thus this is emulated using on/off timeouts specified using the update and search options. - update - the time between two position fix attempts. - search - the time between two acquisition attempts if the receiver is unable to get a position fix. +- fix_req (Bangle.js2 only) - the number of fixes required before the GPS turns off until next search for GPS signal. default is 1. + +- adaptive (Bangle.js2 only) - When a GPS signal is acquired, this can reduce the time in seconds until next scan to generate higher temporal resolution of gps fixes. Off if set to 0. ## Module A module is provided that'll allow you to set GPS configuration from your own @@ -65,11 +70,13 @@ app. To use it: // needed unless the watch's battery has run down require("gpssetup").setPowerMode(); -// This sets up the PSMOO mode. update/search are optional in seconds +// This sets up the PSMOO mode. update/search/adaptive are optional in seconds require("gpssetup").setPowerMode({ power_mode:"PSMOO", update:optional (default 120), - search:optional (default 5)}) + search:optional (default 5), + adaptive: optional (default 0) + }); // This sets up SuperE require("gpssetup").setPowerMode({power_mode:"SuperE"}) diff --git a/apps/gpssetup/app.js b/apps/gpssetup/app.js index e0d188af5..966000681 100644 --- a/apps/gpssetup/app.js +++ b/apps/gpssetup/app.js @@ -34,6 +34,7 @@ function loadSettings() { settings = require("Storage").readJSON(SETTINGS_FILE,1)||{}; settings.update = settings.update||120; settings.search = settings.search||5; + settings.fix_req = settings.fix_req||1; settings.power_mode = settings.power_mode||"SuperE"; log_debug(settings); } @@ -85,6 +86,16 @@ function showMainMenu() { settings.search = v; updateSettings(); } + }, + 'Fix Req (#)': { + value: settings.fix_req, + min: 1, + max: 100, + step: 1, + onchange: v => { + settings.fix_req = v; + updateSettings(); + } } }; diff --git a/apps/gpssetup/gpssetup.js b/apps/gpssetup/gpssetup.js index f8fed68ff..ad20158b3 100644 --- a/apps/gpssetup/gpssetup.js +++ b/apps/gpssetup/gpssetup.js @@ -1,5 +1,5 @@ const SETTINGS_FILE = "gpssetup.settings.json"; - +const BANGLE_VER = process.env.HWVERSION; //BangleJS2 support function log_debug(o) { //let timestamp = new Date().getTime(); //console.log(timestamp + " : " + o); @@ -106,49 +106,104 @@ function delay(ms) { function setupSuperE() { log_debug("setupGPS() Super-E"); - return Promise.resolve().then(function() { - UBX_CFG_RESET(); - return delay(100); - }).then(function() { - UBX_CFG_PMS(); - return delay(20); - }).then(function() { - UBX_CFG_SAVE(); - return delay(20); - }).then(function() { - log_debug("Powering GPS Off"); - /* - * must be part of the promise chain to ensure that - * setup does not return and powerOff before config functions - * have run - */ - return delay(20); - }); + switch(BANGLE_VER){ + case(1): { + return Promise.resolve().then(function() { + UBX_CFG_RESET(); + return delay(100); + }).then(function() { + UBX_CFG_PMS(); + return delay(20); + }).then(function() { + UBX_CFG_SAVE(); + return delay(20); + }).then(function() { + log_debug("Powering GPS Off"); + /* + * must be part of the promise chain to ensure that + * setup does not return and powerOff before config functions + * have run + */ + return delay(20); + }); + } + case(2):{ + //nothing more to do. + return; + } + } + } function setupPSMOO(settings) { log_debug("setupGPS() PSMOO"); - return Promise.resolve().then(function() { - UBX_CFG_RESET(); - return delay(100); - }).then(function() { - UBX_CFG_PM2(settings.update, settings.search); - return delay(20); - }).then(function() { - UBX_CFG_RXM(); - return delay(20); - }).then(function() { - UBX_CFG_SAVE(); - return delay(20); - }).then(function() { - log_debug("Powering GPS Off"); - /* - * must be part of the promise chain to ensure that - * setup does not return and powerOff before config functions - * have run - */ - return delay(20); - }); + switch(BANGLE_VER){ + case(1):{ + return Promise.resolve().then(function() { + UBX_CFG_RESET(); + return delay(100); + }).then(function() { + UBX_CFG_PM2(settings.update, settings.search); + return delay(20); + }).then(function() { + UBX_CFG_RXM(); + return delay(20); + }).then(function() { + UBX_CFG_SAVE(); + return delay(20); + }).then(function() { + log_debug("Powering GPS Off"); + /* + * must be part of the promise chain to ensure that + * setup does not return and powerOff before config functions + * have run + */ + return delay(20); + }); + } + case(2): { + var gpsTimeout = null; + var gpsActive = false; + var fix = 0; + var lastFix = false; + function cb(f){ + if(parseInt(f.fix) === 1){ + fix++; + lastFix = true; + if(fix >= settings.fix_req){ + fix = 0; + turnOffGPS(); + } + } + } + function turnOffGPS() { + if (!gpsActive) return; + gpsActive = false; + clearTimeout(gpsTimeout); + Bangle.setGPSPower(0,settings.appName); + Bangle.removeListener('GPS', cb); // cleaning it up + var timeout = settings.update * 1000; + if(lastFix && settings.adaptive > 0){ + timeout = settings.adaptive * 1000; + } + lastFix = false; + gpsTimeout = setTimeout(() => { + turnOnGPS(); + }, timeout); + } + function turnOnGPS(){ + if (gpsActive) return; + if(!Bangle.isGPSOn()) Bangle.setGPSPower(1,settings.appName); + Bangle.on('GPS',cb); + gpsActive = true; + gpsTimeout = setTimeout(() => { + turnOffGPS(); + }, settings.search * 1000); + } + turnOnGPS(); + break; + } + } } /** Set GPS power mode (assumes GPS on), returns a promise. @@ -161,19 +216,26 @@ require("gpssetup").setPowerMode({power_mode:"SuperE"}) // <-- Super E mode See the README for more information */ exports.setPowerMode = function(options) { - settings = require("Storage").readJSON(SETTINGS_FILE,1)||{}; + var settings = require("Storage").readJSON(SETTINGS_FILE,1)||{}; if (options) { if (options.update) settings.update = options.update; if (options.search) settings.search = options.search; + if (options.adaptive) settings.adaptive = options.adaptive; + if (options.fix_req) settings.fix_req = options.fix_req; if (options.power_mode) settings.power_mode = options.power_mode; + if (options.appName) settings.appName = options.appName; } settings.update = settings.update||120; settings.search = settings.search||5; + settings.adaptive = settings.adaptive||0; + settings.fix_req = settings.fix_req||1; //default to just one fix and will turn off settings.power_mode = settings.power_mode||"SuperE"; + settings.appName = settings.appName||"gpssetup"; if (options) require("Storage").write(SETTINGS_FILE, settings); + if(!Bangle.isGPSOn()) Bangle.setGPSPower(1,settings.appName); //always know its on - no point calling this otherwise!!! if (settings.power_mode === "PSMOO") { return setupPSMOO(settings); } else { return setupSuperE(); } -}; +}; \ No newline at end of file diff --git a/apps/gpssetup/metadata.json b/apps/gpssetup/metadata.json index b8b6dfc23..1d9970d86 100644 --- a/apps/gpssetup/metadata.json +++ b/apps/gpssetup/metadata.json @@ -2,11 +2,11 @@ "id": "gpssetup", "name": "GPS Setup", "shortName": "GPS Setup", - "version": "0.02", + "version": "0.04", "description": "Configure the GPS power options and store them in the GPS nvram", "icon": "gpssetup.png", "tags": "gps,tools,outdoors", - "supports": ["BANGLEJS"], + "supports": ["BANGLEJS","BANGLEJS2"], "readme": "README.md", "storage": [ {"name":"gpssetup","url":"gpssetup.js"}, diff --git a/apps/gpssetup/settings.js b/apps/gpssetup/settings.js index 0e3c621d1..59988b788 100644 --- a/apps/gpssetup/settings.js +++ b/apps/gpssetup/settings.js @@ -1,4 +1,4 @@ (function(back) { - // just go right to our app + /* just go right to our app*/ load("gpssetup.app.js"); -})(); +})() diff --git a/apps/grandfatherclock/ChangeLog b/apps/grandfatherclock/ChangeLog new file mode 100644 index 000000000..a21dc397d --- /dev/null +++ b/apps/grandfatherclock/ChangeLog @@ -0,0 +1,2 @@ +0.01: New Widget! +0.02: rename, new icon, settings menu! diff --git a/apps/grandfatherclock/README.md b/apps/grandfatherclock/README.md new file mode 100644 index 000000000..b701164cc --- /dev/null +++ b/apps/grandfatherclock/README.md @@ -0,0 +1,26 @@ +# Grandfather Clock + +A widget that runs in the background and chimes on every (configurable) fraction of an hour, similar to Chimer, and counts out the fractions and the o'clock hour. + +## Usage + +Once installed, see the App Settings page for options. + +Defaults: +- Twelve hour mode is ENABLED. +- Swap meridian is DISABLED. (in the AM, there will be a single buzz after counting the hours. in the PM, there will be two buzzes after counting the hours) +- The attention buzz for the hour chime is 1000ms long. +- The buzz for each hour count is 250ms long. +- The buzz for each fraction count is 250ms long. +- The widget will count out 4 fractions of an hour (a 15 min interval). +- The time between count buzzes is 500ms. +- The meridian buzzes are 50ms long. +- The time between meridian buzzes is 300ms. + +## Requests + +Drop me a message at @yogsoy on Discord if you need help / discover a bug that I can squash for you. + +## Creator + +Written by June B (yogsoy), inspired by aaronrolls' Chimer. diff --git a/apps/grandfatherclock/icon.png b/apps/grandfatherclock/icon.png new file mode 100644 index 000000000..8dc851c04 Binary files /dev/null and b/apps/grandfatherclock/icon.png differ diff --git a/apps/grandfatherclock/metadata.json b/apps/grandfatherclock/metadata.json new file mode 100644 index 000000000..053e384d6 --- /dev/null +++ b/apps/grandfatherclock/metadata.json @@ -0,0 +1,18 @@ +{ "id": "grandfatherclock", + "name": "Grandfather Clock Widget", + "shortName":"Grandfather Clock", + "version":"0.02", + "description": "A widget that chimes every fraction of an hour (similar to Chimer), and counts out the fractions and the o'clock hour.", + "icon": "icon.png", + "type": "widget", + "tags": "widget", + "supports" : ["BANGLEJS2"], + "readme": "README.md", + "storage": [ + {"name":"grandfatherclock.wid.js","url":"widget.js"}, + {"name":"grandfatherclock.settings.js","url":"settings.js"} + ], + "data": [ + {"name":"grandfatherclock.json"} + ] +} diff --git a/apps/grandfatherclock/settings.js b/apps/grandfatherclock/settings.js new file mode 100644 index 000000000..6401dffa5 --- /dev/null +++ b/apps/grandfatherclock/settings.js @@ -0,0 +1,89 @@ +(function(back) { + + const configFile = "grandfatherclock.json"; + + let config = Object.assign({ + draw_widget: true, + twelve_hour: true, + swap_meridian: false, + hour_attention_buzz_ms: 1000, + hour_count_buzz_ms: 250, + fraction_count_buzz_ms: 250, + fractions_of_hour: 4, // 4 = 15min intervals, 6 = 10min intervals + wait_ms: 500, + meridian_buzz_ms: 50, + meridian_buzz_wait_ms: 300 + }, require('Storage').readJSON("grandfatherclock.json", true) || {}); + + let writeConfig = function() { + require('Storage').writeJSON(configFile, config); + }; + + E.showMenu({ + "": {"title" : "Grandfather Clock"}, + "< Back": () => back(), + "Draw widget": { + value: config.draw_widget, + onchange: v => { + config.draw_widget = v; + writeConfig(); + } + }, + "12 hour": { + value: config.twelve_hour, + onchange: v => { + config.twelve_hour = v; + writeConfig(); + } + },"Swap meridian": { + value: config.swap_meridian, + onchange: v => { + config.swap_meridian = v; + writeConfig(); + } + },"Hr attn. buzz length (ms)": { + value: config.hour_attention_buzz_ms, + onchange: v => { + config.hour_attention_buzz_ms = v; + writeConfig(); + } + },"Hr count buzz (ms)": { + value: config.hour_count_buzz_ms, + onchange: v => { + config.hour_count_buzz_ms = v; + writeConfig(); + } + },"Frac. count buzz (ms)": { + value: config.fraction_count_buzz_ms, + onchange: v => { + config.fraction_count_buzz_ms = v; + writeConfig(); + } + },"Fracs. of hour": { + value: config.fractions_of_hour, + onchange: v => { + config.fractions_of_hour = v; + writeConfig(); + } + },"Count wait (ms)": { + value: config.wait_ms, + onchange: v => { + config.wait_ms = v; + writeConfig(); + } + },"Meridian buzz (ms)": { + value: config.meridian_buzz_ms, + onchange: v => { + config.meridian_buzz_ms = v; + writeConfig(); + } + },"Meridian wait (ms)": { + value: config.meridian_buzz_wait_ms, + onchange: v => { + config.meridian_buzz_wait_ms = v; + writeConfig(); + } + } + }); + +}) diff --git a/apps/grandfatherclock/widget.js b/apps/grandfatherclock/widget.js new file mode 100644 index 000000000..96e121e63 --- /dev/null +++ b/apps/grandfatherclock/widget.js @@ -0,0 +1,81 @@ +(() => { + + // sensible defaults + let config = Object.assign({ + draw_widget: true, + twelve_hour: true, + swap_meridian: false, + hour_attention_buzz_ms: 1000, + hour_count_buzz_ms: 250, + fraction_count_buzz_ms: 250, + fractions_of_hour: 4, // 4 = 15min intervals, 6 = 10min intervals + wait_ms: 500, + meridian_buzz_ms: 50, + meridian_buzz_wait_ms: 300 + }, require('Storage').readJSON("grandfatherclock.json", true) || {}); // or, load the app settings file. + + WIDGETS["grandfatherclock"] = { + area: "tr", + width: config.draw_widget ? 16 : 0, + draw: function() { + if (config.draw_widget) { + g.reset(); + g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); + } + } + }; + + let date; + let fractionMs = 3600000 / config.fractions_of_hour; + + let chime = function () { + date = new Date(); + let hourFrac = Math.floor(date.getMinutes() / (60 / config.fractions_of_hour)); + + if (hourFrac == 0) { // if it's an o'clock hour + let chimeHour = (config.twelve_hour ? date.getHours() % 12 : date.getHours()); + if (chimeHour == 0) (config.twelve_hour ? chimeHour += 12 : chimeHour += 24); + + Bangle.buzz(config.hour_attention_buzz_ms).then(() => { // initial buzz + setTimeout(hourChime, config.wait_ms, chimeHour); // wait a period before doing the first chime + }); + } else { // if it's a fraction of an hour + fractionChime(hourFrac); + } + + queueNextChime(); + }; + + let hourChime = function (hoursLeftToChime) { + hoursLeftToChime--; + Bangle.buzz(config.hour_count_buzz_ms).then(() => { // recursive. buzz and wait to do the next buzz. + if (hoursLeftToChime > 0) { + setTimeout(hourChime, config.wait_ms, hoursLeftToChime); + } else if (config.twelve_hour) { // once finished with the hour count + setTimeout(meridianChime, config.wait_ms, (date.getHours() >= 12)); // if in twelve hour mode, queue up the meridian chime. + } + }); + }; + + let fractionChime = function (fractionsLeftToChime) { + fractionsLeftToChime--; + Bangle.buzz(config.fraction_count_buzz_ms).then(() => { // recursive. buzz and wait to do the next buzz. + if (fractionsLeftToChime > 0) setTimeout(fractionChime, config.wait_ms, fractionsLeftToChime); + }); + }; + + let meridianChime = function (meridian) { + if ((config.swap_meridian ? !meridian : meridian)) { // default: if PM + Bangle.buzz(config.meridian_buzz_ms).then(setTimeout(Bangle.buzz, config.meridian_buzz_wait_ms, config.meridian_buzz_ms)); // buzz once, wait, buzz again. + } else { // default: if AM + Bangle.buzz(config.meridian_buzz_ms); // buzz once. + } + }; + + let queueNextChime = function () { + let msUntilNextFraction = fractionMs - (Date.now() % fractionMs); + setTimeout(chime, msUntilNextFraction); + }; + + queueNextChime(); +})() diff --git a/apps/guitar/metadata.json b/apps/guitar/metadata.json index 0dc6893d6..7b4683c47 100644 --- a/apps/guitar/metadata.json +++ b/apps/guitar/metadata.json @@ -4,8 +4,8 @@ "version": "0.03", "description": "Wrist mounted guitar chords", "icon": "app.png", - "tags": "guitar, chords", - "supports" : ["BANGLEJS2"], + "tags": "guitar,chords", + "supports" : ["BANGLEJS2"], "readme": "README.md", "storage": [ {"name":"guitar.app.js","url":"app.js"}, diff --git a/apps/guitarsongs/metadata.json b/apps/guitarsongs/metadata.json index 242850a70..18e1f7146 100644 --- a/apps/guitarsongs/metadata.json +++ b/apps/guitarsongs/metadata.json @@ -5,7 +5,7 @@ "description": "Songs lyrics and guitar chords", "icon": "app.png", "screenshots": [{"url": "screenshot.png"}], - "tags": "guitar, song, lyrics, chords", + "tags": "guitar,song,lyrics,chords", "supports" : ["BANGLEJS2"], "interface": "manage_songs.html", "readme": "README.md", diff --git a/apps/hadash/.gitignore b/apps/hadash/.gitignore new file mode 100644 index 000000000..c758274ef --- /dev/null +++ b/apps/hadash/.gitignore @@ -0,0 +1,4 @@ +hadash.json +node_modules +package-lock.json +package.json diff --git a/apps/hadash/ChangeLog b/apps/hadash/ChangeLog new file mode 100644 index 000000000..e38271f24 --- /dev/null +++ b/apps/hadash/ChangeLog @@ -0,0 +1,2 @@ +1.00: initial release +1.01: remember scoll positions of menus; "silent" option for service calls diff --git a/apps/hadash/README.md b/apps/hadash/README.md new file mode 100644 index 000000000..7fc50585f --- /dev/null +++ b/apps/hadash/README.md @@ -0,0 +1,66 @@ +# Home-Assistant Dashboard + +This app interacts with a Home-Assistant (HA) instance. You can query entity +states and call services. This allows you access to up-to-date information of +any home automation system integrated into HA, and you can also control your +automations from your wrist. + +![](screenshot.png) + + +## How It Works + +This app uses the REST API to directly interact with HA (which requires a +"long-lived access token" - refer to "Configuration"). + +You can define a menu structure to be displayed on your Bangle, with the states +to be queried and services to be called. Menu entries can be: + +* entry to show the state of a HA entity +* entry to call a HA service +* sub-menus, including nested sub-menus + +Calls to a service can also have optional input for data fields on the Bangle +itself. + + +## Configuration + +After installing the app, use the "interface" page (floppy disk icon) in the +App Loader to configure it. + +Make sure to set the "Home-Assistant API Base URL" (which must include the +"/api" path, as well - but no slash at the end). + +Also create a "long-lived access token" in HA (under the Profile section, at +the bottom) and enter it as the "Long-lived access token". + +The tricky bit will be to configure your menu structure. You need to have a +basic understanding of the JSON format. The configuration page uses a JSON +Editor which will check the syntax and highlight any errors for you. Follow the +instructions on the page regarding how to configure menus, menu entries and the +required attributes. It also contains examples. + +Once you're happy with the menu structure (and you've entered the base URL and +access token), click the "Configure / Upload to Bangle" button. + + +## Security + +The "long-lived access token" will be stored unencrypted on your Bangle. This +would - in theory - mean that if your Bangle gets stolen, the new "owner" would +have unrestricted access to your Home-Assistant instance (the thief would have +to be fairly tech-savvy, though). However, I suggest you create a separate +token exclusively for your Bangle - that way, it's very easy to simply delete +that token in case your watch is stolen or lost. + + +## To-Do + +- A better way to configure the menu structure would be useful, something like a custom editor (replacing the jsoneditor). + + +## Author + +Flaparoo [github](https://github.com/flaparoo) + diff --git a/apps/hadash/hadash-icon.js b/apps/hadash/hadash-icon.js new file mode 100644 index 000000000..a66e9e687 --- /dev/null +++ b/apps/hadash/hadash-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwgmjhGACyuIxAYUCwIABFyowUCwYwSFwgwSCwowQFwwwQCw4wOFxAwOCxIwMFwuDnAwPCwv//4YFFx0/C4PzGBpXFCwIABMJiMGC5IwGQ4wXJGAq7HC5QwEW4+PCwP4YZTqJFxAwEdBIXKGAQXWIxIXMwAXXBRIXFwYFBnATKC5E/AoPzC6bdKC/4XTx4WCO5CbGC4YuDU5CbGC4QuCma+JKYwECXhoXIFwTsLC5DrONgxzMO4woDFx6nDFIYuPJQoqBFx4ADRIYuSGAiUEGCQXUYg4wUC6YwDBpUIGBYWJwA")) diff --git a/apps/hadash/hadash.app.js b/apps/hadash/hadash.app.js new file mode 100644 index 000000000..ea8c4c428 --- /dev/null +++ b/apps/hadash/hadash.app.js @@ -0,0 +1,247 @@ +/* + * Home-Assistant Dashboard - Bangle.js + */ + +const APP_NAME = 'hadash'; + +var scroller; + +// Load settings +var settings = Object.assign({ + menu: [ + { type: 'state', title: 'Check for updates', id: 'update.home_assistant_core_update' }, + { type: 'service', title: 'Create Notification', domain: 'persistent_notification', service: 'create', + data: { 'message': 'test notification', 'title': 'Test'} }, + { type: 'menu', title: 'Sub-menu', data: + [ + { type: 'state', title: 'Check for Supervisor updates', id: 'update.home_assistant_supervisor_update' }, + { type: 'service', title: 'Restart HA', domain: 'homeassistant', service: 'restart', silent: true, data: {} } + ] + }, + { type: 'service', title: 'Custom Notification', domain: 'persistent_notification', service: 'create', + data: { 'title': 'Not via input'}, + input: { 'message': { options: [], value: 'Pre-filled text' }, + 'notification_id': { options: [ 123, 456, 136 ], value: 999, label: "ID" } } }, + ], + HAbaseUrl: '', + HAtoken: '', +}, require('Storage').readJSON(APP_NAME+'.json', true) || {}); + + +// wrapper to show a menu (preserving scroll position) +function showScrollerMenu(menu) { + const r = E.showMenu(menu).scroller; + scroller = r; + return r; +} + + +// query an entity state +function queryState(title, id, level) { + menus[level][''].scroll = scroller.scroll; + E.showMessage('Fetching entity state from HA', { title: title }); + Bangle.http(settings.HAbaseUrl+'/states/'+id, { + headers: { + 'Authorization': 'Bearer '+settings.HAtoken, + 'Content-Type': 'application/json' + }, + }).then(data => { + //console.log(data); + let HAresp = JSON.parse(data.resp); + let title4prompt = title; + let msg = HAresp.state; + if ('attributes' in HAresp) { + if ('friendly_name' in HAresp.attributes) + title4prompt = HAresp.attributes.friendly_name; + if ('unit_of_measurement' in HAresp.attributes) + msg += HAresp.attributes.unit_of_measurement; + } + E.showPrompt(msg, { title: title4prompt, buttons: {OK: true} }).then((v) => { showScrollerMenu(menus[level]); }); + }).catch( error => { + console.log(error); + E.showPrompt('Error querying state!', { title: title, buttons: {OK: true} }).then((v) => { showScrollerMenu(menus[level]); }); + }); +} + + +// call a service +function callService(title, domain, service, data, level, silent) { + menus[level][''].scroll = scroller.scroll; + E.showMessage('Calling HA service', { title: title }); + Bangle.http(settings.HAbaseUrl+'/services/'+domain+'/'+service, { + method: 'POST', + body: data, + headers: { + 'Authorization': 'Bearer '+settings.HAtoken, + 'Content-Type': 'application/json' + }, + }).then(data => { + //console.log(data); + if (! silent) { + return E.showPrompt('Service called successfully', { title: title, buttons: {OK: true} }); + } + }).then(() => { + showScrollerMenu(menus[level]); + }).catch( error => { + console.log(error); + E.showPrompt('Error calling service!', { title: title, buttons: {OK: true} }).then((v) => { showScrollerMenu(menus[level]); }); + }); +} + + +// callbacks for service input menu entries +function serviceInputChoiceChange(v, key, entry, level) { + entry.input[key].value = entry.input[key].options[v]; + getServiceInputData(entry, level); +} + +function serviceInputFreeform(key, entry, level) { + require("textinput").input({text: entry.input[key].value}).then(result => { + entry.input[key].value = result; + getServiceInputData(entry, level); + }); +} + +// get input data before calling a service +function getServiceInputData(entry, level) { + menus[level][''].scroll = scroller.scroll; + let serviceInputMenu = { + '': { + 'title': entry.title, + 'back': () => showScrollerMenu(menus[level]) + }, + }; + let CBs = {}; + for (let key in entry.input) { + // pre-fill data with default values + if ('value' in entry.input[key]) + entry.data[key] = entry.input[key].value; + + let label = ( ('label' in entry.input[key] && entry.input[key].label) ? entry.input[key].label : key ); + let key4CB = key; + + if ('options' in entry.input[key] && entry.input[key].options.length) { + // give choice from a selection of options + let idx = -1; + for (let i in entry.input[key].options) { + if (entry.input[key].value == entry.input[key].options[i]) { + idx = i; + } + } + if (idx == -1) { + idx = entry.input[key].options.push(entry.input[key].value) - 1; + } + // the setTimeout method can not be used for the "format" CB since it expects a return value: + CBs[`${key}_format`] = ((key) => function(v) { return entry.input[key].options[v]; })(key); + serviceInputMenu[label] = { + value: parseInt(idx), + min: 0, + max: entry.input[key].options.length - 1, + format: CBs[key+'_format'], + onchange: (v) => setTimeout(serviceInputChoiceChange, 10, v, key4CB, entry, level) + }; + + } else { + // free-form text input + serviceInputMenu[label] = () => setTimeout(serviceInputFreeform, 10, key4CB, entry, level); + } + } + // menu entry to actually call the service: + serviceInputMenu['Call service'] = function() { callService(entry.title, entry.domain, entry.service, entry.data, level, entry.silent); }; + E.showMenu(serviceInputMenu); +} + + +// menu hierarchy +var menus = []; + + +// add menu entries +function addMenuEntries(level, entries) { + for (let i in entries) { + let entry = entries[i]; + let entryCB; + + // is there a menu entry title? + if (! ('title' in entry) || ! entry.title) + entry.title = 'TBD'; + + switch (entry.type) { + case 'state': + /* + * query entity state + */ + if ('id' in entry && entry.id) { + entryCB = () => setTimeout(queryState, 10, entry.title, entry.id, level); + } + break; + + case 'service': + /* + * call HA service + */ + if (! ('silent' in entry)) + entry.silent = false; + if ('domain' in entry && entry.domain && 'service' in entry && entry.service) { + if (! ('data' in entry)) + entry.data = {}; + if ('input' in entry) { + // get input for some data fields first + entryCB = () => setTimeout(getServiceInputData, 10, entry, level); + } else { + // call service straight away + entryCB = () => setTimeout(callService, 10, entry.title, entry.domain, entry.service, entry.data, level, entry.silent); + } + } + break; + + case 'menu': + /* + * sub-menu + */ + entryCB = () => setTimeout(showSubMenu, 10, level + 1, entry.title, entry.data); + break; + } + + // only attach a call-back to menu entry if it's properly configured + if (! entryCB) { + menus[level][entry.title + ' - not correctly configured!'] = {}; + } else { + menus[level][entry.title] = entryCB; + } + } +} + + +// create and show a sub menu +function showSubMenu(level, title, entries) { + menus[level - 1][''].scroll = scroller.scroll; + menus[level] = { + '': { + 'title': title, + 'back': () => showScrollerMenu(menus[level - 1]) + }, + }; + addMenuEntries(level, entries); + showScrollerMenu(menus[level]); +} + + +/* + * create the main menu + */ +menus[0] = { + '': { + 'title': 'HA-Dash', + 'back': () => load() + }, +}; +addMenuEntries(0, settings.menu); + +// check required configuration +if (! settings.HAbaseUrl || ! settings.HAtoken) { + E.showAlert('The app is not yet configured!', 'HA-Dash').then(() => showScrollerMenu(menus[0])); +} else { + showScrollerMenu(menus[0]); +} + diff --git a/apps/hadash/hadash.png b/apps/hadash/hadash.png new file mode 100644 index 000000000..cfbb8d3b1 Binary files /dev/null and b/apps/hadash/hadash.png differ diff --git a/apps/hadash/interface.html b/apps/hadash/interface.html new file mode 100644 index 000000000..2418c4098 --- /dev/null +++ b/apps/hadash/interface.html @@ -0,0 +1,261 @@ + + + + + + +
+ + +
+ Make sure to include "/api" as the URL path, but no slash at the end. +
+
+ + +
+ It's recommended to create a dedicated token for your Bangle. +
+
+ +
+ +

Menu structure

+ +

Use the editor below to configure the menu structure displayed in the + Bangle app. It is in the JSON format.

+ +

The main menu, and any sub-menus, are arrays. They can contain 3 + different types of entries (objects) defined by the "type" attribute:

+
    +
  • + Query an Entity State +
    +{
    +  "type": "state",
    +  "title": "Menu entry title",
    +  "id": "HA Entity ID"
    +}
    +        
    + The required Entity ID can be looked up in HA under Settings -> + Devices & Services -> Entities. For example: +
    +{
    +  "type": "state",
    +  "title": "Check for updates",
    +  "id": "update.home_assistant_core_update"
    +}
    +        
    +
  • +
  • + Call a HA service +
    +{
    +  "type": "service",
    +  "title": "Menu entry title",
    +  "domain": "HA Domain",
    +  "service": "HA Service",
    +  "silent": (true|false),
    +  "data": {
    +    "key": "value"
    +  }
    +}
    +        
    +

    The required information to call a HA service can be found in HA + under the Developer tools -> Services. Use the "Go to YAML Mode" + function to see the actual names and values. The domain and service + parts are the 2 parts of the service name which are separated by a dot. + If the optional "silent" boolean is set to true (false is default), + there will be no message in case of a successful call. Any (optional) + data key/value pairs can be added under the "data" field. For example, + here's a service call YAML: +

    +service: persistent_notification.create
    +data:
    +  message: test Notification
    +  title: Test
    +        
    + The resulting menu entry (JSON object) should be: +
    +{
    +  "type": "service",
    +  "title": "Create Notification",
    +  "domain": "persistent_notification",
    +  "service": "create",
    +  "data": {
    +    "message": "test Notification",
    +    "title": "Test"
    +  }
    +}
    +        
    + If the service requires a target, include the + "entity_id"/"device_id"/etc. (listed under "target:") also as "data" + key/value pairs. For example, if the YAML also includes: +
    +target:
    +  device_id: abcd1234
    +        
    + ... add another "data" key/value pair: "device_id": "abcd1234". + If that doesn't work, list the device (or entity) ID in an array: + "device_id": [ "abcd1234" ]

    + +

    Data fields can also have variable input on the Bangle. In that + case, don't add the key/value pair under "data", but create an "input" + object with entries per "data" key: +

    +{
    +  "key": {
    +    "options": [],
    +    "value": "",
    +    "label": ""
    +  }
    +}
    +        
    + If "options" is left empty, the preferred text-input (pick your + favourite app - I like the dragboard) is called to allow entering a + free-form value. Otherwise, list the allowed values in the "options" + array. The "value" is the pre-defined/default value. The "label" is + optional and can be used to override the label for this key (as + displayed on the Bangle). For example: +
    +{
    +  "type": "service",
    +  "title": "Custom Notification",
    +  "domain": "persistent_notification",
    +  "service": "create",
    +  "data": {
    +    "title": "Fixed"
    +  },
    +  "input": {
    +    "message": {
    +      "options": [],
    +      "value": "Pre-filled text"
    +    },
    +    "notification_id": {
    +      "options": [
    +        "123",
    +        "456",
    +        "136"
    +      ],
    +      "value": "999",
    +      "label": "ID"
    +    }
    +  }
    +}
    +        
    + In the above example, the "data" will have 3 key/value pairs when the + service is called: the "title" is always the same, "message" can be + entered via the (free-form) text-input and "notification_id" can be + selected from a list of numbers (however, the prompt will be for "ID" + and not "notification_id"). If the default value is not listed in + "options" (like "999"), it will be added to that list.

    +
  • +
  • + Sub-menu +
    +{
    +  "type": "menu",
    +  "title": "Menu entry / sub-menu title",
    +  "data": []
    +}
    +        
    + The "data" needs to be another array of menu entries. For example: +
    +{
    +  "type": "menu",
    +  "title": "Sub-menu",
    +  "data": [
    +    {
    +      "type": "state",
    +      "title": "Check for Supervisor updates",
    +      "id": "update.home_assistant_supervisor_update"
    +    },
    +    {
    +      "type": "service",
    +      "title": "Restart HA",
    +      "domain": "homeassistant",
    +      "service": "restart",
    +      "data": {}
    +    }
    +  ]
    +}
    +        
    + Sub-menus can contain other sub-menus, so you can have multiple levels + of nested menus. +
  • +
+ +
+ +
+ +

+ + + + + + + + + + + + diff --git a/apps/hadash/jsoneditor.bundlejs b/apps/hadash/jsoneditor.bundlejs new file mode 100644 index 000000000..051abb9ff --- /dev/null +++ b/apps/hadash/jsoneditor.bundlejs @@ -0,0 +1,39053 @@ +(() => { + // node_modules/vanilla-jsoneditor/standalone.js + var e; + var t; + var n; + var r; + var o; + var i; + var a; + var s; + var c; + var l; + var u; + var f; + var d; + var h; + var v; + var p; + var m; + var g; + var y; + var b; + var k; + var w; + var x; + var j; + var S; + var C; + var $; + var _; + var O; + var M; + var E; + var A; + var P; + var T; + var R; + var N; + var I; + var D; + var q; + var z; + var B; + var L; + var F; + var V; + var H; + var W; + var U; + var J; + var K; + var G; + var Q; + var Y; + var X; + var Z; + var ee; + var te; + var ne; + var re; + var oe; + var ie; + var ae; + var se; + var ce; + var le; + var ue; + var fe; + var de; + var he; + var ve; + var pe; + var me; + var ge; + var ye; + var be; + var ke; + var we; + var xe; + var je; + var Se; + var Ce; + var $e; + var _e; + var Oe; + var Me; + var Ee; + var Ae; + var Pe; + var Te; + var Re; + var Ne; + var Ie; + var De; + var qe; + var ze; + var Be; + var Le; + var Fe; + var Ve; + var He; + var We; + var Ue; + var Je; + var Ke; + var Ge; + var Qe; + var Ye; + var Xe; + var Ze; + var et; + var tt; + var nt; + var rt; + var ot; + var it; + var at; + var st; + var ct; + var lt; + var ut; + var ft; + var dt; + var ht; + var vt; + var pt; + var mt; + var gt; + var yt; + var bt; + var kt; + var wt; + var xt; + var jt; + var St; + var Ct; + var $t; + var _t; + var Ot; + var Mt; + var Et; + var At; + var Pt; + var Tt; + var Rt; + var Nt; + var It; + var Dt; + var qt; + var zt; + var Bt; + var Lt; + var Ft; + var Vt; + var Ht; + var Wt; + var Ut; + var Jt; + var Kt; + var Gt; + var Qt; + var Yt; + var Xt; + var Zt; + var en; + var tn; + var nn; + var rn; + var on; + var an; + var sn; + var cn; + var ln; + var un; + var fn; + var dn; + var hn; + var vn; + var pn; + var mn; + var gn; + var yn; + var bn; + var kn; + var wn; + var xn; + var jn; + var Sn; + var Cn; + var $n; + var _n; + var On; + var Mn; + var En; + var An; + var Pn; + var Tn; + var Rn; + var Nn; + var In; + var Dn; + var qn; + var zn; + var Bn; + var Ln; + var Fn; + var Vn; + var Hn; + var Wn; + var Un; + var Jn; + var Kn; + var Gn; + var Qn; + var Yn; + var Xn; + var Zn; + var er; + var tr; + var nr; + var rr; + var or; + var ir; + var ar; + var sr; + var cr; + var lr; + var ur; + var fr; + var dr; + var hr; + var vr; + var pr; + var mr; + var gr; + var yr; + var br; + var kr; + var wr; + var xr; + var jr; + var Sr; + var Cr; + var $r; + var _r; + var Or; + var Mr; + var Er; + var Ar; + var Pr; + var Tr; + var Rr; + var Nr; + var Ir; + var Dr; + var qr; + var zr; + var Br; + var Lr; + var Fr; + var Vr; + var Hr; + var Wr; + var Ur; + var Jr; + var Kr; + var Gr; + var Qr; + var Yr; + var Xr; + var Zr; + var eo; + var to; + var no; + var ro; + var oo; + var io; + var ao; + var so; + var co; + var lo; + var uo; + var fo; + var ho; + var vo = ["mainAxis", "crossAxis", "fallbackPlacements", "fallbackStrategy", "fallbackAxisSideDirection", "flipAlignment"]; + var po = ["mainAxis", "crossAxis", "limiter"]; + function mo(e20, t10) { + return t10 || (t10 = e20.slice(0)), Object.freeze(Object.defineProperties(e20, { raw: { value: Object.freeze(t10) } })); + } + function go() { + return go = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e20, t10, n10) { + var r10 = function(e21, t11) { + for (; !Object.prototype.hasOwnProperty.call(e21, t11) && null !== (e21 = Mo(e21)); ) + ; + return e21; + }(e20, t10); + if (r10) { + var o10 = Object.getOwnPropertyDescriptor(r10, t10); + return o10.get ? o10.get.call(arguments.length < 3 ? e20 : n10) : o10.value; + } + }, go.apply(this, arguments); + } + function yo(e20, t10) { + if (null == e20) + return {}; + var n10, r10, o10 = function(e21, t11) { + if (null == e21) + return {}; + var n11, r11, o11 = {}, i11 = Object.keys(e21); + for (r11 = 0; r11 < i11.length; r11++) + n11 = i11[r11], t11.indexOf(n11) >= 0 || (o11[n11] = e21[n11]); + return o11; + }(e20, t10); + if (Object.getOwnPropertySymbols) { + var i10 = Object.getOwnPropertySymbols(e20); + for (r10 = 0; r10 < i10.length; r10++) + n10 = i10[r10], t10.indexOf(n10) >= 0 || Object.prototype.propertyIsEnumerable.call(e20, n10) && (o10[n10] = e20[n10]); + } + return o10; + } + function bo(e20, t10) { + var n10 = "undefined" != typeof Symbol && e20[Symbol.iterator] || e20["@@iterator"]; + if (!n10) { + if (Array.isArray(e20) || (n10 = Lo(e20)) || t10 && e20 && "number" == typeof e20.length) { + n10 && (e20 = n10); + var r10 = 0, o10 = function() { + }; + return { s: o10, n: function() { + return r10 >= e20.length ? { done: true } : { done: false, value: e20[r10++] }; + }, e: function(e21) { + throw e21; + }, f: o10 }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var i10, a10 = true, s10 = false; + return { s: function() { + n10 = n10.call(e20); + }, n: function() { + var e21 = n10.next(); + return a10 = e21.done, e21; + }, e: function(e21) { + s10 = true, i10 = e21; + }, f: function() { + try { + a10 || null == n10.return || n10.return(); + } finally { + if (s10) + throw i10; + } + } }; + } + function ko() { + ko = function() { + return t10; + }; + var e20, t10 = {}, n10 = Object.prototype, r10 = n10.hasOwnProperty, o10 = Object.defineProperty || function(e21, t11, n11) { + e21[t11] = n11.value; + }, i10 = "function" == typeof Symbol ? Symbol : {}, a10 = i10.iterator || "@@iterator", s10 = i10.asyncIterator || "@@asyncIterator", c10 = i10.toStringTag || "@@toStringTag"; + function l10(e21, t11, n11) { + return Object.defineProperty(e21, t11, { value: n11, enumerable: true, configurable: true, writable: true }), e21[t11]; + } + try { + l10({}, ""); + } catch (e21) { + l10 = function(e23, t11, n11) { + return e23[t11] = n11; + }; + } + function u10(e21, t11, n11, r11) { + var i11 = t11 && t11.prototype instanceof g10 ? t11 : g10, a11 = Object.create(i11.prototype), s11 = new E10(r11 || []); + return o10(a11, "_invoke", { value: $10(e21, n11, s11) }), a11; + } + function f10(e21, t11, n11) { + try { + return { type: "normal", arg: e21.call(t11, n11) }; + } catch (e23) { + return { type: "throw", arg: e23 }; + } + } + t10.wrap = u10; + var d10 = "suspendedStart", h10 = "suspendedYield", v10 = "executing", p10 = "completed", m10 = {}; + function g10() { + } + function y10() { + } + function b10() { + } + var k10 = {}; + l10(k10, a10, function() { + return this; + }); + var w10 = Object.getPrototypeOf, x10 = w10 && w10(w10(A10([]))); + x10 && x10 !== n10 && r10.call(x10, a10) && (k10 = x10); + var j10 = b10.prototype = g10.prototype = Object.create(k10); + function S10(e21) { + ["next", "throw", "return"].forEach(function(t11) { + l10(e21, t11, function(e23) { + return this._invoke(t11, e23); + }); + }); + } + function C10(e21, t11) { + function n11(o11, i12, a11, s11) { + var c11 = f10(e21[o11], e21, i12); + if ("throw" !== c11.type) { + var l11 = c11.arg, u11 = l11.value; + return u11 && "object" == Ho(u11) && r10.call(u11, "__await") ? t11.resolve(u11.__await).then(function(e23) { + n11("next", e23, a11, s11); + }, function(e23) { + n11("throw", e23, a11, s11); + }) : t11.resolve(u11).then(function(e23) { + l11.value = e23, a11(l11); + }, function(e23) { + return n11("throw", e23, a11, s11); + }); + } + s11(c11.arg); + } + var i11; + o10(this, "_invoke", { value: function(e23, r11) { + function o11() { + return new t11(function(t12, o12) { + n11(e23, r11, t12, o12); + }); + } + return i11 = i11 ? i11.then(o11, o11) : o11(); + } }); + } + function $10(t11, n11, r11) { + var o11 = d10; + return function(i11, a11) { + if (o11 === v10) + throw new Error("Generator is already running"); + if (o11 === p10) { + if ("throw" === i11) + throw a11; + return { value: e20, done: true }; + } + for (r11.method = i11, r11.arg = a11; ; ) { + var s11 = r11.delegate; + if (s11) { + var c11 = _10(s11, r11); + if (c11) { + if (c11 === m10) + continue; + return c11; + } + } + if ("next" === r11.method) + r11.sent = r11._sent = r11.arg; + else if ("throw" === r11.method) { + if (o11 === d10) + throw o11 = p10, r11.arg; + r11.dispatchException(r11.arg); + } else + "return" === r11.method && r11.abrupt("return", r11.arg); + o11 = v10; + var l11 = f10(t11, n11, r11); + if ("normal" === l11.type) { + if (o11 = r11.done ? p10 : h10, l11.arg === m10) + continue; + return { value: l11.arg, done: r11.done }; + } + "throw" === l11.type && (o11 = p10, r11.method = "throw", r11.arg = l11.arg); + } + }; + } + function _10(t11, n11) { + var r11 = n11.method, o11 = t11.iterator[r11]; + if (o11 === e20) + return n11.delegate = null, "throw" === r11 && t11.iterator.return && (n11.method = "return", n11.arg = e20, _10(t11, n11), "throw" === n11.method) || "return" !== r11 && (n11.method = "throw", n11.arg = new TypeError("The iterator does not provide a '" + r11 + "' method")), m10; + var i11 = f10(o11, t11.iterator, n11.arg); + if ("throw" === i11.type) + return n11.method = "throw", n11.arg = i11.arg, n11.delegate = null, m10; + var a11 = i11.arg; + return a11 ? a11.done ? (n11[t11.resultName] = a11.value, n11.next = t11.nextLoc, "return" !== n11.method && (n11.method = "next", n11.arg = e20), n11.delegate = null, m10) : a11 : (n11.method = "throw", n11.arg = new TypeError("iterator result is not an object"), n11.delegate = null, m10); + } + function O10(e21) { + var t11 = { tryLoc: e21[0] }; + 1 in e21 && (t11.catchLoc = e21[1]), 2 in e21 && (t11.finallyLoc = e21[2], t11.afterLoc = e21[3]), this.tryEntries.push(t11); + } + function M10(e21) { + var t11 = e21.completion || {}; + t11.type = "normal", delete t11.arg, e21.completion = t11; + } + function E10(e21) { + this.tryEntries = [{ tryLoc: "root" }], e21.forEach(O10, this), this.reset(true); + } + function A10(t11) { + if (t11 || "" === t11) { + var n11 = t11[a10]; + if (n11) + return n11.call(t11); + if ("function" == typeof t11.next) + return t11; + if (!isNaN(t11.length)) { + var o11 = -1, i11 = function n12() { + for (; ++o11 < t11.length; ) + if (r10.call(t11, o11)) + return n12.value = t11[o11], n12.done = false, n12; + return n12.value = e20, n12.done = true, n12; + }; + return i11.next = i11; + } + } + throw new TypeError(Ho(t11) + " is not iterable"); + } + return y10.prototype = b10, o10(j10, "constructor", { value: b10, configurable: true }), o10(b10, "constructor", { value: y10, configurable: true }), y10.displayName = l10(b10, c10, "GeneratorFunction"), t10.isGeneratorFunction = function(e21) { + var t11 = "function" == typeof e21 && e21.constructor; + return !!t11 && (t11 === y10 || "GeneratorFunction" === (t11.displayName || t11.name)); + }, t10.mark = function(e21) { + return Object.setPrototypeOf ? Object.setPrototypeOf(e21, b10) : (e21.__proto__ = b10, l10(e21, c10, "GeneratorFunction")), e21.prototype = Object.create(j10), e21; + }, t10.awrap = function(e21) { + return { __await: e21 }; + }, S10(C10.prototype), l10(C10.prototype, s10, function() { + return this; + }), t10.AsyncIterator = C10, t10.async = function(e21, n11, r11, o11, i11) { + void 0 === i11 && (i11 = Promise); + var a11 = new C10(u10(e21, n11, r11, o11), i11); + return t10.isGeneratorFunction(n11) ? a11 : a11.next().then(function(e23) { + return e23.done ? e23.value : a11.next(); + }); + }, S10(j10), l10(j10, c10, "Generator"), l10(j10, a10, function() { + return this; + }), l10(j10, "toString", function() { + return "[object Generator]"; + }), t10.keys = function(e21) { + var t11 = Object(e21), n11 = []; + for (var r11 in t11) + n11.push(r11); + return n11.reverse(), function e23() { + for (; n11.length; ) { + var r12 = n11.pop(); + if (r12 in t11) + return e23.value = r12, e23.done = false, e23; + } + return e23.done = true, e23; + }; + }, t10.values = A10, E10.prototype = { constructor: E10, reset: function(t11) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = e20, this.done = false, this.delegate = null, this.method = "next", this.arg = e20, this.tryEntries.forEach(M10), !t11) + for (var n11 in this) + "t" === n11.charAt(0) && r10.call(this, n11) && !isNaN(+n11.slice(1)) && (this[n11] = e20); + }, stop: function() { + this.done = true; + var e21 = this.tryEntries[0].completion; + if ("throw" === e21.type) + throw e21.arg; + return this.rval; + }, dispatchException: function(t11) { + if (this.done) + throw t11; + var n11 = this; + function o11(r11, o12) { + return s11.type = "throw", s11.arg = t11, n11.next = r11, o12 && (n11.method = "next", n11.arg = e20), !!o12; + } + for (var i11 = this.tryEntries.length - 1; i11 >= 0; --i11) { + var a11 = this.tryEntries[i11], s11 = a11.completion; + if ("root" === a11.tryLoc) + return o11("end"); + if (a11.tryLoc <= this.prev) { + var c11 = r10.call(a11, "catchLoc"), l11 = r10.call(a11, "finallyLoc"); + if (c11 && l11) { + if (this.prev < a11.catchLoc) + return o11(a11.catchLoc, true); + if (this.prev < a11.finallyLoc) + return o11(a11.finallyLoc); + } else if (c11) { + if (this.prev < a11.catchLoc) + return o11(a11.catchLoc, true); + } else { + if (!l11) + throw new Error("try statement without catch or finally"); + if (this.prev < a11.finallyLoc) + return o11(a11.finallyLoc); + } + } + } + }, abrupt: function(e21, t11) { + for (var n11 = this.tryEntries.length - 1; n11 >= 0; --n11) { + var o11 = this.tryEntries[n11]; + if (o11.tryLoc <= this.prev && r10.call(o11, "finallyLoc") && this.prev < o11.finallyLoc) { + var i11 = o11; + break; + } + } + i11 && ("break" === e21 || "continue" === e21) && i11.tryLoc <= t11 && t11 <= i11.finallyLoc && (i11 = null); + var a11 = i11 ? i11.completion : {}; + return a11.type = e21, a11.arg = t11, i11 ? (this.method = "next", this.next = i11.finallyLoc, m10) : this.complete(a11); + }, complete: function(e21, t11) { + if ("throw" === e21.type) + throw e21.arg; + return "break" === e21.type || "continue" === e21.type ? this.next = e21.arg : "return" === e21.type ? (this.rval = this.arg = e21.arg, this.method = "return", this.next = "end") : "normal" === e21.type && t11 && (this.next = t11), m10; + }, finish: function(e21) { + for (var t11 = this.tryEntries.length - 1; t11 >= 0; --t11) { + var n11 = this.tryEntries[t11]; + if (n11.finallyLoc === e21) + return this.complete(n11.completion, n11.afterLoc), M10(n11), m10; + } + }, catch: function(e21) { + for (var t11 = this.tryEntries.length - 1; t11 >= 0; --t11) { + var n11 = this.tryEntries[t11]; + if (n11.tryLoc === e21) { + var r11 = n11.completion; + if ("throw" === r11.type) { + var o11 = r11.arg; + M10(n11); + } + return o11; + } + } + throw new Error("illegal catch attempt"); + }, delegateYield: function(t11, n11, r11) { + return this.delegate = { iterator: A10(t11), resultName: n11, nextLoc: r11 }, "next" === this.method && (this.arg = e20), m10; + } }, t10; + } + function wo(e20, t10, n10, r10, o10, i10, a10) { + try { + var s10 = e20[i10](a10), c10 = s10.value; + } catch (e21) { + return void n10(e21); + } + s10.done ? t10(c10) : Promise.resolve(c10).then(r10, o10); + } + function xo(e20) { + return function() { + var t10 = this, n10 = arguments; + return new Promise(function(r10, o10) { + var i10 = e20.apply(t10, n10); + function a10(e21) { + wo(i10, r10, o10, a10, s10, "next", e21); + } + function s10(e21) { + wo(i10, r10, o10, a10, s10, "throw", e21); + } + a10(void 0); + }); + }; + } + function jo(e20, t10) { + return Co(e20) || function(e21, t11) { + var n10 = null == e21 ? null : "undefined" != typeof Symbol && e21[Symbol.iterator] || e21["@@iterator"]; + if (null != n10) { + var r10, o10, i10, a10, s10 = [], c10 = true, l10 = false; + try { + if (i10 = (n10 = n10.call(e21)).next, 0 === t11) { + if (Object(n10) !== n10) + return; + c10 = false; + } else + for (; !(c10 = (r10 = i10.call(n10)).done) && (s10.push(r10.value), s10.length !== t11); c10 = true) + ; + } catch (e23) { + l10 = true, o10 = e23; + } finally { + try { + if (!c10 && null != n10.return && (a10 = n10.return(), Object(a10) !== a10)) + return; + } finally { + if (l10) + throw o10; + } + } + return s10; + } + }(e20, t10) || Lo(e20, t10) || So(); + } + function So() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function Co(e20) { + if (Array.isArray(e20)) + return e20; + } + function $o(e20) { + var t10 = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0; + return $o = function(e21) { + if (null === e21 || !function(e23) { + try { + return -1 !== Function.toString.call(e23).indexOf("[native code]"); + } catch (t11) { + return "function" == typeof e23; + } + }(e21)) + return e21; + if ("function" != typeof e21) + throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== t10) { + if (t10.has(e21)) + return t10.get(e21); + t10.set(e21, n10); + } + function n10() { + return function(e23, t11, n11) { + if (Oo()) + return Reflect.construct.apply(null, arguments); + var r10 = [null]; + r10.push.apply(r10, t11); + var o10 = new (e23.bind.apply(e23, r10))(); + return n11 && Po(o10, n11.prototype), o10; + }(e21, arguments, Mo(this).constructor); + } + return n10.prototype = Object.create(e21.prototype, { constructor: { value: n10, enumerable: false, writable: true, configurable: true } }), Po(n10, e21); + }, $o(e20); + } + function _o(e20, t10, n10) { + return t10 = Mo(t10), function(e21, t11) { + if (t11 && ("object" === Ho(t11) || "function" == typeof t11)) + return t11; + if (void 0 !== t11) + throw new TypeError("Derived constructors may only return object or undefined"); + return Eo(e21); + }(e20, Oo() ? Reflect.construct(t10, n10 || [], Mo(e20).constructor) : t10.apply(e20, n10)); + } + function Oo() { + try { + var e20 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { + })); + } catch (e21) { + } + return (Oo = function() { + return !!e20; + })(); + } + function Mo(e20) { + return Mo = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e21) { + return e21.__proto__ || Object.getPrototypeOf(e21); + }, Mo(e20); + } + function Eo(e20) { + if (void 0 === e20) + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e20; + } + function Ao(e20, t10) { + if ("function" != typeof t10 && null !== t10) + throw new TypeError("Super expression must either be null or a function"); + e20.prototype = Object.create(t10 && t10.prototype, { constructor: { value: e20, writable: true, configurable: true } }), Object.defineProperty(e20, "prototype", { writable: false }), t10 && Po(e20, t10); + } + function Po(e20, t10) { + return Po = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e21, t11) { + return e21.__proto__ = t11, e21; + }, Po(e20, t10); + } + function To(e20, t10) { + var n10 = Object.keys(e20); + if (Object.getOwnPropertySymbols) { + var r10 = Object.getOwnPropertySymbols(e20); + t10 && (r10 = r10.filter(function(t11) { + return Object.getOwnPropertyDescriptor(e20, t11).enumerable; + })), n10.push.apply(n10, r10); + } + return n10; + } + function Ro(e20) { + for (var t10 = 1; t10 < arguments.length; t10++) { + var n10 = null != arguments[t10] ? arguments[t10] : {}; + t10 % 2 ? To(Object(n10), true).forEach(function(t11) { + qo(e20, t11, n10[t11]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e20, Object.getOwnPropertyDescriptors(n10)) : To(Object(n10)).forEach(function(t11) { + Object.defineProperty(e20, t11, Object.getOwnPropertyDescriptor(n10, t11)); + }); + } + return e20; + } + function No(e20, t10) { + if (!(e20 instanceof t10)) + throw new TypeError("Cannot call a class as a function"); + } + function Io(e20, t10) { + for (var n10 = 0; n10 < t10.length; n10++) { + var r10 = t10[n10]; + r10.enumerable = r10.enumerable || false, r10.configurable = true, "value" in r10 && (r10.writable = true), Object.defineProperty(e20, zo(r10.key), r10); + } + } + function Do(e20, t10, n10) { + return t10 && Io(e20.prototype, t10), n10 && Io(e20, n10), Object.defineProperty(e20, "prototype", { writable: false }), e20; + } + function qo(e20, t10, n10) { + return (t10 = zo(t10)) in e20 ? Object.defineProperty(e20, t10, { value: n10, enumerable: true, configurable: true, writable: true }) : e20[t10] = n10, e20; + } + function zo(e20) { + var t10 = function(e21, t11) { + if ("object" != Ho(e21) || !e21) + return e21; + var n10 = e21[Symbol.toPrimitive]; + if (void 0 !== n10) { + var r10 = n10.call(e21, t11 || "default"); + if ("object" != Ho(r10)) + return r10; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === t11 ? String : Number)(e21); + }(e20, "string"); + return "symbol" == Ho(t10) ? t10 : String(t10); + } + function Bo(e20) { + return function(e21) { + if (Array.isArray(e21)) + return Vo(e21); + }(e20) || Fo(e20) || Lo(e20) || function() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + }(); + } + function Lo(e20, t10) { + if (e20) { + if ("string" == typeof e20) + return Vo(e20, t10); + var n10 = Object.prototype.toString.call(e20).slice(8, -1); + return "Object" === n10 && e20.constructor && (n10 = e20.constructor.name), "Map" === n10 || "Set" === n10 ? Array.from(e20) : "Arguments" === n10 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n10) ? Vo(e20, t10) : void 0; + } + } + function Fo(e20) { + if ("undefined" != typeof Symbol && null != e20[Symbol.iterator] || null != e20["@@iterator"]) + return Array.from(e20); + } + function Vo(e20, t10) { + (null == t10 || t10 > e20.length) && (t10 = e20.length); + for (var n10 = 0, r10 = new Array(t10); n10 < t10; n10++) + r10[n10] = e20[n10]; + return r10; + } + function Ho(e20) { + return Ho = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e21) { + return typeof e21; + } : function(e21) { + return e21 && "function" == typeof Symbol && e21.constructor === Symbol && e21 !== Symbol.prototype ? "symbol" : typeof e21; + }, Ho(e20); + } + function Wo() { + } + var Uo = function(e20) { + return e20; + }; + function Jo(e20, t10) { + for (var n10 in t10) + e20[n10] = t10[n10]; + return e20; + } + function Ko(e20) { + return e20(); + } + function Go() { + return /* @__PURE__ */ Object.create(null); + } + function Qo(e20) { + e20.forEach(Ko); + } + function Yo(e20) { + return "function" == typeof e20; + } + function Xo(e20, t10) { + return e20 != e20 ? t10 == t10 : e20 !== t10 || e20 && "object" === Ho(e20) || "function" == typeof e20; + } + function Zo(e20, t10) { + return e20 != e20 ? t10 == t10 : e20 !== t10; + } + function ei(e20, t10, n10, r10) { + if (e20) { + var o10 = ti(e20, t10, n10, r10); + return e20[0](o10); + } + } + function ti(e20, t10, n10, r10) { + return e20[1] && r10 ? Jo(n10.ctx.slice(), e20[1](r10(t10))) : n10.ctx; + } + function ni(e20, t10, n10, r10) { + if (e20[2] && r10) { + var o10 = e20[2](r10(n10)); + if (void 0 === t10.dirty) + return o10; + if ("object" === Ho(o10)) { + for (var i10 = [], a10 = Math.max(t10.dirty.length, o10.length), s10 = 0; s10 < a10; s10 += 1) + i10[s10] = t10.dirty[s10] | o10[s10]; + return i10; + } + return t10.dirty | o10; + } + return t10.dirty; + } + function ri(e20, t10, n10, r10, o10, i10) { + if (o10) { + var a10 = ti(t10, n10, r10, i10); + e20.p(a10, o10); + } + } + function oi(e20) { + if (e20.ctx.length > 32) { + for (var t10 = [], n10 = e20.ctx.length / 32, r10 = 0; r10 < n10; r10++) + t10[r10] = -1; + return t10; + } + return -1; + } + function ii(e20) { + var t10 = {}; + for (var n10 in e20) + "$" !== n10[0] && (t10[n10] = e20[n10]); + return t10; + } + function ai(e20, t10) { + var n10 = {}; + for (var r10 in t10 = new Set(t10), e20) + t10.has(r10) || "$" === r10[0] || (n10[r10] = e20[r10]); + return n10; + } + function si(e20) { + return null == e20 ? "" : e20; + } + function ci(e20) { + return e20 && Yo(e20.destroy) ? e20.destroy : Wo; + } + var li = "undefined" != typeof window; + var ui = li ? function() { + return window.performance.now(); + } : function() { + return Date.now(); + }; + var fi = li ? function(e20) { + return requestAnimationFrame(e20); + } : Wo; + var di = /* @__PURE__ */ new Set(); + function hi(e20) { + di.forEach(function(t10) { + t10.c(e20) || (di.delete(t10), t10.f()); + }), 0 !== di.size && fi(hi); + } + var vi = "undefined" != typeof window ? window : "undefined" != typeof globalThis ? globalThis : global; + function pi(e20, t10) { + e20.appendChild(t10); + } + function mi(e20, t10, n10) { + var r10 = gi(e20); + if (!r10.getElementById(t10)) { + var o10 = ji("style"); + o10.id = t10, o10.textContent = n10, bi(r10, o10); + } + } + function gi(e20) { + if (!e20) + return document; + var t10 = e20.getRootNode ? e20.getRootNode() : e20.ownerDocument; + return t10 && t10.host ? t10 : e20.ownerDocument; + } + function yi(e20) { + var t10 = ji("style"); + return t10.textContent = "/* empty */", bi(gi(e20), t10), t10.sheet; + } + function bi(e20, t10) { + return pi(e20.head || e20, t10), t10.sheet; + } + function ki(e20, t10, n10) { + e20.insertBefore(t10, n10 || null); + } + function wi(e20) { + e20.parentNode && e20.parentNode.removeChild(e20); + } + function xi(e20, t10) { + for (var n10 = 0; n10 < e20.length; n10 += 1) + e20[n10] && e20[n10].d(t10); + } + function ji(e20) { + return document.createElement(e20); + } + function Si(e20) { + return document.createElementNS("http://www.w3.org/2000/svg", e20); + } + function Ci(e20) { + return document.createTextNode(e20); + } + function $i() { + return Ci(" "); + } + function _i() { + return Ci(""); + } + function Oi(e20, t10, n10, r10) { + return e20.addEventListener(t10, n10, r10), function() { + return e20.removeEventListener(t10, n10, r10); + }; + } + function Mi(e20) { + return function(t10) { + return t10.preventDefault(), e20.call(this, t10); + }; + } + function Ei(e20) { + return function(t10) { + return t10.stopPropagation(), e20.call(this, t10); + }; + } + function Ai(e20, t10, n10) { + null == n10 ? e20.removeAttribute(t10) : e20.getAttribute(t10) !== n10 && e20.setAttribute(t10, n10); + } + var Pi = ["width", "height"]; + function Ti(e20, t10) { + var n10 = Object.getOwnPropertyDescriptors(e20.__proto__); + for (var r10 in t10) + null == t10[r10] ? e20.removeAttribute(r10) : "style" === r10 ? e20.style.cssText = t10[r10] : "__value" === r10 ? e20.value = e20[r10] = t10[r10] : n10[r10] && n10[r10].set && -1 === Pi.indexOf(r10) ? e20[r10] = t10[r10] : Ai(e20, r10, t10[r10]); + } + function Ri(e20, t10) { + for (var n10 in t10) + Ai(e20, n10, t10[n10]); + } + function Ni(e20, t10) { + t10 = "" + t10, e20.data !== t10 && (e20.data = t10); + } + function Ii(e20, t10) { + e20.value = null == t10 ? "" : t10; + } + function Di(e20, t10, n10, r10) { + null == n10 ? e20.style.removeProperty(t10) : e20.style.setProperty(t10, n10, r10 ? "important" : ""); + } + function qi(e20, t10, n10) { + for (var r10 = 0; r10 < e20.options.length; r10 += 1) { + var o10 = e20.options[r10]; + if (o10.__value === t10) + return void (o10.selected = true); + } + n10 && void 0 === t10 || (e20.selectedIndex = -1); + } + function zi(e20, t10, n10) { + e20.classList.toggle(t10, !!n10); + } + function Bi(e20, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, r10 = n10.bubbles, o10 = void 0 !== r10 && r10, i10 = n10.cancelable; + return new CustomEvent(e20, { detail: t10, bubbles: o10, cancelable: void 0 !== i10 && i10 }); + } + function Li(e20, t10) { + return new e20(t10); + } + var Fi; + var Vi = /* @__PURE__ */ new Map(); + var Hi = 0; + function Wi(e20, t10, n10, r10, o10, i10, a10) { + for (var s10 = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : 0, c10 = 16.666 / r10, l10 = "{\n", u10 = 0; u10 <= 1; u10 += c10) { + var f10 = t10 + (n10 - t10) * i10(u10); + l10 += 100 * u10 + "%{".concat(a10(f10, 1 - f10), "}\n"); + } + var d10 = l10 + "100% {".concat(a10(n10, 1 - n10), "}\n}"), h10 = "__svelte_".concat(function(e21) { + for (var t11 = 5381, n11 = e21.length; n11--; ) + t11 = (t11 << 5) - t11 ^ e21.charCodeAt(n11); + return t11 >>> 0; + }(d10), "_").concat(s10), v10 = gi(e20), p10 = Vi.get(v10) || function(e21, t11) { + var n11 = { stylesheet: yi(t11), rules: {} }; + return Vi.set(e21, n11), n11; + }(v10, e20), m10 = p10.stylesheet, g10 = p10.rules; + g10[h10] || (g10[h10] = true, m10.insertRule("@keyframes ".concat(h10, " ").concat(d10), m10.cssRules.length)); + var y10 = e20.style.animation || ""; + return e20.style.animation = "".concat(y10 ? "".concat(y10, ", ") : "").concat(h10, " ").concat(r10, "ms linear ").concat(o10, "ms 1 both"), Hi += 1, h10; + } + function Ui(e20, t10) { + var n10 = (e20.style.animation || "").split(", "), r10 = n10.filter(t10 ? function(e21) { + return e21.indexOf(t10) < 0; + } : function(e21) { + return -1 === e21.indexOf("__svelte"); + }), o10 = n10.length - r10.length; + o10 && (e20.style.animation = r10.join(", "), (Hi -= o10) || fi(function() { + Hi || (Vi.forEach(function(e21) { + var t11 = e21.stylesheet.ownerNode; + t11 && wi(t11); + }), Vi.clear()); + })); + } + function Ji(e20) { + Fi = e20; + } + function Ki() { + if (!Fi) + throw new Error("Function called outside component initialization"); + return Fi; + } + function Gi(e20) { + Ki().$$.on_mount.push(e20); + } + function Qi(e20) { + Ki().$$.on_destroy.push(e20); + } + function Yi() { + var e20 = Ki(); + return function(t10, n10) { + var r10 = (arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}).cancelable, o10 = void 0 !== r10 && r10, i10 = e20.$$.callbacks[t10]; + if (i10) { + var a10 = Bi(t10, n10, { cancelable: o10 }); + return i10.slice().forEach(function(t11) { + t11.call(e20, a10); + }), !a10.defaultPrevented; + } + return true; + }; + } + function Xi(e20, t10) { + return Ki().$$.context.set(e20, t10), t10; + } + function Zi(e20) { + return Ki().$$.context.get(e20); + } + function ea(e20, t10) { + var n10 = this, r10 = e20.$$.callbacks[t10.type]; + r10 && r10.slice().forEach(function(e21) { + return e21.call(n10, t10); + }); + } + var ta = []; + var na = []; + var ra = []; + var oa = []; + var ia = Promise.resolve(); + var aa = false; + function sa() { + aa || (aa = true, ia.then(va)); + } + function ca() { + return sa(), ia; + } + function la(e20) { + ra.push(e20); + } + function ua(e20) { + oa.push(e20); + } + var fa; + var da = /* @__PURE__ */ new Set(); + var ha = 0; + function va() { + if (0 === ha) { + var e20 = Fi; + do { + try { + for (; ha < ta.length; ) { + var t10 = ta[ha]; + ha++, Ji(t10), pa(t10.$$); + } + } catch (e21) { + throw ta.length = 0, ha = 0, e21; + } + for (Ji(null), ta.length = 0, ha = 0; na.length; ) + na.pop()(); + for (var n10 = 0; n10 < ra.length; n10 += 1) { + var r10 = ra[n10]; + da.has(r10) || (da.add(r10), r10()); + } + ra.length = 0; + } while (ta.length); + for (; oa.length; ) + oa.pop()(); + aa = false, da.clear(), Ji(e20); + } + } + function pa(e20) { + if (null !== e20.fragment) { + e20.update(), Qo(e20.before_update); + var t10 = e20.dirty; + e20.dirty = [-1], e20.fragment && e20.fragment.p(e20.ctx, t10), e20.after_update.forEach(la); + } + } + function ma(e20, t10, n10) { + e20.dispatchEvent(Bi("".concat(t10 ? "intro" : "outro").concat(n10))); + } + var ga; + var ya = /* @__PURE__ */ new Set(); + function ba() { + ga = { r: 0, c: [], p: ga }; + } + function ka() { + ga.r || Qo(ga.c), ga = ga.p; + } + function wa(e20, t10) { + e20 && e20.i && (ya.delete(e20), e20.i(t10)); + } + function xa(e20, t10, n10, r10) { + if (e20 && e20.o) { + if (ya.has(e20)) + return; + ya.add(e20), ga.c.push(function() { + ya.delete(e20), r10 && (n10 && e20.d(1), r10()); + }), e20.o(t10); + } else + r10 && r10(); + } + var ja = { duration: 0 }; + function Sa(e20, t10, n10, r10) { + var o10, i10 = t10(e20, n10, { direction: "both" }), a10 = r10 ? 0 : 1, s10 = null, c10 = null, l10 = null; + function u10() { + l10 && Ui(e20, l10); + } + function f10(e21, t11) { + var n11 = e21.b - a10; + return t11 *= Math.abs(n11), { a: a10, b: e21.b, d: n11, duration: t11, start: e21.start, end: e21.start + t11, group: e21.group }; + } + function d10(t11) { + var n11, r11 = i10 || ja, d11 = r11.delay, h10 = void 0 === d11 ? 0 : d11, v10 = r11.duration, p10 = void 0 === v10 ? 300 : v10, m10 = r11.easing, g10 = void 0 === m10 ? Uo : m10, y10 = r11.tick, b10 = void 0 === y10 ? Wo : y10, k10 = r11.css, w10 = { start: ui() + h10, b: t11 }; + t11 || (w10.group = ga, ga.r += 1), "inert" in e20 && (t11 ? void 0 !== o10 && (e20.inert = o10) : (o10 = e20.inert, e20.inert = true)), s10 || c10 ? c10 = w10 : (k10 && (u10(), l10 = Wi(e20, a10, t11, p10, h10, g10, k10)), t11 && b10(0, 1), s10 = f10(w10, p10), la(function() { + return ma(e20, t11, "start"); + }), n11 = function(t12) { + if (c10 && t12 > c10.start && (s10 = f10(c10, p10), c10 = null, ma(e20, s10.b, "start"), k10 && (u10(), l10 = Wi(e20, a10, s10.b, s10.duration, 0, g10, i10.css))), s10) { + if (t12 >= s10.end) + b10(a10 = s10.b, 1 - a10), ma(e20, s10.b, "end"), c10 || (s10.b ? u10() : --s10.group.r || Qo(s10.group.c)), s10 = null; + else if (t12 >= s10.start) { + var n12 = t12 - s10.start; + a10 = s10.a + s10.d * g10(n12 / s10.duration), b10(a10, 1 - a10); + } + } + return !(!s10 && !c10); + }, 0 === di.size && fi(hi), new Promise(function(e21) { + di.add({ c: n11, f: e21 }); + })); + } + return { run: function(e21) { + Yo(i10) ? (fa || (fa = Promise.resolve()).then(function() { + fa = null; + }), fa).then(function() { + i10 = i10({ direction: e21 ? "in" : "out" }), d10(e21); + }) : d10(e21); + }, end: function() { + u10(), s10 = c10 = null; + } }; + } + function Ca(e20) { + return void 0 !== (null == e20 ? void 0 : e20.length) ? e20 : Array.from(e20); + } + function $a(e20, t10) { + e20.d(1), t10.delete(e20.key); + } + function _a(e20, t10) { + xa(e20, 1, 1, function() { + t10.delete(e20.key); + }); + } + function Oa(e20, t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10) { + for (var d10 = e20.length, h10 = i10.length, v10 = d10, p10 = {}; v10--; ) + p10[e20[v10].key] = v10; + var m10 = [], g10 = /* @__PURE__ */ new Map(), y10 = /* @__PURE__ */ new Map(), b10 = []; + v10 = h10; + for (var k10 = function() { + var e21 = f10(o10, i10, v10), s11 = n10(e21), c11 = a10.get(s11); + c11 ? r10 && b10.push(function() { + return c11.p(e21, t10); + }) : (c11 = l10(s11, e21)).c(), g10.set(s11, m10[v10] = c11), s11 in p10 && y10.set(s11, Math.abs(v10 - p10[s11])); + }; v10--; ) + k10(); + var w10 = /* @__PURE__ */ new Set(), x10 = /* @__PURE__ */ new Set(); + function j10(e21) { + wa(e21, 1), e21.m(s10, u10), a10.set(e21.key, e21), u10 = e21.first, h10--; + } + for (; d10 && h10; ) { + var S10 = m10[h10 - 1], C10 = e20[d10 - 1], $10 = S10.key, _10 = C10.key; + S10 === C10 ? (u10 = S10.first, d10--, h10--) : g10.has(_10) ? !a10.has($10) || w10.has($10) ? j10(S10) : x10.has(_10) ? d10-- : y10.get($10) > y10.get(_10) ? (x10.add($10), j10(S10)) : (w10.add(_10), d10--) : (c10(C10, a10), d10--); + } + for (; d10--; ) { + var O10 = e20[d10]; + g10.has(O10.key) || c10(O10, a10); + } + for (; h10; ) + j10(m10[h10 - 1]); + return Qo(b10), m10; + } + function Ma(e20, t10) { + for (var n10 = {}, r10 = {}, o10 = { $$scope: 1 }, i10 = e20.length; i10--; ) { + var a10 = e20[i10], s10 = t10[i10]; + if (s10) { + for (var c10 in a10) + c10 in s10 || (r10[c10] = 1); + for (var l10 in s10) + o10[l10] || (n10[l10] = s10[l10], o10[l10] = 1); + e20[i10] = s10; + } else + for (var u10 in a10) + o10[u10] = 1; + } + for (var f10 in r10) + f10 in n10 || (n10[f10] = void 0); + return n10; + } + function Ea(e20) { + return "object" === Ho(e20) && null !== e20 ? e20 : {}; + } + function Aa(e20, t10, n10) { + var r10 = e20.$$.props[t10]; + void 0 !== r10 && (e20.$$.bound[r10] = n10, n10(e20.$$.ctx[r10])); + } + function Pa(e20) { + e20 && e20.c(); + } + function Ta(e20, t10, n10) { + var r10 = e20.$$, o10 = r10.fragment, i10 = r10.after_update; + o10 && o10.m(t10, n10), la(function() { + var t11, n11 = e20.$$.on_mount.map(Ko).filter(Yo); + e20.$$.on_destroy ? (t11 = e20.$$.on_destroy).push.apply(t11, Bo(n11)) : Qo(n11); + e20.$$.on_mount = []; + }), i10.forEach(la); + } + function Ra(e20, t10) { + var n10, r10, o10, i10 = e20.$$; + null !== i10.fragment && (n10 = i10.after_update, r10 = [], o10 = [], ra.forEach(function(e21) { + return -1 === n10.indexOf(e21) ? r10.push(e21) : o10.push(e21); + }), o10.forEach(function(e21) { + return e21(); + }), ra = r10, Qo(i10.on_destroy), i10.fragment && i10.fragment.d(t10), i10.on_destroy = i10.fragment = null, i10.ctx = []); + } + function Na(e20, t10, n10, r10, o10, i10) { + var a10 = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : null, s10 = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : [-1], c10 = Fi; + Ji(e20); + var l10 = e20.$$ = { fragment: null, ctx: [], props: i10, update: Wo, not_equal: o10, bound: Go(), on_mount: [], on_destroy: [], on_disconnect: [], before_update: [], after_update: [], context: new Map(t10.context || (c10 ? c10.$$.context : [])), callbacks: Go(), dirty: s10, skip_bound: false, root: t10.target || c10.$$.root }; + a10 && a10(l10.root); + var u10 = false; + if (l10.ctx = n10 ? n10(e20, t10.props || {}, function(t11, n11) { + var r11 = !(arguments.length <= 2) && arguments.length - 2 ? arguments.length <= 2 ? void 0 : arguments[2] : n11; + return l10.ctx && o10(l10.ctx[t11], l10.ctx[t11] = r11) && (!l10.skip_bound && l10.bound[t11] && l10.bound[t11](r11), u10 && function(e21, t12) { + -1 === e21.$$.dirty[0] && (ta.push(e21), sa(), e21.$$.dirty.fill(0)), e21.$$.dirty[t12 / 31 | 0] |= 1 << t12 % 31; + }(e20, t11)), n11; + }) : [], l10.update(), u10 = true, Qo(l10.before_update), l10.fragment = !!r10 && r10(l10.ctx), t10.target) { + if (t10.hydrate) { + var f10 = function(e21) { + return Array.from(e21.childNodes); + }(t10.target); + l10.fragment && l10.fragment.l(f10), f10.forEach(wi); + } else + l10.fragment && l10.fragment.c(); + t10.intro && wa(e20.$$.fragment), Ta(e20, t10.target, t10.anchor), va(); + } + Ji(c10); + } + var Ia = function() { + function e20() { + No(this, e20), qo(this, "$$", void 0), qo(this, "$$set", void 0); + } + return Do(e20, [{ key: "$destroy", value: function() { + Ra(this, 1), this.$destroy = Wo; + } }, { key: "$on", value: function(e21, t10) { + if (!Yo(t10)) + return Wo; + var n10 = this.$$.callbacks[e21] || (this.$$.callbacks[e21] = []); + return n10.push(t10), function() { + var e23 = n10.indexOf(t10); + -1 !== e23 && n10.splice(e23, 1); + }; + } }, { key: "$set", value: function(e21) { + var t10; + this.$$set && (t10 = e21, 0 !== Object.keys(t10).length) && (this.$$.skip_bound = true, this.$$set(e21), this.$$.skip_bound = false); + } }]), e20; + }(); + function Da(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function(e21) { + var t11 = function(e23) { + try { + if ("undefined" != typeof window && void 0 !== window.localStorage) + return window.localStorage[e23]; + } catch (e24) { + } + }("debug"); + return null != t11 && t11.endsWith("*") ? e21.startsWith(t11.slice(0, -1)) : e21 === t11; + }(e20); + if (!t10) + return qa; + var n10 = function(e21) { + for (var t11 = 0, n11 = 0; n11 < e21.length; n11++) + t11 = (t11 << 5) - t11 + e21.charCodeAt(n11), t11 |= 0; + return za[Math.abs(t11) % za.length]; + }(e20); + return function() { + for (var t11, r10 = arguments.length, o10 = new Array(r10), i10 = 0; i10 < r10; i10++) + o10[i10] = arguments[i10]; + (t11 = console).log.apply(t11, ["%c".concat(e20), "color:".concat(n10)].concat(o10)); + }; + } + function qa() { + } + "undefined" != typeof window && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add("4"); + var za = ["#0000CC", "#0099FF", "#009400", "#8dd200", "#CCCC00", "#CC9933", "#ae04e7", "#ff35d7", "#FF3333", "#FF6600", "#FF9933", "#FFCC33"]; + function Ba(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n10 = t10.delay, r10 = void 0 === n10 ? 0 : n10, o10 = t10.duration, i10 = void 0 === o10 ? 400 : o10, a10 = t10.easing, s10 = void 0 === a10 ? Uo : a10, c10 = +getComputedStyle(e20).opacity; + return { delay: r10, duration: i10, easing: s10, css: function(e21) { + return "opacity: ".concat(e21 * c10); + } }; + } + var La = vi.window; + function Fa(e20) { + mi(e20, "svelte-n7cvum", ".svelte-n7cvum{box-sizing:border-box}.bg.svelte-n7cvum{position:fixed;z-index:1000;top:0;left:0;display:flex;flex-direction:column;justify-content:center;width:100vw;height:100vh;background:rgba(0, 0, 0, 0.66)}@supports (-webkit-touch-callout: none){}.wrap.svelte-n7cvum{position:relative;margin:2rem;max-height:100%}.window.svelte-n7cvum{position:relative;width:40rem;max-width:100%;max-height:100%;margin:2rem auto;color:black;border-radius:0.5rem;background:white}.content.svelte-n7cvum{position:relative;padding:1rem;max-height:calc(100vh - 4rem);overflow:auto}.close.svelte-n7cvum{display:block;box-sizing:border-box;position:absolute;z-index:1000;top:1rem;right:1rem;margin:0;padding:0;width:1.5rem;height:1.5rem;border:0;color:black;border-radius:1.5rem;background:white;box-shadow:0 0 0 1px black;transition:transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),\n background 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);-webkit-appearance:none}.close.svelte-n7cvum:before,.close.svelte-n7cvum:after{content:'';display:block;box-sizing:border-box;position:absolute;top:50%;width:1rem;height:1px;background:black;transform-origin:center;transition:height 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),\n background 0.2s cubic-bezier(0.25, 0.1, 0.25, 1)}.close.svelte-n7cvum:before{-webkit-transform:translate(0, -50%) rotate(45deg);-moz-transform:translate(0, -50%) rotate(45deg);transform:translate(0, -50%) rotate(45deg);left:0.25rem}.close.svelte-n7cvum:after{-webkit-transform:translate(0, -50%) rotate(-45deg);-moz-transform:translate(0, -50%) rotate(-45deg);transform:translate(0, -50%) rotate(-45deg);left:0.25rem}.close.svelte-n7cvum:hover{background:black}.close.svelte-n7cvum:hover:before,.close.svelte-n7cvum:hover:after{height:2px;background:white}.close.svelte-n7cvum:focus{border-color:#3399ff;box-shadow:0 0 0 2px #3399ff}.close.svelte-n7cvum:active{transform:scale(0.9)}.close.svelte-n7cvum:hover,.close.svelte-n7cvum:focus,.close.svelte-n7cvum:active{outline:none}"); + } + function Va(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10 = e20[1].closeButton && Ha(e20), k10 = e20[2]; + return k10 && (a10 = Li(k10, {})), { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = ji("div"), b10 && b10.c(), o10 = $i(), i10 = ji("div"), a10 && Pa(a10.$$.fragment), Ai(i10, "class", s10 = si(e20[1].classContent) + " svelte-n7cvum"), Ai(i10, "style", e20[9]), zi(i10, "content", !e20[0]), Ai(r10, "class", c10 = si(e20[1].classWindow) + " svelte-n7cvum"), Ai(r10, "role", "dialog"), Ai(r10, "aria-modal", "true"), Ai(r10, "aria-label", l10 = e20[1].ariaLabelledBy ? null : e20[1].ariaLabel || null), Ai(r10, "aria-labelledby", u10 = e20[1].ariaLabelledBy || null), Ai(r10, "style", e20[8]), zi(r10, "window", !e20[0]), Ai(n10, "class", d10 = si(e20[1].classWindowWrap) + " svelte-n7cvum"), Ai(n10, "style", e20[7]), zi(n10, "wrap", !e20[0]), Ai(t10, "aria-hidden", "true"), Ai(t10, "id", h10 = e20[1].id), Ai(t10, "class", v10 = si(e20[1].classBg) + " svelte-n7cvum"), Ai(t10, "style", e20[6]), zi(t10, "bg", !e20[0]); + }, m: function(s11, c11) { + ki(s11, t10, c11), pi(t10, n10), pi(n10, r10), b10 && b10.m(r10, null), pi(r10, o10), pi(r10, i10), a10 && Ta(a10, i10, null), e20[50](r10), e20[51](n10), e20[52](t10), m10 = true, g10 || (y10 = [Oi(r10, "introstart", function() { + Yo(e20[13]) && e20[13].apply(this, arguments); + }), Oi(r10, "outrostart", function() { + Yo(e20[14]) && e20[14].apply(this, arguments); + }), Oi(r10, "introend", function() { + Yo(e20[15]) && e20[15].apply(this, arguments); + }), Oi(r10, "outroend", function() { + Yo(e20[16]) && e20[16].apply(this, arguments); + }), Oi(t10, "mousedown", e20[20]), Oi(t10, "mouseup", e20[21])], g10 = true); + }, p: function(f11, p11) { + if ((e20 = f11)[1].closeButton ? b10 ? (b10.p(e20, p11), 2 & p11[0] && wa(b10, 1)) : ((b10 = Ha(e20)).c(), wa(b10, 1), b10.m(r10, o10)) : b10 && (ba(), xa(b10, 1, 1, function() { + b10 = null; + }), ka()), 4 & p11[0] && k10 !== (k10 = e20[2])) { + if (a10) { + ba(); + var g11 = a10; + xa(g11.$$.fragment, 1, 0, function() { + Ra(g11, 1); + }), ka(); + } + k10 ? (Pa((a10 = Li(k10, {})).$$.fragment), wa(a10.$$.fragment, 1), Ta(a10, i10, null)) : a10 = null; + } + (!m10 || 2 & p11[0] && s10 !== (s10 = si(e20[1].classContent) + " svelte-n7cvum")) && Ai(i10, "class", s10), (!m10 || 512 & p11[0]) && Ai(i10, "style", e20[9]), (!m10 || 3 & p11[0]) && zi(i10, "content", !e20[0]), (!m10 || 2 & p11[0] && c10 !== (c10 = si(e20[1].classWindow) + " svelte-n7cvum")) && Ai(r10, "class", c10), (!m10 || 2 & p11[0] && l10 !== (l10 = e20[1].ariaLabelledBy ? null : e20[1].ariaLabel || null)) && Ai(r10, "aria-label", l10), (!m10 || 2 & p11[0] && u10 !== (u10 = e20[1].ariaLabelledBy || null)) && Ai(r10, "aria-labelledby", u10), (!m10 || 256 & p11[0]) && Ai(r10, "style", e20[8]), (!m10 || 3 & p11[0]) && zi(r10, "window", !e20[0]), (!m10 || 2 & p11[0] && d10 !== (d10 = si(e20[1].classWindowWrap) + " svelte-n7cvum")) && Ai(n10, "class", d10), (!m10 || 128 & p11[0]) && Ai(n10, "style", e20[7]), (!m10 || 3 & p11[0]) && zi(n10, "wrap", !e20[0]), (!m10 || 2 & p11[0] && h10 !== (h10 = e20[1].id)) && Ai(t10, "id", h10), (!m10 || 2 & p11[0] && v10 !== (v10 = si(e20[1].classBg) + " svelte-n7cvum")) && Ai(t10, "class", v10), (!m10 || 64 & p11[0]) && Ai(t10, "style", e20[6]), (!m10 || 3 & p11[0]) && zi(t10, "bg", !e20[0]); + }, i: function(n11) { + m10 || (wa(b10), a10 && wa(a10.$$.fragment, n11), n11 && la(function() { + m10 && (f10 || (f10 = Sa(r10, e20[12], e20[1].transitionWindowProps, true)), f10.run(1)); + }), n11 && la(function() { + m10 && (p10 || (p10 = Sa(t10, e20[11], e20[1].transitionBgProps, true)), p10.run(1)); + }), m10 = true); + }, o: function(n11) { + xa(b10), a10 && xa(a10.$$.fragment, n11), n11 && (f10 || (f10 = Sa(r10, e20[12], e20[1].transitionWindowProps, false)), f10.run(0)), n11 && (p10 || (p10 = Sa(t10, e20[11], e20[1].transitionBgProps, false)), p10.run(0)), m10 = false; + }, d: function(n11) { + n11 && wi(t10), b10 && b10.d(), a10 && Ra(a10), e20[50](null), n11 && f10 && f10.end(), e20[51](null), e20[52](null), n11 && p10 && p10.end(), g10 = false, Qo(y10); + } }; + } + function Ha(e20) { + var t10, n10, r10, o10, i10, a10 = [Ua, Wa], s10 = []; + function c10(e21, n11) { + return 2 & n11[0] && (t10 = null), null == t10 && (t10 = !!e21[17](e21[1].closeButton)), t10 ? 0 : 1; + } + return n10 = c10(e20, [-1, -1, -1]), r10 = s10[n10] = a10[n10](e20), { c: function() { + r10.c(), o10 = _i(); + }, m: function(e21, t11) { + s10[n10].m(e21, t11), ki(e21, o10, t11), i10 = true; + }, p: function(e21, t11) { + var i11 = n10; + (n10 = c10(e21, t11)) === i11 ? s10[n10].p(e21, t11) : (ba(), xa(s10[i11], 1, 1, function() { + s10[i11] = null; + }), ka(), (r10 = s10[n10]) ? r10.p(e21, t11) : (r10 = s10[n10] = a10[n10](e21)).c(), wa(r10, 1), r10.m(o10.parentNode, o10)); + }, i: function(e21) { + i10 || (wa(r10), i10 = true); + }, o: function(e21) { + xa(r10), i10 = false; + }, d: function(e21) { + e21 && wi(o10), s10[n10].d(e21); + } }; + } + function Wa(e20) { + var t10, n10, r10, o10; + return { c: function() { + Ai(t10 = ji("button"), "class", n10 = si(e20[1].classCloseButton) + " svelte-n7cvum"), Ai(t10, "aria-label", "Close modal"), Ai(t10, "style", e20[10]), Ai(t10, "type", "button"), zi(t10, "close", !e20[0]); + }, m: function(n11, i10) { + ki(n11, t10, i10), r10 || (o10 = Oi(t10, "click", e20[18]), r10 = true); + }, p: function(e21, r11) { + 2 & r11[0] && n10 !== (n10 = si(e21[1].classCloseButton) + " svelte-n7cvum") && Ai(t10, "class", n10), 1024 & r11[0] && Ai(t10, "style", e21[10]), 3 & r11[0] && zi(t10, "close", !e21[0]); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10), r10 = false, o10(); + } }; + } + function Ua(e20) { + var t10, n10, r10, o10 = e20[1].closeButton; + function i10(e21, t11) { + return { props: { onClose: e21[18] } }; + } + return o10 && (t10 = Li(o10, i10(e20))), { c: function() { + t10 && Pa(t10.$$.fragment), n10 = _i(); + }, m: function(e21, o11) { + t10 && Ta(t10, e21, o11), ki(e21, n10, o11), r10 = true; + }, p: function(e21, r11) { + if (2 & r11[0] && o10 !== (o10 = e21[1].closeButton)) { + if (t10) { + ba(); + var a10 = t10; + xa(a10.$$.fragment, 1, 0, function() { + Ra(a10, 1); + }), ka(); + } + o10 ? (Pa((t10 = Li(o10, i10(e21))).$$.fragment), wa(t10.$$.fragment, 1), Ta(t10, n10.parentNode, n10)) : t10 = null; + } + }, i: function(e21) { + r10 || (t10 && wa(t10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + t10 && xa(t10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(n10), t10 && Ra(t10, e21); + } }; + } + function Ja(e20) { + var t10, n10, r10, o10, i10 = e20[2] && Va(e20), a10 = e20[49].default, s10 = ei(a10, e20, e20[48], null); + return { c: function() { + i10 && i10.c(), t10 = $i(), s10 && s10.c(); + }, m: function(a11, c10) { + i10 && i10.m(a11, c10), ki(a11, t10, c10), s10 && s10.m(a11, c10), n10 = true, r10 || (o10 = Oi(La, "keydown", e20[19]), r10 = true); + }, p: function(e21, r11) { + e21[2] ? i10 ? (i10.p(e21, r11), 4 & r11[0] && wa(i10, 1)) : ((i10 = Va(e21)).c(), wa(i10, 1), i10.m(t10.parentNode, t10)) : i10 && (ba(), xa(i10, 1, 1, function() { + i10 = null; + }), ka()), s10 && s10.p && (!n10 || 131072 & r11[1]) && ri(s10, a10, e21, e21[48], n10 ? ni(a10, e21[48], r11, null) : oi(e21[48]), null); + }, i: function(e21) { + n10 || (wa(i10), wa(s10, e21), n10 = true); + }, o: function(e21) { + xa(i10), xa(s10, e21), n10 = false; + }, d: function(e21) { + e21 && wi(t10), i10 && i10.d(e21), s10 && s10.d(e21), r10 = false, o10(); + } }; + } + function Ka(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + return function(n10) { + return new e20(Ro(Ro({}, n10), {}, { props: Ro(Ro({}, t10), n10.props) })); + }; + } + function Ga(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10 = t10.$$slots, b10 = void 0 === y10 ? {} : y10, k10 = t10.$$scope, w10 = Yi(), x10 = Xi, j10 = t10.isTabbable, S10 = void 0 === j10 ? function(e21) { + return e21.tabIndex >= 0 && !e21.hidden && !e21.disabled && "none" !== e21.style.display && "hidden" !== e21.type && Boolean(e21.offsetWidth || e21.offsetHeight || e21.getClientRects().length); + } : j10, C10 = t10.show, $10 = void 0 === C10 ? null : C10, _10 = t10.id, O10 = void 0 === _10 ? null : _10, M10 = t10.key, E10 = void 0 === M10 ? "simple-modal" : M10, A10 = t10.ariaLabel, P10 = void 0 === A10 ? null : A10, T8 = t10.ariaLabelledBy, R8 = void 0 === T8 ? null : T8, N8 = t10.closeButton, I10 = void 0 === N8 || N8, D10 = t10.closeOnEsc, q10 = void 0 === D10 || D10, z10 = t10.closeOnOuterClick, B10 = void 0 === z10 || z10, L10 = t10.styleBg, F10 = void 0 === L10 ? {} : L10, V10 = t10.styleWindowWrap, H10 = void 0 === V10 ? {} : V10, W10 = t10.styleWindow, U10 = void 0 === W10 ? {} : W10, J10 = t10.styleContent, K10 = void 0 === J10 ? {} : J10, G10 = t10.styleCloseButton, Q10 = void 0 === G10 ? {} : G10, Y10 = t10.classBg, X10 = void 0 === Y10 ? null : Y10, Z10 = t10.classWindowWrap, ee2 = void 0 === Z10 ? null : Z10, te2 = t10.classWindow, ne2 = void 0 === te2 ? null : te2, re2 = t10.classContent, oe2 = void 0 === re2 ? null : re2, ie2 = t10.classCloseButton, ae2 = void 0 === ie2 ? null : ie2, se2 = t10.unstyled, ce2 = void 0 !== se2 && se2, le2 = t10.setContext, ue2 = void 0 === le2 ? x10 : le2, fe2 = t10.transitionBg, de2 = void 0 === fe2 ? Ba : fe2, he2 = t10.transitionBgProps, ve2 = void 0 === he2 ? { duration: 250 } : he2, pe2 = t10.transitionWindow, me2 = void 0 === pe2 ? de2 : pe2, ge2 = t10.transitionWindowProps, ye2 = void 0 === ge2 ? ve2 : ge2, be2 = t10.disableFocusTrap, ke2 = void 0 !== be2 && be2, we2 = { id: O10, ariaLabel: P10, ariaLabelledBy: R8, closeButton: I10, closeOnEsc: q10, closeOnOuterClick: B10, styleBg: F10, styleWindowWrap: H10, styleWindow: U10, styleContent: K10, styleCloseButton: Q10, classBg: X10, classWindowWrap: ee2, classWindow: ne2, classContent: oe2, classCloseButton: ae2, transitionBg: de2, transitionBgProps: ve2, transitionWindow: me2, transitionWindowProps: ye2, disableFocusTrap: ke2, isTabbable: S10, unstyled: ce2 }, xe2 = Ro({}, we2), je2 = null, Se2 = function(e21) { + return e21 ? Object.keys(e21).reduce(function(t11, n11) { + return "".concat(t11, "; ").concat(function(e23) { + return e23.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase(); + }(n11), ": ").concat(e21[n11]); + }, "") : ""; + }, Ce2 = function(e21) { + return !!(e21 && e21.constructor && e21.call && e21.apply); + }, $e2 = function() { + }, _e2 = $e2, Oe2 = $e2, Me2 = $e2, Ee2 = $e2, Ae2 = function(e21) { + var t11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, r11 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}; + n10(2, je2 = Ka(e21, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {})), n10(1, xe2 = Ro(Ro({}, we2), t11)), n10(6, s10 = Se2(Object.assign({}, { width: window.innerWidth, height: window.innerHeight }, xe2.styleBg))), n10(7, c10 = Se2(xe2.styleWindowWrap)), n10(8, l10 = Se2(xe2.styleWindow)), n10(9, u10 = Se2(xe2.styleContent)), n10(10, f10 = Se2(xe2.styleCloseButton)), n10(11, d10 = xe2.transitionBg), n10(12, h10 = xe2.transitionWindow), Te2(), n10(13, _e2 = function(e23) { + r11.onOpen && r11.onOpen(e23), w10("open"), w10("opening"); + }), n10(14, Oe2 = function(e23) { + r11.onClose && r11.onClose(e23), w10("close"), w10("closing"); + }), n10(15, Me2 = function(e23) { + r11.onOpened && r11.onOpened(e23), w10("opened"); + }), n10(16, Ee2 = function(e23) { + r11.onClosed && r11.onClosed(e23), w10("closed"); + }); + }, Pe2 = function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + je2 && (n10(14, Oe2 = e21.onClose || Oe2), n10(16, Ee2 = e21.onClosed || Ee2), n10(2, je2 = null), Re2()); + }, Te2 = function() { + a10 = window.scrollY, v10 = document.body.style.position, p10 = document.body.style.overflow, m10 = document.body.style.width, document.body.style.position = "fixed", document.body.style.top = "-".concat(a10, "px"), document.body.style.overflow = "hidden", document.body.style.width = "100%"; + }, Re2 = function() { + document.body.style.position = v10 || "", document.body.style.top = "", document.body.style.overflow = p10 || "", document.body.style.width = m10 || "", window.scrollTo({ top: a10, left: 0, behavior: "instant" }); + }; + ue2(E10, { open: Ae2, close: Pe2 }); + var Ne2 = false; + return Qi(function() { + Ne2 && Pe2(); + }), Gi(function() { + n10(47, Ne2 = true); + }), e20.$$set = function(e21) { + "isTabbable" in e21 && n10(22, S10 = e21.isTabbable), "show" in e21 && n10(23, $10 = e21.show), "id" in e21 && n10(24, O10 = e21.id), "key" in e21 && n10(25, E10 = e21.key), "ariaLabel" in e21 && n10(26, P10 = e21.ariaLabel), "ariaLabelledBy" in e21 && n10(27, R8 = e21.ariaLabelledBy), "closeButton" in e21 && n10(28, I10 = e21.closeButton), "closeOnEsc" in e21 && n10(29, q10 = e21.closeOnEsc), "closeOnOuterClick" in e21 && n10(30, B10 = e21.closeOnOuterClick), "styleBg" in e21 && n10(31, F10 = e21.styleBg), "styleWindowWrap" in e21 && n10(32, H10 = e21.styleWindowWrap), "styleWindow" in e21 && n10(33, U10 = e21.styleWindow), "styleContent" in e21 && n10(34, K10 = e21.styleContent), "styleCloseButton" in e21 && n10(35, Q10 = e21.styleCloseButton), "classBg" in e21 && n10(36, X10 = e21.classBg), "classWindowWrap" in e21 && n10(37, ee2 = e21.classWindowWrap), "classWindow" in e21 && n10(38, ne2 = e21.classWindow), "classContent" in e21 && n10(39, oe2 = e21.classContent), "classCloseButton" in e21 && n10(40, ae2 = e21.classCloseButton), "unstyled" in e21 && n10(0, ce2 = e21.unstyled), "setContext" in e21 && n10(41, ue2 = e21.setContext), "transitionBg" in e21 && n10(42, de2 = e21.transitionBg), "transitionBgProps" in e21 && n10(43, ve2 = e21.transitionBgProps), "transitionWindow" in e21 && n10(44, me2 = e21.transitionWindow), "transitionWindowProps" in e21 && n10(45, ye2 = e21.transitionWindowProps), "disableFocusTrap" in e21 && n10(46, ke2 = e21.disableFocusTrap), "$$scope" in e21 && n10(48, k10 = e21.$$scope); + }, e20.$$.update = function() { + 8388608 & e20.$$.dirty[0] | 65536 & e20.$$.dirty[1] && Ne2 && (Ce2($10) ? Ae2($10) : Pe2()); + }, [ce2, xe2, je2, r10, o10, i10, s10, c10, l10, u10, f10, d10, h10, _e2, Oe2, Me2, Ee2, Ce2, Pe2, function(e21) { + if (xe2.closeOnEsc && je2 && "Escape" === e21.key && (e21.preventDefault(), Pe2()), je2 && "Tab" === e21.key && !xe2.disableFocusTrap) { + var t11 = i10.querySelectorAll("*"), n11 = Array.from(t11).filter(xe2.isTabbable).sort(function(e23, t12) { + return e23.tabIndex - t12.tabIndex; + }), r11 = n11.indexOf(document.activeElement); + -1 === r11 && e21.shiftKey && (r11 = 0), r11 += n11.length + (e21.shiftKey ? -1 : 1), n11[r11 %= n11.length].focus(), e21.preventDefault(); + } + }, function(e21) { + !xe2.closeOnOuterClick || e21.target !== r10 && e21.target !== o10 || (g10 = e21.target); + }, function(e21) { + xe2.closeOnOuterClick && e21.target === g10 && (e21.preventDefault(), Pe2()); + }, S10, $10, O10, E10, P10, R8, I10, q10, B10, F10, H10, U10, K10, Q10, X10, ee2, ne2, oe2, ae2, ue2, de2, ve2, me2, ye2, ke2, Ne2, k10, b10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(5, i10 = e21); + }); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(4, o10 = e21); + }); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(3, r10 = e21); + }); + }]; + } + var Qa; + var Ya; + var Xa; + var Za; + var es; + var ts; + var ns; + var rs = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, Ga, Ja, Xo, { isTabbable: 22, show: 23, id: 24, key: 25, ariaLabel: 26, ariaLabelledBy: 27, closeButton: 28, closeOnEsc: 29, closeOnOuterClick: 30, styleBg: 31, styleWindowWrap: 32, styleWindow: 33, styleContent: 34, styleCloseButton: 35, classBg: 36, classWindowWrap: 37, classWindow: 38, classContent: 39, classCloseButton: 40, unstyled: 0, setContext: 41, transitionBg: 42, transitionBgProps: 43, transitionWindow: 44, transitionWindowProps: 45, disableFocusTrap: 46 }, Fa, [-1, -1, -1]), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + !function(e20) { + e20.text = "text", e20.tree = "tree", e20.table = "table"; + }(Qa || (Qa = {})), function(e20) { + e20.after = "after", e20.inside = "inside", e20.key = "key", e20.value = "value", e20.multi = "multi", e20.text = "text"; + }(Ya || (Ya = {})), function(e20) { + e20.after = "after", e20.key = "key", e20.value = "value", e20.inside = "inside"; + }(Xa || (Xa = {})), function(e20) { + e20.info = "info", e20.warning = "warning", e20.error = "error"; + }(Za || (Za = {})), function(e20) { + e20.key = "key", e20.value = "value"; + }(es || (es = {})), function(e20) { + e20.asc = "asc", e20.desc = "desc"; + }(ts || (ts = {})), function(e20) { + e20.no = "no", e20.self = "self", e20.nextInside = "nextInside"; + }(ns || (ns = {})); + var os = 50; + var is = 200; + var as = 400; + var ss = 1200; + var cs = 1e3; + var ls = 100; + var us = 100; + var fs = 2e4; + var ds = [{ start: 0, end: ls }]; + var hs = 104857600; + var vs = 1048576; + var ps = 10485760; + var ms = 10240; + var gs = { closeButton: false, classBg: "jse-modal-bg", classWindow: "jse-modal-window", classWindowWrap: "jse-modal-window-wrap", classContent: "jse-modal-container" }; + var ys = Ro(Ro({}, gs), {}, { classWindow: "jse-modal-window jse-modal-window-sort" }); + var bs = Ro(Ro({}, gs), {}, { classWindow: "jse-modal-window jse-modal-window-transform" }); + var ks = Ro(Ro({}, gs), {}, { classWindow: "jse-modal-window jse-modal-window-jsoneditor" }); + var ws = "Insert or paste contents, enter [ insert a new array, enter { to insert a new object, or start typing to insert a new value"; + var xs = "Open context menu (Click here, right click on the selection, or use the context menu button or Ctrl+Q)"; + var js = "hover-insert-inside"; + var Ss = "hover-insert-after"; + var Cs = "hover-collection"; + var $s = "valid"; + var _s = "repairable"; + var Os = 336; + var Ms = 260; + var Es = qo(qo({}, ts.asc, "ascending"), ts.desc, "descending"); + var As = 0; + function Ps() { + return ++As; + } + function Ts(e20) { + return Array.isArray(e20); + } + function Rs(e20) { + return null !== e20 && "object" === Ho(e20) && e20.constructor === Object; + } + function Ns(e20) { + return !(!e20 || "object" !== Ho(e20)) && "add" === e20.op; + } + function Is(e20) { + return !(!e20 || "object" !== Ho(e20)) && "remove" === e20.op; + } + function Ds(e20) { + return !(!e20 || "object" !== Ho(e20)) && "replace" === e20.op; + } + function qs(e20) { + return !(!e20 || "object" !== Ho(e20)) && "copy" === e20.op; + } + function zs(e20) { + return !(!e20 || "object" !== Ho(e20)) && "move" === e20.op; + } + function Bs(e20, t10) { + return e20 === t10; + } + function Ls(e20) { + return e20.slice(0, e20.length - 1); + } + function Fs(e20) { + return "object" === Ho(e20) && null !== e20; + } + function Vs(e20) { + if (Ts(e20)) { + var t10 = e20.slice(); + return Object.getOwnPropertySymbols(e20).forEach(function(n11) { + t10[n11] = e20[n11]; + }), t10; + } + if (Rs(e20)) { + var n10 = Ro({}, e20); + return Object.getOwnPropertySymbols(e20).forEach(function(t11) { + n10[t11] = e20[t11]; + }), n10; + } + return e20; + } + function Hs(e20, t10, n10) { + if (e20[t10] === n10) + return e20; + var r10 = Vs(e20); + return r10[t10] = n10, r10; + } + function Ws(e20, t10) { + for (var n10 = e20, r10 = 0; r10 < t10.length; ) + n10 = Rs(n10) ? n10[t10[r10]] : Ts(n10) ? n10[parseInt(t10[r10])] : void 0, r10++; + return n10; + } + function Us(e20, t10, n10) { + var r10 = arguments.length > 3 && void 0 !== arguments[3] && arguments[3]; + if (0 === t10.length) + return n10; + var o10 = t10[0], i10 = Us(e20 ? e20[o10] : void 0, t10.slice(1), n10, r10); + if (Rs(e20) || Ts(e20)) + return Hs(e20, o10, i10); + if (r10) { + var a10 = Js.test(o10) ? [] : {}; + return a10[o10] = i10, a10; + } + throw new Error("Path does not exist"); + } + var Js = /^\d+$/; + function Ks(e20, t10, n10) { + if (0 === t10.length) + return n10(e20); + if (!Fs(e20)) + throw new Error("Path doesn't exist"); + var r10 = t10[0]; + return Hs(e20, r10, Ks(e20[r10], t10.slice(1), n10)); + } + function Gs(e20, t10) { + if (0 === t10.length) + return e20; + if (!Fs(e20)) + throw new Error("Path does not exist"); + if (1 === t10.length) { + var n10 = t10[0]; + if (n10 in e20) { + var r10 = Vs(e20); + return Ts(r10) && r10.splice(parseInt(n10), 1), Rs(r10) && delete r10[n10], r10; + } + return e20; + } + var o10 = t10[0]; + return Hs(e20, o10, Gs(e20[o10], t10.slice(1))); + } + function Qs(e20, t10, n10) { + var r10 = t10.slice(0, t10.length - 1), o10 = t10[t10.length - 1]; + return Ks(e20, r10, function(e21) { + if (!Array.isArray(e21)) + throw new TypeError("Array expected at path " + JSON.stringify(r10)); + var t11 = Vs(e21); + return t11.splice(parseInt(o10), 0, n10), t11; + }); + } + function Ys(e20, t10) { + return void 0 !== e20 && (0 === t10.length || null !== e20 && Ys(e20[t10[0]], t10.slice(1))); + } + function Xs(e20) { + var t10 = e20.split("/"); + return t10.shift(), t10.map(function(e21) { + return e21.replace(/~1/g, "/").replace(/~0/g, "~"); + }); + } + function Zs(e20) { + return e20.map(ec).join(""); + } + function ec(e20) { + return "/" + String(e20).replace(/~/g, "~0").replace(/\//g, "~1"); + } + function tc(e20, t10) { + return e20 + ec(t10); + } + function nc(e20, t10) { + return e20.startsWith(t10) && (e20.length === t10.length || "/" === e20[t10.length]); + } + function rc(e20, t10, n10) { + for (var r10 = e20, o10 = 0; o10 < t10.length; o10++) { + fc(t10[o10]); + var i10 = t10[o10]; + if (n10 && n10.before) { + var a10 = n10.before(r10, i10); + if (void 0 !== a10) { + if (void 0 !== a10.document && (r10 = a10.document), void 0 !== a10.json) + throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"'); + void 0 !== a10.operation && (i10 = a10.operation); + } + } + var s10 = r10, c10 = dc(r10, i10.path); + if ("add" === i10.op) + r10 = ac(r10, c10, i10.value); + else if ("remove" === i10.op) + r10 = ic(r10, c10); + else if ("replace" === i10.op) + r10 = oc(r10, c10, i10.value); + else if ("copy" === i10.op) + r10 = sc(r10, c10, hc(i10.from)); + else if ("move" === i10.op) + r10 = cc(r10, c10, hc(i10.from)); + else { + if ("test" !== i10.op) + throw new Error("Unknown JSONPatch operation " + JSON.stringify(i10)); + lc(r10, c10, i10.value); + } + if (n10 && n10.after) { + var l10 = n10.after(r10, i10, s10); + void 0 !== l10 && (r10 = l10); + } + } + return r10; + } + function oc(e20, t10, n10) { + return Us(e20, t10, n10); + } + function ic(e20, t10) { + return Gs(e20, t10); + } + function ac(e20, t10, n10) { + return uc(e20, t10) ? Qs(e20, t10, n10) : Us(e20, t10, n10); + } + function sc(e20, t10, n10) { + var r10 = Ws(e20, n10); + return uc(e20, t10) ? Qs(e20, t10, r10) : Us(e20, t10, Ws(e20, n10)); + } + function cc(e20, t10, n10) { + var r10 = Ws(e20, n10), o10 = Gs(e20, n10); + return uc(o10, t10) ? Qs(o10, t10, r10) : Us(o10, t10, r10); + } + function lc(e20, t10, n10) { + if (void 0 === n10) + throw new Error('Test failed: no value provided (path: "'.concat(Zs(t10), '")')); + if (!Ys(e20, t10)) + throw new Error('Test failed: path not found (path: "'.concat(Zs(t10), '")')); + var r10, o10, i10 = Ws(e20, t10); + if (r10 = i10, o10 = n10, JSON.stringify(r10) !== JSON.stringify(o10)) + throw new Error('Test failed, value differs (path: "'.concat(Zs(t10), '")')); + } + function uc(e20, t10) { + if (0 === t10.length) + return false; + var n10 = Ws(e20, Ls(t10)); + return Array.isArray(n10); + } + function fc(e20) { + if (!["add", "remove", "replace", "copy", "move", "test"].includes(e20.op)) + throw new Error("Unknown JSONPatch op " + JSON.stringify(e20.op)); + if ("string" != typeof e20.path) + throw new Error('Required property "path" missing or not a string in operation ' + JSON.stringify(e20)); + if (("copy" === e20.op || "move" === e20.op) && "string" != typeof e20.from) + throw new Error('Required property "from" missing or not a string in operation ' + JSON.stringify(e20)); + } + function dc(e20, t10) { + return function(e21, t11) { + if ("-" !== function(e23) { + return e23[e23.length - 1]; + }(t11)) + return t11; + var n10 = Ls(t11), r10 = Ws(e21, n10); + return n10.concat(r10.length); + }(e20, Xs(t10)); + } + function hc(e20) { + return Xs(e20); + } + function vc(e20, t10, n10) { + var r10 = []; + return rc(e20, t10, { before: function(e21, t11) { + var o10, i10, a10 = dc(e21, t11.path); + if ("add" === t11.op) + o10 = gc(e21, a10); + else if ("remove" === t11.op) + o10 = mc(e21, a10); + else if ("replace" === t11.op) + o10 = pc(e21, a10); + else if ("copy" === t11.op) + o10 = function(e23, t12) { + return gc(e23, t12); + }(e21, a10); + else if ("move" === t11.op) + o10 = function(e23, t12, n11) { + if (t12.length < n11.length && function(e24, t13) { + var n12 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Bs; + if (e24.length < t13.length) + return false; + for (var r12 = 0; r12 < t13.length; r12++) + if (!n12(e24[r12], t13[r12])) + return false; + return true; + }(n11, t12)) + return [{ op: "replace", path: Zs(t12), value: e23 }]; + var r11 = { op: "move", from: Zs(t12), path: Zs(n11) }; + return !uc(e23, t12) && Ys(e23, t12) ? [r11].concat(Bo(mc(e23, t12))) : [r11]; + }(e21, a10, hc(t11.from)); + else { + if ("test" !== t11.op) + throw new Error("Unknown JSONPatch operation " + JSON.stringify(t11)); + o10 = []; + } + if (n10 && n10.before) { + var s10 = n10.before(e21, t11, o10); + if (s10 && s10.revertOperations && (o10 = s10.revertOperations), s10 && s10.document && (i10 = s10.document), s10 && s10.json) + throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"'); + } + if (r10 = o10.concat(r10), void 0 !== i10) + return { document: i10 }; + } }), r10; + } + function pc(e20, t10) { + return [{ op: "replace", path: Zs(t10), value: Ws(e20, t10) }]; + } + function mc(e20, t10) { + return [{ op: "add", path: Zs(t10), value: Ws(e20, t10) }]; + } + function gc(e20, t10) { + return uc(e20, t10) || !Ys(e20, t10) ? [{ op: "remove", path: Zs(t10) }] : pc(e20, t10); + } + function yc(e20) { + return e20 && e20.__esModule && Object.prototype.hasOwnProperty.call(e20, "default") ? e20.default : e20; + } + var bc = {}; + var kc = { b: "\b", f: "\f", n: "\n", r: "\r", t: " ", '"': '"', "/": "/", "\\": "\\" }; + var wc = "a".charCodeAt(); + bc.parse = function(e20, t10, n10) { + var r10 = {}, o10 = 0, i10 = 0, a10 = 0, s10 = n10 && n10.bigint && "undefined" != typeof BigInt; + return { data: c10("", true), pointers: r10 }; + function c10(t11, n11) { + var r11; + l10(), m10(t11, "value"); + var o11 = d10(); + switch (o11) { + case "t": + f10("rue"), r11 = true; + break; + case "f": + f10("alse"), r11 = false; + break; + case "n": + f10("ull"), r11 = null; + break; + case '"': + r11 = u10(); + break; + case "[": + r11 = function(e21) { + l10(); + var t12 = [], n12 = 0; + if ("]" == d10()) + return t12; + h10(); + for (; ; ) { + var r12 = e21 + "/" + n12; + t12.push(c10(r12)), l10(); + var o12 = d10(); + if ("]" == o12) + break; + "," != o12 && k10(), l10(), n12++; + } + return t12; + }(t11); + break; + case "{": + r11 = function(e21) { + l10(); + var t12 = {}; + if ("}" == d10()) + return t12; + h10(); + for (; ; ) { + var n12 = y10(); + '"' != d10() && k10(); + var r12 = u10(), o12 = e21 + "/" + Tc(r12); + g10(o12, "key", n12), m10(o12, "keyEnd"), l10(), ":" != d10() && k10(), l10(), t12[r12] = c10(o12), l10(); + var i11 = d10(); + if ("}" == i11) + break; + "," != i11 && k10(), l10(); + } + return t12; + }(t11); + break; + default: + h10(), "-0123456789".indexOf(o11) >= 0 ? r11 = function() { + var t12 = "", n12 = true; + "-" == e20[a10] && (t12 += d10()); + t12 += "0" == e20[a10] ? d10() : p10(), "." == e20[a10] && (t12 += d10() + p10(), n12 = false); + "e" != e20[a10] && "E" != e20[a10] || (t12 += d10(), "+" != e20[a10] && "-" != e20[a10] || (t12 += d10()), t12 += p10(), n12 = false); + var r12 = +t12; + return s10 && n12 && (r12 > Number.MAX_SAFE_INTEGER || r12 < Number.MIN_SAFE_INTEGER) ? BigInt(t12) : r12; + }() : b10(); + } + return m10(t11, "valueEnd"), l10(), n11 && a10 < e20.length && b10(), r11; + } + function l10() { + e: + for (; a10 < e20.length; ) { + switch (e20[a10]) { + case " ": + i10++; + break; + case " ": + i10 += 4; + break; + case "\r": + i10 = 0; + break; + case "\n": + i10 = 0, o10++; + break; + default: + break e; + } + a10++; + } + } + function u10() { + for (var e21, t11 = ""; '"' != (e21 = d10()); ) + "\\" == e21 ? (e21 = d10()) in kc ? t11 += kc[e21] : "u" == e21 ? t11 += v10() : k10() : t11 += e21; + return t11; + } + function f10(e21) { + for (var t11 = 0; t11 < e21.length; t11++) + d10() !== e21[t11] && k10(); + } + function d10() { + w10(); + var t11 = e20[a10]; + return a10++, i10++, t11; + } + function h10() { + a10--, i10--; + } + function v10() { + for (var e21 = 4, t11 = 0; e21--; ) { + t11 <<= 4; + var n11 = d10().toLowerCase(); + n11 >= "a" && n11 <= "f" ? t11 += n11.charCodeAt() - wc + 10 : n11 >= "0" && n11 <= "9" ? t11 += +n11 : k10(); + } + return String.fromCharCode(t11); + } + function p10() { + for (var t11 = ""; e20[a10] >= "0" && e20[a10] <= "9"; ) + t11 += d10(); + if (t11.length) + return t11; + w10(), b10(); + } + function m10(e21, t11) { + g10(e21, t11, y10()); + } + function g10(e21, t11, n11) { + r10[e21] = r10[e21] || {}, r10[e21][t11] = n11; + } + function y10() { + return { line: o10, column: i10, pos: a10 }; + } + function b10() { + throw new SyntaxError("Unexpected token " + e20[a10] + " in JSON at position " + a10); + } + function k10() { + h10(), b10(); + } + function w10() { + if (a10 >= e20.length) + throw new SyntaxError("Unexpected end of JSON input"); + } + }, bc.stringify = function(e20, t10, n10) { + if (jc(e20)) { + var r10, o10, i10 = 0, a10 = "object" == Ho(n10) ? n10.space : n10; + switch (Ho(a10)) { + case "number": + var s10 = a10 > 10 ? 10 : a10 < 0 ? 0 : Math.floor(a10); + a10 = s10 && y10(s10, " "), r10 = s10, o10 = s10; + break; + case "string": + a10 = a10.slice(0, 10), r10 = 0, o10 = 0; + for (var c10 = 0; c10 < a10.length; c10++) { + switch (a10[c10]) { + case " ": + o10++; + break; + case " ": + o10 += 4; + break; + case "\r": + o10 = 0; + break; + case "\n": + o10 = 0, i10++; + break; + default: + throw new Error("whitespace characters not allowed in JSON"); + } + r10++; + } + break; + default: + a10 = void 0; + } + var l10 = "", u10 = {}, f10 = 0, d10 = 0, h10 = 0, v10 = n10 && n10.es6 && "function" == typeof Map; + return function e21(t11, n11, r11) { + switch (g10(r11, "value"), Ho(t11)) { + case "number": + case "bigint": + case "boolean": + p10("" + t11); + break; + case "string": + p10(Ec(t11)); + break; + case "object": + null === t11 ? p10("null") : "function" == typeof t11.toJSON ? p10(Ec(t11.toJSON())) : Array.isArray(t11) ? o11() : v10 ? t11.constructor.BYTES_PER_ELEMENT ? o11() : t11 instanceof Map ? s11() : t11 instanceof Set ? s11(true) : i11() : i11(); + } + function o11() { + if (t11.length) { + p10("["); + for (var o12 = n11 + 1, i12 = 0; i12 < t11.length; i12++) { + i12 && p10(","), m10(o12); + var a11 = jc(t11[i12]) ? t11[i12] : null; + e21(a11, o12, r11 + "/" + i12); + } + m10(n11), p10("]"); + } else + p10("[]"); + } + function i11() { + var o12 = Object.keys(t11); + if (o12.length) { + p10("{"); + for (var i12 = n11 + 1, s12 = 0; s12 < o12.length; s12++) { + var c11 = o12[s12], l11 = t11[c11]; + if (jc(l11)) { + s12 && p10(","); + var u11 = r11 + "/" + Tc(c11); + m10(i12), g10(u11, "key"), p10(Ec(c11)), g10(u11, "keyEnd"), p10(":"), a10 && p10(" "), e21(l11, i12, u11); + } + } + m10(n11), p10("}"); + } else + p10("{}"); + } + function s11(o12) { + if (t11.size) { + p10("{"); + for (var i12 = n11 + 1, s12 = true, c11 = t11.entries(), l11 = c11.next(); !l11.done; ) { + var u11 = l11.value, f11 = u11[0], d11 = !!o12 || u11[1]; + if (jc(d11)) { + s12 || p10(","), s12 = false; + var h11 = r11 + "/" + Tc(f11); + m10(i12), g10(h11, "key"), p10(Ec(f11)), g10(h11, "keyEnd"), p10(":"), a10 && p10(" "), e21(d11, i12, h11); + } + l11 = c11.next(); + } + m10(n11), p10("}"); + } else + p10("{}"); + } + g10(r11, "valueEnd"); + }(e20, 0, ""), { json: l10, pointers: u10 }; + } + function p10(e21) { + d10 += e21.length, h10 += e21.length, l10 += e21; + } + function m10(e21) { + if (a10) { + for (l10 += "\n" + y10(e21, a10), f10++, d10 = 0; e21--; ) + i10 ? (f10 += i10, d10 = o10) : d10 += o10, h10 += r10; + h10 += 1; + } + } + function g10(e21, t11) { + u10[e21] = u10[e21] || {}, u10[e21][t11] = { line: f10, column: d10, pos: h10 }; + } + function y10(e21, t11) { + return Array(e21 + 1).join(t11); + } + }; + var xc = ["number", "bigint", "boolean", "string", "object"]; + function jc(e20) { + return xc.indexOf(Ho(e20)) >= 0; + } + var Sc = /"|\\/g; + var Cc = /[\b]/g; + var $c = /\f/g; + var _c = /\n/g; + var Oc = /\r/g; + var Mc = /\t/g; + function Ec(e20) { + return '"' + (e20 = e20.replace(Sc, "\\$&").replace($c, "\\f").replace(Cc, "\\b").replace(_c, "\\n").replace(Oc, "\\r").replace(Mc, "\\t")) + '"'; + } + var Ac = /~/g; + var Pc = /\//g; + function Tc(e20) { + return e20.replace(Ac, "~0").replace(Pc, "~1"); + } + var Rc = function(e20) { + function t10(e21, n10) { + var r10; + return No(this, t10), (r10 = _o(this, t10, [e21 + " at position " + n10])).position = n10, r10; + } + return Ao(t10, $o(Error)), Do(t10); + }(); + var Nc = 92; + var Ic = 47; + var Dc = 42; + var qc = 123; + var zc = 125; + var Bc = 91; + var Lc = 93; + var Fc = 40; + var Vc = 41; + var Hc = 32; + var Wc = 10; + var Uc = 9; + var Jc = 13; + var Kc = 8; + var Gc = 12; + var Qc = 34; + var Yc = 43; + var Xc = 45; + var Zc = 39; + var el = 48; + var tl = 57; + var nl = 44; + var rl = 46; + var ol = 58; + var il = 59; + var al = 65; + var sl = 97; + var cl = 69; + var ll = 101; + var ul = 70; + var fl = 102; + var dl = 160; + var hl = 8192; + var vl = 8202; + var pl = 8239; + var ml = 8287; + var gl = 12288; + var yl = 8220; + var bl = 8221; + var kl = 8216; + var wl = 8217; + var xl = 96; + var jl = 180; + function Sl(e20) { + return e20 >= el && e20 <= tl || e20 >= al && e20 <= ul || e20 >= sl && e20 <= fl; + } + function Cl(e20) { + return e20 >= el && e20 <= tl; + } + function $l(e20) { + return e20 >= 32 && e20 <= 1114111; + } + function _l(e20) { + return Ol.test(e20) || Rl(e20.charCodeAt(0)); + } + var Ol = /^[,:[\]{}()\n+]$/; + function Ml(e20) { + return El.test(e20) || e20 && Rl(e20.charCodeAt(0)); + } + var El = /^[[{\w-]$/; + function Al(e20) { + return e20 === Wc || e20 === Jc || e20 === Uc || e20 === Kc || e20 === Gc; + } + function Pl(e20) { + return e20 === Hc || e20 === Wc || e20 === Uc || e20 === Jc; + } + function Tl(e20) { + return e20 === dl || e20 >= hl && e20 <= vl || e20 === pl || e20 === ml || e20 === gl; + } + function Rl(e20) { + return Nl(e20) || Dl(e20); + } + function Nl(e20) { + return e20 === Qc || e20 === yl || e20 === bl; + } + function Il(e20) { + return e20 === Qc; + } + function Dl(e20) { + return e20 === Zc || e20 === kl || e20 === wl || e20 === xl || e20 === jl; + } + function ql(e20) { + return e20 === Zc; + } + function zl(e20, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], r10 = e20.lastIndexOf(t10); + return -1 !== r10 ? e20.substring(0, r10) + (n10 ? "" : e20.substring(r10 + 1)) : e20; + } + function Bl(e20, t10) { + var n10 = e20.length; + if (!Pl(e20.charCodeAt(n10 - 1))) + return e20 + t10; + for (; Pl(e20.charCodeAt(n10 - 1)); ) + n10--; + return e20.substring(0, n10) + t10 + e20.substring(n10); + } + function Ll(e20, t10, n10) { + return e20.substring(0, t10) + e20.substring(t10 + n10); + } + var Fl = { "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t" }; + var Vl = { '"': '"', "\\": "\\", "/": "/", b: "\b", f: "\f", n: "\n", r: "\r", t: " " }; + function Hl(e20) { + var t10 = 0, n10 = ""; + o10() || function() { + throw new Rc("Unexpected end of json string", e20.length); + }(); + var r10 = c10(nl); + for (r10 && i10(), Ml(e20[t10]) && function(e21) { + return /[,\n][ \t\r]*$/.test(e21); + }(n10) ? (r10 || (n10 = Bl(n10, ",")), function() { + var e21 = true, t11 = true; + for (; t11; ) { + if (e21) + e21 = false; + else + c10(nl) || (n10 = Bl(n10, ",")); + t11 = o10(); + } + t11 || (n10 = zl(n10, ",")); + n10 = "[\n".concat(n10, "\n]"); + }()) : r10 && (n10 = zl(n10, ",")); e20.charCodeAt(t10) === zc || e20.charCodeAt(t10) === Lc; ) + t10++, i10(); + if (t10 >= e20.length) + return n10; + function o10() { + i10(); + var r11 = function() { + if (e20.charCodeAt(t10) === qc) { + n10 += "{", t10++, i10(); + for (var r12 = true; t10 < e20.length && e20.charCodeAt(t10) !== zc; ) { + if (r12 ? (true, r12 = false) : (c10(nl) || (n10 = Bl(n10, ",")), i10()), !(u10() || d10())) { + e20.charCodeAt(t10) === zc || e20.charCodeAt(t10) === qc || e20.charCodeAt(t10) === Lc || e20.charCodeAt(t10) === Bc || void 0 === e20[t10] ? n10 = zl(n10, ",") : m10(); + break; + } + i10(); + var a11 = c10(ol), s11 = t10 >= e20.length; + a11 || (Ml(e20[t10]) || s11 ? n10 = Bl(n10, ":") : g10()), o10() || (a11 || s11 ? n10 += "null" : g10()); + } + return e20.charCodeAt(t10) === zc ? (n10 += "}", t10++) : n10 = Bl(n10, "}"), true; + } + return false; + }() || function() { + if (e20.charCodeAt(t10) === Bc) { + n10 += "[", t10++, i10(); + for (var r12 = true; t10 < e20.length && e20.charCodeAt(t10) !== Lc; ) { + if (r12) + r12 = false; + else + c10(nl) || (n10 = Bl(n10, ",")); + if (!o10()) { + n10 = zl(n10, ","); + break; + } + } + return e20.charCodeAt(t10) === Lc ? (n10 += "]", t10++) : n10 = Bl(n10, "]"), true; + } + return false; + }() || u10() || function() { + var r12 = t10; + if (e20.charCodeAt(t10) === Xc && (t10++, v10(r12))) + return true; + for (; Cl(e20.charCodeAt(t10)); ) + t10++; + if (e20.charCodeAt(t10) === rl) { + if (t10++, v10(r12)) + return true; + for (; Cl(e20.charCodeAt(t10)); ) + t10++; + } + if (e20.charCodeAt(t10) === ll || e20.charCodeAt(t10) === cl) { + if (t10++, e20.charCodeAt(t10) !== Xc && e20.charCodeAt(t10) !== Yc || t10++, v10(r12)) + return true; + for (; Cl(e20.charCodeAt(t10)); ) + t10++; + } + if (t10 > r12) { + var o11 = e20.slice(r12, t10), i11 = /^0\d/.test(o11); + return n10 += i11 ? '"'.concat(o11, '"') : o11, true; + } + return false; + }() || f10("true", "true") || f10("false", "false") || f10("null", "null") || f10("True", "true") || f10("False", "false") || f10("None", "null") || d10(); + return i10(), r11; + } + function i10() { + var e21 = t10, n11 = a10(); + do { + (n11 = s10()) && (n11 = a10()); + } while (n11); + return t10 > e21; + } + function a10() { + for (var r11, o11 = ""; (r11 = Pl(e20.charCodeAt(t10))) || Tl(e20.charCodeAt(t10)); ) + o11 += r11 ? e20[t10] : " ", t10++; + return o11.length > 0 && (n10 += o11, true); + } + function s10() { + if (e20.charCodeAt(t10) === Ic && e20.charCodeAt(t10 + 1) === Dc) { + for (; t10 < e20.length && !Wl(e20, t10); ) + t10++; + return t10 += 2, true; + } + if (e20.charCodeAt(t10) === Ic && e20.charCodeAt(t10 + 1) === Ic) { + for (; t10 < e20.length && e20.charCodeAt(t10) !== Wc; ) + t10++; + return true; + } + return false; + } + function c10(r11) { + return e20.charCodeAt(t10) === r11 && (n10 += e20[t10], t10++, true); + } + function l10() { + return function(n11) { + return e20.charCodeAt(t10) === n11 && (t10++, true); + }(Nc); + } + function u10() { + var r11 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], o11 = e20.charCodeAt(t10) === Nc; + if (o11 && (t10++, o11 = true), Rl(e20.charCodeAt(t10))) { + var a11 = Il(e20.charCodeAt(t10)) ? Il : ql(e20.charCodeAt(t10)) ? ql : Dl(e20.charCodeAt(t10)) ? Dl : Nl, s11 = t10, c11 = n10.length, f11 = '"'; + t10++; + for (var d11 = r11 ? function(t11) { + return _l(e20[t11]); + } : function(t11) { + return a11(e20.charCodeAt(t11)); + }; t10 < e20.length && !d11(t10); ) { + if (e20.charCodeAt(t10) === Nc) { + var h11 = e20.charAt(t10 + 1); + if (void 0 !== Vl[h11]) + f11 += e20.slice(t10, t10 + 2), t10 += 2; + else if ("u" === h11) { + for (var v11 = 2; v11 < 6 && Sl(e20.charCodeAt(t10 + v11)); ) + v11++; + 6 === v11 ? (f11 += e20.slice(t10, t10 + 6), t10 += 6) : t10 + v11 >= e20.length ? t10 = e20.length : y10(); + } else + f11 += h11, t10 += 2; + } else { + var m11 = e20.charAt(t10), g11 = e20.charCodeAt(t10); + g11 === Qc && e20.charCodeAt(t10 - 1) !== Nc ? (f11 += "\\" + m11, t10++) : Al(g11) ? (f11 += Fl[m11], t10++) : ($l(g11) || p10(m11), f11 += m11, t10++); + } + o11 && l10(); + } + var b10 = Rl(e20.charCodeAt(t10)); + b10 ? (f11 += '"', t10++) : f11 = Bl(f11, '"'), n10 += f11, i10(); + var k10 = t10 >= e20.length, w10 = _l(e20.charAt(t10)); + return !r11 && (b10 && !k10 && !w10 || !b10 && k10) ? (t10 = s11, n10 = n10.substring(0, c11), u10(true)) : (function() { + var r12 = false; + i10(); + for (; e20.charCodeAt(t10) === Yc; ) { + r12 = true, t10++, i10(); + var o12 = (n10 = zl(n10, '"', true)).length, a12 = u10(); + n10 = a12 ? Ll(n10, o12, 1) : Bl(n10, '"'); + } + }(), true); + } + return false; + } + function f10(r11, o11) { + return e20.slice(t10, t10 + r11.length) === r11 && (n10 += o11, t10 += r11.length, true); + } + function d10() { + for (var r11 = t10; t10 < e20.length && !_l(e20[t10]); ) + t10++; + if (t10 > r11) { + if (e20.charCodeAt(t10) === Fc) + return t10++, o10(), e20.charCodeAt(t10) === Vc && (t10++, e20.charCodeAt(t10) === il && t10++), true; + for (; Pl(e20.charCodeAt(t10 - 1)) && t10 > 0; ) + t10--; + var i11 = e20.slice(r11, t10); + return n10 += "undefined" === i11 ? "null" : JSON.stringify(i11), e20.charCodeAt(t10) === Qc && t10++, true; + } + } + function h10(n11) { + if (!Cl(e20.charCodeAt(t10))) { + var r11 = e20.slice(n11, t10); + throw new Rc("Invalid number '".concat(r11, "', expecting a digit ").concat(e20[t10] ? "but got '".concat(e20[t10], "'") : "but reached end of input"), t10); + } + } + function v10(r11) { + return t10 >= e20.length ? (n10 += e20.slice(r11, t10) + "0", true) : (h10(r11), false); + } + function p10(e21) { + throw new Rc("Invalid character " + JSON.stringify(e21), t10); + } + function m10() { + throw new Rc("Object key expected", t10); + } + function g10() { + throw new Rc("Colon expected", t10); + } + function y10() { + var n11 = e20.slice(t10, t10 + 6); + throw new Rc('Invalid unicode character "'.concat(n11, '"'), t10); + } + !function() { + throw new Rc("Unexpected character " + JSON.stringify(e20[t10]), t10); + }(); + } + function Wl(e20, t10) { + return "*" === e20[t10] && "/" === e20[t10 + 1]; + } + function Ul(e20) { + return parseInt(e20, 10); + } + function Jl(e20) { + return Kl.test(e20); + } + var Kl = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/; + function Gl(e20) { + return "object" === Ho(e20) && null !== e20 && "Object" === e20.constructor.name; + } + function Ql(e20) { + return "object" === Ho(e20) && null !== e20 && ("Object" === e20.constructor.name || "Array" === e20.constructor.name); + } + function Yl(e20) { + if ("number" == typeof e20) + return e20 > 9466848e5 && isFinite(e20) && Math.floor(e20) === e20 && !isNaN(new Date(e20).valueOf()); + if ("bigint" == typeof e20) + return Yl(Number(e20)); + try { + var t10 = e20 ? e20.valueOf() : e20; + if (t10 !== e20) + return Yl(t10); + } catch (e21) { + return false; + } + return false; + } + function Xl(e20) { + (Zl = Zl || window.document.createElement("div")).style.color = "", Zl.style.color = e20; + var t10 = Zl.style.color; + return "" !== t10 ? t10.replace(/\s+/g, "").toLowerCase() : null; + } + var Zl = null; + function eu(e20, t10) { + if ("number" == typeof e20 || "string" == typeof e20 || "boolean" == typeof e20 || void 0 === e20) + return Ho(e20); + if ("bigint" == typeof e20) + return "number"; + if (null === e20) + return "null"; + if (Array.isArray(e20)) + return "array"; + if (Gl(e20)) + return "object"; + var n10 = t10.stringify(e20); + return n10 && Jl(n10) ? "number" : "true" === n10 || "false" === n10 ? "boolean" : "null" === n10 ? "null" : "unknown"; + } + var tu = /^https?:\/\/\S+$/; + function nu(e20) { + return "string" == typeof e20 && tu.test(e20); + } + function ru(e20, t10) { + if ("" === e20) + return ""; + var n10 = e20.trim(); + return "null" === n10 ? null : "true" === n10 || "false" !== n10 && (Jl(n10) ? t10.parse(n10) : e20); + } + function ou(e20) { + return iu.test(e20); + } + var iu = /^-?[0-9]+$/; + var au = "object" == ("undefined" == typeof global ? "undefined" : Ho(global)) && global && global.Object === Object && global; + var su = "object" == ("undefined" == typeof self ? "undefined" : Ho(self)) && self && self.Object === Object && self; + var cu = au || su || Function("return this")(); + var lu = cu.Symbol; + var uu = Object.prototype; + var fu = uu.hasOwnProperty; + var du = uu.toString; + var hu = lu ? lu.toStringTag : void 0; + var vu = Object.prototype.toString; + var pu = "[object Null]"; + var mu = "[object Undefined]"; + var gu = lu ? lu.toStringTag : void 0; + function yu(e20) { + return null == e20 ? void 0 === e20 ? mu : pu : gu && gu in Object(e20) ? function(e21) { + var t10 = fu.call(e21, hu), n10 = e21[hu]; + try { + e21[hu] = void 0; + var r10 = true; + } catch (e23) { + } + var o10 = du.call(e21); + return r10 && (t10 ? e21[hu] = n10 : delete e21[hu]), o10; + }(e20) : function(e21) { + return vu.call(e21); + }(e20); + } + function bu(e20) { + return null != e20 && "object" == Ho(e20); + } + var ku = "[object Symbol]"; + function wu(e20) { + return "symbol" == Ho(e20) || bu(e20) && yu(e20) == ku; + } + var xu = NaN; + function ju(e20) { + return "number" == typeof e20 ? e20 : wu(e20) ? xu : +e20; + } + function Su(e20, t10) { + for (var n10 = -1, r10 = null == e20 ? 0 : e20.length, o10 = Array(r10); ++n10 < r10; ) + o10[n10] = t10(e20[n10], n10, e20); + return o10; + } + var Cu = Array.isArray; + var $u = 1 / 0; + var _u = lu ? lu.prototype : void 0; + var Ou = _u ? _u.toString : void 0; + function Mu(e20) { + if ("string" == typeof e20) + return e20; + if (Cu(e20)) + return Su(e20, Mu) + ""; + if (wu(e20)) + return Ou ? Ou.call(e20) : ""; + var t10 = e20 + ""; + return "0" == t10 && 1 / e20 == -$u ? "-0" : t10; + } + function Eu(e20, t10) { + return function(n10, r10) { + var o10; + if (void 0 === n10 && void 0 === r10) + return t10; + if (void 0 !== n10 && (o10 = n10), void 0 !== r10) { + if (void 0 === o10) + return r10; + "string" == typeof n10 || "string" == typeof r10 ? (n10 = Mu(n10), r10 = Mu(r10)) : (n10 = ju(n10), r10 = ju(r10)), o10 = e20(n10, r10); + } + return o10; + }; + } + var Au = Eu(function(e20, t10) { + return e20 + t10; + }, 0); + var Pu = /\s/; + function Tu(e20) { + for (var t10 = e20.length; t10-- && Pu.test(e20.charAt(t10)); ) + ; + return t10; + } + var Ru = /^\s+/; + function Nu(e20) { + return e20 ? e20.slice(0, Tu(e20) + 1).replace(Ru, "") : e20; + } + function Iu(e20) { + var t10 = Ho(e20); + return null != e20 && ("object" == t10 || "function" == t10); + } + var Du = NaN; + var qu = /^[-+]0x[0-9a-f]+$/i; + var zu = /^0b[01]+$/i; + var Bu = /^0o[0-7]+$/i; + var Lu = parseInt; + function Fu(e20) { + if ("number" == typeof e20) + return e20; + if (wu(e20)) + return Du; + if (Iu(e20)) { + var t10 = "function" == typeof e20.valueOf ? e20.valueOf() : e20; + e20 = Iu(t10) ? t10 + "" : t10; + } + if ("string" != typeof e20) + return 0 === e20 ? e20 : +e20; + e20 = Nu(e20); + var n10 = zu.test(e20); + return n10 || Bu.test(e20) ? Lu(e20.slice(2), n10 ? 2 : 8) : qu.test(e20) ? Du : +e20; + } + var Vu = 1 / 0; + var Hu = 17976931348623157e292; + function Wu(e20) { + return e20 ? (e20 = Fu(e20)) === Vu || e20 === -Vu ? (e20 < 0 ? -1 : 1) * Hu : e20 == e20 ? e20 : 0 : 0 === e20 ? e20 : 0; + } + function Uu(e20) { + var t10 = Wu(e20), n10 = t10 % 1; + return t10 == t10 ? n10 ? t10 - n10 : t10 : 0; + } + function Ju(e20, t10) { + if ("function" != typeof t10) + throw new TypeError("Expected a function"); + return e20 = Uu(e20), function() { + if (--e20 < 1) + return t10.apply(this, arguments); + }; + } + function Ku(e20) { + return e20; + } + var Gu = "[object AsyncFunction]"; + var Qu = "[object Function]"; + var Yu = "[object GeneratorFunction]"; + var Xu = "[object Proxy]"; + function Zu(e20) { + if (!Iu(e20)) + return false; + var t10 = yu(e20); + return t10 == Qu || t10 == Yu || t10 == Gu || t10 == Xu; + } + var ef; + var tf = cu["__core-js_shared__"]; + var nf = (ef = /[^.]+$/.exec(tf && tf.keys && tf.keys.IE_PROTO || "")) ? "Symbol(src)_1." + ef : ""; + var rf = Function.prototype.toString; + function of(e20) { + if (null != e20) { + try { + return rf.call(e20); + } catch (e21) { + } + try { + return e20 + ""; + } catch (e21) { + } + } + return ""; + } + var af = /^\[object .+?Constructor\]$/; + var sf = Function.prototype; + var cf = Object.prototype; + var lf = sf.toString; + var uf = cf.hasOwnProperty; + var ff = RegExp("^" + lf.call(uf).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); + function df(e20) { + return !(!Iu(e20) || function(e21) { + return !!nf && nf in e21; + }(e20)) && (Zu(e20) ? ff : af).test(of(e20)); + } + function hf(e20, t10) { + var n10 = function(e21, t11) { + return null == e21 ? void 0 : e21[t11]; + }(e20, t10); + return df(n10) ? n10 : void 0; + } + var vf = hf(cu, "WeakMap"); + var pf = vf && new vf(); + var mf = pf ? function(e20, t10) { + return pf.set(e20, t10), e20; + } : Ku; + var gf = Object.create; + var yf = /* @__PURE__ */ function() { + function e20() { + } + return function(t10) { + if (!Iu(t10)) + return {}; + if (gf) + return gf(t10); + e20.prototype = t10; + var n10 = new e20(); + return e20.prototype = void 0, n10; + }; + }(); + function bf(e20) { + return function() { + var t10 = arguments; + switch (t10.length) { + case 0: + return new e20(); + case 1: + return new e20(t10[0]); + case 2: + return new e20(t10[0], t10[1]); + case 3: + return new e20(t10[0], t10[1], t10[2]); + case 4: + return new e20(t10[0], t10[1], t10[2], t10[3]); + case 5: + return new e20(t10[0], t10[1], t10[2], t10[3], t10[4]); + case 6: + return new e20(t10[0], t10[1], t10[2], t10[3], t10[4], t10[5]); + case 7: + return new e20(t10[0], t10[1], t10[2], t10[3], t10[4], t10[5], t10[6]); + } + var n10 = yf(e20.prototype), r10 = e20.apply(n10, t10); + return Iu(r10) ? r10 : n10; + }; + } + var kf = 1; + function wf(e20, t10, n10) { + switch (n10.length) { + case 0: + return e20.call(t10); + case 1: + return e20.call(t10, n10[0]); + case 2: + return e20.call(t10, n10[0], n10[1]); + case 3: + return e20.call(t10, n10[0], n10[1], n10[2]); + } + return e20.apply(t10, n10); + } + var xf = Math.max; + function jf(e20, t10, n10, r10) { + for (var o10 = -1, i10 = e20.length, a10 = n10.length, s10 = -1, c10 = t10.length, l10 = xf(i10 - a10, 0), u10 = Array(c10 + l10), f10 = !r10; ++s10 < c10; ) + u10[s10] = t10[s10]; + for (; ++o10 < a10; ) + (f10 || o10 < i10) && (u10[n10[o10]] = e20[o10]); + for (; l10--; ) + u10[s10++] = e20[o10++]; + return u10; + } + var Sf = Math.max; + function Cf(e20, t10, n10, r10) { + for (var o10 = -1, i10 = e20.length, a10 = -1, s10 = n10.length, c10 = -1, l10 = t10.length, u10 = Sf(i10 - s10, 0), f10 = Array(u10 + l10), d10 = !r10; ++o10 < u10; ) + f10[o10] = e20[o10]; + for (var h10 = o10; ++c10 < l10; ) + f10[h10 + c10] = t10[c10]; + for (; ++a10 < s10; ) + (d10 || o10 < i10) && (f10[h10 + n10[a10]] = e20[o10++]); + return f10; + } + function $f() { + } + var _f = 4294967295; + function Of(e20) { + this.__wrapped__ = e20, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = false, this.__iteratees__ = [], this.__takeCount__ = _f, this.__views__ = []; + } + function Mf() { + } + Of.prototype = yf($f.prototype), Of.prototype.constructor = Of; + var Ef = pf ? function(e20) { + return pf.get(e20); + } : Mf; + var Af = {}; + var Pf = Object.prototype.hasOwnProperty; + function Tf(e20) { + for (var t10 = e20.name + "", n10 = Af[t10], r10 = Pf.call(Af, t10) ? n10.length : 0; r10--; ) { + var o10 = n10[r10], i10 = o10.func; + if (null == i10 || i10 == e20) + return o10.name; + } + return t10; + } + function Rf(e20, t10) { + this.__wrapped__ = e20, this.__actions__ = [], this.__chain__ = !!t10, this.__index__ = 0, this.__values__ = void 0; + } + function Nf(e20, t10) { + var n10 = -1, r10 = e20.length; + for (t10 || (t10 = Array(r10)); ++n10 < r10; ) + t10[n10] = e20[n10]; + return t10; + } + function If(e20) { + if (e20 instanceof Of) + return e20.clone(); + var t10 = new Rf(e20.__wrapped__, e20.__chain__); + return t10.__actions__ = Nf(e20.__actions__), t10.__index__ = e20.__index__, t10.__values__ = e20.__values__, t10; + } + Rf.prototype = yf($f.prototype), Rf.prototype.constructor = Rf; + var Df = Object.prototype.hasOwnProperty; + function qf(e20) { + if (bu(e20) && !Cu(e20) && !(e20 instanceof Of)) { + if (e20 instanceof Rf) + return e20; + if (Df.call(e20, "__wrapped__")) + return If(e20); + } + return new Rf(e20); + } + function zf(e20) { + var t10 = Tf(e20), n10 = qf[t10]; + if ("function" != typeof n10 || !(t10 in Of.prototype)) + return false; + if (e20 === n10) + return true; + var r10 = Ef(n10); + return !!r10 && e20 === r10[0]; + } + qf.prototype = $f.prototype, qf.prototype.constructor = qf; + var Bf = Date.now; + function Lf(e20) { + var t10 = 0, n10 = 0; + return function() { + var r10 = Bf(), o10 = 16 - (r10 - n10); + if (n10 = r10, o10 > 0) { + if (++t10 >= 800) + return arguments[0]; + } else + t10 = 0; + return e20.apply(void 0, arguments); + }; + } + var Ff = Lf(mf); + var Vf = /\{\n\/\* \[wrapped with (.+)\] \*/; + var Hf = /,? & /; + var Wf = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/; + function Uf(e20) { + return function() { + return e20; + }; + } + var Jf = function() { + try { + var e20 = hf(Object, "defineProperty"); + return e20({}, "", {}), e20; + } catch (e21) { + } + }(); + var Kf = Jf ? function(e20, t10) { + return Jf(e20, "toString", { configurable: true, enumerable: false, value: Uf(t10), writable: true }); + } : Ku; + var Gf = Lf(Kf); + function Qf(e20, t10) { + for (var n10 = -1, r10 = null == e20 ? 0 : e20.length; ++n10 < r10 && false !== t10(e20[n10], n10, e20); ) + ; + return e20; + } + function Yf(e20, t10, n10, r10) { + for (var o10 = e20.length, i10 = n10 + (r10 ? 1 : -1); r10 ? i10-- : ++i10 < o10; ) + if (t10(e20[i10], i10, e20)) + return i10; + return -1; + } + function Xf(e20) { + return e20 != e20; + } + function Zf(e20, t10, n10) { + return t10 == t10 ? function(e21, t11, n11) { + for (var r10 = n11 - 1, o10 = e21.length; ++r10 < o10; ) + if (e21[r10] === t11) + return r10; + return -1; + }(e20, t10, n10) : Yf(e20, Xf, n10); + } + function ed(e20, t10) { + return !!(null == e20 ? 0 : e20.length) && Zf(e20, t10, 0) > -1; + } + var td = [["ary", 128], ["bind", 1], ["bindKey", 2], ["curry", 8], ["curryRight", 16], ["flip", 512], ["partial", 32], ["partialRight", 64], ["rearg", 256]]; + function nd(e20, t10, n10) { + var r10 = t10 + ""; + return Gf(e20, function(e21, t11) { + var n11 = t11.length; + if (!n11) + return e21; + var r11 = n11 - 1; + return t11[r11] = (n11 > 1 ? "& " : "") + t11[r11], t11 = t11.join(n11 > 2 ? ", " : " "), e21.replace(Wf, "{\n/* [wrapped with " + t11 + "] */\n"); + }(r10, function(e21, t11) { + return Qf(td, function(n11) { + var r11 = "_." + n11[0]; + t11 & n11[1] && !ed(e21, r11) && e21.push(r11); + }), e21.sort(); + }(function(e21) { + var t11 = e21.match(Vf); + return t11 ? t11[1].split(Hf) : []; + }(r10), n10))); + } + var rd = 1; + var od = 2; + var id = 4; + var ad = 8; + var sd = 32; + var cd = 64; + function ld(e20, t10, n10, r10, o10, i10, a10, s10, c10, l10) { + var u10 = t10 & ad; + t10 |= u10 ? sd : cd, (t10 &= ~(u10 ? cd : sd)) & id || (t10 &= ~(rd | od)); + var f10 = [e20, t10, o10, u10 ? i10 : void 0, u10 ? a10 : void 0, u10 ? void 0 : i10, u10 ? void 0 : a10, s10, c10, l10], d10 = n10.apply(void 0, f10); + return zf(e20) && Ff(d10, f10), d10.placeholder = r10, nd(d10, e20, t10); + } + function ud(e20) { + return e20.placeholder; + } + var fd = 9007199254740991; + var dd = /^(?:0|[1-9]\d*)$/; + function hd(e20, t10) { + var n10 = Ho(e20); + return !!(t10 = null == t10 ? fd : t10) && ("number" == n10 || "symbol" != n10 && dd.test(e20)) && e20 > -1 && e20 % 1 == 0 && e20 < t10; + } + var vd = Math.min; + var pd = "__lodash_placeholder__"; + function md(e20, t10) { + for (var n10 = -1, r10 = e20.length, o10 = 0, i10 = []; ++n10 < r10; ) { + var a10 = e20[n10]; + a10 !== t10 && a10 !== pd || (e20[n10] = pd, i10[o10++] = n10); + } + return i10; + } + var gd = 1; + var yd = 2; + var bd = 8; + var kd = 16; + var wd = 128; + var xd = 512; + function jd(e20, t10, n10, r10, o10, i10, a10, s10, c10, l10) { + var u10 = t10 & wd, f10 = t10 & gd, d10 = t10 & yd, h10 = t10 & (bd | kd), v10 = t10 & xd, p10 = d10 ? void 0 : bf(e20); + return function m10() { + for (var g10 = arguments.length, y10 = Array(g10), b10 = g10; b10--; ) + y10[b10] = arguments[b10]; + if (h10) + var k10 = ud(m10), w10 = function(e21, t11) { + for (var n11 = e21.length, r11 = 0; n11--; ) + e21[n11] === t11 && ++r11; + return r11; + }(y10, k10); + if (r10 && (y10 = jf(y10, r10, o10, h10)), i10 && (y10 = Cf(y10, i10, a10, h10)), g10 -= w10, h10 && g10 < l10) { + var x10 = md(y10, k10); + return ld(e20, t10, jd, m10.placeholder, n10, y10, x10, s10, c10, l10 - g10); + } + var j10 = f10 ? n10 : this, S10 = d10 ? j10[e20] : e20; + return g10 = y10.length, s10 ? y10 = function(e21, t11) { + for (var n11 = e21.length, r11 = vd(t11.length, n11), o11 = Nf(e21); r11--; ) { + var i11 = t11[r11]; + e21[r11] = hd(i11, n11) ? o11[i11] : void 0; + } + return e21; + }(y10, s10) : v10 && g10 > 1 && y10.reverse(), u10 && c10 < g10 && (y10.length = c10), this && this !== cu && this instanceof m10 && (S10 = p10 || bf(S10)), S10.apply(j10, y10); + }; + } + var Sd = 1; + var Cd = "__lodash_placeholder__"; + var $d = 1; + var _d = 2; + var Od = 4; + var Md = 8; + var Ed = 128; + var Ad = 256; + var Pd = Math.min; + var Td = "Expected a function"; + var Rd = 1; + var Nd = 2; + var Id = 8; + var Dd = 16; + var qd = 32; + var zd = 64; + var Bd = Math.max; + function Ld(e20, t10, n10, r10, o10, i10, a10, s10) { + var c10 = t10 & Nd; + if (!c10 && "function" != typeof e20) + throw new TypeError(Td); + var l10 = r10 ? r10.length : 0; + if (l10 || (t10 &= ~(qd | zd), r10 = o10 = void 0), a10 = void 0 === a10 ? a10 : Bd(Uu(a10), 0), s10 = void 0 === s10 ? s10 : Uu(s10), l10 -= o10 ? o10.length : 0, t10 & zd) { + var u10 = r10, f10 = o10; + r10 = o10 = void 0; + } + var d10 = c10 ? void 0 : Ef(e20), h10 = [e20, t10, n10, r10, o10, u10, f10, i10, a10, s10]; + if (d10 && function(e21, t11) { + var n11 = e21[1], r11 = t11[1], o11 = n11 | r11, i11 = o11 < ($d | _d | Ed), a11 = r11 == Ed && n11 == Md || r11 == Ed && n11 == Ad && e21[7].length <= t11[8] || r11 == (Ed | Ad) && t11[7].length <= t11[8] && n11 == Md; + if (!i11 && !a11) + return e21; + r11 & $d && (e21[2] = t11[2], o11 |= n11 & $d ? 0 : Od); + var s11 = t11[3]; + if (s11) { + var c11 = e21[3]; + e21[3] = c11 ? jf(c11, s11, t11[4]) : s11, e21[4] = c11 ? md(e21[3], Cd) : t11[4]; + } + (s11 = t11[5]) && (c11 = e21[5], e21[5] = c11 ? Cf(c11, s11, t11[6]) : s11, e21[6] = c11 ? md(e21[5], Cd) : t11[6]), (s11 = t11[7]) && (e21[7] = s11), r11 & Ed && (e21[8] = null == e21[8] ? t11[8] : Pd(e21[8], t11[8])), null == e21[9] && (e21[9] = t11[9]), e21[0] = t11[0], e21[1] = o11; + }(h10, d10), e20 = h10[0], t10 = h10[1], n10 = h10[2], r10 = h10[3], o10 = h10[4], !(s10 = h10[9] = void 0 === h10[9] ? c10 ? 0 : e20.length : Bd(h10[9] - l10, 0)) && t10 & (Id | Dd) && (t10 &= ~(Id | Dd)), t10 && t10 != Rd) + v10 = t10 == Id || t10 == Dd ? function(e21, t11, n11) { + var r11 = bf(e21); + return function o11() { + for (var i11 = arguments.length, a11 = Array(i11), s11 = i11, c11 = ud(o11); s11--; ) + a11[s11] = arguments[s11]; + var l11 = i11 < 3 && a11[0] !== c11 && a11[i11 - 1] !== c11 ? [] : md(a11, c11); + return (i11 -= l11.length) < n11 ? ld(e21, t11, jd, o11.placeholder, void 0, a11, l11, void 0, void 0, n11 - i11) : wf(this && this !== cu && this instanceof o11 ? r11 : e21, this, a11); + }; + }(e20, t10, s10) : t10 != qd && t10 != (Rd | qd) || o10.length ? jd.apply(void 0, h10) : function(e21, t11, n11, r11) { + var o11 = t11 & Sd, i11 = bf(e21); + return function t12() { + for (var a11 = -1, s11 = arguments.length, c11 = -1, l11 = r11.length, u11 = Array(l11 + s11), f11 = this && this !== cu && this instanceof t12 ? i11 : e21; ++c11 < l11; ) + u11[c11] = r11[c11]; + for (; s11--; ) + u11[c11++] = arguments[++a11]; + return wf(f11, o11 ? n11 : this, u11); + }; + }(e20, t10, n10, r10); + else + var v10 = function(e21, t11, n11) { + var r11 = t11 & kf, o11 = bf(e21); + return function t12() { + return (this && this !== cu && this instanceof t12 ? o11 : e21).apply(r11 ? n11 : this, arguments); + }; + }(e20, t10, n10); + return nd((d10 ? mf : Ff)(v10, h10), e20, t10); + } + var Fd = 128; + function Vd(e20, t10, n10) { + return t10 = n10 ? void 0 : t10, t10 = e20 && null == t10 ? e20.length : t10, Ld(e20, Fd, void 0, void 0, void 0, void 0, t10); + } + function Hd(e20, t10, n10) { + "__proto__" == t10 && Jf ? Jf(e20, t10, { configurable: true, enumerable: true, value: n10, writable: true }) : e20[t10] = n10; + } + function Wd(e20, t10) { + return e20 === t10 || e20 != e20 && t10 != t10; + } + var Ud = Object.prototype.hasOwnProperty; + function Jd(e20, t10, n10) { + var r10 = e20[t10]; + Ud.call(e20, t10) && Wd(r10, n10) && (void 0 !== n10 || t10 in e20) || Hd(e20, t10, n10); + } + function Kd(e20, t10, n10, r10) { + var o10 = !n10; + n10 || (n10 = {}); + for (var i10 = -1, a10 = t10.length; ++i10 < a10; ) { + var s10 = t10[i10], c10 = r10 ? r10(n10[s10], e20[s10], s10, n10, e20) : void 0; + void 0 === c10 && (c10 = e20[s10]), o10 ? Hd(n10, s10, c10) : Jd(n10, s10, c10); + } + return n10; + } + var Gd = Math.max; + function Qd(e20, t10, n10) { + return t10 = Gd(void 0 === t10 ? e20.length - 1 : t10, 0), function() { + for (var r10 = arguments, o10 = -1, i10 = Gd(r10.length - t10, 0), a10 = Array(i10); ++o10 < i10; ) + a10[o10] = r10[t10 + o10]; + o10 = -1; + for (var s10 = Array(t10 + 1); ++o10 < t10; ) + s10[o10] = r10[o10]; + return s10[t10] = n10(a10), wf(e20, this, s10); + }; + } + function Yd(e20, t10) { + return Gf(Qd(e20, t10, Ku), e20 + ""); + } + var Xd = 9007199254740991; + function Zd(e20) { + return "number" == typeof e20 && e20 > -1 && e20 % 1 == 0 && e20 <= Xd; + } + function eh(e20) { + return null != e20 && Zd(e20.length) && !Zu(e20); + } + function th(e20, t10, n10) { + if (!Iu(n10)) + return false; + var r10 = Ho(t10); + return !!("number" == r10 ? eh(n10) && hd(t10, n10.length) : "string" == r10 && t10 in n10) && Wd(n10[t10], e20); + } + function nh(e20) { + return Yd(function(t10, n10) { + var r10 = -1, o10 = n10.length, i10 = o10 > 1 ? n10[o10 - 1] : void 0, a10 = o10 > 2 ? n10[2] : void 0; + for (i10 = e20.length > 3 && "function" == typeof i10 ? (o10--, i10) : void 0, a10 && th(n10[0], n10[1], a10) && (i10 = o10 < 3 ? void 0 : i10, o10 = 1), t10 = Object(t10); ++r10 < o10; ) { + var s10 = n10[r10]; + s10 && e20(t10, s10, r10, i10); + } + return t10; + }); + } + var rh = Object.prototype; + function oh(e20) { + var t10 = e20 && e20.constructor; + return e20 === ("function" == typeof t10 && t10.prototype || rh); + } + function ih(e20, t10) { + for (var n10 = -1, r10 = Array(e20); ++n10 < e20; ) + r10[n10] = t10(n10); + return r10; + } + function ah(e20) { + return bu(e20) && "[object Arguments]" == yu(e20); + } + var sh = Object.prototype; + var ch = sh.hasOwnProperty; + var lh = sh.propertyIsEnumerable; + var uh = ah(/* @__PURE__ */ function() { + return arguments; + }()) ? ah : function(e20) { + return bu(e20) && ch.call(e20, "callee") && !lh.call(e20, "callee"); + }; + function fh() { + return false; + } + var dh = "object" == ("undefined" == typeof exports ? "undefined" : Ho(exports)) && exports && !exports.nodeType && exports; + var hh = dh && "object" == ("undefined" == typeof module ? "undefined" : Ho(module)) && module && !module.nodeType && module; + var vh = hh && hh.exports === dh ? cu.Buffer : void 0; + var ph = (vh ? vh.isBuffer : void 0) || fh; + var mh = {}; + function gh(e20) { + return function(t10) { + return e20(t10); + }; + } + mh["[object Float32Array]"] = mh["[object Float64Array]"] = mh["[object Int8Array]"] = mh["[object Int16Array]"] = mh["[object Int32Array]"] = mh["[object Uint8Array]"] = mh["[object Uint8ClampedArray]"] = mh["[object Uint16Array]"] = mh["[object Uint32Array]"] = true, mh["[object Arguments]"] = mh["[object Array]"] = mh["[object ArrayBuffer]"] = mh["[object Boolean]"] = mh["[object DataView]"] = mh["[object Date]"] = mh["[object Error]"] = mh["[object Function]"] = mh["[object Map]"] = mh["[object Number]"] = mh["[object Object]"] = mh["[object RegExp]"] = mh["[object Set]"] = mh["[object String]"] = mh["[object WeakMap]"] = false; + var yh = "object" == ("undefined" == typeof exports ? "undefined" : Ho(exports)) && exports && !exports.nodeType && exports; + var bh = yh && "object" == ("undefined" == typeof module ? "undefined" : Ho(module)) && module && !module.nodeType && module; + var kh = bh && bh.exports === yh && au.process; + var wh = function() { + try { + var e20 = bh && bh.require && bh.require("util").types; + return e20 || kh && kh.binding && kh.binding("util"); + } catch (e21) { + } + }(); + var xh = wh && wh.isTypedArray; + var jh = xh ? gh(xh) : function(e20) { + return bu(e20) && Zd(e20.length) && !!mh[yu(e20)]; + }; + var Sh = Object.prototype.hasOwnProperty; + function Ch(e20, t10) { + var n10 = Cu(e20), r10 = !n10 && uh(e20), o10 = !n10 && !r10 && ph(e20), i10 = !n10 && !r10 && !o10 && jh(e20), a10 = n10 || r10 || o10 || i10, s10 = a10 ? ih(e20.length, String) : [], c10 = s10.length; + for (var l10 in e20) + !t10 && !Sh.call(e20, l10) || a10 && ("length" == l10 || o10 && ("offset" == l10 || "parent" == l10) || i10 && ("buffer" == l10 || "byteLength" == l10 || "byteOffset" == l10) || hd(l10, c10)) || s10.push(l10); + return s10; + } + function $h(e20, t10) { + return function(n10) { + return e20(t10(n10)); + }; + } + var _h = $h(Object.keys, Object); + var Oh = Object.prototype.hasOwnProperty; + function Mh(e20) { + if (!oh(e20)) + return _h(e20); + var t10 = []; + for (var n10 in Object(e20)) + Oh.call(e20, n10) && "constructor" != n10 && t10.push(n10); + return t10; + } + function Eh(e20) { + return eh(e20) ? Ch(e20) : Mh(e20); + } + var Ah = Object.prototype.hasOwnProperty; + var Ph = nh(function(e20, t10) { + if (oh(t10) || eh(t10)) + Kd(t10, Eh(t10), e20); + else + for (var n10 in t10) + Ah.call(t10, n10) && Jd(e20, n10, t10[n10]); + }); + var Th = Ph; + var Rh = Object.prototype.hasOwnProperty; + function Nh(e20) { + if (!Iu(e20)) + return function(e21) { + var t11 = []; + if (null != e21) + for (var n11 in Object(e21)) + t11.push(n11); + return t11; + }(e20); + var t10 = oh(e20), n10 = []; + for (var r10 in e20) + ("constructor" != r10 || !t10 && Rh.call(e20, r10)) && n10.push(r10); + return n10; + } + function Ih(e20) { + return eh(e20) ? Ch(e20, true) : Nh(e20); + } + var Dh = nh(function(e20, t10) { + Kd(t10, Ih(t10), e20); + }); + var qh = Dh; + var zh = nh(function(e20, t10, n10, r10) { + Kd(t10, Ih(t10), e20, r10); + }); + var Bh = zh; + var Lh = nh(function(e20, t10, n10, r10) { + Kd(t10, Eh(t10), e20, r10); + }); + var Fh = Lh; + var Vh = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; + var Hh = /^\w*$/; + function Wh(e20, t10) { + if (Cu(e20)) + return false; + var n10 = Ho(e20); + return !("number" != n10 && "symbol" != n10 && "boolean" != n10 && null != e20 && !wu(e20)) || (Hh.test(e20) || !Vh.test(e20) || null != t10 && e20 in Object(t10)); + } + var Uh = hf(Object, "create"); + var Jh = Object.prototype.hasOwnProperty; + var Kh = Object.prototype.hasOwnProperty; + function Gh(e20) { + var t10 = -1, n10 = null == e20 ? 0 : e20.length; + for (this.clear(); ++t10 < n10; ) { + var r10 = e20[t10]; + this.set(r10[0], r10[1]); + } + } + function Qh(e20, t10) { + for (var n10 = e20.length; n10--; ) + if (Wd(e20[n10][0], t10)) + return n10; + return -1; + } + Gh.prototype.clear = function() { + this.__data__ = Uh ? Uh(null) : {}, this.size = 0; + }, Gh.prototype.delete = function(e20) { + var t10 = this.has(e20) && delete this.__data__[e20]; + return this.size -= t10 ? 1 : 0, t10; + }, Gh.prototype.get = function(e20) { + var t10 = this.__data__; + if (Uh) { + var n10 = t10[e20]; + return "__lodash_hash_undefined__" === n10 ? void 0 : n10; + } + return Jh.call(t10, e20) ? t10[e20] : void 0; + }, Gh.prototype.has = function(e20) { + var t10 = this.__data__; + return Uh ? void 0 !== t10[e20] : Kh.call(t10, e20); + }, Gh.prototype.set = function(e20, t10) { + var n10 = this.__data__; + return this.size += this.has(e20) ? 0 : 1, n10[e20] = Uh && void 0 === t10 ? "__lodash_hash_undefined__" : t10, this; + }; + var Yh = Array.prototype.splice; + function Xh(e20) { + var t10 = -1, n10 = null == e20 ? 0 : e20.length; + for (this.clear(); ++t10 < n10; ) { + var r10 = e20[t10]; + this.set(r10[0], r10[1]); + } + } + Xh.prototype.clear = function() { + this.__data__ = [], this.size = 0; + }, Xh.prototype.delete = function(e20) { + var t10 = this.__data__, n10 = Qh(t10, e20); + return !(n10 < 0) && (n10 == t10.length - 1 ? t10.pop() : Yh.call(t10, n10, 1), --this.size, true); + }, Xh.prototype.get = function(e20) { + var t10 = this.__data__, n10 = Qh(t10, e20); + return n10 < 0 ? void 0 : t10[n10][1]; + }, Xh.prototype.has = function(e20) { + return Qh(this.__data__, e20) > -1; + }, Xh.prototype.set = function(e20, t10) { + var n10 = this.__data__, r10 = Qh(n10, e20); + return r10 < 0 ? (++this.size, n10.push([e20, t10])) : n10[r10][1] = t10, this; + }; + var Zh = hf(cu, "Map"); + function ev(e20, t10) { + var n10 = e20.__data__; + return function(e21) { + var t11 = Ho(e21); + return "string" == t11 || "number" == t11 || "symbol" == t11 || "boolean" == t11 ? "__proto__" !== e21 : null === e21; + }(t10) ? n10["string" == typeof t10 ? "string" : "hash"] : n10.map; + } + function tv(e20) { + var t10 = -1, n10 = null == e20 ? 0 : e20.length; + for (this.clear(); ++t10 < n10; ) { + var r10 = e20[t10]; + this.set(r10[0], r10[1]); + } + } + tv.prototype.clear = function() { + this.size = 0, this.__data__ = { hash: new Gh(), map: new (Zh || Xh)(), string: new Gh() }; + }, tv.prototype.delete = function(e20) { + var t10 = ev(this, e20).delete(e20); + return this.size -= t10 ? 1 : 0, t10; + }, tv.prototype.get = function(e20) { + return ev(this, e20).get(e20); + }, tv.prototype.has = function(e20) { + return ev(this, e20).has(e20); + }, tv.prototype.set = function(e20, t10) { + var n10 = ev(this, e20), r10 = n10.size; + return n10.set(e20, t10), this.size += n10.size == r10 ? 0 : 1, this; + }; + var nv = "Expected a function"; + function rv(e20, t10) { + if ("function" != typeof e20 || null != t10 && "function" != typeof t10) + throw new TypeError(nv); + var n10 = function n11() { + var r10 = arguments, o10 = t10 ? t10.apply(this, r10) : r10[0], i10 = n11.cache; + if (i10.has(o10)) + return i10.get(o10); + var a10 = e20.apply(this, r10); + return n11.cache = i10.set(o10, a10) || i10, a10; + }; + return n10.cache = new (rv.Cache || tv)(), n10; + } + rv.Cache = tv; + var ov = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + var iv = /\\(\\)?/g; + var av = function(e20) { + var t10 = rv(e20, function(e21) { + return 500 === n10.size && n10.clear(), e21; + }), n10 = t10.cache; + return t10; + }(function(e20) { + var t10 = []; + return 46 === e20.charCodeAt(0) && t10.push(""), e20.replace(ov, function(e21, n10, r10, o10) { + t10.push(r10 ? o10.replace(iv, "$1") : n10 || e21); + }), t10; + }); + function sv(e20) { + return null == e20 ? "" : Mu(e20); + } + function cv(e20, t10) { + return Cu(e20) ? e20 : Wh(e20, t10) ? [e20] : av(sv(e20)); + } + var lv = 1 / 0; + function uv(e20) { + if ("string" == typeof e20 || wu(e20)) + return e20; + var t10 = e20 + ""; + return "0" == t10 && 1 / e20 == -lv ? "-0" : t10; + } + function fv(e20, t10) { + for (var n10 = 0, r10 = (t10 = cv(t10, e20)).length; null != e20 && n10 < r10; ) + e20 = e20[uv(t10[n10++])]; + return n10 && n10 == r10 ? e20 : void 0; + } + function dv(e20, t10, n10) { + var r10 = null == e20 ? void 0 : fv(e20, t10); + return void 0 === r10 ? n10 : r10; + } + function hv(e20, t10) { + for (var n10 = -1, r10 = t10.length, o10 = Array(r10), i10 = null == e20; ++n10 < r10; ) + o10[n10] = i10 ? void 0 : dv(e20, t10[n10]); + return o10; + } + function vv(e20, t10) { + for (var n10 = -1, r10 = t10.length, o10 = e20.length; ++n10 < r10; ) + e20[o10 + n10] = t10[n10]; + return e20; + } + var pv = lu ? lu.isConcatSpreadable : void 0; + function mv(e20) { + return Cu(e20) || uh(e20) || !!(pv && e20 && e20[pv]); + } + function gv(e20, t10, n10, r10, o10) { + var i10 = -1, a10 = e20.length; + for (n10 || (n10 = mv), o10 || (o10 = []); ++i10 < a10; ) { + var s10 = e20[i10]; + t10 > 0 && n10(s10) ? t10 > 1 ? gv(s10, t10 - 1, n10, r10, o10) : vv(o10, s10) : r10 || (o10[o10.length] = s10); + } + return o10; + } + function yv(e20) { + return (null == e20 ? 0 : e20.length) ? gv(e20, 1) : []; + } + function bv(e20) { + return Gf(Qd(e20, void 0, yv), e20 + ""); + } + var kv = bv(hv); + var wv = $h(Object.getPrototypeOf, Object); + var xv = "[object Object]"; + var jv = Function.prototype; + var Sv = Object.prototype; + var Cv = jv.toString; + var $v = Sv.hasOwnProperty; + var _v = Cv.call(Object); + function Ov(e20) { + if (!bu(e20) || yu(e20) != xv) + return false; + var t10 = wv(e20); + if (null === t10) + return true; + var n10 = $v.call(t10, "constructor") && t10.constructor; + return "function" == typeof n10 && n10 instanceof n10 && Cv.call(n10) == _v; + } + var Mv = "[object DOMException]"; + var Ev = "[object Error]"; + function Av(e20) { + if (!bu(e20)) + return false; + var t10 = yu(e20); + return t10 == Ev || t10 == Mv || "string" == typeof e20.message && "string" == typeof e20.name && !Ov(e20); + } + var Pv = Yd(function(e20, t10) { + try { + return wf(e20, void 0, t10); + } catch (e21) { + return Av(e21) ? e21 : new Error(e21); + } + }); + var Tv = Pv; + var Rv = "Expected a function"; + function Nv(e20, t10) { + var n10; + if ("function" != typeof t10) + throw new TypeError(Rv); + return e20 = Uu(e20), function() { + return --e20 > 0 && (n10 = t10.apply(this, arguments)), e20 <= 1 && (t10 = void 0), n10; + }; + } + var Iv = Yd(function(e20, t10, n10) { + var r10 = 1; + if (n10.length) { + var o10 = md(n10, ud(Iv)); + r10 |= 32; + } + return Ld(e20, r10, t10, n10, o10); + }); + Iv.placeholder = {}; + var Dv = Iv; + var qv = bv(function(e20, t10) { + return Qf(t10, function(t11) { + t11 = uv(t11), Hd(e20, t11, Dv(e20[t11], e20)); + }), e20; + }); + var zv = qv; + var Bv = Yd(function(e20, t10, n10) { + var r10 = 3; + if (n10.length) { + var o10 = md(n10, ud(Bv)); + r10 |= 32; + } + return Ld(t10, r10, e20, n10, o10); + }); + Bv.placeholder = {}; + var Lv = Bv; + function Fv(e20, t10, n10) { + var r10 = -1, o10 = e20.length; + t10 < 0 && (t10 = -t10 > o10 ? 0 : o10 + t10), (n10 = n10 > o10 ? o10 : n10) < 0 && (n10 += o10), o10 = t10 > n10 ? 0 : n10 - t10 >>> 0, t10 >>>= 0; + for (var i10 = Array(o10); ++r10 < o10; ) + i10[r10] = e20[r10 + t10]; + return i10; + } + function Vv(e20, t10, n10) { + var r10 = e20.length; + return n10 = void 0 === n10 ? r10 : n10, !t10 && n10 >= r10 ? e20 : Fv(e20, t10, n10); + } + var Hv = RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"); + function Wv(e20) { + return Hv.test(e20); + } + var Uv = "\\ud800-\\udfff"; + var Jv = "[" + Uv + "]"; + var Kv = "[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]"; + var Gv = "\\ud83c[\\udffb-\\udfff]"; + var Qv = "[^" + Uv + "]"; + var Yv = "(?:\\ud83c[\\udde6-\\uddff]){2}"; + var Xv = "[\\ud800-\\udbff][\\udc00-\\udfff]"; + var Zv = "(?:" + Kv + "|" + Gv + ")?"; + var ep = "[\\ufe0e\\ufe0f]?"; + var tp = ep + Zv + ("(?:\\u200d(?:" + [Qv, Yv, Xv].join("|") + ")" + ep + Zv + ")*"); + var np = "(?:" + [Qv + Kv + "?", Kv, Yv, Xv, Jv].join("|") + ")"; + var rp = RegExp(Gv + "(?=" + Gv + ")|" + np + tp, "g"); + function op(e20) { + return Wv(e20) ? function(e21) { + return e21.match(rp) || []; + }(e20) : function(e21) { + return e21.split(""); + }(e20); + } + function ip(e20) { + return function(t10) { + var n10 = Wv(t10 = sv(t10)) ? op(t10) : void 0, r10 = n10 ? n10[0] : t10.charAt(0), o10 = n10 ? Vv(n10, 1).join("") : t10.slice(1); + return r10[e20]() + o10; + }; + } + var ap = ip("toUpperCase"); + function sp(e20) { + return ap(sv(e20).toLowerCase()); + } + function cp(e20, t10, n10, r10) { + var o10 = -1, i10 = null == e20 ? 0 : e20.length; + for (r10 && i10 && (n10 = e20[++o10]); ++o10 < i10; ) + n10 = t10(n10, e20[o10], o10, e20); + return n10; + } + function lp(e20) { + return function(t10) { + return null == e20 ? void 0 : e20[t10]; + }; + } + var up = lp({ "\xC0": "A", "\xC1": "A", "\xC2": "A", "\xC3": "A", "\xC4": "A", "\xC5": "A", "\xE0": "a", "\xE1": "a", "\xE2": "a", "\xE3": "a", "\xE4": "a", "\xE5": "a", "\xC7": "C", "\xE7": "c", "\xD0": "D", "\xF0": "d", "\xC8": "E", "\xC9": "E", "\xCA": "E", "\xCB": "E", "\xE8": "e", "\xE9": "e", "\xEA": "e", "\xEB": "e", "\xCC": "I", "\xCD": "I", "\xCE": "I", "\xCF": "I", "\xEC": "i", "\xED": "i", "\xEE": "i", "\xEF": "i", "\xD1": "N", "\xF1": "n", "\xD2": "O", "\xD3": "O", "\xD4": "O", "\xD5": "O", "\xD6": "O", "\xD8": "O", "\xF2": "o", "\xF3": "o", "\xF4": "o", "\xF5": "o", "\xF6": "o", "\xF8": "o", "\xD9": "U", "\xDA": "U", "\xDB": "U", "\xDC": "U", "\xF9": "u", "\xFA": "u", "\xFB": "u", "\xFC": "u", "\xDD": "Y", "\xFD": "y", "\xFF": "y", "\xC6": "Ae", "\xE6": "ae", "\xDE": "Th", "\xFE": "th", "\xDF": "ss", "\u0100": "A", "\u0102": "A", "\u0104": "A", "\u0101": "a", "\u0103": "a", "\u0105": "a", "\u0106": "C", "\u0108": "C", "\u010A": "C", "\u010C": "C", "\u0107": "c", "\u0109": "c", "\u010B": "c", "\u010D": "c", "\u010E": "D", "\u0110": "D", "\u010F": "d", "\u0111": "d", "\u0112": "E", "\u0114": "E", "\u0116": "E", "\u0118": "E", "\u011A": "E", "\u0113": "e", "\u0115": "e", "\u0117": "e", "\u0119": "e", "\u011B": "e", "\u011C": "G", "\u011E": "G", "\u0120": "G", "\u0122": "G", "\u011D": "g", "\u011F": "g", "\u0121": "g", "\u0123": "g", "\u0124": "H", "\u0126": "H", "\u0125": "h", "\u0127": "h", "\u0128": "I", "\u012A": "I", "\u012C": "I", "\u012E": "I", "\u0130": "I", "\u0129": "i", "\u012B": "i", "\u012D": "i", "\u012F": "i", "\u0131": "i", "\u0134": "J", "\u0135": "j", "\u0136": "K", "\u0137": "k", "\u0138": "k", "\u0139": "L", "\u013B": "L", "\u013D": "L", "\u013F": "L", "\u0141": "L", "\u013A": "l", "\u013C": "l", "\u013E": "l", "\u0140": "l", "\u0142": "l", "\u0143": "N", "\u0145": "N", "\u0147": "N", "\u014A": "N", "\u0144": "n", "\u0146": "n", "\u0148": "n", "\u014B": "n", "\u014C": "O", "\u014E": "O", "\u0150": "O", "\u014D": "o", "\u014F": "o", "\u0151": "o", "\u0154": "R", "\u0156": "R", "\u0158": "R", "\u0155": "r", "\u0157": "r", "\u0159": "r", "\u015A": "S", "\u015C": "S", "\u015E": "S", "\u0160": "S", "\u015B": "s", "\u015D": "s", "\u015F": "s", "\u0161": "s", "\u0162": "T", "\u0164": "T", "\u0166": "T", "\u0163": "t", "\u0165": "t", "\u0167": "t", "\u0168": "U", "\u016A": "U", "\u016C": "U", "\u016E": "U", "\u0170": "U", "\u0172": "U", "\u0169": "u", "\u016B": "u", "\u016D": "u", "\u016F": "u", "\u0171": "u", "\u0173": "u", "\u0174": "W", "\u0175": "w", "\u0176": "Y", "\u0177": "y", "\u0178": "Y", "\u0179": "Z", "\u017B": "Z", "\u017D": "Z", "\u017A": "z", "\u017C": "z", "\u017E": "z", "\u0132": "IJ", "\u0133": "ij", "\u0152": "Oe", "\u0153": "oe", "\u0149": "'n", "\u017F": "s" }); + var fp = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + var dp = RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]", "g"); + function hp(e20) { + return (e20 = sv(e20)) && e20.replace(fp, up).replace(dp, ""); + } + var vp = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + var pp = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + var mp = "\\ud800-\\udfff"; + var gp = "\\u2700-\\u27bf"; + var yp = "a-z\\xdf-\\xf6\\xf8-\\xff"; + var bp = "A-Z\\xc0-\\xd6\\xd8-\\xde"; + var kp = "\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000"; + var wp = "[" + kp + "]"; + var xp = "\\d+"; + var jp = "[" + gp + "]"; + var Sp = "[" + yp + "]"; + var Cp = "[^" + mp + kp + xp + gp + yp + bp + "]"; + var $p = "(?:\\ud83c[\\udde6-\\uddff]){2}"; + var _p = "[\\ud800-\\udbff][\\udc00-\\udfff]"; + var Op = "[" + bp + "]"; + var Mp = "(?:" + Sp + "|" + Cp + ")"; + var Ep = "(?:" + Op + "|" + Cp + ")"; + var Ap = "(?:['\u2019](?:d|ll|m|re|s|t|ve))?"; + var Pp = "(?:['\u2019](?:D|LL|M|RE|S|T|VE))?"; + var Tp = "(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?"; + var Rp = "[\\ufe0e\\ufe0f]?"; + var Np = Rp + Tp + ("(?:\\u200d(?:" + ["[^" + mp + "]", $p, _p].join("|") + ")" + Rp + Tp + ")*"); + var Ip = "(?:" + [jp, $p, _p].join("|") + ")" + Np; + var Dp = RegExp([Op + "?" + Sp + "+" + Ap + "(?=" + [wp, Op, "$"].join("|") + ")", Ep + "+" + Pp + "(?=" + [wp, Op + Mp, "$"].join("|") + ")", Op + "?" + Mp + "+" + Ap, Op + "+" + Pp, "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", xp, Ip].join("|"), "g"); + function qp(e20, t10, n10) { + return e20 = sv(e20), void 0 === (t10 = n10 ? void 0 : t10) ? function(e21) { + return pp.test(e21); + }(e20) ? function(e21) { + return e21.match(Dp) || []; + }(e20) : function(e21) { + return e21.match(vp) || []; + }(e20) : e20.match(t10) || []; + } + var zp = RegExp("['\u2019]", "g"); + function Bp(e20) { + return function(t10) { + return cp(qp(hp(t10).replace(zp, "")), e20, ""); + }; + } + var Lp = Bp(function(e20, t10, n10) { + return t10 = t10.toLowerCase(), e20 + (n10 ? sp(t10) : t10); + }); + var Fp = Lp; + function Vp() { + if (!arguments.length) + return []; + var e20 = arguments[0]; + return Cu(e20) ? e20 : [e20]; + } + var Hp = cu.isFinite; + var Wp = Math.min; + function Up(e20) { + var t10 = Math[e20]; + return function(e21, n10) { + if (e21 = Fu(e21), (n10 = null == n10 ? 0 : Wp(Uu(n10), 292)) && Hp(e21)) { + var r10 = (sv(e21) + "e").split("e"); + return +((r10 = (sv(t10(r10[0] + "e" + (+r10[1] + n10))) + "e").split("e"))[0] + "e" + (+r10[1] - n10)); + } + return t10(e21); + }; + } + var Jp = Up("ceil"); + function Kp(e20) { + var t10 = qf(e20); + return t10.__chain__ = true, t10; + } + var Gp = Math.ceil; + var Qp = Math.max; + function Yp(e20, t10, n10) { + t10 = (n10 ? th(e20, t10, n10) : void 0 === t10) ? 1 : Qp(Uu(t10), 0); + var r10 = null == e20 ? 0 : e20.length; + if (!r10 || t10 < 1) + return []; + for (var o10 = 0, i10 = 0, a10 = Array(Gp(r10 / t10)); o10 < r10; ) + a10[i10++] = Fv(e20, o10, o10 += t10); + return a10; + } + function Xp(e20, t10, n10) { + return e20 == e20 && (void 0 !== n10 && (e20 = e20 <= n10 ? e20 : n10), void 0 !== t10 && (e20 = e20 >= t10 ? e20 : t10)), e20; + } + function Zp(e20, t10, n10) { + return void 0 === n10 && (n10 = t10, t10 = void 0), void 0 !== n10 && (n10 = (n10 = Fu(n10)) == n10 ? n10 : 0), void 0 !== t10 && (t10 = (t10 = Fu(t10)) == t10 ? t10 : 0), Xp(Fu(e20), t10, n10); + } + function em(e20) { + var t10 = this.__data__ = new Xh(e20); + this.size = t10.size; + } + function tm(e20, t10) { + return e20 && Kd(t10, Eh(t10), e20); + } + em.prototype.clear = function() { + this.__data__ = new Xh(), this.size = 0; + }, em.prototype.delete = function(e20) { + var t10 = this.__data__, n10 = t10.delete(e20); + return this.size = t10.size, n10; + }, em.prototype.get = function(e20) { + return this.__data__.get(e20); + }, em.prototype.has = function(e20) { + return this.__data__.has(e20); + }, em.prototype.set = function(e20, t10) { + var n10 = this.__data__; + if (n10 instanceof Xh) { + var r10 = n10.__data__; + if (!Zh || r10.length < 199) + return r10.push([e20, t10]), this.size = ++n10.size, this; + n10 = this.__data__ = new tv(r10); + } + return n10.set(e20, t10), this.size = n10.size, this; + }; + var nm = "object" == ("undefined" == typeof exports ? "undefined" : Ho(exports)) && exports && !exports.nodeType && exports; + var rm = nm && "object" == ("undefined" == typeof module ? "undefined" : Ho(module)) && module && !module.nodeType && module; + var om = rm && rm.exports === nm ? cu.Buffer : void 0; + var im = om ? om.allocUnsafe : void 0; + function am(e20, t10) { + if (t10) + return e20.slice(); + var n10 = e20.length, r10 = im ? im(n10) : new e20.constructor(n10); + return e20.copy(r10), r10; + } + function sm(e20, t10) { + for (var n10 = -1, r10 = null == e20 ? 0 : e20.length, o10 = 0, i10 = []; ++n10 < r10; ) { + var a10 = e20[n10]; + t10(a10, n10, e20) && (i10[o10++] = a10); + } + return i10; + } + function cm() { + return []; + } + var lm = Object.prototype.propertyIsEnumerable; + var um = Object.getOwnPropertySymbols; + var fm = um ? function(e20) { + return null == e20 ? [] : (e20 = Object(e20), sm(um(e20), function(t10) { + return lm.call(e20, t10); + })); + } : cm; + var dm = Object.getOwnPropertySymbols ? function(e20) { + for (var t10 = []; e20; ) + vv(t10, fm(e20)), e20 = wv(e20); + return t10; + } : cm; + function hm(e20, t10, n10) { + var r10 = t10(e20); + return Cu(e20) ? r10 : vv(r10, n10(e20)); + } + function vm(e20) { + return hm(e20, Eh, fm); + } + function pm(e20) { + return hm(e20, Ih, dm); + } + var mm = hf(cu, "DataView"); + var gm = hf(cu, "Promise"); + var ym = hf(cu, "Set"); + var bm = "[object Map]"; + var km = "[object Promise]"; + var wm = "[object Set]"; + var xm = "[object WeakMap]"; + var jm = "[object DataView]"; + var Sm = of(mm); + var Cm = of(Zh); + var $m = of(gm); + var _m = of(ym); + var Om = of(vf); + var Mm = yu; + (mm && Mm(new mm(new ArrayBuffer(1))) != jm || Zh && Mm(new Zh()) != bm || gm && Mm(gm.resolve()) != km || ym && Mm(new ym()) != wm || vf && Mm(new vf()) != xm) && (Mm = function(e20) { + var t10 = yu(e20), n10 = "[object Object]" == t10 ? e20.constructor : void 0, r10 = n10 ? of(n10) : ""; + if (r10) + switch (r10) { + case Sm: + return jm; + case Cm: + return bm; + case $m: + return km; + case _m: + return wm; + case Om: + return xm; + } + return t10; + }); + var Em = Mm; + var Am = Object.prototype.hasOwnProperty; + var Pm = cu.Uint8Array; + function Tm(e20) { + var t10 = new e20.constructor(e20.byteLength); + return new Pm(t10).set(new Pm(e20)), t10; + } + var Rm = /\w*$/; + var Nm = lu ? lu.prototype : void 0; + var Im = Nm ? Nm.valueOf : void 0; + function Dm(e20, t10) { + var n10 = t10 ? Tm(e20.buffer) : e20.buffer; + return new e20.constructor(n10, e20.byteOffset, e20.length); + } + var qm = "[object Boolean]"; + var zm = "[object Date]"; + var Bm = "[object Map]"; + var Lm = "[object Number]"; + var Fm = "[object RegExp]"; + var Vm = "[object Set]"; + var Hm = "[object String]"; + var Wm = "[object Symbol]"; + var Um = "[object ArrayBuffer]"; + var Jm = "[object DataView]"; + var Km = "[object Float32Array]"; + var Gm = "[object Float64Array]"; + var Qm = "[object Int8Array]"; + var Ym = "[object Int16Array]"; + var Xm = "[object Int32Array]"; + var Zm = "[object Uint8Array]"; + var eg = "[object Uint8ClampedArray]"; + var tg = "[object Uint16Array]"; + var ng = "[object Uint32Array]"; + function rg(e20, t10, n10) { + var r10, o10 = e20.constructor; + switch (t10) { + case Um: + return Tm(e20); + case qm: + case zm: + return new o10(+e20); + case Jm: + return function(e21, t11) { + var n11 = t11 ? Tm(e21.buffer) : e21.buffer; + return new e21.constructor(n11, e21.byteOffset, e21.byteLength); + }(e20, n10); + case Km: + case Gm: + case Qm: + case Ym: + case Xm: + case Zm: + case eg: + case tg: + case ng: + return Dm(e20, n10); + case Bm: + return new o10(); + case Lm: + case Hm: + return new o10(e20); + case Fm: + return function(e21) { + var t11 = new e21.constructor(e21.source, Rm.exec(e21)); + return t11.lastIndex = e21.lastIndex, t11; + }(e20); + case Vm: + return new o10(); + case Wm: + return r10 = e20, Im ? Object(Im.call(r10)) : {}; + } + } + function og(e20) { + return "function" != typeof e20.constructor || oh(e20) ? {} : yf(wv(e20)); + } + var ig = wh && wh.isMap; + var ag = ig ? gh(ig) : function(e20) { + return bu(e20) && "[object Map]" == Em(e20); + }; + var sg = wh && wh.isSet; + var cg = sg ? gh(sg) : function(e20) { + return bu(e20) && "[object Set]" == Em(e20); + }; + var lg = 1; + var ug = 2; + var fg = 4; + var dg = "[object Arguments]"; + var hg = "[object Function]"; + var vg = "[object GeneratorFunction]"; + var pg = "[object Object]"; + var mg = {}; + function gg(e20, t10, n10, r10, o10, i10) { + var a10, s10 = t10 & lg, c10 = t10 & ug, l10 = t10 & fg; + if (n10 && (a10 = o10 ? n10(e20, r10, o10, i10) : n10(e20)), void 0 !== a10) + return a10; + if (!Iu(e20)) + return e20; + var u10 = Cu(e20); + if (u10) { + if (a10 = function(e21) { + var t11 = e21.length, n11 = new e21.constructor(t11); + return t11 && "string" == typeof e21[0] && Am.call(e21, "index") && (n11.index = e21.index, n11.input = e21.input), n11; + }(e20), !s10) + return Nf(e20, a10); + } else { + var f10 = Em(e20), d10 = f10 == hg || f10 == vg; + if (ph(e20)) + return am(e20, s10); + if (f10 == pg || f10 == dg || d10 && !o10) { + if (a10 = c10 || d10 ? {} : og(e20), !s10) + return c10 ? function(e21, t11) { + return Kd(e21, dm(e21), t11); + }(e20, function(e21, t11) { + return e21 && Kd(t11, Ih(t11), e21); + }(a10, e20)) : function(e21, t11) { + return Kd(e21, fm(e21), t11); + }(e20, tm(a10, e20)); + } else { + if (!mg[f10]) + return o10 ? e20 : {}; + a10 = rg(e20, f10, s10); + } + } + i10 || (i10 = new em()); + var h10 = i10.get(e20); + if (h10) + return h10; + i10.set(e20, a10), cg(e20) ? e20.forEach(function(r11) { + a10.add(gg(r11, t10, n10, r11, e20, i10)); + }) : ag(e20) && e20.forEach(function(r11, o11) { + a10.set(o11, gg(r11, t10, n10, o11, e20, i10)); + }); + var v10 = u10 ? void 0 : (l10 ? c10 ? pm : vm : c10 ? Ih : Eh)(e20); + return Qf(v10 || e20, function(r11, o11) { + v10 && (r11 = e20[o11 = r11]), Jd(a10, o11, gg(r11, t10, n10, o11, e20, i10)); + }), a10; + } + mg[dg] = mg["[object Array]"] = mg["[object ArrayBuffer]"] = mg["[object DataView]"] = mg["[object Boolean]"] = mg["[object Date]"] = mg["[object Float32Array]"] = mg["[object Float64Array]"] = mg["[object Int8Array]"] = mg["[object Int16Array]"] = mg["[object Int32Array]"] = mg["[object Map]"] = mg["[object Number]"] = mg[pg] = mg["[object RegExp]"] = mg["[object Set]"] = mg["[object String]"] = mg["[object Symbol]"] = mg["[object Uint8Array]"] = mg["[object Uint8ClampedArray]"] = mg["[object Uint16Array]"] = mg["[object Uint32Array]"] = true, mg["[object Error]"] = mg[hg] = mg["[object WeakMap]"] = false; + function yg(e20) { + return gg(e20, 4); + } + function bg(e20) { + return gg(e20, 5); + } + var kg = 1; + var wg = 4; + function xg(e20, t10) { + return gg(e20, kg | wg, t10 = "function" == typeof t10 ? t10 : void 0); + } + function jg(e20, t10) { + return gg(e20, 4, t10 = "function" == typeof t10 ? t10 : void 0); + } + function Sg() { + return new Rf(this.value(), this.__chain__); + } + function Cg(e20) { + for (var t10 = -1, n10 = null == e20 ? 0 : e20.length, r10 = 0, o10 = []; ++t10 < n10; ) { + var i10 = e20[t10]; + i10 && (o10[r10++] = i10); + } + return o10; + } + function $g() { + var e20 = arguments.length; + if (!e20) + return []; + for (var t10 = Array(e20 - 1), n10 = arguments[0], r10 = e20; r10--; ) + t10[r10 - 1] = arguments[r10]; + return vv(Cu(n10) ? Nf(n10) : [n10], gv(t10, 1)); + } + function _g(e20) { + var t10 = -1, n10 = null == e20 ? 0 : e20.length; + for (this.__data__ = new tv(); ++t10 < n10; ) + this.add(e20[t10]); + } + function Og(e20, t10) { + for (var n10 = -1, r10 = null == e20 ? 0 : e20.length; ++n10 < r10; ) + if (t10(e20[n10], n10, e20)) + return true; + return false; + } + function Mg(e20, t10) { + return e20.has(t10); + } + _g.prototype.add = _g.prototype.push = function(e20) { + return this.__data__.set(e20, "__lodash_hash_undefined__"), this; + }, _g.prototype.has = function(e20) { + return this.__data__.has(e20); + }; + var Eg = 1; + var Ag = 2; + function Pg(e20, t10, n10, r10, o10, i10) { + var a10 = n10 & Eg, s10 = e20.length, c10 = t10.length; + if (s10 != c10 && !(a10 && c10 > s10)) + return false; + var l10 = i10.get(e20), u10 = i10.get(t10); + if (l10 && u10) + return l10 == t10 && u10 == e20; + var f10 = -1, d10 = true, h10 = n10 & Ag ? new _g() : void 0; + for (i10.set(e20, t10), i10.set(t10, e20); ++f10 < s10; ) { + var v10 = e20[f10], p10 = t10[f10]; + if (r10) + var m10 = a10 ? r10(p10, v10, f10, t10, e20, i10) : r10(v10, p10, f10, e20, t10, i10); + if (void 0 !== m10) { + if (m10) + continue; + d10 = false; + break; + } + if (h10) { + if (!Og(t10, function(e21, t11) { + if (!Mg(h10, t11) && (v10 === e21 || o10(v10, e21, n10, r10, i10))) + return h10.push(t11); + })) { + d10 = false; + break; + } + } else if (v10 !== p10 && !o10(v10, p10, n10, r10, i10)) { + d10 = false; + break; + } + } + return i10.delete(e20), i10.delete(t10), d10; + } + function Tg(e20) { + var t10 = -1, n10 = Array(e20.size); + return e20.forEach(function(e21, r10) { + n10[++t10] = [r10, e21]; + }), n10; + } + function Rg(e20) { + var t10 = -1, n10 = Array(e20.size); + return e20.forEach(function(e21) { + n10[++t10] = e21; + }), n10; + } + var Ng = 1; + var Ig = 2; + var Dg = "[object Boolean]"; + var qg = "[object Date]"; + var zg = "[object Error]"; + var Bg = "[object Map]"; + var Lg = "[object Number]"; + var Fg = "[object RegExp]"; + var Vg = "[object Set]"; + var Hg = "[object String]"; + var Wg = "[object Symbol]"; + var Ug = "[object ArrayBuffer]"; + var Jg = "[object DataView]"; + var Kg = lu ? lu.prototype : void 0; + var Gg = Kg ? Kg.valueOf : void 0; + var Qg = 1; + var Yg = Object.prototype.hasOwnProperty; + var Xg = 1; + var Zg = "[object Arguments]"; + var ey = "[object Array]"; + var ty = "[object Object]"; + var ny = Object.prototype.hasOwnProperty; + function ry(e20, t10, n10, r10, o10, i10) { + var a10 = Cu(e20), s10 = Cu(t10), c10 = a10 ? ey : Em(e20), l10 = s10 ? ey : Em(t10), u10 = (c10 = c10 == Zg ? ty : c10) == ty, f10 = (l10 = l10 == Zg ? ty : l10) == ty, d10 = c10 == l10; + if (d10 && ph(e20)) { + if (!ph(t10)) + return false; + a10 = true, u10 = false; + } + if (d10 && !u10) + return i10 || (i10 = new em()), a10 || jh(e20) ? Pg(e20, t10, n10, r10, o10, i10) : function(e21, t11, n11, r11, o11, i11, a11) { + switch (n11) { + case Jg: + if (e21.byteLength != t11.byteLength || e21.byteOffset != t11.byteOffset) + return false; + e21 = e21.buffer, t11 = t11.buffer; + case Ug: + return !(e21.byteLength != t11.byteLength || !i11(new Pm(e21), new Pm(t11))); + case Dg: + case qg: + case Lg: + return Wd(+e21, +t11); + case zg: + return e21.name == t11.name && e21.message == t11.message; + case Fg: + case Hg: + return e21 == t11 + ""; + case Bg: + var s11 = Tg; + case Vg: + var c11 = r11 & Ng; + if (s11 || (s11 = Rg), e21.size != t11.size && !c11) + return false; + var l11 = a11.get(e21); + if (l11) + return l11 == t11; + r11 |= Ig, a11.set(e21, t11); + var u11 = Pg(s11(e21), s11(t11), r11, o11, i11, a11); + return a11.delete(e21), u11; + case Wg: + if (Gg) + return Gg.call(e21) == Gg.call(t11); + } + return false; + }(e20, t10, c10, n10, r10, o10, i10); + if (!(n10 & Xg)) { + var h10 = u10 && ny.call(e20, "__wrapped__"), v10 = f10 && ny.call(t10, "__wrapped__"); + if (h10 || v10) { + var p10 = h10 ? e20.value() : e20, m10 = v10 ? t10.value() : t10; + return i10 || (i10 = new em()), o10(p10, m10, n10, r10, i10); + } + } + return !!d10 && (i10 || (i10 = new em()), function(e21, t11, n11, r11, o11, i11) { + var a11 = n11 & Qg, s11 = vm(e21), c11 = s11.length; + if (c11 != vm(t11).length && !a11) + return false; + for (var l11 = c11; l11--; ) { + var u11 = s11[l11]; + if (!(a11 ? u11 in t11 : Yg.call(t11, u11))) + return false; + } + var f11 = i11.get(e21), d11 = i11.get(t11); + if (f11 && d11) + return f11 == t11 && d11 == e21; + var h11 = true; + i11.set(e21, t11), i11.set(t11, e21); + for (var v11 = a11; ++l11 < c11; ) { + var p11 = e21[u11 = s11[l11]], m11 = t11[u11]; + if (r11) + var g10 = a11 ? r11(m11, p11, u11, t11, e21, i11) : r11(p11, m11, u11, e21, t11, i11); + if (!(void 0 === g10 ? p11 === m11 || o11(p11, m11, n11, r11, i11) : g10)) { + h11 = false; + break; + } + v11 || (v11 = "constructor" == u11); + } + if (h11 && !v11) { + var y10 = e21.constructor, b10 = t11.constructor; + y10 == b10 || !("constructor" in e21) || !("constructor" in t11) || "function" == typeof y10 && y10 instanceof y10 && "function" == typeof b10 && b10 instanceof b10 || (h11 = false); + } + return i11.delete(e21), i11.delete(t11), h11; + }(e20, t10, n10, r10, o10, i10)); + } + function oy(e20, t10, n10, r10, o10) { + return e20 === t10 || (null == e20 || null == t10 || !bu(e20) && !bu(t10) ? e20 != e20 && t10 != t10 : ry(e20, t10, n10, r10, oy, o10)); + } + var iy = 1; + var ay = 2; + function sy(e20, t10, n10, r10) { + var o10 = n10.length, i10 = o10, a10 = !r10; + if (null == e20) + return !i10; + for (e20 = Object(e20); o10--; ) { + var s10 = n10[o10]; + if (a10 && s10[2] ? s10[1] !== e20[s10[0]] : !(s10[0] in e20)) + return false; + } + for (; ++o10 < i10; ) { + var c10 = (s10 = n10[o10])[0], l10 = e20[c10], u10 = s10[1]; + if (a10 && s10[2]) { + if (void 0 === l10 && !(c10 in e20)) + return false; + } else { + var f10 = new em(); + if (r10) + var d10 = r10(l10, u10, c10, e20, t10, f10); + if (!(void 0 === d10 ? oy(u10, l10, iy | ay, r10, f10) : d10)) + return false; + } + } + return true; + } + function cy(e20) { + return e20 == e20 && !Iu(e20); + } + function ly(e20) { + for (var t10 = Eh(e20), n10 = t10.length; n10--; ) { + var r10 = t10[n10], o10 = e20[r10]; + t10[n10] = [r10, o10, cy(o10)]; + } + return t10; + } + function uy(e20, t10) { + return function(n10) { + return null != n10 && (n10[e20] === t10 && (void 0 !== t10 || e20 in Object(n10))); + }; + } + function fy(e20) { + var t10 = ly(e20); + return 1 == t10.length && t10[0][2] ? uy(t10[0][0], t10[0][1]) : function(n10) { + return n10 === e20 || sy(n10, e20, t10); + }; + } + function dy(e20, t10) { + return null != e20 && t10 in Object(e20); + } + function hy(e20, t10, n10) { + for (var r10 = -1, o10 = (t10 = cv(t10, e20)).length, i10 = false; ++r10 < o10; ) { + var a10 = uv(t10[r10]); + if (!(i10 = null != e20 && n10(e20, a10))) + break; + e20 = e20[a10]; + } + return i10 || ++r10 != o10 ? i10 : !!(o10 = null == e20 ? 0 : e20.length) && Zd(o10) && hd(a10, o10) && (Cu(e20) || uh(e20)); + } + function vy(e20, t10) { + return null != e20 && hy(e20, t10, dy); + } + var py = 1; + var my = 2; + function gy(e20, t10) { + return Wh(e20) && cy(t10) ? uy(uv(e20), t10) : function(n10) { + var r10 = dv(n10, e20); + return void 0 === r10 && r10 === t10 ? vy(n10, e20) : oy(t10, r10, py | my); + }; + } + function yy(e20) { + return function(t10) { + return null == t10 ? void 0 : t10[e20]; + }; + } + function by(e20) { + return Wh(e20) ? yy(uv(e20)) : /* @__PURE__ */ function(e21) { + return function(t10) { + return fv(t10, e21); + }; + }(e20); + } + function ky(e20) { + return "function" == typeof e20 ? e20 : null == e20 ? Ku : "object" == Ho(e20) ? Cu(e20) ? gy(e20[0], e20[1]) : fy(e20) : by(e20); + } + function wy(e20) { + var t10 = null == e20 ? 0 : e20.length, n10 = ky; + return e20 = t10 ? Su(e20, function(e21) { + if ("function" != typeof e21[1]) + throw new TypeError("Expected a function"); + return [n10(e21[0]), e21[1]]; + }) : [], Yd(function(n11) { + for (var r10 = -1; ++r10 < t10; ) { + var o10 = e20[r10]; + if (wf(o10[0], this, n11)) + return wf(o10[1], this, n11); + } + }); + } + function xy(e20, t10, n10) { + var r10 = n10.length; + if (null == e20) + return !r10; + for (e20 = Object(e20); r10--; ) { + var o10 = n10[r10], i10 = t10[o10], a10 = e20[o10]; + if (void 0 === a10 && !(o10 in e20) || !i10(a10)) + return false; + } + return true; + } + function jy(e20) { + return function(e21) { + var t10 = Eh(e21); + return function(n10) { + return xy(n10, e21, t10); + }; + }(gg(e20, 1)); + } + function Sy(e20, t10) { + return null == t10 || xy(e20, t10, Eh(t10)); + } + function Cy(e20, t10, n10, r10) { + for (var o10 = -1, i10 = null == e20 ? 0 : e20.length; ++o10 < i10; ) { + var a10 = e20[o10]; + t10(r10, a10, n10(a10), e20); + } + return r10; + } + function $y(e20) { + return function(t10, n10, r10) { + for (var o10 = -1, i10 = Object(t10), a10 = r10(t10), s10 = a10.length; s10--; ) { + var c10 = a10[e20 ? s10 : ++o10]; + if (false === n10(i10[c10], c10, i10)) + break; + } + return t10; + }; + } + var _y = $y(); + function Oy(e20, t10) { + return e20 && _y(e20, t10, Eh); + } + function My(e20, t10) { + return function(n10, r10) { + if (null == n10) + return n10; + if (!eh(n10)) + return e20(n10, r10); + for (var o10 = n10.length, i10 = t10 ? o10 : -1, a10 = Object(n10); (t10 ? i10-- : ++i10 < o10) && false !== r10(a10[i10], i10, a10); ) + ; + return n10; + }; + } + var Ey = My(Oy); + function Ay(e20, t10, n10, r10) { + return Ey(e20, function(e21, o10, i10) { + t10(r10, e21, n10(e21), i10); + }), r10; + } + function Py(e20, t10) { + return function(n10, r10) { + var o10 = Cu(n10) ? Cy : Ay, i10 = t10 ? t10() : {}; + return o10(n10, e20, ky(r10), i10); + }; + } + var Ty = Object.prototype.hasOwnProperty; + var Ry = Py(function(e20, t10, n10) { + Ty.call(e20, n10) ? ++e20[n10] : Hd(e20, n10, 1); + }); + var Ny = Ry; + function Iy(e20, t10) { + var n10 = yf(e20); + return null == t10 ? n10 : tm(n10, t10); + } + function Dy(e20, t10, n10) { + var r10 = Ld(e20, 8, void 0, void 0, void 0, void 0, void 0, t10 = n10 ? void 0 : t10); + return r10.placeholder = Dy.placeholder, r10; + } + Dy.placeholder = {}; + function qy(e20, t10, n10) { + var r10 = Ld(e20, 16, void 0, void 0, void 0, void 0, void 0, t10 = n10 ? void 0 : t10); + return r10.placeholder = qy.placeholder, r10; + } + qy.placeholder = {}; + var zy = function() { + return cu.Date.now(); + }; + var By = "Expected a function"; + var Ly = Math.max; + var Fy = Math.min; + function Vy(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10 = 0, u10 = false, f10 = false, d10 = true; + if ("function" != typeof e20) + throw new TypeError(By); + function h10(t11) { + var n11 = r10, i11 = o10; + return r10 = o10 = void 0, l10 = t11, a10 = e20.apply(i11, n11); + } + function v10(e21) { + var n11 = e21 - c10; + return void 0 === c10 || n11 >= t10 || n11 < 0 || f10 && e21 - l10 >= i10; + } + function p10() { + var e21 = zy(); + if (v10(e21)) + return m10(e21); + s10 = setTimeout(p10, function(e23) { + var n11 = t10 - (e23 - c10); + return f10 ? Fy(n11, i10 - (e23 - l10)) : n11; + }(e21)); + } + function m10(e21) { + return s10 = void 0, d10 && r10 ? h10(e21) : (r10 = o10 = void 0, a10); + } + function g10() { + var e21 = zy(), n11 = v10(e21); + if (r10 = arguments, o10 = this, c10 = e21, n11) { + if (void 0 === s10) + return function(e23) { + return l10 = e23, s10 = setTimeout(p10, t10), u10 ? h10(e23) : a10; + }(c10); + if (f10) + return clearTimeout(s10), s10 = setTimeout(p10, t10), h10(c10); + } + return void 0 === s10 && (s10 = setTimeout(p10, t10)), a10; + } + return t10 = Fu(t10) || 0, Iu(n10) && (u10 = !!n10.leading, i10 = (f10 = "maxWait" in n10) ? Ly(Fu(n10.maxWait) || 0, t10) : i10, d10 = "trailing" in n10 ? !!n10.trailing : d10), g10.cancel = function() { + void 0 !== s10 && clearTimeout(s10), l10 = 0, r10 = c10 = o10 = s10 = void 0; + }, g10.flush = function() { + return void 0 === s10 ? a10 : m10(zy()); + }, g10; + } + function Hy(e20, t10) { + return null == e20 || e20 != e20 ? t10 : e20; + } + var Wy = Object.prototype; + var Uy = Wy.hasOwnProperty; + var Jy = Yd(function(e20, t10) { + e20 = Object(e20); + var n10 = -1, r10 = t10.length, o10 = r10 > 2 ? t10[2] : void 0; + for (o10 && th(t10[0], t10[1], o10) && (r10 = 1); ++n10 < r10; ) + for (var i10 = t10[n10], a10 = Ih(i10), s10 = -1, c10 = a10.length; ++s10 < c10; ) { + var l10 = a10[s10], u10 = e20[l10]; + (void 0 === u10 || Wd(u10, Wy[l10]) && !Uy.call(e20, l10)) && (e20[l10] = i10[l10]); + } + return e20; + }); + var Ky = Jy; + function Gy(e20, t10, n10) { + (void 0 !== n10 && !Wd(e20[t10], n10) || void 0 === n10 && !(t10 in e20)) && Hd(e20, t10, n10); + } + function Qy(e20) { + return bu(e20) && eh(e20); + } + function Yy(e20, t10) { + if (("constructor" !== t10 || "function" != typeof e20[t10]) && "__proto__" != t10) + return e20[t10]; + } + function Xy(e20) { + return Kd(e20, Ih(e20)); + } + function Zy(e20, t10, n10, r10, o10) { + e20 !== t10 && _y(t10, function(i10, a10) { + if (o10 || (o10 = new em()), Iu(i10)) + !function(e21, t11, n11, r11, o11, i11, a11) { + var s11 = Yy(e21, n11), c10 = Yy(t11, n11), l10 = a11.get(c10); + if (l10) + Gy(e21, n11, l10); + else { + var u10 = i11 ? i11(s11, c10, n11 + "", e21, t11, a11) : void 0, f10 = void 0 === u10; + if (f10) { + var d10 = Cu(c10), h10 = !d10 && ph(c10), v10 = !d10 && !h10 && jh(c10); + u10 = c10, d10 || h10 || v10 ? Cu(s11) ? u10 = s11 : Qy(s11) ? u10 = Nf(s11) : h10 ? (f10 = false, u10 = am(c10, true)) : v10 ? (f10 = false, u10 = Dm(c10, true)) : u10 = [] : Ov(c10) || uh(c10) ? (u10 = s11, uh(s11) ? u10 = Xy(s11) : Iu(s11) && !Zu(s11) || (u10 = og(c10))) : f10 = false; + } + f10 && (a11.set(c10, u10), o11(u10, c10, r11, i11, a11), a11.delete(c10)), Gy(e21, n11, u10); + } + }(e20, t10, a10, n10, Zy, r10, o10); + else { + var s10 = r10 ? r10(Yy(e20, a10), i10, a10 + "", e20, t10, o10) : void 0; + void 0 === s10 && (s10 = i10), Gy(e20, a10, s10); + } + }, Ih); + } + function eb(e20, t10, n10, r10, o10, i10) { + return Iu(e20) && Iu(t10) && (i10.set(t10, e20), Zy(e20, t10, void 0, eb, i10), i10.delete(t10)), e20; + } + var tb = nh(function(e20, t10, n10, r10) { + Zy(e20, t10, n10, r10); + }); + var nb = tb; + var rb = Yd(function(e20) { + return e20.push(void 0, eb), wf(nb, void 0, e20); + }); + function ob(e20, t10, n10) { + if ("function" != typeof e20) + throw new TypeError("Expected a function"); + return setTimeout(function() { + e20.apply(void 0, n10); + }, t10); + } + var ib = Yd(function(e20, t10) { + return ob(e20, 1, t10); + }); + var ab = ib; + var sb = Yd(function(e20, t10, n10) { + return ob(e20, Fu(t10) || 0, n10); + }); + var cb = sb; + function lb(e20, t10, n10) { + for (var r10 = -1, o10 = null == e20 ? 0 : e20.length; ++r10 < o10; ) + if (n10(t10, e20[r10])) + return true; + return false; + } + var ub = 200; + function fb(e20, t10, n10, r10) { + var o10 = -1, i10 = ed, a10 = true, s10 = e20.length, c10 = [], l10 = t10.length; + if (!s10) + return c10; + n10 && (t10 = Su(t10, gh(n10))), r10 ? (i10 = lb, a10 = false) : t10.length >= ub && (i10 = Mg, a10 = false, t10 = new _g(t10)); + e: + for (; ++o10 < s10; ) { + var u10 = e20[o10], f10 = null == n10 ? u10 : n10(u10); + if (u10 = r10 || 0 !== u10 ? u10 : 0, a10 && f10 == f10) { + for (var d10 = l10; d10--; ) + if (t10[d10] === f10) + continue e; + c10.push(u10); + } else + i10(t10, f10, r10) || c10.push(u10); + } + return c10; + } + var db = Yd(function(e20, t10) { + return Qy(e20) ? fb(e20, gv(t10, 1, Qy, true)) : []; + }); + var hb = db; + function vb(e20) { + var t10 = null == e20 ? 0 : e20.length; + return t10 ? e20[t10 - 1] : void 0; + } + var pb = Yd(function(e20, t10) { + var n10 = vb(t10); + return Qy(n10) && (n10 = void 0), Qy(e20) ? fb(e20, gv(t10, 1, Qy, true), ky(n10)) : []; + }); + var mb = pb; + var gb = Yd(function(e20, t10) { + var n10 = vb(t10); + return Qy(n10) && (n10 = void 0), Qy(e20) ? fb(e20, gv(t10, 1, Qy, true), void 0, n10) : []; + }); + var yb = gb; + var bb = Eu(function(e20, t10) { + return e20 / t10; + }, 1); + function kb(e20, t10, n10) { + var r10 = null == e20 ? 0 : e20.length; + return r10 ? Fv(e20, (t10 = n10 || void 0 === t10 ? 1 : Uu(t10)) < 0 ? 0 : t10, r10) : []; + } + function wb(e20, t10, n10) { + var r10 = null == e20 ? 0 : e20.length; + return r10 ? Fv(e20, 0, (t10 = r10 - (t10 = n10 || void 0 === t10 ? 1 : Uu(t10))) < 0 ? 0 : t10) : []; + } + function xb(e20, t10, n10, r10) { + for (var o10 = e20.length, i10 = r10 ? o10 : -1; (r10 ? i10-- : ++i10 < o10) && t10(e20[i10], i10, e20); ) + ; + return n10 ? Fv(e20, r10 ? 0 : i10, r10 ? i10 + 1 : o10) : Fv(e20, r10 ? i10 + 1 : 0, r10 ? o10 : i10); + } + function jb(e20, t10) { + return e20 && e20.length ? xb(e20, ky(t10), true, true) : []; + } + function Sb(e20, t10) { + return e20 && e20.length ? xb(e20, ky(t10), true) : []; + } + function Cb(e20) { + return "function" == typeof e20 ? e20 : Ku; + } + function $b(e20, t10) { + return (Cu(e20) ? Qf : Ey)(e20, Cb(t10)); + } + function _b(e20, t10) { + for (var n10 = null == e20 ? 0 : e20.length; n10-- && false !== t10(e20[n10], n10, e20); ) + ; + return e20; + } + var Ob = $y(true); + function Mb(e20, t10) { + return e20 && Ob(e20, t10, Eh); + } + var Eb = My(Mb, true); + function Ab(e20, t10) { + return (Cu(e20) ? _b : Eb)(e20, Cb(t10)); + } + function Pb(e20, t10, n10) { + e20 = sv(e20), t10 = Mu(t10); + var r10 = e20.length, o10 = n10 = void 0 === n10 ? r10 : Xp(Uu(n10), 0, r10); + return (n10 -= t10.length) >= 0 && e20.slice(n10, o10) == t10; + } + function Tb(e20) { + return function(t10) { + var n10 = Em(t10); + return "[object Map]" == n10 ? Tg(t10) : "[object Set]" == n10 ? function(e21) { + var t11 = -1, n11 = Array(e21.size); + return e21.forEach(function(e23) { + n11[++t11] = [e23, e23]; + }), n11; + }(t10) : function(e21, t11) { + return Su(t11, function(t12) { + return [t12, e21[t12]]; + }); + }(t10, e20(t10)); + }; + } + var Rb = Tb(Eh); + var Nb = Tb(Ih); + var Ib = lp({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }); + var Db = /[&<>"']/g; + var qb = RegExp(Db.source); + function zb(e20) { + return (e20 = sv(e20)) && qb.test(e20) ? e20.replace(Db, Ib) : e20; + } + var Bb = /[\\^$.*+?()[\]{}|]/g; + var Lb = RegExp(Bb.source); + function Fb(e20) { + return (e20 = sv(e20)) && Lb.test(e20) ? e20.replace(Bb, "\\$&") : e20; + } + function Vb(e20, t10) { + for (var n10 = -1, r10 = null == e20 ? 0 : e20.length; ++n10 < r10; ) + if (!t10(e20[n10], n10, e20)) + return false; + return true; + } + function Hb(e20, t10) { + var n10 = true; + return Ey(e20, function(e21, r10, o10) { + return n10 = !!t10(e21, r10, o10); + }), n10; + } + function Wb(e20, t10, n10) { + var r10 = Cu(e20) ? Vb : Hb; + return n10 && th(e20, t10, n10) && (t10 = void 0), r10(e20, ky(t10)); + } + var Ub = 4294967295; + function Jb(e20) { + return e20 ? Xp(Uu(e20), 0, Ub) : 0; + } + function Kb(e20, t10, n10, r10) { + var o10 = null == e20 ? 0 : e20.length; + return o10 ? (n10 && "number" != typeof n10 && th(e20, t10, n10) && (n10 = 0, r10 = o10), function(e21, t11, n11, r11) { + var o11 = e21.length; + for ((n11 = Uu(n11)) < 0 && (n11 = -n11 > o11 ? 0 : o11 + n11), (r11 = void 0 === r11 || r11 > o11 ? o11 : Uu(r11)) < 0 && (r11 += o11), r11 = n11 > r11 ? 0 : Jb(r11); n11 < r11; ) + e21[n11++] = t11; + return e21; + }(e20, t10, n10, r10)) : []; + } + function Gb(e20, t10) { + var n10 = []; + return Ey(e20, function(e21, r10, o10) { + t10(e21, r10, o10) && n10.push(e21); + }), n10; + } + function Qb(e20, t10) { + return (Cu(e20) ? sm : Gb)(e20, ky(t10)); + } + function Yb(e20) { + return function(t10, n10, r10) { + var o10 = Object(t10); + if (!eh(t10)) { + var i10 = ky(n10); + t10 = Eh(t10), n10 = function(e21) { + return i10(o10[e21], e21, o10); + }; + } + var a10 = e20(t10, n10, r10); + return a10 > -1 ? o10[i10 ? t10[a10] : a10] : void 0; + }; + } + var Xb = Math.max; + function Zb(e20, t10, n10) { + var r10 = null == e20 ? 0 : e20.length; + if (!r10) + return -1; + var o10 = null == n10 ? 0 : Uu(n10); + return o10 < 0 && (o10 = Xb(r10 + o10, 0)), Yf(e20, ky(t10), o10); + } + var ek = Yb(Zb); + function tk(e20, t10, n10) { + var r10; + return n10(e20, function(e21, n11, o10) { + if (t10(e21, n11, o10)) + return r10 = n11, false; + }), r10; + } + function nk(e20, t10) { + return tk(e20, ky(t10), Oy); + } + var rk = Math.max; + var ok = Math.min; + function ik(e20, t10, n10) { + var r10 = null == e20 ? 0 : e20.length; + if (!r10) + return -1; + var o10 = r10 - 1; + return void 0 !== n10 && (o10 = Uu(n10), o10 = n10 < 0 ? rk(r10 + o10, 0) : ok(o10, r10 - 1)), Yf(e20, ky(t10), o10, true); + } + var ak = Yb(ik); + function sk(e20, t10) { + return tk(e20, ky(t10), Mb); + } + function ck(e20) { + return e20 && e20.length ? e20[0] : void 0; + } + function lk(e20, t10) { + var n10 = -1, r10 = eh(e20) ? Array(e20.length) : []; + return Ey(e20, function(e21, o10, i10) { + r10[++n10] = t10(e21, o10, i10); + }), r10; + } + function uk(e20, t10) { + return (Cu(e20) ? Su : lk)(e20, ky(t10)); + } + function fk(e20, t10) { + return gv(uk(e20, t10), 1); + } + function dk(e20, t10) { + return gv(uk(e20, t10), Infinity); + } + function hk(e20, t10, n10) { + return n10 = void 0 === n10 ? 1 : Uu(n10), gv(uk(e20, t10), n10); + } + function vk(e20) { + return (null == e20 ? 0 : e20.length) ? gv(e20, Infinity) : []; + } + function pk(e20, t10) { + return (null == e20 ? 0 : e20.length) ? gv(e20, t10 = void 0 === t10 ? 1 : Uu(t10)) : []; + } + function mk(e20) { + return Ld(e20, 512); + } + var gk = Up("floor"); + function yk(e20) { + return bv(function(t10) { + var n10 = t10.length, r10 = n10, o10 = Rf.prototype.thru; + for (e20 && t10.reverse(); r10--; ) { + var i10 = t10[r10]; + if ("function" != typeof i10) + throw new TypeError("Expected a function"); + if (o10 && !a10 && "wrapper" == Tf(i10)) + var a10 = new Rf([], true); + } + for (r10 = a10 ? r10 : n10; ++r10 < n10; ) { + var s10 = Tf(i10 = t10[r10]), c10 = "wrapper" == s10 ? Ef(i10) : void 0; + a10 = c10 && zf(c10[0]) && 424 == c10[1] && !c10[4].length && 1 == c10[9] ? a10[Tf(c10[0])].apply(a10, c10[3]) : 1 == i10.length && zf(i10) ? a10[s10]() : a10.thru(i10); + } + return function() { + var e21 = arguments, r11 = e21[0]; + if (a10 && 1 == e21.length && Cu(r11)) + return a10.plant(r11).value(); + for (var o11 = 0, i11 = n10 ? t10[o11].apply(this, e21) : r11; ++o11 < n10; ) + i11 = t10[o11].call(this, i11); + return i11; + }; + }); + } + var bk = yk(); + var kk = yk(true); + function wk(e20, t10) { + return null == e20 ? e20 : _y(e20, Cb(t10), Ih); + } + function xk(e20, t10) { + return null == e20 ? e20 : Ob(e20, Cb(t10), Ih); + } + function jk(e20, t10) { + return e20 && Oy(e20, Cb(t10)); + } + function Sk(e20, t10) { + return e20 && Mb(e20, Cb(t10)); + } + function Ck(e20) { + for (var t10 = -1, n10 = null == e20 ? 0 : e20.length, r10 = {}; ++t10 < n10; ) { + var o10 = e20[t10]; + r10[o10[0]] = o10[1]; + } + return r10; + } + function $k(e20, t10) { + return sm(t10, function(t11) { + return Zu(e20[t11]); + }); + } + function _k(e20) { + return null == e20 ? [] : $k(e20, Eh(e20)); + } + function Ok(e20) { + return null == e20 ? [] : $k(e20, Ih(e20)); + } + var Mk = Object.prototype.hasOwnProperty; + var Ek = Py(function(e20, t10, n10) { + Mk.call(e20, n10) ? e20[n10].push(t10) : Hd(e20, n10, [t10]); + }); + var Ak = Ek; + function Pk(e20, t10) { + return e20 > t10; + } + function Tk(e20) { + return function(t10, n10) { + return "string" == typeof t10 && "string" == typeof n10 || (t10 = Fu(t10), n10 = Fu(n10)), e20(t10, n10); + }; + } + var Rk = Tk(Pk); + var Nk = Tk(function(e20, t10) { + return e20 >= t10; + }); + var Ik = Object.prototype.hasOwnProperty; + function Dk(e20, t10) { + return null != e20 && Ik.call(e20, t10); + } + function qk(e20, t10) { + return null != e20 && hy(e20, t10, Dk); + } + var zk = Math.max; + var Bk = Math.min; + function Lk(e20, t10, n10) { + return t10 = Wu(t10), void 0 === n10 ? (n10 = t10, t10 = 0) : n10 = Wu(n10), function(e21, t11, n11) { + return e21 >= Bk(t11, n11) && e21 < zk(t11, n11); + }(e20 = Fu(e20), t10, n10); + } + var Fk = "[object String]"; + function Vk(e20) { + return "string" == typeof e20 || !Cu(e20) && bu(e20) && yu(e20) == Fk; + } + function Hk(e20, t10) { + return Su(t10, function(t11) { + return e20[t11]; + }); + } + function Wk(e20) { + return null == e20 ? [] : Hk(e20, Eh(e20)); + } + var Uk = Math.max; + function Jk(e20, t10, n10, r10) { + e20 = eh(e20) ? e20 : Wk(e20), n10 = n10 && !r10 ? Uu(n10) : 0; + var o10 = e20.length; + return n10 < 0 && (n10 = Uk(o10 + n10, 0)), Vk(e20) ? n10 <= o10 && e20.indexOf(t10, n10) > -1 : !!o10 && Zf(e20, t10, n10) > -1; + } + var Kk = Math.max; + function Gk(e20, t10, n10) { + var r10 = null == e20 ? 0 : e20.length; + if (!r10) + return -1; + var o10 = null == n10 ? 0 : Uu(n10); + return o10 < 0 && (o10 = Kk(r10 + o10, 0)), Zf(e20, t10, o10); + } + function Qk(e20) { + return (null == e20 ? 0 : e20.length) ? Fv(e20, 0, -1) : []; + } + var Yk = Math.min; + function Xk(e20, t10, n10) { + for (var r10 = n10 ? lb : ed, o10 = e20[0].length, i10 = e20.length, a10 = i10, s10 = Array(i10), c10 = 1 / 0, l10 = []; a10--; ) { + var u10 = e20[a10]; + a10 && t10 && (u10 = Su(u10, gh(t10))), c10 = Yk(u10.length, c10), s10[a10] = !n10 && (t10 || o10 >= 120 && u10.length >= 120) ? new _g(a10 && u10) : void 0; + } + u10 = e20[0]; + var f10 = -1, d10 = s10[0]; + e: + for (; ++f10 < o10 && l10.length < c10; ) { + var h10 = u10[f10], v10 = t10 ? t10(h10) : h10; + if (h10 = n10 || 0 !== h10 ? h10 : 0, !(d10 ? Mg(d10, v10) : r10(l10, v10, n10))) { + for (a10 = i10; --a10; ) { + var p10 = s10[a10]; + if (!(p10 ? Mg(p10, v10) : r10(e20[a10], v10, n10))) + continue e; + } + d10 && d10.push(v10), l10.push(h10); + } + } + return l10; + } + function Zk(e20) { + return Qy(e20) ? e20 : []; + } + var ew = Yd(function(e20) { + var t10 = Su(e20, Zk); + return t10.length && t10[0] === e20[0] ? Xk(t10) : []; + }); + var tw = Yd(function(e20) { + var t10 = vb(e20), n10 = Su(e20, Zk); + return t10 === vb(n10) ? t10 = void 0 : n10.pop(), n10.length && n10[0] === e20[0] ? Xk(n10, ky(t10)) : []; + }); + var nw = tw; + var rw = Yd(function(e20) { + var t10 = vb(e20), n10 = Su(e20, Zk); + return (t10 = "function" == typeof t10 ? t10 : void 0) && n10.pop(), n10.length && n10[0] === e20[0] ? Xk(n10, void 0, t10) : []; + }); + function ow(e20, t10) { + return function(n10, r10) { + return function(e21, t11, n11, r11) { + return Oy(e21, function(e23, o10, i10) { + t11(r11, n11(e23), o10, i10); + }), r11; + }(n10, e20, t10(r10), {}); + }; + } + var iw = Object.prototype.toString; + var aw = ow(function(e20, t10, n10) { + null != t10 && "function" != typeof t10.toString && (t10 = iw.call(t10)), e20[t10] = n10; + }, Uf(Ku)); + var sw = aw; + var cw = Object.prototype; + var lw = cw.hasOwnProperty; + var uw = cw.toString; + var fw = ow(function(e20, t10, n10) { + null != t10 && "function" != typeof t10.toString && (t10 = uw.call(t10)), lw.call(e20, t10) ? e20[t10].push(n10) : e20[t10] = [n10]; + }, ky); + var dw = fw; + function hw(e20, t10) { + return t10.length < 2 ? e20 : fv(e20, Fv(t10, 0, -1)); + } + function vw(e20, t10, n10) { + var r10 = null == (e20 = hw(e20, t10 = cv(t10, e20))) ? e20 : e20[uv(vb(t10))]; + return null == r10 ? void 0 : wf(r10, e20, n10); + } + var pw = Yd(vw); + var mw = Yd(function(e20, t10, n10) { + var r10 = -1, o10 = "function" == typeof t10, i10 = eh(e20) ? Array(e20.length) : []; + return Ey(e20, function(e21) { + i10[++r10] = o10 ? wf(t10, e21, n10) : vw(e21, t10, n10); + }), i10; + }); + var gw = mw; + var yw = wh && wh.isArrayBuffer; + var bw = yw ? gh(yw) : function(e20) { + return bu(e20) && "[object ArrayBuffer]" == yu(e20); + }; + function kw(e20) { + return true === e20 || false === e20 || bu(e20) && "[object Boolean]" == yu(e20); + } + var ww = wh && wh.isDate; + var xw = ww ? gh(ww) : function(e20) { + return bu(e20) && "[object Date]" == yu(e20); + }; + function jw(e20) { + return bu(e20) && 1 === e20.nodeType && !Ov(e20); + } + var Sw = "[object Map]"; + var Cw = "[object Set]"; + var $w = Object.prototype.hasOwnProperty; + function _w(e20) { + if (null == e20) + return true; + if (eh(e20) && (Cu(e20) || "string" == typeof e20 || "function" == typeof e20.splice || ph(e20) || jh(e20) || uh(e20))) + return !e20.length; + var t10 = Em(e20); + if (t10 == Sw || t10 == Cw) + return !e20.size; + if (oh(e20)) + return !Mh(e20).length; + for (var n10 in e20) + if ($w.call(e20, n10)) + return false; + return true; + } + function Ow(e20, t10) { + return oy(e20, t10); + } + function Mw(e20, t10, n10) { + var r10 = (n10 = "function" == typeof n10 ? n10 : void 0) ? n10(e20, t10) : void 0; + return void 0 === r10 ? oy(e20, t10, void 0, n10) : !!r10; + } + var Ew = cu.isFinite; + function Aw(e20) { + return "number" == typeof e20 && Ew(e20); + } + function Pw(e20) { + return "number" == typeof e20 && e20 == Uu(e20); + } + function Tw(e20, t10) { + return e20 === t10 || sy(e20, t10, ly(t10)); + } + function Rw(e20, t10, n10) { + return n10 = "function" == typeof n10 ? n10 : void 0, sy(e20, t10, ly(t10), n10); + } + var Nw = "[object Number]"; + function Iw(e20) { + return "number" == typeof e20 || bu(e20) && yu(e20) == Nw; + } + function Dw(e20) { + return Iw(e20) && e20 != +e20; + } + var qw = tf ? Zu : fh; + function zw(e20) { + if (qw(e20)) + throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill."); + return df(e20); + } + function Bw(e20) { + return null == e20; + } + function Lw(e20) { + return null === e20; + } + var Fw = wh && wh.isRegExp; + var Vw = Fw ? gh(Fw) : function(e20) { + return bu(e20) && "[object RegExp]" == yu(e20); + }; + var Hw = 9007199254740991; + function Ww(e20) { + return Pw(e20) && e20 >= -9007199254740991 && e20 <= Hw; + } + function Uw(e20) { + return void 0 === e20; + } + function Jw(e20) { + return bu(e20) && "[object WeakMap]" == Em(e20); + } + function Kw(e20) { + return bu(e20) && "[object WeakSet]" == yu(e20); + } + function Gw(e20) { + return ky("function" == typeof e20 ? e20 : gg(e20, 1)); + } + var Qw = Array.prototype.join; + function Yw(e20, t10) { + return null == e20 ? "" : Qw.call(e20, t10); + } + var Xw = Bp(function(e20, t10, n10) { + return e20 + (n10 ? "-" : "") + t10.toLowerCase(); + }); + var Zw = Xw; + var ex = Py(function(e20, t10, n10) { + Hd(e20, n10, t10); + }); + var tx = ex; + var nx = Math.max; + var rx = Math.min; + function ox(e20, t10, n10) { + var r10 = null == e20 ? 0 : e20.length; + if (!r10) + return -1; + var o10 = r10; + return void 0 !== n10 && (o10 = (o10 = Uu(n10)) < 0 ? nx(r10 + o10, 0) : rx(o10, r10 - 1)), t10 == t10 ? function(e21, t11, n11) { + for (var r11 = n11 + 1; r11--; ) + if (e21[r11] === t11) + return r11; + return r11; + }(e20, t10, o10) : Yf(e20, Xf, o10, true); + } + var ix = Bp(function(e20, t10, n10) { + return e20 + (n10 ? " " : "") + t10.toLowerCase(); + }); + var ax = ix; + var sx = ip("toLowerCase"); + function cx(e20, t10) { + return e20 < t10; + } + var lx = Tk(cx); + var ux = Tk(function(e20, t10) { + return e20 <= t10; + }); + function fx(e20, t10) { + var n10 = {}; + return t10 = ky(t10), Oy(e20, function(e21, r10, o10) { + Hd(n10, t10(e21, r10, o10), e21); + }), n10; + } + function dx(e20, t10) { + var n10 = {}; + return t10 = ky(t10), Oy(e20, function(e21, r10, o10) { + Hd(n10, r10, t10(e21, r10, o10)); + }), n10; + } + function hx(e20) { + return fy(gg(e20, 1)); + } + function vx(e20, t10) { + return gy(e20, gg(t10, 1)); + } + function px(e20, t10, n10) { + for (var r10 = -1, o10 = e20.length; ++r10 < o10; ) { + var i10 = e20[r10], a10 = t10(i10); + if (null != a10 && (void 0 === s10 ? a10 == a10 && !wu(a10) : n10(a10, s10))) + var s10 = a10, c10 = i10; + } + return c10; + } + function mx(e20) { + return e20 && e20.length ? px(e20, Ku, Pk) : void 0; + } + function gx(e20, t10) { + return e20 && e20.length ? px(e20, ky(t10), Pk) : void 0; + } + function yx(e20, t10) { + for (var n10, r10 = -1, o10 = e20.length; ++r10 < o10; ) { + var i10 = t10(e20[r10]); + void 0 !== i10 && (n10 = void 0 === n10 ? i10 : n10 + i10); + } + return n10; + } + var bx = NaN; + function kx(e20, t10) { + var n10 = null == e20 ? 0 : e20.length; + return n10 ? yx(e20, t10) / n10 : bx; + } + function wx(e20) { + return kx(e20, Ku); + } + function xx(e20, t10) { + return kx(e20, ky(t10)); + } + var jx = nh(function(e20, t10, n10) { + Zy(e20, t10, n10); + }); + var Sx = jx; + var Cx = Yd(function(e20, t10) { + return function(n10) { + return vw(n10, e20, t10); + }; + }); + var $x = Cx; + var _x = Yd(function(e20, t10) { + return function(n10) { + return vw(e20, n10, t10); + }; + }); + var Ox = _x; + function Mx(e20) { + return e20 && e20.length ? px(e20, Ku, cx) : void 0; + } + function Ex(e20, t10) { + return e20 && e20.length ? px(e20, ky(t10), cx) : void 0; + } + function Ax(e20, t10, n10) { + var r10 = Eh(t10), o10 = $k(t10, r10), i10 = !(Iu(n10) && "chain" in n10 && !n10.chain), a10 = Zu(e20); + return Qf(o10, function(n11) { + var r11 = t10[n11]; + e20[n11] = r11, a10 && (e20.prototype[n11] = function() { + var t11 = this.__chain__; + if (i10 || t11) { + var n12 = e20(this.__wrapped__); + return (n12.__actions__ = Nf(this.__actions__)).push({ func: r11, args: arguments, thisArg: e20 }), n12.__chain__ = t11, n12; + } + return r11.apply(e20, vv([this.value()], arguments)); + }); + }), e20; + } + var Px = Eu(function(e20, t10) { + return e20 * t10; + }, 1); + var Tx = "Expected a function"; + function Rx(e20) { + if ("function" != typeof e20) + throw new TypeError(Tx); + return function() { + var t10 = arguments; + switch (t10.length) { + case 0: + return !e20.call(this); + case 1: + return !e20.call(this, t10[0]); + case 2: + return !e20.call(this, t10[0], t10[1]); + case 3: + return !e20.call(this, t10[0], t10[1], t10[2]); + } + return !e20.apply(this, t10); + }; + } + var Nx = "[object Map]"; + var Ix = "[object Set]"; + var Dx = lu ? lu.iterator : void 0; + function qx(e20) { + if (!e20) + return []; + if (eh(e20)) + return Vk(e20) ? op(e20) : Nf(e20); + if (Dx && e20[Dx]) + return function(e21) { + for (var t11, n10 = []; !(t11 = e21.next()).done; ) + n10.push(t11.value); + return n10; + }(e20[Dx]()); + var t10 = Em(e20); + return (t10 == Nx ? Tg : t10 == Ix ? Rg : Wk)(e20); + } + function zx() { + void 0 === this.__values__ && (this.__values__ = qx(this.value())); + var e20 = this.__index__ >= this.__values__.length; + return { done: e20, value: e20 ? void 0 : this.__values__[this.__index__++] }; + } + function Bx(e20, t10) { + var n10 = e20.length; + if (n10) + return hd(t10 += t10 < 0 ? n10 : 0, n10) ? e20[t10] : void 0; + } + function Lx(e20, t10) { + return e20 && e20.length ? Bx(e20, Uu(t10)) : void 0; + } + function Fx(e20) { + return e20 = Uu(e20), Yd(function(t10) { + return Bx(t10, e20); + }); + } + function Vx(e20, t10) { + return null == (e20 = hw(e20, t10 = cv(t10, e20))) || delete e20[uv(vb(t10))]; + } + function Hx(e20) { + return Ov(e20) ? void 0 : e20; + } + var Wx = bv(function(e20, t10) { + var n10 = {}; + if (null == e20) + return n10; + var r10 = false; + t10 = Su(t10, function(t11) { + return t11 = cv(t11, e20), r10 || (r10 = t11.length > 1), t11; + }), Kd(e20, pm(e20), n10), r10 && (n10 = gg(n10, 7, Hx)); + for (var o10 = t10.length; o10--; ) + Vx(n10, t10[o10]); + return n10; + }); + var Ux = Wx; + function Jx(e20, t10, n10, r10) { + if (!Iu(e20)) + return e20; + for (var o10 = -1, i10 = (t10 = cv(t10, e20)).length, a10 = i10 - 1, s10 = e20; null != s10 && ++o10 < i10; ) { + var c10 = uv(t10[o10]), l10 = n10; + if ("__proto__" === c10 || "constructor" === c10 || "prototype" === c10) + return e20; + if (o10 != a10) { + var u10 = s10[c10]; + void 0 === (l10 = r10 ? r10(u10, c10, s10) : void 0) && (l10 = Iu(u10) ? u10 : hd(t10[o10 + 1]) ? [] : {}); + } + Jd(s10, c10, l10), s10 = s10[c10]; + } + return e20; + } + function Kx(e20, t10, n10) { + for (var r10 = -1, o10 = t10.length, i10 = {}; ++r10 < o10; ) { + var a10 = t10[r10], s10 = fv(e20, a10); + n10(s10, a10) && Jx(i10, cv(a10, e20), s10); + } + return i10; + } + function Gx(e20, t10) { + if (null == e20) + return {}; + var n10 = Su(pm(e20), function(e21) { + return [e21]; + }); + return t10 = ky(t10), Kx(e20, n10, function(e21, n11) { + return t10(e21, n11[0]); + }); + } + function Qx(e20, t10) { + return Gx(e20, Rx(ky(t10))); + } + function Yx(e20) { + return Nv(2, e20); + } + function Xx(e20, t10) { + if (e20 !== t10) { + var n10 = void 0 !== e20, r10 = null === e20, o10 = e20 == e20, i10 = wu(e20), a10 = void 0 !== t10, s10 = null === t10, c10 = t10 == t10, l10 = wu(t10); + if (!s10 && !l10 && !i10 && e20 > t10 || i10 && a10 && c10 && !s10 && !l10 || r10 && a10 && c10 || !n10 && c10 || !o10) + return 1; + if (!r10 && !i10 && !l10 && e20 < t10 || l10 && n10 && o10 && !r10 && !i10 || s10 && n10 && o10 || !a10 && o10 || !c10) + return -1; + } + return 0; + } + function Zx(e20, t10, n10) { + t10 = t10.length ? Su(t10, function(e21) { + return Cu(e21) ? function(t11) { + return fv(t11, 1 === e21.length ? e21[0] : e21); + } : e21; + }) : [Ku]; + var r10 = -1; + t10 = Su(t10, gh(ky)); + var o10 = lk(e20, function(e21, n11, o11) { + var i10 = Su(t10, function(t11) { + return t11(e21); + }); + return { criteria: i10, index: ++r10, value: e21 }; + }); + return function(e21, t11) { + var n11 = e21.length; + for (e21.sort(t11); n11--; ) + e21[n11] = e21[n11].value; + return e21; + }(o10, function(e21, t11) { + return function(e23, t12, n11) { + for (var r11 = -1, o11 = e23.criteria, i10 = t12.criteria, a10 = o11.length, s10 = n11.length; ++r11 < a10; ) { + var c10 = Xx(o11[r11], i10[r11]); + if (c10) + return r11 >= s10 ? c10 : c10 * ("desc" == n11[r11] ? -1 : 1); + } + return e23.index - t12.index; + }(e21, t11, n10); + }); + } + function ej(e20, t10, n10, r10) { + return null == e20 ? [] : (Cu(t10) || (t10 = null == t10 ? [] : [t10]), Cu(n10 = r10 ? void 0 : n10) || (n10 = null == n10 ? [] : [n10]), Zx(e20, t10, n10)); + } + function tj(e20) { + return bv(function(t10) { + return t10 = Su(t10, gh(ky)), Yd(function(n10) { + var r10 = this; + return e20(t10, function(e21) { + return wf(e21, r10, n10); + }); + }); + }); + } + var nj = tj(Su); + var rj = Yd; + var oj = Math.min; + var ij = rj(function(e20, t10) { + var n10 = (t10 = 1 == t10.length && Cu(t10[0]) ? Su(t10[0], gh(ky)) : Su(gv(t10, 1), gh(ky))).length; + return Yd(function(r10) { + for (var o10 = -1, i10 = oj(r10.length, n10); ++o10 < i10; ) + r10[o10] = t10[o10].call(this, r10[o10]); + return wf(e20, this, r10); + }); + }); + var aj = ij; + var sj = tj(Vb); + var cj = tj(Og); + var lj = 9007199254740991; + var uj = Math.floor; + function fj(e20, t10) { + var n10 = ""; + if (!e20 || t10 < 1 || t10 > lj) + return n10; + do { + t10 % 2 && (n10 += e20), (t10 = uj(t10 / 2)) && (e20 += e20); + } while (t10); + return n10; + } + var dj = yy("length"); + var hj = "\\ud800-\\udfff"; + var vj = "[" + hj + "]"; + var pj = "[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]"; + var mj = "\\ud83c[\\udffb-\\udfff]"; + var gj = "[^" + hj + "]"; + var yj = "(?:\\ud83c[\\udde6-\\uddff]){2}"; + var bj = "[\\ud800-\\udbff][\\udc00-\\udfff]"; + var kj = "(?:" + pj + "|" + mj + ")?"; + var wj = "[\\ufe0e\\ufe0f]?"; + var xj = wj + kj + ("(?:\\u200d(?:" + [gj, yj, bj].join("|") + ")" + wj + kj + ")*"); + var jj = "(?:" + [gj + pj + "?", pj, yj, bj, vj].join("|") + ")"; + var Sj = RegExp(mj + "(?=" + mj + ")|" + jj + xj, "g"); + function Cj(e20) { + return Wv(e20) ? function(e21) { + for (var t10 = Sj.lastIndex = 0; Sj.test(e21); ) + ++t10; + return t10; + }(e20) : dj(e20); + } + var $j = Math.ceil; + function _j(e20, t10) { + var n10 = (t10 = void 0 === t10 ? " " : Mu(t10)).length; + if (n10 < 2) + return n10 ? fj(t10, e20) : t10; + var r10 = fj(t10, $j(e20 / Cj(t10))); + return Wv(t10) ? Vv(op(r10), 0, e20).join("") : r10.slice(0, e20); + } + var Oj = Math.ceil; + var Mj = Math.floor; + function Ej(e20, t10, n10) { + e20 = sv(e20); + var r10 = (t10 = Uu(t10)) ? Cj(e20) : 0; + if (!t10 || r10 >= t10) + return e20; + var o10 = (t10 - r10) / 2; + return _j(Mj(o10), n10) + e20 + _j(Oj(o10), n10); + } + function Aj(e20, t10, n10) { + e20 = sv(e20); + var r10 = (t10 = Uu(t10)) ? Cj(e20) : 0; + return t10 && r10 < t10 ? e20 + _j(t10 - r10, n10) : e20; + } + function Pj(e20, t10, n10) { + e20 = sv(e20); + var r10 = (t10 = Uu(t10)) ? Cj(e20) : 0; + return t10 && r10 < t10 ? _j(t10 - r10, n10) + e20 : e20; + } + var Tj = /^\s+/; + var Rj = cu.parseInt; + function Nj(e20, t10, n10) { + return n10 || null == t10 ? t10 = 0 : t10 && (t10 = +t10), Rj(sv(e20).replace(Tj, ""), t10 || 0); + } + var Ij = Yd(function(e20, t10) { + return Ld(e20, 32, void 0, t10, md(t10, ud(Ij))); + }); + Ij.placeholder = {}; + var Dj = Ij; + var qj = Yd(function(e20, t10) { + return Ld(e20, 64, void 0, t10, md(t10, ud(qj))); + }); + qj.placeholder = {}; + var zj = qj; + var Bj = Py(function(e20, t10, n10) { + e20[n10 ? 0 : 1].push(t10); + }, function() { + return [[], []]; + }); + var Lj = Bj; + var Fj = bv(function(e20, t10) { + return null == e20 ? {} : function(e21, t11) { + return Kx(e21, t11, function(t12, n10) { + return vy(e21, n10); + }); + }(e20, t10); + }); + var Vj = Fj; + function Hj(e20) { + for (var t10, n10 = this; n10 instanceof $f; ) { + var r10 = If(n10); + r10.__index__ = 0, r10.__values__ = void 0, t10 ? o10.__wrapped__ = r10 : t10 = r10; + var o10 = r10; + n10 = n10.__wrapped__; + } + return o10.__wrapped__ = e20, t10; + } + function Wj(e20) { + return function(t10) { + return null == e20 ? void 0 : fv(e20, t10); + }; + } + function Uj(e20, t10, n10, r10) { + for (var o10 = n10 - 1, i10 = e20.length; ++o10 < i10; ) + if (r10(e20[o10], t10)) + return o10; + return -1; + } + var Jj = Array.prototype.splice; + function Kj(e20, t10, n10, r10) { + var o10 = r10 ? Uj : Zf, i10 = -1, a10 = t10.length, s10 = e20; + for (e20 === t10 && (t10 = Nf(t10)), n10 && (s10 = Su(e20, gh(n10))); ++i10 < a10; ) + for (var c10 = 0, l10 = t10[i10], u10 = n10 ? n10(l10) : l10; (c10 = o10(s10, u10, c10, r10)) > -1; ) + s10 !== e20 && Jj.call(s10, c10, 1), Jj.call(e20, c10, 1); + return e20; + } + function Gj(e20, t10) { + return e20 && e20.length && t10 && t10.length ? Kj(e20, t10) : e20; + } + var Qj = Yd(Gj); + function Yj(e20, t10, n10) { + return e20 && e20.length && t10 && t10.length ? Kj(e20, t10, ky(n10)) : e20; + } + function Xj(e20, t10, n10) { + return e20 && e20.length && t10 && t10.length ? Kj(e20, t10, void 0, n10) : e20; + } + var Zj = Array.prototype.splice; + function eS(e20, t10) { + for (var n10 = e20 ? t10.length : 0, r10 = n10 - 1; n10--; ) { + var o10 = t10[n10]; + if (n10 == r10 || o10 !== i10) { + var i10 = o10; + hd(o10) ? Zj.call(e20, o10, 1) : Vx(e20, o10); + } + } + return e20; + } + var tS = bv(function(e20, t10) { + var n10 = null == e20 ? 0 : e20.length, r10 = hv(e20, t10); + return eS(e20, Su(t10, function(e21) { + return hd(e21, n10) ? +e21 : e21; + }).sort(Xx)), r10; + }); + var nS = tS; + var rS = Math.floor; + var oS = Math.random; + function iS(e20, t10) { + return e20 + rS(oS() * (t10 - e20 + 1)); + } + var aS = parseFloat; + var sS = Math.min; + var cS = Math.random; + function lS(e20, t10, n10) { + if (n10 && "boolean" != typeof n10 && th(e20, t10, n10) && (t10 = n10 = void 0), void 0 === n10 && ("boolean" == typeof t10 ? (n10 = t10, t10 = void 0) : "boolean" == typeof e20 && (n10 = e20, e20 = void 0)), void 0 === e20 && void 0 === t10 ? (e20 = 0, t10 = 1) : (e20 = Wu(e20), void 0 === t10 ? (t10 = e20, e20 = 0) : t10 = Wu(t10)), e20 > t10) { + var r10 = e20; + e20 = t10, t10 = r10; + } + if (n10 || e20 % 1 || t10 % 1) { + var o10 = cS(); + return sS(e20 + o10 * (t10 - e20 + aS("1e-" + ((o10 + "").length - 1))), t10); + } + return iS(e20, t10); + } + var uS = Math.ceil; + var fS = Math.max; + function dS(e20) { + return function(t10, n10, r10) { + return r10 && "number" != typeof r10 && th(t10, n10, r10) && (n10 = r10 = void 0), t10 = Wu(t10), void 0 === n10 ? (n10 = t10, t10 = 0) : n10 = Wu(n10), function(e21, t11, n11, r11) { + for (var o10 = -1, i10 = fS(uS((t11 - e21) / (n11 || 1)), 0), a10 = Array(i10); i10--; ) + a10[r11 ? i10 : ++o10] = e21, e21 += n11; + return a10; + }(t10, n10, r10 = void 0 === r10 ? t10 < n10 ? 1 : -1 : Wu(r10), e20); + }; + } + var hS = dS(); + var vS = dS(true); + var pS = bv(function(e20, t10) { + return Ld(e20, 256, void 0, void 0, void 0, t10); + }); + var mS = pS; + function gS(e20, t10, n10, r10, o10) { + return o10(e20, function(e21, o11, i10) { + n10 = r10 ? (r10 = false, e21) : t10(n10, e21, o11, i10); + }), n10; + } + function yS(e20, t10, n10) { + var r10 = Cu(e20) ? cp : gS, o10 = arguments.length < 3; + return r10(e20, ky(t10), n10, o10, Ey); + } + function bS(e20, t10, n10, r10) { + var o10 = null == e20 ? 0 : e20.length; + for (r10 && o10 && (n10 = e20[--o10]); o10--; ) + n10 = t10(n10, e20[o10], o10, e20); + return n10; + } + function kS(e20, t10, n10) { + var r10 = Cu(e20) ? bS : gS, o10 = arguments.length < 3; + return r10(e20, ky(t10), n10, o10, Eb); + } + function wS(e20, t10) { + return (Cu(e20) ? sm : Gb)(e20, Rx(ky(t10))); + } + function xS(e20, t10) { + var n10 = []; + if (!e20 || !e20.length) + return n10; + var r10 = -1, o10 = [], i10 = e20.length; + for (t10 = ky(t10); ++r10 < i10; ) { + var a10 = e20[r10]; + t10(a10, r10, e20) && (n10.push(a10), o10.push(r10)); + } + return eS(e20, o10), n10; + } + function jS(e20, t10, n10) { + return t10 = (n10 ? th(e20, t10, n10) : void 0 === t10) ? 1 : Uu(t10), fj(sv(e20), t10); + } + function SS() { + var e20 = arguments, t10 = sv(e20[0]); + return e20.length < 3 ? t10 : t10.replace(e20[1], e20[2]); + } + function CS(e20, t10) { + if ("function" != typeof e20) + throw new TypeError("Expected a function"); + return Yd(e20, t10 = void 0 === t10 ? t10 : Uu(t10)); + } + function $S(e20, t10, n10) { + var r10 = -1, o10 = (t10 = cv(t10, e20)).length; + for (o10 || (o10 = 1, e20 = void 0); ++r10 < o10; ) { + var i10 = null == e20 ? void 0 : e20[uv(t10[r10])]; + void 0 === i10 && (r10 = o10, i10 = n10), e20 = Zu(i10) ? i10.call(e20) : i10; + } + return e20; + } + var _S = Array.prototype.reverse; + function OS(e20) { + return null == e20 ? e20 : _S.call(e20); + } + var MS = Up("round"); + function ES(e20) { + var t10 = e20.length; + return t10 ? e20[iS(0, t10 - 1)] : void 0; + } + function AS(e20) { + return ES(Wk(e20)); + } + function PS(e20) { + return (Cu(e20) ? ES : AS)(e20); + } + function TS(e20, t10) { + var n10 = -1, r10 = e20.length, o10 = r10 - 1; + for (t10 = void 0 === t10 ? r10 : t10; ++n10 < t10; ) { + var i10 = iS(n10, o10), a10 = e20[i10]; + e20[i10] = e20[n10], e20[n10] = a10; + } + return e20.length = t10, e20; + } + function RS(e20, t10) { + return TS(Nf(e20), Xp(t10, 0, e20.length)); + } + function NS(e20, t10) { + var n10 = Wk(e20); + return TS(n10, Xp(t10, 0, n10.length)); + } + function IS(e20, t10, n10) { + return t10 = (n10 ? th(e20, t10, n10) : void 0 === t10) ? 1 : Uu(t10), (Cu(e20) ? RS : NS)(e20, t10); + } + function DS(e20, t10, n10) { + return null == e20 ? e20 : Jx(e20, t10, n10); + } + function qS(e20, t10, n10, r10) { + return r10 = "function" == typeof r10 ? r10 : void 0, null == e20 ? e20 : Jx(e20, t10, n10, r10); + } + function zS(e20) { + return TS(Nf(e20)); + } + function BS(e20) { + return TS(Wk(e20)); + } + function LS(e20) { + return (Cu(e20) ? zS : BS)(e20); + } + function FS(e20) { + if (null == e20) + return 0; + if (eh(e20)) + return Vk(e20) ? Cj(e20) : e20.length; + var t10 = Em(e20); + return "[object Map]" == t10 || "[object Set]" == t10 ? e20.size : Mh(e20).length; + } + function VS(e20, t10, n10) { + var r10 = null == e20 ? 0 : e20.length; + return r10 ? (n10 && "number" != typeof n10 && th(e20, t10, n10) ? (t10 = 0, n10 = r10) : (t10 = null == t10 ? 0 : Uu(t10), n10 = void 0 === n10 ? r10 : Uu(n10)), Fv(e20, t10, n10)) : []; + } + var HS = Bp(function(e20, t10, n10) { + return e20 + (n10 ? "_" : "") + t10.toLowerCase(); + }); + var WS = HS; + function US(e20, t10) { + var n10; + return Ey(e20, function(e21, r10, o10) { + return !(n10 = t10(e21, r10, o10)); + }), !!n10; + } + function JS(e20, t10, n10) { + var r10 = Cu(e20) ? Og : US; + return n10 && th(e20, t10, n10) && (t10 = void 0), r10(e20, ky(t10)); + } + var KS = Yd(function(e20, t10) { + if (null == e20) + return []; + var n10 = t10.length; + return n10 > 1 && th(e20, t10[0], t10[1]) ? t10 = [] : n10 > 2 && th(t10[0], t10[1], t10[2]) && (t10 = [t10[0]]), Zx(e20, gv(t10, 1), []); + }); + var GS = KS; + var QS = 4294967294; + var YS = Math.floor; + var XS = Math.min; + function ZS(e20, t10, n10, r10) { + var o10 = 0, i10 = null == e20 ? 0 : e20.length; + if (0 === i10) + return 0; + for (var a10 = (t10 = n10(t10)) != t10, s10 = null === t10, c10 = wu(t10), l10 = void 0 === t10; o10 < i10; ) { + var u10 = YS((o10 + i10) / 2), f10 = n10(e20[u10]), d10 = void 0 !== f10, h10 = null === f10, v10 = f10 == f10, p10 = wu(f10); + if (a10) + var m10 = r10 || v10; + else + m10 = l10 ? v10 && (r10 || d10) : s10 ? v10 && d10 && (r10 || !h10) : c10 ? v10 && d10 && !h10 && (r10 || !p10) : !h10 && !p10 && (r10 ? f10 <= t10 : f10 < t10); + m10 ? o10 = u10 + 1 : i10 = u10; + } + return XS(i10, QS); + } + var eC = 2147483647; + function tC(e20, t10, n10) { + var r10 = 0, o10 = null == e20 ? r10 : e20.length; + if ("number" == typeof t10 && t10 == t10 && o10 <= eC) { + for (; r10 < o10; ) { + var i10 = r10 + o10 >>> 1, a10 = e20[i10]; + null !== a10 && !wu(a10) && (n10 ? a10 <= t10 : a10 < t10) ? r10 = i10 + 1 : o10 = i10; + } + return o10; + } + return ZS(e20, t10, Ku, n10); + } + function nC(e20, t10) { + return tC(e20, t10); + } + function rC(e20, t10, n10) { + return ZS(e20, t10, ky(n10)); + } + function oC(e20, t10) { + var n10 = null == e20 ? 0 : e20.length; + if (n10) { + var r10 = tC(e20, t10); + if (r10 < n10 && Wd(e20[r10], t10)) + return r10; + } + return -1; + } + function iC(e20, t10) { + return tC(e20, t10, true); + } + function aC(e20, t10, n10) { + return ZS(e20, t10, ky(n10), true); + } + function sC(e20, t10) { + if (null == e20 ? 0 : e20.length) { + var n10 = tC(e20, t10, true) - 1; + if (Wd(e20[n10], t10)) + return n10; + } + return -1; + } + function cC(e20, t10) { + for (var n10 = -1, r10 = e20.length, o10 = 0, i10 = []; ++n10 < r10; ) { + var a10 = e20[n10], s10 = t10 ? t10(a10) : a10; + if (!n10 || !Wd(s10, c10)) { + var c10 = s10; + i10[o10++] = 0 === a10 ? 0 : a10; + } + } + return i10; + } + function lC(e20) { + return e20 && e20.length ? cC(e20) : []; + } + function uC(e20, t10) { + return e20 && e20.length ? cC(e20, ky(t10)) : []; + } + function fC(e20, t10, n10) { + return n10 && "number" != typeof n10 && th(e20, t10, n10) && (t10 = n10 = void 0), (n10 = void 0 === n10 ? 4294967295 : n10 >>> 0) ? (e20 = sv(e20)) && ("string" == typeof t10 || null != t10 && !Vw(t10)) && !(t10 = Mu(t10)) && Wv(e20) ? Vv(op(e20), 0, n10) : e20.split(t10, n10) : []; + } + var dC = Math.max; + function hC(e20, t10) { + if ("function" != typeof e20) + throw new TypeError("Expected a function"); + return t10 = null == t10 ? 0 : dC(Uu(t10), 0), Yd(function(n10) { + var r10 = n10[t10], o10 = Vv(n10, 0, t10); + return r10 && vv(o10, r10), wf(e20, this, o10); + }); + } + var vC = Bp(function(e20, t10, n10) { + return e20 + (n10 ? " " : "") + ap(t10); + }); + var pC = vC; + function mC(e20, t10, n10) { + return e20 = sv(e20), n10 = null == n10 ? 0 : Xp(Uu(n10), 0, e20.length), t10 = Mu(t10), e20.slice(n10, n10 + t10.length) == t10; + } + function gC() { + return {}; + } + function yC() { + return ""; + } + function bC() { + return true; + } + var kC = Eu(function(e20, t10) { + return e20 - t10; + }, 0); + function wC(e20) { + return e20 && e20.length ? yx(e20, Ku) : 0; + } + function xC(e20, t10) { + return e20 && e20.length ? yx(e20, ky(t10)) : 0; + } + function jC(e20) { + var t10 = null == e20 ? 0 : e20.length; + return t10 ? Fv(e20, 1, t10) : []; + } + function SC(e20, t10, n10) { + return e20 && e20.length ? Fv(e20, 0, (t10 = n10 || void 0 === t10 ? 1 : Uu(t10)) < 0 ? 0 : t10) : []; + } + function CC(e20, t10, n10) { + var r10 = null == e20 ? 0 : e20.length; + return r10 ? Fv(e20, (t10 = r10 - (t10 = n10 || void 0 === t10 ? 1 : Uu(t10))) < 0 ? 0 : t10, r10) : []; + } + function $C(e20, t10) { + return e20 && e20.length ? xb(e20, ky(t10), false, true) : []; + } + function _C(e20, t10) { + return e20 && e20.length ? xb(e20, ky(t10)) : []; + } + function OC(e20, t10) { + return t10(e20), e20; + } + var MC = Object.prototype; + var EC = MC.hasOwnProperty; + function AC(e20, t10, n10, r10) { + return void 0 === e20 || Wd(e20, MC[n10]) && !EC.call(r10, n10) ? t10 : e20; + } + var PC = { "\\": "\\", "'": "'", "\n": "n", "\r": "r", "\u2028": "u2028", "\u2029": "u2029" }; + function TC(e20) { + return "\\" + PC[e20]; + } + var RC = /<%=([\s\S]+?)%>/g; + var NC = { escape: /<%-([\s\S]+?)%>/g, evaluate: /<%([\s\S]+?)%>/g, interpolate: RC, variable: "", imports: { _: { escape: zb } } }; + var IC = /\b__p \+= '';/g; + var DC = /\b(__p \+=) '' \+/g; + var qC = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + var zC = /[()=,{}\[\]\/\s]/; + var BC = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + var LC = /($^)/; + var FC = /['\n\r\u2028\u2029\\]/g; + var VC = Object.prototype.hasOwnProperty; + function HC(e20, t10, n10) { + var r10 = NC.imports._.templateSettings || NC; + n10 && th(e20, t10, n10) && (t10 = void 0), e20 = sv(e20), t10 = Bh({}, t10, r10, AC); + var o10, i10, a10 = Bh({}, t10.imports, r10.imports, AC), s10 = Eh(a10), c10 = Hk(a10, s10), l10 = 0, u10 = t10.interpolate || LC, f10 = "__p += '", d10 = RegExp((t10.escape || LC).source + "|" + u10.source + "|" + (u10 === RC ? BC : LC).source + "|" + (t10.evaluate || LC).source + "|$", "g"), h10 = VC.call(t10, "sourceURL") ? "//# sourceURL=" + (t10.sourceURL + "").replace(/\s/g, " ") + "\n" : ""; + e20.replace(d10, function(t11, n11, r11, a11, s11, c11) { + return r11 || (r11 = a11), f10 += e20.slice(l10, c11).replace(FC, TC), n11 && (o10 = true, f10 += "' +\n__e(" + n11 + ") +\n'"), s11 && (i10 = true, f10 += "';\n" + s11 + ";\n__p += '"), r11 && (f10 += "' +\n((__t = (" + r11 + ")) == null ? '' : __t) +\n'"), l10 = c11 + t11.length, t11; + }), f10 += "';\n"; + var v10 = VC.call(t10, "variable") && t10.variable; + if (v10) { + if (zC.test(v10)) + throw new Error("Invalid `variable` option passed into `_.template`"); + } else + f10 = "with (obj) {\n" + f10 + "\n}\n"; + f10 = (i10 ? f10.replace(IC, "") : f10).replace(DC, "$1").replace(qC, "$1;"), f10 = "function(" + (v10 || "obj") + ") {\n" + (v10 ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (o10 ? ", __e = _.escape" : "") + (i10 ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + f10 + "return __p\n}"; + var p10 = Tv(function() { + return Function(s10, h10 + "return " + f10).apply(void 0, c10); + }); + if (p10.source = f10, Av(p10)) + throw p10; + return p10; + } + var WC = "Expected a function"; + function UC(e20, t10, n10) { + var r10 = true, o10 = true; + if ("function" != typeof e20) + throw new TypeError(WC); + return Iu(n10) && (r10 = "leading" in n10 ? !!n10.leading : r10, o10 = "trailing" in n10 ? !!n10.trailing : o10), Vy(e20, t10, { leading: r10, maxWait: t10, trailing: o10 }); + } + function JC(e20, t10) { + return t10(e20); + } + var KC = 9007199254740991; + var GC = 4294967295; + var QC = Math.min; + function YC(e20, t10) { + if ((e20 = Uu(e20)) < 1 || e20 > KC) + return []; + var n10 = GC, r10 = QC(e20, GC); + t10 = Cb(t10), e20 -= GC; + for (var o10 = ih(r10, t10); ++n10 < e20; ) + t10(n10); + return o10; + } + function XC() { + return this; + } + function ZC(e20, t10) { + var n10 = e20; + return n10 instanceof Of && (n10 = n10.value()), cp(t10, function(e21, t11) { + return t11.func.apply(t11.thisArg, vv([e21], t11.args)); + }, n10); + } + function e$() { + return ZC(this.__wrapped__, this.__actions__); + } + function t$(e20) { + return sv(e20).toLowerCase(); + } + function n$(e20) { + return Cu(e20) ? Su(e20, uv) : wu(e20) ? [e20] : Nf(av(sv(e20))); + } + var r$ = 9007199254740991; + function o$(e20) { + return e20 ? Xp(Uu(e20), -9007199254740991, r$) : 0 === e20 ? e20 : 0; + } + function i$(e20) { + return sv(e20).toUpperCase(); + } + function a$(e20, t10, n10) { + var r10 = Cu(e20), o10 = r10 || ph(e20) || jh(e20); + if (t10 = ky(t10), null == n10) { + var i10 = e20 && e20.constructor; + n10 = o10 ? r10 ? new i10() : [] : Iu(e20) && Zu(i10) ? yf(wv(e20)) : {}; + } + return (o10 ? Qf : Oy)(e20, function(e21, r11, o11) { + return t10(n10, e21, r11, o11); + }), n10; + } + function s$(e20, t10) { + for (var n10 = e20.length; n10-- && Zf(t10, e20[n10], 0) > -1; ) + ; + return n10; + } + function c$(e20, t10) { + for (var n10 = -1, r10 = e20.length; ++n10 < r10 && Zf(t10, e20[n10], 0) > -1; ) + ; + return n10; + } + function l$(e20, t10, n10) { + if ((e20 = sv(e20)) && (n10 || void 0 === t10)) + return Nu(e20); + if (!e20 || !(t10 = Mu(t10))) + return e20; + var r10 = op(e20), o10 = op(t10); + return Vv(r10, c$(r10, o10), s$(r10, o10) + 1).join(""); + } + function u$(e20, t10, n10) { + if ((e20 = sv(e20)) && (n10 || void 0 === t10)) + return e20.slice(0, Tu(e20) + 1); + if (!e20 || !(t10 = Mu(t10))) + return e20; + var r10 = op(e20); + return Vv(r10, 0, s$(r10, op(t10)) + 1).join(""); + } + var f$ = /^\s+/; + function d$(e20, t10, n10) { + if ((e20 = sv(e20)) && (n10 || void 0 === t10)) + return e20.replace(f$, ""); + if (!e20 || !(t10 = Mu(t10))) + return e20; + var r10 = op(e20); + return Vv(r10, c$(r10, op(t10))).join(""); + } + var h$ = /\w*$/; + function v$(e20, t10) { + var n10 = 30, r10 = "..."; + if (Iu(t10)) { + var o10 = "separator" in t10 ? t10.separator : o10; + n10 = "length" in t10 ? Uu(t10.length) : n10, r10 = "omission" in t10 ? Mu(t10.omission) : r10; + } + var i10 = (e20 = sv(e20)).length; + if (Wv(e20)) { + var a10 = op(e20); + i10 = a10.length; + } + if (n10 >= i10) + return e20; + var s10 = n10 - Cj(r10); + if (s10 < 1) + return r10; + var c10 = a10 ? Vv(a10, 0, s10).join("") : e20.slice(0, s10); + if (void 0 === o10) + return c10 + r10; + if (a10 && (s10 += c10.length - s10), Vw(o10)) { + if (e20.slice(s10).search(o10)) { + var l10, u10 = c10; + for (o10.global || (o10 = RegExp(o10.source, sv(h$.exec(o10)) + "g")), o10.lastIndex = 0; l10 = o10.exec(u10); ) + var f10 = l10.index; + c10 = c10.slice(0, void 0 === f10 ? s10 : f10); + } + } else if (e20.indexOf(Mu(o10), s10) != s10) { + var d10 = c10.lastIndexOf(o10); + d10 > -1 && (c10 = c10.slice(0, d10)); + } + return c10 + r10; + } + function p$(e20) { + return Vd(e20, 1); + } + var m$ = lp({ "&": "&", "<": "<", ">": ">", """: '"', "'": "'" }); + var g$ = /&(?:amp|lt|gt|quot|#39);/g; + var y$ = RegExp(g$.source); + function b$(e20) { + return (e20 = sv(e20)) && y$.test(e20) ? e20.replace(g$, m$) : e20; + } + var k$ = ym && 1 / Rg(new ym([, -0]))[1] == 1 / 0 ? function(e20) { + return new ym(e20); + } : Mf; + var w$ = 200; + function x$(e20, t10, n10) { + var r10 = -1, o10 = ed, i10 = e20.length, a10 = true, s10 = [], c10 = s10; + if (n10) + a10 = false, o10 = lb; + else if (i10 >= w$) { + var l10 = t10 ? null : k$(e20); + if (l10) + return Rg(l10); + a10 = false, o10 = Mg, c10 = new _g(); + } else + c10 = t10 ? [] : s10; + e: + for (; ++r10 < i10; ) { + var u10 = e20[r10], f10 = t10 ? t10(u10) : u10; + if (u10 = n10 || 0 !== u10 ? u10 : 0, a10 && f10 == f10) { + for (var d10 = c10.length; d10--; ) + if (c10[d10] === f10) + continue e; + t10 && c10.push(f10), s10.push(u10); + } else + o10(c10, f10, n10) || (c10 !== s10 && c10.push(f10), s10.push(u10)); + } + return s10; + } + var j$ = Yd(function(e20) { + return x$(gv(e20, 1, Qy, true)); + }); + var S$ = Yd(function(e20) { + var t10 = vb(e20); + return Qy(t10) && (t10 = void 0), x$(gv(e20, 1, Qy, true), ky(t10)); + }); + var C$ = S$; + var $$ = Yd(function(e20) { + var t10 = vb(e20); + return t10 = "function" == typeof t10 ? t10 : void 0, x$(gv(e20, 1, Qy, true), void 0, t10); + }); + function _$(e20) { + return e20 && e20.length ? x$(e20) : []; + } + function O$(e20, t10) { + return e20 && e20.length ? x$(e20, ky(t10)) : []; + } + function M$(e20, t10) { + return t10 = "function" == typeof t10 ? t10 : void 0, e20 && e20.length ? x$(e20, void 0, t10) : []; + } + var E$ = 0; + function A$(e20) { + var t10 = ++E$; + return sv(e20) + t10; + } + function P$(e20, t10) { + return null == e20 || Vx(e20, t10); + } + var T$ = Math.max; + function R$(e20) { + if (!e20 || !e20.length) + return []; + var t10 = 0; + return e20 = sm(e20, function(e21) { + if (Qy(e21)) + return t10 = T$(e21.length, t10), true; + }), ih(t10, function(t11) { + return Su(e20, yy(t11)); + }); + } + function N$(e20, t10) { + if (!e20 || !e20.length) + return []; + var n10 = R$(e20); + return null == t10 ? n10 : Su(n10, function(e21) { + return wf(t10, void 0, e21); + }); + } + function I$(e20, t10, n10, r10) { + return Jx(e20, t10, n10(fv(e20, t10)), r10); + } + function D$(e20, t10, n10) { + return null == e20 ? e20 : I$(e20, t10, Cb(n10)); + } + function q$(e20, t10, n10, r10) { + return r10 = "function" == typeof r10 ? r10 : void 0, null == e20 ? e20 : I$(e20, t10, Cb(n10), r10); + } + var z$ = Bp(function(e20, t10, n10) { + return e20 + (n10 ? " " : "") + t10.toUpperCase(); + }); + var B$ = z$; + function L$(e20) { + return null == e20 ? [] : Hk(e20, Ih(e20)); + } + var F$ = Yd(function(e20, t10) { + return Qy(e20) ? fb(e20, t10) : []; + }); + var V$ = F$; + function H$(e20, t10) { + return Dj(Cb(t10), e20); + } + var W$ = bv(function(e20) { + var t10 = e20.length, n10 = t10 ? e20[0] : 0, r10 = this.__wrapped__, o10 = function(t11) { + return hv(t11, e20); + }; + return !(t10 > 1 || this.__actions__.length) && r10 instanceof Of && hd(n10) ? ((r10 = r10.slice(n10, +n10 + (t10 ? 1 : 0))).__actions__.push({ func: JC, args: [o10], thisArg: void 0 }), new Rf(r10, this.__chain__).thru(function(e21) { + return t10 && !e21.length && e21.push(void 0), e21; + })) : this.thru(o10); + }); + var U$ = W$; + function J$() { + return Kp(this); + } + function K$() { + var e20 = this.__wrapped__; + if (e20 instanceof Of) { + var t10 = e20; + return this.__actions__.length && (t10 = new Of(this)), (t10 = t10.reverse()).__actions__.push({ func: JC, args: [OS], thisArg: void 0 }), new Rf(t10, this.__chain__); + } + return this.thru(OS); + } + function G$(e20, t10, n10) { + var r10 = e20.length; + if (r10 < 2) + return r10 ? x$(e20[0]) : []; + for (var o10 = -1, i10 = Array(r10); ++o10 < r10; ) + for (var a10 = e20[o10], s10 = -1; ++s10 < r10; ) + s10 != o10 && (i10[o10] = fb(i10[o10] || a10, e20[s10], t10, n10)); + return x$(gv(i10, 1), t10, n10); + } + var Q$ = Yd(function(e20) { + return G$(sm(e20, Qy)); + }); + var Y$ = Yd(function(e20) { + var t10 = vb(e20); + return Qy(t10) && (t10 = void 0), G$(sm(e20, Qy), ky(t10)); + }); + var X$ = Y$; + var Z$ = Yd(function(e20) { + var t10 = vb(e20); + return t10 = "function" == typeof t10 ? t10 : void 0, G$(sm(e20, Qy), void 0, t10); + }); + var e_ = Yd(R$); + function t_(e20, t10, n10) { + for (var r10 = -1, o10 = e20.length, i10 = t10.length, a10 = {}; ++r10 < o10; ) { + var s10 = r10 < i10 ? t10[r10] : void 0; + n10(a10, e20[r10], s10); + } + return a10; + } + function n_(e20, t10) { + return t_(e20 || [], t10 || [], Jd); + } + function r_(e20, t10) { + return t_(e20 || [], t10 || [], Jx); + } + var o_ = Yd(function(e20) { + var t10 = e20.length, n10 = t10 > 1 ? e20[t10 - 1] : void 0; + return n10 = "function" == typeof n10 ? (e20.pop(), n10) : void 0, N$(e20, n10); + }); + var i_ = o_; + var a_ = { chunk: Yp, compact: Cg, concat: $g, difference: hb, differenceBy: mb, differenceWith: yb, drop: kb, dropRight: wb, dropRightWhile: jb, dropWhile: Sb, fill: Kb, findIndex: Zb, findLastIndex: ik, first: ck, flatten: yv, flattenDeep: vk, flattenDepth: pk, fromPairs: Ck, head: ck, indexOf: Gk, initial: Qk, intersection: ew, intersectionBy: nw, intersectionWith: rw, join: Yw, last: vb, lastIndexOf: ox, nth: Lx, pull: Qj, pullAll: Gj, pullAllBy: Yj, pullAllWith: Xj, pullAt: nS, remove: xS, reverse: OS, slice: VS, sortedIndex: nC, sortedIndexBy: rC, sortedIndexOf: oC, sortedLastIndex: iC, sortedLastIndexBy: aC, sortedLastIndexOf: sC, sortedUniq: lC, sortedUniqBy: uC, tail: jC, take: SC, takeRight: CC, takeRightWhile: $C, takeWhile: _C, union: j$, unionBy: C$, unionWith: $$, uniq: _$, uniqBy: O$, uniqWith: M$, unzip: R$, unzipWith: N$, without: V$, xor: Q$, xorBy: X$, xorWith: Z$, zip: e_, zipObject: n_, zipObjectDeep: r_, zipWith: i_ }; + var s_ = { countBy: Ny, each: $b, eachRight: Ab, every: Wb, filter: Qb, find: ek, findLast: ak, flatMap: fk, flatMapDeep: dk, flatMapDepth: hk, forEach: $b, forEachRight: Ab, groupBy: Ak, includes: Jk, invokeMap: gw, keyBy: tx, map: uk, orderBy: ej, partition: Lj, reduce: yS, reduceRight: kS, reject: wS, sample: PS, sampleSize: IS, shuffle: LS, size: FS, some: JS, sortBy: GS }; + var c_ = { now: zy }; + var l_ = { after: Ju, ary: Vd, before: Nv, bind: Dv, bindKey: Lv, curry: Dy, curryRight: qy, debounce: Vy, defer: ab, delay: cb, flip: mk, memoize: rv, negate: Rx, once: Yx, overArgs: aj, partial: Dj, partialRight: zj, rearg: mS, rest: CS, spread: hC, throttle: UC, unary: p$, wrap: H$ }; + var u_ = { castArray: Vp, clone: yg, cloneDeep: bg, cloneDeepWith: xg, cloneWith: jg, conformsTo: Sy, eq: Wd, gt: Rk, gte: Nk, isArguments: uh, isArray: Cu, isArrayBuffer: bw, isArrayLike: eh, isArrayLikeObject: Qy, isBoolean: kw, isBuffer: ph, isDate: xw, isElement: jw, isEmpty: _w, isEqual: Ow, isEqualWith: Mw, isError: Av, isFinite: Aw, isFunction: Zu, isInteger: Pw, isLength: Zd, isMap: ag, isMatch: Tw, isMatchWith: Rw, isNaN: Dw, isNative: zw, isNil: Bw, isNull: Lw, isNumber: Iw, isObject: Iu, isObjectLike: bu, isPlainObject: Ov, isRegExp: Vw, isSafeInteger: Ww, isSet: cg, isString: Vk, isSymbol: wu, isTypedArray: jh, isUndefined: Uw, isWeakMap: Jw, isWeakSet: Kw, lt: lx, lte: ux, toArray: qx, toFinite: Wu, toInteger: Uu, toLength: Jb, toNumber: Fu, toPlainObject: Xy, toSafeInteger: o$, toString: sv }; + var f_ = { add: Au, ceil: Jp, divide: bb, floor: gk, max: mx, maxBy: gx, mean: wx, meanBy: xx, min: Mx, minBy: Ex, multiply: Px, round: MS, subtract: kC, sum: wC, sumBy: xC }; + var d_ = Zp; + var h_ = Lk; + var v_ = lS; + var p_ = { assign: Th, assignIn: qh, assignInWith: Bh, assignWith: Fh, at: kv, create: Iy, defaults: Ky, defaultsDeep: rb, entries: Rb, entriesIn: Nb, extend: qh, extendWith: Bh, findKey: nk, findLastKey: sk, forIn: wk, forInRight: xk, forOwn: jk, forOwnRight: Sk, functions: _k, functionsIn: Ok, get: dv, has: qk, hasIn: vy, invert: sw, invertBy: dw, invoke: pw, keys: Eh, keysIn: Ih, mapKeys: fx, mapValues: dx, merge: Sx, mergeWith: nb, omit: Ux, omitBy: Qx, pick: Vj, pickBy: Gx, result: $S, set: DS, setWith: qS, toPairs: Rb, toPairsIn: Nb, transform: a$, unset: P$, update: D$, updateWith: q$, values: Wk, valuesIn: L$ }; + var m_ = { at: U$, chain: Kp, commit: Sg, lodash: qf, next: zx, plant: Hj, reverse: K$, tap: OC, thru: JC, toIterator: XC, toJSON: e$, value: e$, valueOf: e$, wrapperChain: J$ }; + var g_ = { camelCase: Fp, capitalize: sp, deburr: hp, endsWith: Pb, escape: zb, escapeRegExp: Fb, kebabCase: Zw, lowerCase: ax, lowerFirst: sx, pad: Ej, padEnd: Aj, padStart: Pj, parseInt: Nj, repeat: jS, replace: SS, snakeCase: WS, split: fC, startCase: pC, startsWith: mC, template: HC, templateSettings: NC, toLower: t$, toUpper: i$, trim: l$, trimEnd: u$, trimStart: d$, truncate: v$, unescape: b$, upperCase: B$, upperFirst: ap, words: qp }; + var y_ = { attempt: Tv, bindAll: zv, cond: wy, conforms: jy, constant: Uf, defaultTo: Hy, flow: bk, flowRight: kk, identity: Ku, iteratee: Gw, matches: hx, matchesProperty: vx, method: $x, methodOf: Ox, mixin: Ax, noop: Mf, nthArg: Fx, over: nj, overEvery: sj, overSome: cj, property: by, propertyOf: Wj, range: hS, rangeRight: vS, stubArray: cm, stubFalse: fh, stubObject: gC, stubString: yC, stubTrue: bC, times: YC, toPath: n$, uniqueId: A$ }; + var b_ = Math.max; + var k_ = Math.min; + var w_ = Math.min; + var x_; + var j_ = 4294967295; + var S_ = Array.prototype; + var C_ = Object.prototype.hasOwnProperty; + var $_ = lu ? lu.iterator : void 0; + var __ = Math.max; + var O_ = Math.min; + var M_ = /* @__PURE__ */ function(e20) { + return function(t10, n10, r10) { + if (null == r10) { + var o10 = Iu(n10), i10 = o10 && Eh(n10), a10 = i10 && i10.length && $k(n10, i10); + (a10 ? a10.length : o10) || (r10 = n10, n10 = t10, t10 = this); + } + return e20(t10, n10, r10); + }; + }(Ax); + qf.after = l_.after, qf.ary = l_.ary, qf.assign = p_.assign, qf.assignIn = p_.assignIn, qf.assignInWith = p_.assignInWith, qf.assignWith = p_.assignWith, qf.at = p_.at, qf.before = l_.before, qf.bind = l_.bind, qf.bindAll = y_.bindAll, qf.bindKey = l_.bindKey, qf.castArray = u_.castArray, qf.chain = m_.chain, qf.chunk = a_.chunk, qf.compact = a_.compact, qf.concat = a_.concat, qf.cond = y_.cond, qf.conforms = y_.conforms, qf.constant = y_.constant, qf.countBy = s_.countBy, qf.create = p_.create, qf.curry = l_.curry, qf.curryRight = l_.curryRight, qf.debounce = l_.debounce, qf.defaults = p_.defaults, qf.defaultsDeep = p_.defaultsDeep, qf.defer = l_.defer, qf.delay = l_.delay, qf.difference = a_.difference, qf.differenceBy = a_.differenceBy, qf.differenceWith = a_.differenceWith, qf.drop = a_.drop, qf.dropRight = a_.dropRight, qf.dropRightWhile = a_.dropRightWhile, qf.dropWhile = a_.dropWhile, qf.fill = a_.fill, qf.filter = s_.filter, qf.flatMap = s_.flatMap, qf.flatMapDeep = s_.flatMapDeep, qf.flatMapDepth = s_.flatMapDepth, qf.flatten = a_.flatten, qf.flattenDeep = a_.flattenDeep, qf.flattenDepth = a_.flattenDepth, qf.flip = l_.flip, qf.flow = y_.flow, qf.flowRight = y_.flowRight, qf.fromPairs = a_.fromPairs, qf.functions = p_.functions, qf.functionsIn = p_.functionsIn, qf.groupBy = s_.groupBy, qf.initial = a_.initial, qf.intersection = a_.intersection, qf.intersectionBy = a_.intersectionBy, qf.intersectionWith = a_.intersectionWith, qf.invert = p_.invert, qf.invertBy = p_.invertBy, qf.invokeMap = s_.invokeMap, qf.iteratee = y_.iteratee, qf.keyBy = s_.keyBy, qf.keys = Eh, qf.keysIn = p_.keysIn, qf.map = s_.map, qf.mapKeys = p_.mapKeys, qf.mapValues = p_.mapValues, qf.matches = y_.matches, qf.matchesProperty = y_.matchesProperty, qf.memoize = l_.memoize, qf.merge = p_.merge, qf.mergeWith = p_.mergeWith, qf.method = y_.method, qf.methodOf = y_.methodOf, qf.mixin = M_, qf.negate = Rx, qf.nthArg = y_.nthArg, qf.omit = p_.omit, qf.omitBy = p_.omitBy, qf.once = l_.once, qf.orderBy = s_.orderBy, qf.over = y_.over, qf.overArgs = l_.overArgs, qf.overEvery = y_.overEvery, qf.overSome = y_.overSome, qf.partial = l_.partial, qf.partialRight = l_.partialRight, qf.partition = s_.partition, qf.pick = p_.pick, qf.pickBy = p_.pickBy, qf.property = y_.property, qf.propertyOf = y_.propertyOf, qf.pull = a_.pull, qf.pullAll = a_.pullAll, qf.pullAllBy = a_.pullAllBy, qf.pullAllWith = a_.pullAllWith, qf.pullAt = a_.pullAt, qf.range = y_.range, qf.rangeRight = y_.rangeRight, qf.rearg = l_.rearg, qf.reject = s_.reject, qf.remove = a_.remove, qf.rest = l_.rest, qf.reverse = a_.reverse, qf.sampleSize = s_.sampleSize, qf.set = p_.set, qf.setWith = p_.setWith, qf.shuffle = s_.shuffle, qf.slice = a_.slice, qf.sortBy = s_.sortBy, qf.sortedUniq = a_.sortedUniq, qf.sortedUniqBy = a_.sortedUniqBy, qf.split = g_.split, qf.spread = l_.spread, qf.tail = a_.tail, qf.take = a_.take, qf.takeRight = a_.takeRight, qf.takeRightWhile = a_.takeRightWhile, qf.takeWhile = a_.takeWhile, qf.tap = m_.tap, qf.throttle = l_.throttle, qf.thru = JC, qf.toArray = u_.toArray, qf.toPairs = p_.toPairs, qf.toPairsIn = p_.toPairsIn, qf.toPath = y_.toPath, qf.toPlainObject = u_.toPlainObject, qf.transform = p_.transform, qf.unary = l_.unary, qf.union = a_.union, qf.unionBy = a_.unionBy, qf.unionWith = a_.unionWith, qf.uniq = a_.uniq, qf.uniqBy = a_.uniqBy, qf.uniqWith = a_.uniqWith, qf.unset = p_.unset, qf.unzip = a_.unzip, qf.unzipWith = a_.unzipWith, qf.update = p_.update, qf.updateWith = p_.updateWith, qf.values = p_.values, qf.valuesIn = p_.valuesIn, qf.without = a_.without, qf.words = g_.words, qf.wrap = l_.wrap, qf.xor = a_.xor, qf.xorBy = a_.xorBy, qf.xorWith = a_.xorWith, qf.zip = a_.zip, qf.zipObject = a_.zipObject, qf.zipObjectDeep = a_.zipObjectDeep, qf.zipWith = a_.zipWith, qf.entries = p_.toPairs, qf.entriesIn = p_.toPairsIn, qf.extend = p_.assignIn, qf.extendWith = p_.assignInWith, M_(qf, qf), qf.add = f_.add, qf.attempt = y_.attempt, qf.camelCase = g_.camelCase, qf.capitalize = g_.capitalize, qf.ceil = f_.ceil, qf.clamp = d_, qf.clone = u_.clone, qf.cloneDeep = u_.cloneDeep, qf.cloneDeepWith = u_.cloneDeepWith, qf.cloneWith = u_.cloneWith, qf.conformsTo = u_.conformsTo, qf.deburr = g_.deburr, qf.defaultTo = y_.defaultTo, qf.divide = f_.divide, qf.endsWith = g_.endsWith, qf.eq = u_.eq, qf.escape = g_.escape, qf.escapeRegExp = g_.escapeRegExp, qf.every = s_.every, qf.find = s_.find, qf.findIndex = a_.findIndex, qf.findKey = p_.findKey, qf.findLast = s_.findLast, qf.findLastIndex = a_.findLastIndex, qf.findLastKey = p_.findLastKey, qf.floor = f_.floor, qf.forEach = s_.forEach, qf.forEachRight = s_.forEachRight, qf.forIn = p_.forIn, qf.forInRight = p_.forInRight, qf.forOwn = p_.forOwn, qf.forOwnRight = p_.forOwnRight, qf.get = p_.get, qf.gt = u_.gt, qf.gte = u_.gte, qf.has = p_.has, qf.hasIn = p_.hasIn, qf.head = a_.head, qf.identity = Ku, qf.includes = s_.includes, qf.indexOf = a_.indexOf, qf.inRange = h_, qf.invoke = p_.invoke, qf.isArguments = u_.isArguments, qf.isArray = Cu, qf.isArrayBuffer = u_.isArrayBuffer, qf.isArrayLike = u_.isArrayLike, qf.isArrayLikeObject = u_.isArrayLikeObject, qf.isBoolean = u_.isBoolean, qf.isBuffer = u_.isBuffer, qf.isDate = u_.isDate, qf.isElement = u_.isElement, qf.isEmpty = u_.isEmpty, qf.isEqual = u_.isEqual, qf.isEqualWith = u_.isEqualWith, qf.isError = u_.isError, qf.isFinite = u_.isFinite, qf.isFunction = u_.isFunction, qf.isInteger = u_.isInteger, qf.isLength = u_.isLength, qf.isMap = u_.isMap, qf.isMatch = u_.isMatch, qf.isMatchWith = u_.isMatchWith, qf.isNaN = u_.isNaN, qf.isNative = u_.isNative, qf.isNil = u_.isNil, qf.isNull = u_.isNull, qf.isNumber = u_.isNumber, qf.isObject = Iu, qf.isObjectLike = u_.isObjectLike, qf.isPlainObject = u_.isPlainObject, qf.isRegExp = u_.isRegExp, qf.isSafeInteger = u_.isSafeInteger, qf.isSet = u_.isSet, qf.isString = u_.isString, qf.isSymbol = u_.isSymbol, qf.isTypedArray = u_.isTypedArray, qf.isUndefined = u_.isUndefined, qf.isWeakMap = u_.isWeakMap, qf.isWeakSet = u_.isWeakSet, qf.join = a_.join, qf.kebabCase = g_.kebabCase, qf.last = vb, qf.lastIndexOf = a_.lastIndexOf, qf.lowerCase = g_.lowerCase, qf.lowerFirst = g_.lowerFirst, qf.lt = u_.lt, qf.lte = u_.lte, qf.max = f_.max, qf.maxBy = f_.maxBy, qf.mean = f_.mean, qf.meanBy = f_.meanBy, qf.min = f_.min, qf.minBy = f_.minBy, qf.stubArray = y_.stubArray, qf.stubFalse = y_.stubFalse, qf.stubObject = y_.stubObject, qf.stubString = y_.stubString, qf.stubTrue = y_.stubTrue, qf.multiply = f_.multiply, qf.nth = a_.nth, qf.noop = y_.noop, qf.now = c_.now, qf.pad = g_.pad, qf.padEnd = g_.padEnd, qf.padStart = g_.padStart, qf.parseInt = g_.parseInt, qf.random = v_, qf.reduce = s_.reduce, qf.reduceRight = s_.reduceRight, qf.repeat = g_.repeat, qf.replace = g_.replace, qf.result = p_.result, qf.round = f_.round, qf.sample = s_.sample, qf.size = s_.size, qf.snakeCase = g_.snakeCase, qf.some = s_.some, qf.sortedIndex = a_.sortedIndex, qf.sortedIndexBy = a_.sortedIndexBy, qf.sortedIndexOf = a_.sortedIndexOf, qf.sortedLastIndex = a_.sortedLastIndex, qf.sortedLastIndexBy = a_.sortedLastIndexBy, qf.sortedLastIndexOf = a_.sortedLastIndexOf, qf.startCase = g_.startCase, qf.startsWith = g_.startsWith, qf.subtract = f_.subtract, qf.sum = f_.sum, qf.sumBy = f_.sumBy, qf.template = g_.template, qf.times = y_.times, qf.toFinite = u_.toFinite, qf.toInteger = Uu, qf.toLength = u_.toLength, qf.toLower = g_.toLower, qf.toNumber = u_.toNumber, qf.toSafeInteger = u_.toSafeInteger, qf.toString = u_.toString, qf.toUpper = g_.toUpper, qf.trim = g_.trim, qf.trimEnd = g_.trimEnd, qf.trimStart = g_.trimStart, qf.truncate = g_.truncate, qf.unescape = g_.unescape, qf.uniqueId = y_.uniqueId, qf.upperCase = g_.upperCase, qf.upperFirst = g_.upperFirst, qf.each = s_.forEach, qf.eachRight = s_.forEachRight, qf.first = a_.head, M_(qf, (x_ = {}, Oy(qf, function(e20, t10) { + C_.call(qf.prototype, t10) || (x_[t10] = e20); + }), x_), { chain: false }), qf.VERSION = "4.17.21", (qf.templateSettings = g_.templateSettings).imports._ = qf, Qf(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(e20) { + qf[e20].placeholder = qf; + }), Qf(["drop", "take"], function(e20, t10) { + Of.prototype[e20] = function(n10) { + n10 = void 0 === n10 ? 1 : __(Uu(n10), 0); + var r10 = this.__filtered__ && !t10 ? new Of(this) : this.clone(); + return r10.__filtered__ ? r10.__takeCount__ = O_(n10, r10.__takeCount__) : r10.__views__.push({ size: O_(n10, j_), type: e20 + (r10.__dir__ < 0 ? "Right" : "") }), r10; + }, Of.prototype[e20 + "Right"] = function(t11) { + return this.reverse()[e20](t11).reverse(); + }; + }), Qf(["filter", "map", "takeWhile"], function(e20, t10) { + var n10 = t10 + 1, r10 = 1 == n10 || 3 == n10; + Of.prototype[e20] = function(e21) { + var t11 = this.clone(); + return t11.__iteratees__.push({ iteratee: ky(e21), type: n10 }), t11.__filtered__ = t11.__filtered__ || r10, t11; + }; + }), Qf(["head", "last"], function(e20, t10) { + var n10 = "take" + (t10 ? "Right" : ""); + Of.prototype[e20] = function() { + return this[n10](1).value()[0]; + }; + }), Qf(["initial", "tail"], function(e20, t10) { + var n10 = "drop" + (t10 ? "" : "Right"); + Of.prototype[e20] = function() { + return this.__filtered__ ? new Of(this) : this[n10](1); + }; + }), Of.prototype.compact = function() { + return this.filter(Ku); + }, Of.prototype.find = function(e20) { + return this.filter(e20).head(); + }, Of.prototype.findLast = function(e20) { + return this.reverse().find(e20); + }, Of.prototype.invokeMap = Yd(function(e20, t10) { + return "function" == typeof e20 ? new Of(this) : this.map(function(n10) { + return vw(n10, e20, t10); + }); + }), Of.prototype.reject = function(e20) { + return this.filter(Rx(ky(e20))); + }, Of.prototype.slice = function(e20, t10) { + e20 = Uu(e20); + var n10 = this; + return n10.__filtered__ && (e20 > 0 || t10 < 0) ? new Of(n10) : (e20 < 0 ? n10 = n10.takeRight(-e20) : e20 && (n10 = n10.drop(e20)), void 0 !== t10 && (n10 = (t10 = Uu(t10)) < 0 ? n10.dropRight(-t10) : n10.take(t10 - e20)), n10); + }, Of.prototype.takeRightWhile = function(e20) { + return this.reverse().takeWhile(e20).reverse(); + }, Of.prototype.toArray = function() { + return this.take(j_); + }, Oy(Of.prototype, function(e20, t10) { + var n10 = /^(?:filter|find|map|reject)|While$/.test(t10), r10 = /^(?:head|last)$/.test(t10), o10 = qf[r10 ? "take" + ("last" == t10 ? "Right" : "") : t10], i10 = r10 || /^find/.test(t10); + o10 && (qf.prototype[t10] = function() { + var t11 = this.__wrapped__, a10 = r10 ? [1] : arguments, s10 = t11 instanceof Of, c10 = a10[0], l10 = s10 || Cu(t11), u10 = function(e21) { + var t12 = o10.apply(qf, vv([e21], a10)); + return r10 && f10 ? t12[0] : t12; + }; + l10 && n10 && "function" == typeof c10 && 1 != c10.length && (s10 = l10 = false); + var f10 = this.__chain__, d10 = !!this.__actions__.length, h10 = i10 && !f10, v10 = s10 && !d10; + if (!i10 && l10) { + t11 = v10 ? t11 : new Of(this); + var p10 = e20.apply(t11, a10); + return p10.__actions__.push({ func: JC, args: [u10], thisArg: void 0 }), new Rf(p10, f10); + } + return h10 && v10 ? e20.apply(this, a10) : (p10 = this.thru(u10), h10 ? r10 ? p10.value()[0] : p10.value() : p10); + }); + }), Qf(["pop", "push", "shift", "sort", "splice", "unshift"], function(e20) { + var t10 = S_[e20], n10 = /^(?:push|sort|unshift)$/.test(e20) ? "tap" : "thru", r10 = /^(?:pop|shift)$/.test(e20); + qf.prototype[e20] = function() { + var e21 = arguments; + if (r10 && !this.__chain__) { + var o10 = this.value(); + return t10.apply(Cu(o10) ? o10 : [], e21); + } + return this[n10](function(n11) { + return t10.apply(Cu(n11) ? n11 : [], e21); + }); + }; + }), Oy(Of.prototype, function(e20, t10) { + var n10 = qf[t10]; + if (n10) { + var r10 = n10.name + ""; + C_.call(Af, r10) || (Af[r10] = []), Af[r10].push({ name: t10, func: n10 }); + } + }), Af[jd(void 0, 2).name] = [{ name: "wrapper", func: void 0 }], Of.prototype.clone = function() { + var e20 = new Of(this.__wrapped__); + return e20.__actions__ = Nf(this.__actions__), e20.__dir__ = this.__dir__, e20.__filtered__ = this.__filtered__, e20.__iteratees__ = Nf(this.__iteratees__), e20.__takeCount__ = this.__takeCount__, e20.__views__ = Nf(this.__views__), e20; + }, Of.prototype.reverse = function() { + if (this.__filtered__) { + var e20 = new Of(this); + e20.__dir__ = -1, e20.__filtered__ = true; + } else + (e20 = this.clone()).__dir__ *= -1; + return e20; + }, Of.prototype.value = function() { + var e20 = this.__wrapped__.value(), t10 = this.__dir__, n10 = Cu(e20), r10 = t10 < 0, o10 = n10 ? e20.length : 0, i10 = function(e21, t11, n11) { + for (var r11 = -1, o11 = n11.length; ++r11 < o11; ) { + var i11 = n11[r11], a11 = i11.size; + switch (i11.type) { + case "drop": + e21 += a11; + break; + case "dropRight": + t11 -= a11; + break; + case "take": + t11 = k_(t11, e21 + a11); + break; + case "takeRight": + e21 = b_(e21, t11 - a11); + } + } + return { start: e21, end: t11 }; + }(0, o10, this.__views__), a10 = i10.start, s10 = i10.end, c10 = s10 - a10, l10 = r10 ? s10 : a10 - 1, u10 = this.__iteratees__, f10 = u10.length, d10 = 0, h10 = w_(c10, this.__takeCount__); + if (!n10 || !r10 && o10 == c10 && h10 == c10) + return ZC(e20, this.__actions__); + var v10 = []; + e: + for (; c10-- && d10 < h10; ) { + for (var p10 = -1, m10 = e20[l10 += t10]; ++p10 < f10; ) { + var g10 = u10[p10], y10 = g10.iteratee, b10 = g10.type, k10 = y10(m10); + if (2 == b10) + m10 = k10; + else if (!k10) { + if (1 == b10) + continue e; + break e; + } + } + v10[d10++] = m10; + } + return v10; + }, qf.prototype.at = m_.at, qf.prototype.chain = m_.wrapperChain, qf.prototype.commit = m_.commit, qf.prototype.next = m_.next, qf.prototype.plant = m_.plant, qf.prototype.reverse = m_.reverse, qf.prototype.toJSON = qf.prototype.valueOf = qf.prototype.value = m_.value, qf.prototype.first = qf.prototype.head, $_ && (qf.prototype[$_] = m_.toIterator); + var E_ = Object.freeze({ __proto__: null, add: Au, after: Ju, ary: Vd, assign: Th, assignIn: qh, assignInWith: Bh, assignWith: Fh, at: kv, attempt: Tv, before: Nv, bind: Dv, bindAll: zv, bindKey: Lv, camelCase: Fp, capitalize: sp, castArray: Vp, ceil: Jp, chain: Kp, chunk: Yp, clamp: Zp, clone: yg, cloneDeep: bg, cloneDeepWith: xg, cloneWith: jg, commit: Sg, compact: Cg, concat: $g, cond: wy, conforms: jy, conformsTo: Sy, constant: Uf, countBy: Ny, create: Iy, curry: Dy, curryRight: qy, debounce: Vy, deburr: hp, default: qf, defaultTo: Hy, defaults: Ky, defaultsDeep: rb, defer: ab, delay: cb, difference: hb, differenceBy: mb, differenceWith: yb, divide: bb, drop: kb, dropRight: wb, dropRightWhile: jb, dropWhile: Sb, each: $b, eachRight: Ab, endsWith: Pb, entries: Rb, entriesIn: Nb, eq: Wd, escape: zb, escapeRegExp: Fb, every: Wb, extend: qh, extendWith: Bh, fill: Kb, filter: Qb, find: ek, findIndex: Zb, findKey: nk, findLast: ak, findLastIndex: ik, findLastKey: sk, first: ck, flatMap: fk, flatMapDeep: dk, flatMapDepth: hk, flatten: yv, flattenDeep: vk, flattenDepth: pk, flip: mk, floor: gk, flow: bk, flowRight: kk, forEach: $b, forEachRight: Ab, forIn: wk, forInRight: xk, forOwn: jk, forOwnRight: Sk, fromPairs: Ck, functions: _k, functionsIn: Ok, get: dv, groupBy: Ak, gt: Rk, gte: Nk, has: qk, hasIn: vy, head: ck, identity: Ku, inRange: Lk, includes: Jk, indexOf: Gk, initial: Qk, intersection: ew, intersectionBy: nw, intersectionWith: rw, invert: sw, invertBy: dw, invoke: pw, invokeMap: gw, isArguments: uh, isArray: Cu, isArrayBuffer: bw, isArrayLike: eh, isArrayLikeObject: Qy, isBoolean: kw, isBuffer: ph, isDate: xw, isElement: jw, isEmpty: _w, isEqual: Ow, isEqualWith: Mw, isError: Av, isFinite: Aw, isFunction: Zu, isInteger: Pw, isLength: Zd, isMap: ag, isMatch: Tw, isMatchWith: Rw, isNaN: Dw, isNative: zw, isNil: Bw, isNull: Lw, isNumber: Iw, isObject: Iu, isObjectLike: bu, isPlainObject: Ov, isRegExp: Vw, isSafeInteger: Ww, isSet: cg, isString: Vk, isSymbol: wu, isTypedArray: jh, isUndefined: Uw, isWeakMap: Jw, isWeakSet: Kw, iteratee: Gw, join: Yw, kebabCase: Zw, keyBy: tx, keys: Eh, keysIn: Ih, last: vb, lastIndexOf: ox, lodash: qf, lowerCase: ax, lowerFirst: sx, lt: lx, lte: ux, map: uk, mapKeys: fx, mapValues: dx, matches: hx, matchesProperty: vx, max: mx, maxBy: gx, mean: wx, meanBy: xx, memoize: rv, merge: Sx, mergeWith: nb, method: $x, methodOf: Ox, min: Mx, minBy: Ex, mixin: Ax, multiply: Px, negate: Rx, next: zx, noop: Mf, now: zy, nth: Lx, nthArg: Fx, omit: Ux, omitBy: Qx, once: Yx, orderBy: ej, over: nj, overArgs: aj, overEvery: sj, overSome: cj, pad: Ej, padEnd: Aj, padStart: Pj, parseInt: Nj, partial: Dj, partialRight: zj, partition: Lj, pick: Vj, pickBy: Gx, plant: Hj, property: by, propertyOf: Wj, pull: Qj, pullAll: Gj, pullAllBy: Yj, pullAllWith: Xj, pullAt: nS, random: lS, range: hS, rangeRight: vS, rearg: mS, reduce: yS, reduceRight: kS, reject: wS, remove: xS, repeat: jS, replace: SS, rest: CS, result: $S, reverse: OS, round: MS, sample: PS, sampleSize: IS, set: DS, setWith: qS, shuffle: LS, size: FS, slice: VS, snakeCase: WS, some: JS, sortBy: GS, sortedIndex: nC, sortedIndexBy: rC, sortedIndexOf: oC, sortedLastIndex: iC, sortedLastIndexBy: aC, sortedLastIndexOf: sC, sortedUniq: lC, sortedUniqBy: uC, split: fC, spread: hC, startCase: pC, startsWith: mC, stubArray: cm, stubFalse: fh, stubObject: gC, stubString: yC, stubTrue: bC, subtract: kC, sum: wC, sumBy: xC, tail: jC, take: SC, takeRight: CC, takeRightWhile: $C, takeWhile: _C, tap: OC, template: HC, templateSettings: NC, throttle: UC, thru: JC, times: YC, toArray: qx, toFinite: Wu, toInteger: Uu, toIterator: XC, toJSON: e$, toLength: Jb, toLower: t$, toNumber: Fu, toPairs: Rb, toPairsIn: Nb, toPath: n$, toPlainObject: Xy, toSafeInteger: o$, toString: sv, toUpper: i$, transform: a$, trim: l$, trimEnd: u$, trimStart: d$, truncate: v$, unary: p$, unescape: b$, union: j$, unionBy: C$, unionWith: $$, uniq: _$, uniqBy: O$, uniqWith: M$, uniqueId: A$, unset: P$, unzip: R$, unzipWith: N$, update: D$, updateWith: q$, upperCase: B$, upperFirst: ap, value: e$, valueOf: e$, values: Wk, valuesIn: L$, without: V$, words: qp, wrap: H$, wrapperAt: U$, wrapperChain: J$, wrapperCommit: Sg, wrapperLodash: qf, wrapperNext: zx, wrapperPlant: Hj, wrapperReverse: K$, wrapperToIterator: XC, wrapperValue: e$, xor: Q$, xorBy: X$, xorWith: Z$, zip: e_, zipObject: n_, zipObjectDeep: r_, zipWith: i_ }); + var A_ = 1e4; + var P_ = []; + function T_(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], n10 = {}; + if (!Array.isArray(e20)) + throw new TypeError("Array expected"); + function r10(e21, o11) { + (!Array.isArray(e21) && !Gl(e21) || t10 && o11.length > 0) && (n10[Zs(o11)] = true), Gl(e21) && Object.keys(e21).forEach(function(t11) { + r10(e21[t11], o11.concat(t11)); + }); + } + for (var o10 = Math.min(e20.length, A_), i10 = 0; i10 < o10; i10++) { + r10(e20[i10], P_); + } + return Object.keys(n10).sort().map(Xs); + } + function R_(e20, t10, n10) { + if (!(t10 <= e20)) + for (var r10 = e20; r10 < t10; r10++) + n10(r10); + } + function N_(e20, t10) { + return e20.length > t10 ? e20.slice(0, t10) : e20; + } + function I_(e20) { + return Ro({}, e20); + } + function D_(e20) { + return Object.values(e20); + } + function q_(e20, t10, n10, r10) { + var o10 = e20.slice(0), i10 = o10.splice(t10, n10); + return o10.splice.apply(o10, [t10 + r10, 0].concat(Bo(i10))), o10; + } + function z_(e20, t10) { + try { + return t10.parse(e20); + } catch (n10) { + return t10.parse(Hl(e20)); + } + } + function B_(e20, t10) { + try { + return z_(e20, t10); + } catch (e21) { + return; + } + } + function L_(e20, t10) { + e20 = e20.replace(V_, ""); + try { + return t10(e20); + } catch (e21) { + } + try { + return t10("[" + e20 + "]"); + } catch (e21) { + } + try { + return t10("{" + e20 + "}"); + } catch (e21) { + } + throw new Error("Failed to parse partial JSON"); + } + function F_(e20) { + e20 = e20.replace(V_, ""); + try { + return Hl(e20); + } catch (e21) { + } + try { + var t10 = Hl("[" + e20 + "]"); + return t10.substring(1, t10.length - 1); + } catch (e21) { + } + try { + var n10 = Hl("{" + e20 + "}"); + return n10.substring(1, n10.length - 1); + } catch (e21) { + } + throw new Error("Failed to repair partial JSON"); + } + var V_ = /,\s*$/; + function H_(e20, t10) { + var n10 = eO.exec(t10); + if (n10) { + var r10 = Ul(n10[2]), o10 = function(e21, t11) { + for (var n11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, r11 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : e21.length, o11 = 0, i11 = n11; i11 < r11; i11++) + e21.charAt(i11) === t11 && o11++; + return o11; + }(e20, "\n", 0, r10), i10 = r10 - e20.lastIndexOf("\n", r10) - 1; + return { position: r10, line: o10, column: i10, message: t10.replace(eO, function() { + return "line ".concat(o10 + 1, " column ").concat(i10 + 1); + }) }; + } + var a10 = tO.exec(t10), s10 = a10 ? Ul(a10[1]) : null, c10 = null !== s10 ? s10 - 1 : null, l10 = nO.exec(t10), u10 = l10 ? Ul(l10[1]) : null, f10 = null !== u10 ? u10 - 1 : null, d10 = null !== c10 && null !== f10 ? function(e21, t11, n11) { + var r11 = e21.indexOf("\n"), o11 = 1; + for (; o11 < t11 && -1 !== r11; ) + r11 = e21.indexOf("\n", r11 + 1), o11++; + return -1 !== r11 ? r11 + n11 + 1 : null; + }(e20, c10, f10) : null; + return { position: d10, line: c10, column: f10, message: t10.replace(/^JSON.parse: /, "").replace(/ of the JSON data$/, "") }; + } + function W_(e20) { + return Gl(e20) ? void 0 !== e20.json ? void 0 !== e20.text ? 'Content must contain either a property "json" or a property "text" but not both' : null : void 0 === e20.text ? 'Content must contain either a property "json" or a property "text"' : "string" != typeof e20.text ? 'Content "text" property must be a string containing a JSON document. Did you mean to use the "json" property instead?' : null : "Content must be an object"; + } + function J_(e20) { + return Gl(e20) && "string" == typeof e20.text; + } + function K_(e20) { + return Gl(e20) && void 0 !== e20.json; + } + function G_(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0, n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : JSON; + return J_(e20) ? e20 : { text: n10.stringify(e20.json, null, t10) }; + } + function Q_(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : JSON; + return K_(e20) ? e20 : { json: t10.parse(e20.text) }; + } + function Y_(e20, t10, n10) { + return G_(e20, t10, n10).text; + } + function X_(e20, t10) { + return Z_(e20, t10) > t10; + } + function Z_(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1 / 0; + if (J_(e20)) + return e20.text.length; + var n10 = e20.json, r10 = 0; + return function e21(n11) { + if (Array.isArray(n11)) { + if ((r10 += n11.length - 1 + 2) > t10) + return r10; + for (var o10 = 0; o10 < n11.length; o10++) { + if (e21(n11[o10]), r10 > t10) + return r10; + } + } else if (Gl(n11)) { + var i10 = Object.keys(n11); + r10 += 2 + i10.length + (i10.length - 1); + for (var a10 = 0; a10 < i10.length; a10++) { + var s10 = i10[a10], c10 = n11[s10]; + r10 += s10.length + 2, e21(c10); + } + } else + r10 += "string" == typeof n11 ? n11.length + 2 : String(n11).length; + }(n10), r10; + } + var eO = /(position|char) (\d+)/; + var tO = /line (\d+)/; + var nO = /column (\d+)/; + function rO(e20, t10) { + return e20.parse === t10.parse && e20.stringify === t10.stringify; + } + function oO(e20) { + return iO.test(e20) && e20.length > 2; + } + var iO = /^[[{]\S/; + function aO(e20) { + var t10 = e20.escapeControlCharacters, n10 = e20.escapeUnicodeCharacters; + return t10 ? n10 ? sO : cO : n10 ? lO : uO; + } + var sO = { escapeValue: function(e20) { + return fO(pO(String(e20))); + }, unescapeValue: function(e20) { + return mO(dO(e20)); + } }; + var cO = { escapeValue: function(e20) { + return pO(String(e20)); + }, unescapeValue: function(e20) { + return mO(e20); + } }; + var lO = { escapeValue: function(e20) { + return fO(String(e20)); + }, unescapeValue: function(e20) { + return dO(e20); + } }; + var uO = { escapeValue: function(e20) { + return String(e20); + }, unescapeValue: function(e20) { + return e20; + } }; + function fO(e20) { + return e20.replace(/[^\x20-\x7F]/g, function(e21) { + var t10; + return "\b" === e21 || "\f" === e21 || "\n" === e21 || "\r" === e21 || " " === e21 ? e21 : "\\u" + ("000" + (null === (t10 = e21.codePointAt(0)) || void 0 === t10 ? void 0 : t10.toString(16))).slice(-4); + }); + } + function dO(e20) { + return e20.replace(/\\u[a-fA-F0-9]{4}/g, function(e21) { + try { + var t10 = JSON.parse('"' + e21 + '"'); + return hO[t10] || t10; + } catch (t11) { + return e21; + } + }); + } + var hO = { '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t" }; + var vO = { '\\"': '"', "\\\\": "\\", "\\/": "/", "\\b": "\b", "\\f": "\f", "\\n": "\n", "\\r": "\r", "\\t": " " }; + function pO(e20) { + return e20.replace(/["\b\f\n\r\t\\]/g, function(e21) { + return hO[e21] || e21; + }); + } + function mO(e20) { + return e20.replace(/\\["bfnrt\\]/g, function(e21) { + return vO[e21] || e21; + }); + } + function gO(e20) { + return "string" != typeof e20 ? String(e20) : e20.endsWith("\n") ? e20 + "\n" : e20; + } + function yO(e20, t10) { + return kO(e20, function(e21) { + return e21.nodeName.toUpperCase() === t10.toUpperCase(); + }); + } + function bO(e20, t10, n10) { + return kO(e20, function(e21) { + return function(e23, t11, n11) { + return "function" == typeof e23.getAttribute && e23.getAttribute(t11) === n11; + }(e21, t10, n10); + }); + } + function kO(e20, t10) { + return !!wO(e20, t10); + } + function wO(e20, t10) { + for (var n10 = e20; n10 && !t10(n10); ) + n10 = n10.parentNode; + return n10 || void 0; + } + function xO(e20) { + if (null != e20.firstChild) { + var t10 = document.createRange(), n10 = window.getSelection(); + t10.setStart(e20, 1), t10.collapse(true), null == n10 || n10.removeAllRanges(), null == n10 || n10.addRange(t10); + } else + e20.focus(); + } + function jO(e20, t10, n10, r10) { + var o10 = SO(e20); + if (o10) { + var i10 = o10.document.activeElement ? o10.document.activeElement : null; + i10 && i10.isContentEditable && (i10.textContent = n10 ? t10 : i10.textContent + t10, xO(i10), r10 && r10(i10)); + } + } + function SO(e20) { + return e20 && e20.ownerDocument ? e20.ownerDocument.defaultView : null; + } + function CO(e20) { + var t10 = SO(e20), n10 = null == t10 ? void 0 : t10.document.activeElement; + return !!n10 && kO(n10, function(t11) { + return t11 === e20; + }); + } + function $O(e20, t10) { + return wO(e20, function(e21) { + return e21.nodeName === t10; + }); + } + function _O(e20) { + return bO(e20, "data-type", "selectable-key") ? Ya.key : bO(e20, "data-type", "selectable-value") ? Ya.value : bO(e20, "data-type", "insert-selection-area-inside") ? Ya.inside : bO(e20, "data-type", "insert-selection-area-after") ? Ya.after : Ya.multi; + } + function OO(e20) { + return encodeURIComponent(Zs(e20)); + } + function MO(e20) { + var t10 = wO(e20, function(e21) { + return !(null == e21 || !e21.hasAttribute) && e21.hasAttribute("data-path"); + }), n10 = null == t10 ? void 0 : t10.getAttribute("data-path"); + return n10 ? Xs(decodeURIComponent(n10)) : null; + } + function EO(e20) { + var t10 = e20.allElements, n10 = e20.currentElement, r10 = e20.direction, o10 = e20.hasPrio, i10 = void 0 === o10 ? function() { + return true; + } : o10, a10 = e20.margin, s10 = void 0 === a10 ? 10 : a10, c10 = uk(t10.filter(function(e21) { + var t11 = e21.getBoundingClientRect(); + return t11.width > 0 && t11.height > 0; + }), u10), l10 = u10(n10); + function u10(e21) { + var t11 = e21.getBoundingClientRect(); + return { x: t11.left + t11.width / 2, y: t11.top + t11.height / 2, rect: t11, element: e21 }; + } + function f10(e21, t11) { + var n11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, r11 = e21.x - t11.x, o11 = (e21.y - t11.y) * n11; + return Math.sqrt(r11 * r11 + o11 * o11); + } + var d10 = function(e21) { + return f10(e21, l10); + }; + if ("Left" === r10 || "Right" === r10) { + var h10 = "Left" === r10 ? c10.filter(function(e21) { + return t11 = l10, e21.rect.left + s10 < t11.rect.left; + var t11; + }) : c10.filter(function(e21) { + return t11 = l10, e21.rect.right > t11.rect.right + s10; + var t11; + }), v10 = Ex(h10.filter(function(e21) { + return t11 = e21, n11 = l10, Math.abs(t11.y - n11.y) < s10; + var t11, n11; + }), d10) || Ex(h10, function(e21) { + return f10(e21, l10, 10); + }); + return null == v10 ? void 0 : v10.element; + } + if ("Up" === r10 || "Down" === r10) { + var p10 = "Up" === r10 ? c10.filter(function(e21) { + return t11 = l10, e21.y + s10 < t11.y; + var t11; + }) : c10.filter(function(e21) { + return t11 = l10, e21.y > t11.y + s10; + var t11; + }), m10 = Ex(p10.filter(function(e21) { + return i10(e21.element); + }), d10) || Ex(p10, d10); + return null == m10 ? void 0 : m10.element; + } + } + function AO(e20) { + return !!e20 && "DIV" === e20.nodeName && "function" == typeof e20.refresh && "function" == typeof e20.cancel; + } + function PO(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "+", n10 = []; + e20.ctrlKey && n10.push("Ctrl"), e20.metaKey && n10.push("Ctrl"), e20.altKey && n10.push("Alt"), e20.shiftKey && n10.push("Shift"); + var r10 = 1 === e20.key.length ? e20.key.toUpperCase() : e20.key; + return r10 in TO || n10.push(r10), n10.join(t10); + } + var TO = { Ctrl: true, Command: true, Control: true, Alt: true, Option: true, Shift: true }; + var RO = vi.window; + function NO(e20) { + mi(e20, "svelte-1r8q3m8", ".jse-absolute-popup.svelte-1r8q3m8.svelte-1r8q3m8{position:relative;left:0;top:0;width:0;height:0;z-index:1001}.jse-absolute-popup.svelte-1r8q3m8 .jse-hidden-input.svelte-1r8q3m8{position:fixed;left:0;top:0;width:0;height:0;padding:0;margin:0;border:none;outline:none;overflow:hidden}.jse-absolute-popup.svelte-1r8q3m8 .jse-absolute-popup-content.svelte-1r8q3m8{position:absolute}"); + } + function IO(e20) { + var t10, n10, r10, o10, i10, a10, s10 = [e20[0].props], c10 = e20[0].component; + function l10(e21, t11) { + var n11 = {}; + if (void 0 !== t11 && 1 & t11) + n11 = Ma(s10, [Ea(e21[0].props)]); + else + for (var r11 = 0; r11 < s10.length; r11 += 1) + n11 = Jo(n11, s10[r11]); + return { props: n11 }; + } + return c10 && (o10 = Li(c10, l10(e20))), { c: function() { + t10 = ji("div"), n10 = ji("input"), r10 = $i(), o10 && Pa(o10.$$.fragment), Ai(n10, "type", "text"), n10.readOnly = true, Ai(n10, "tabindex", "-1"), Ai(n10, "class", "jse-hidden-input svelte-1r8q3m8"), Ai(t10, "class", "jse-absolute-popup-content svelte-1r8q3m8"), Ai(t10, "style", i10 = zO(e20[1], e20[0].options)); + }, m: function(i11, s11) { + ki(i11, t10, s11), pi(t10, n10), e20[7](n10), pi(t10, r10), o10 && Ta(o10, t10, null), a10 = true; + }, p: function(e21, n11) { + if (1 & n11 && c10 !== (c10 = e21[0].component)) { + if (o10) { + ba(); + var r11 = o10; + xa(r11.$$.fragment, 1, 0, function() { + Ra(r11, 1); + }), ka(); + } + c10 ? (Pa((o10 = Li(c10, l10(e21, n11))).$$.fragment), wa(o10.$$.fragment, 1), Ta(o10, t10, null)) : o10 = null; + } else if (c10) { + var u10 = 1 & n11 ? Ma(s10, [Ea(e21[0].props)]) : {}; + o10.$set(u10); + } + (!a10 || 3 & n11 && i10 !== (i10 = zO(e21[1], e21[0].options))) && Ai(t10, "style", i10); + }, i: function(e21) { + a10 || (o10 && wa(o10.$$.fragment, e21), a10 = true); + }, o: function(e21) { + o10 && xa(o10.$$.fragment, e21), a10 = false; + }, d: function(n11) { + n11 && wi(t10), e20[7](null), o10 && Ra(o10); + } }; + } + function DO(e20) { + var t10, n10, r10, o10, i10 = e20[1] && IO(e20); + return { c: function() { + t10 = ji("div"), i10 && i10.c(), Ai(t10, "role", "none"), Ai(t10, "class", "jse-absolute-popup svelte-1r8q3m8"); + }, m: function(a10, s10) { + ki(a10, t10, s10), i10 && i10.m(t10, null), e20[8](t10), n10 = true, r10 || (o10 = [Oi(RO, "mousedown", e20[3], true), Oi(RO, "keydown", e20[4], true), Oi(RO, "wheel", e20[5], true), Oi(t10, "mousedown", qO), Oi(t10, "keydown", e20[4])], r10 = true); + }, p: function(e21, n11) { + var r11 = jo(n11, 1)[0]; + e21[1] ? i10 ? (i10.p(e21, r11), 2 & r11 && wa(i10, 1)) : ((i10 = IO(e21)).c(), wa(i10, 1), i10.m(t10, null)) : i10 && (ba(), xa(i10, 1, 1, function() { + i10 = null; + }), ka()); + }, i: function(e21) { + n10 || (wa(i10), n10 = true); + }, o: function(e21) { + xa(i10), n10 = false; + }, d: function(n11) { + n11 && wi(t10), i10 && i10.d(), e20[8](null), r10 = false, Qo(o10); + } }; + } + function qO(e20) { + e20.stopPropagation(); + } + function zO(e20, t10) { + var n10 = e20.getBoundingClientRect(), r10 = function() { + if (t10.anchor) { + var e21 = t10.anchor, n11 = t10.width, r11 = void 0 === n11 ? 0 : n11, o11 = t10.height, i11 = void 0 === o11 ? 0 : o11, a11 = t10.offsetTop, s11 = void 0 === a11 ? 0 : a11, c10 = t10.offsetLeft, l10 = void 0 === c10 ? 0 : c10, u10 = t10.position, f10 = e21.getBoundingClientRect(), d10 = f10.left, h10 = f10.top, v10 = f10.bottom, p10 = f10.right, m10 = "top" === u10 || h10 + i11 > window.innerHeight && h10 > i11, g10 = "left" === u10 || d10 + r11 > window.innerWidth && d10 > r11; + return { left: g10 ? p10 - l10 : d10 + l10, top: m10 ? h10 - s11 : v10 + s11, positionAbove: m10, positionLeft: g10 }; + } + if ("number" == typeof t10.left && "number" == typeof t10.top) { + var y10 = t10.left, b10 = t10.top, k10 = t10.width, w10 = void 0 === k10 ? 0 : k10, x10 = t10.height, j10 = void 0 === x10 ? 0 : x10; + return { left: y10, top: b10, positionAbove: b10 + j10 > window.innerHeight && b10 > j10, positionLeft: y10 + w10 > window.innerWidth && y10 > w10 }; + } + throw new Error('Invalid config: pass either "left" and "top", or pass "anchor"'); + }(), o10 = r10.left, i10 = r10.top, a10 = r10.positionAbove, s10 = r10.positionLeft; + return (a10 ? "bottom: ".concat(n10.top - i10, "px;") : "top: ".concat(i10 - n10.top, "px;")) + (s10 ? "right: ".concat(n10.left - o10, "px;") : "left: ".concat(o10 - n10.left, "px;")); + } + function BO(e20, t10, n10) { + var r10, o10, i10 = t10.popup, a10 = t10.closeAbsolutePopup; + function s10(e21) { + i10.options && i10.options.closeOnOuterClick && !kO(e21.target, function(e23) { + return e23 === r10; + }) && a10(i10.id); + } + return Gi(function() { + o10 && o10.focus(); + }), e20.$$set = function(e21) { + "popup" in e21 && n10(0, i10 = e21.popup), "closeAbsolutePopup" in e21 && n10(6, a10 = e21.closeAbsolutePopup); + }, [i10, r10, o10, function(e21) { + s10(e21); + }, function(e21) { + "Escape" === PO(e21) && a10(i10.id); + }, function(e21) { + s10(e21); + }, a10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(2, o10 = e21); + }); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(1, r10 = e21); + }); + }]; + } + var LO = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, BO, DO, Xo, { popup: 0, closeAbsolutePopup: 6 }, NO), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function FO(e20, t10, n10) { + var r10 = e20.slice(); + return r10[6] = t10[n10], r10; + } + function VO(e20) { + var t10, n10; + return t10 = new LO({ props: { popup: e20[6], closeAbsolutePopup: e20[1] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.popup = e21[6]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function HO(e20) { + for (var t10, n10, r10 = Ca(e20[0]), o10 = [], i10 = 0; i10 < r10.length; i10 += 1) + o10[i10] = VO(FO(e20, r10, i10)); + var a10 = function(e21) { + return xa(o10[e21], 1, 1, function() { + o10[e21] = null; + }); + }, s10 = e20[3].default, c10 = ei(s10, e20, e20[2], null); + return { c: function() { + for (var e21 = 0; e21 < o10.length; e21 += 1) + o10[e21].c(); + t10 = $i(), c10 && c10.c(); + }, m: function(e21, r11) { + for (var i11 = 0; i11 < o10.length; i11 += 1) + o10[i11] && o10[i11].m(e21, r11); + ki(e21, t10, r11), c10 && c10.m(e21, r11), n10 = true; + }, p: function(e21, i11) { + var l10 = jo(i11, 1)[0]; + if (3 & l10) { + var u10; + for (r10 = Ca(e21[0]), u10 = 0; u10 < r10.length; u10 += 1) { + var f10 = FO(e21, r10, u10); + o10[u10] ? (o10[u10].p(f10, l10), wa(o10[u10], 1)) : (o10[u10] = VO(f10), o10[u10].c(), wa(o10[u10], 1), o10[u10].m(t10.parentNode, t10)); + } + for (ba(), u10 = r10.length; u10 < o10.length; u10 += 1) + a10(u10); + ka(); + } + c10 && c10.p && (!n10 || 4 & l10) && ri(c10, s10, e21, e21[2], n10 ? ni(s10, e21[2], l10, null) : oi(e21[2]), null); + }, i: function(e21) { + if (!n10) { + for (var t11 = 0; t11 < r10.length; t11 += 1) + wa(o10[t11]); + wa(c10, e21), n10 = true; + } + }, o: function(e21) { + o10 = o10.filter(Boolean); + for (var t11 = 0; t11 < o10.length; t11 += 1) + xa(o10[t11]); + xa(c10, e21), n10 = false; + }, d: function(e21) { + e21 && wi(t10), xi(o10, e21), c10 && c10.d(e21); + } }; + } + function WO(e20, t10, n10) { + var r10 = t10.$$slots, o10 = void 0 === r10 ? {} : r10, i10 = t10.$$scope, a10 = Da("jsoneditor:AbsolutePopup"), s10 = []; + function c10(e21) { + var t11 = s10.findIndex(function(t12) { + return t12.id === e21; + }); + if (-1 !== t11) { + var r11 = s10[t11]; + r11.options.onClose && r11.options.onClose(), n10(0, s10 = s10.filter(function(t12) { + return t12.id !== e21; + })); + } + } + return Xi("absolute-popup", { openAbsolutePopup: function(e21, t11, r11) { + a10("open...", t11, r11); + var o11 = { id: Ps(), component: e21, props: t11 || {}, options: r11 || {} }; + return n10(0, s10 = [].concat(Bo(s10), [o11])), o11.id; + }, closeAbsolutePopup: c10 }), e20.$$set = function(e21) { + "$$scope" in e21 && n10(2, i10 = e21.$$scope); + }, e20.$$.update = function() { + 1 & e20.$$.dirty && a10("popups", s10); + }, [s10, c10, i10, o10]; + } + var UO = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, WO, HO, Zo, {}), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function JO(e20) { + return e20.map(function(e21, t10) { + return ZO.test(e21) ? "[" + e21 + "]" : /[.[\]]/.test(e21) || "" === e21 ? '["' + (e21.replace(/"/g, '\\"') + '"]') : (t10 > 0 ? "." : "") + e21; + }).join(""); + } + function KO(e20) { + for (var t10 = [], n10 = 0; n10 < e20.length; ) + "." === e20[n10] && n10++, "[" === e20[n10] ? (n10++, '"' === e20[n10] ? (n10++, t10.push(r10(function(e21) { + return '"' === e21; + }, true)), o10('"')) : t10.push(r10(function(e21) { + return "]" === e21; + })), o10("]")) : t10.push(r10(function(e21) { + return "." === e21 || "[" === e21; + })); + function r10(t11) { + for (var r11 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], o11 = ""; n10 < e20.length && !t11(e20[n10]); ) + r11 && "\\" === e20[n10] && '"' === e20[n10 + 1] ? (o11 += '"', n10 += 2) : (o11 += e20[n10], n10++); + return o11; + } + function o10(t11) { + if (e20[n10] !== t11) + throw new SyntaxError("Invalid JSON path: ".concat(t11, " expected at position ").concat(n10)); + n10++; + } + return t10; + } + function GO(e20) { + return { value: e20, label: _w(e20) ? "(item root)" : JO(e20) }; + } + function YO(e20) { + return e20.map(function(e21) { + return ZO.test(e21) ? "?.[".concat(e21, "]") : XO.test(e21) ? "?.".concat(e21) : "?.[".concat(JSON.stringify(e21), "]"); + }).join(""); + } + var XO = /^[a-zA-Z$_][a-zA-Z$_\d]*$/; + var ZO = /^\d+$/; + function eM(e20, t10) { + for (var n10 = new Set(t10), r10 = e20.replace(/ \(copy( \d+)?\)$/, ""), o10 = e20, i10 = 1; n10.has(o10); ) { + var a10 = "copy" + (i10 > 1 ? " " + i10 : ""); + o10 = "".concat(r10, " (").concat(a10, ")"), i10++; + } + return o10; + } + function tM(e20, t10) { + var n10 = t10 - 3; + return e20.length > t10 ? e20.substring(0, n10) + "..." : e20; + } + function nM(e20) { + if ("" === e20) + return ""; + var t10 = e20.toLowerCase(); + if ("null" === t10) + return null; + if ("true" === t10) + return true; + if ("false" === t10) + return false; + if ("undefined" !== t10) { + var n10 = Number(e20), r10 = parseFloat(e20); + return isNaN(n10) || isNaN(r10) ? e20 : n10; + } + } + var rM = { id: "javascript", name: "JavaScript", description: "\n

\n Enter a JavaScript function to filter, sort, or transform the data.\n

\n", createQuery: function(e20, t10) { + var n10 = t10.filter, r10 = t10.sort, o10 = t10.projection, i10 = [" return data\n"]; + if (n10 && n10.path && n10.relation && n10.value) { + var a10 = "item => item".concat(YO(n10.path)), s10 = nM(n10.value), c10 = "string" == typeof s10 ? "'".concat(n10.value, "'") : ou(n10.value) && !Number.isSafeInteger(s10) ? "".concat(n10.value, "n") : n10.value; + i10.push(" .filter(".concat(a10, " ").concat(n10.relation, " ").concat(c10, ")\n")); + } + r10 && r10.path && r10.direction && ("desc" === r10.direction ? i10.push(" .slice()\n .sort((a, b) => {\n // sort descending\n" + " const valueA = a".concat(YO(r10.path), "\n") + " const valueB = b".concat(YO(r10.path), "\n") + " return valueA > valueB ? -1 : valueA < valueB ? 1 : 0\n })\n") : i10.push(" .slice()\n .sort((a, b) => {\n // sort ascending\n" + " const valueA = a".concat(YO(r10.path), "\n") + " const valueB = b".concat(YO(r10.path), "\n") + " return valueA > valueB ? 1 : valueA < valueB ? -1 : 0\n })\n")); + if (o10 && o10.paths) + if (o10.paths.length > 1) { + var l10 = o10.paths.map(function(e21) { + var t11 = e21[e21.length - 1] || "item", n11 = "item".concat(YO(e21)); + return " ".concat(JSON.stringify(t11), ": ").concat(n11); + }); + i10.push(" .map(item => ({\n".concat(l10.join(",\n"), "})\n )\n")); + } else { + var u10 = "item".concat(YO(o10.paths[0])); + i10.push(" .map(item => ".concat(u10, ")\n")); + } + return "function query (data) {\n".concat(i10.join(""), "}"); + }, executeQuery: function(e20, t10) { + var n10 = new Function('"use strict";\n\n' + t10 + ` + +if (typeof query !== "function") { + throw new Error("Cannot execute query: expecting a function named 'query' but is undefined") +} + +return query; +`)()(e20); + return void 0 !== n10 ? n10 : null; + } }; + var oM = { prefix: "far", iconName: "lightbulb", icon: [384, 512, [128161], "f0eb", "M297.2 248.9C311.6 228.3 320 203.2 320 176c0-70.7-57.3-128-128-128S64 105.3 64 176c0 27.2 8.4 52.3 22.8 72.9c3.7 5.3 8.1 11.3 12.8 17.7l0 0c12.9 17.7 28.3 38.9 39.8 59.8c10.4 19 15.7 38.8 18.3 57.5H109c-2.2-12-5.9-23.7-11.8-34.5c-9.9-18-22.2-34.9-34.5-51.8l0 0 0 0c-5.2-7.1-10.4-14.2-15.4-21.4C27.6 247.9 16 213.3 16 176C16 78.8 94.8 0 192 0s176 78.8 176 176c0 37.3-11.6 71.9-31.4 100.3c-5 7.2-10.2 14.3-15.4 21.4l0 0 0 0c-12.3 16.8-24.6 33.7-34.5 51.8c-5.9 10.8-9.6 22.5-11.8 34.5H226.4c2.6-18.7 7.9-38.6 18.3-57.5c11.5-20.9 26.9-42.1 39.8-59.8l0 0 0 0 0 0c4.7-6.4 9-12.4 12.7-17.7zM192 128c-26.5 0-48 21.5-48 48c0 8.8-7.2 16-16 16s-16-7.2-16-16c0-44.2 35.8-80 80-80c8.8 0 16 7.2 16 16s-7.2 16-16 16zm0 384c-44.2 0-80-35.8-80-80V416H272v16c0 44.2-35.8 80-80 80z"] }; + var iM = { prefix: "far", iconName: "square-check", icon: [448, 512, [9745, 9989, 61510, "check-square"], "f14a", "M64 80c-8.8 0-16 7.2-16 16V416c0 8.8 7.2 16 16 16H384c8.8 0 16-7.2 16-16V96c0-8.8-7.2-16-16-16H64zM0 96C0 60.7 28.7 32 64 32H384c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM337 209L209 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L303 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"] }; + var aM = { prefix: "far", iconName: "square", icon: [448, 512, [9632, 9723, 9724, 61590], "f0c8", "M384 80c8.8 0 16 7.2 16 16V416c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V96c0-8.8 7.2-16 16-16H384zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z"] }; + var sM = { prefix: "far", iconName: "clock", icon: [512, 512, [128339, "clock-four"], "f017", "M464 256A208 208 0 1 1 48 256a208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z"] }; + function cM(e20) { + var t10; + return { c: function() { + t10 = Si("g"); + }, m: function(n10, r10) { + ki(n10, t10, r10), t10.innerHTML = e20[0]; + }, p: function(e21, n10) { + 1 & jo(n10, 1)[0] && (t10.innerHTML = e21[0]); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function lM(e20, t10, n10) { + var r10 = 870711; + var o10 = "", i10 = t10.data; + function a10(e21) { + if (!e21 || !e21.raw) + return ""; + var t11 = e21.raw, n11 = {}; + return t11 = t11.replace(/\s(?:xml:)?id=["']?([^"')\s]+)/g, function(e23, t12) { + var o11 = "fa-".concat((r10 += 1).toString(16)); + return n11[t12] = o11, ' id="'.concat(o11, '"'); + }), t11 = t11.replace(/#(?:([^'")\s]+)|xpointer\(id\((['"]?)([^')]+)\2\)\))/g, function(e23, t12, r11, o11) { + var i11 = t12 || o11; + return i11 && n11[i11] ? "#".concat(n11[i11]) : e23; + }), t11; + } + return e20.$$set = function(e21) { + "data" in e21 && n10(1, i10 = e21.data); + }, e20.$$.update = function() { + 2 & e20.$$.dirty && n10(0, o10 = a10(i10)); + }, [o10, i10]; + } + var uM = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, lM, cM, Xo, { data: 1 }), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function fM(e20) { + mi(e20, "svelte-1mc5hvj", ".fa-icon.svelte-1mc5hvj{display:inline-block;fill:currentColor}.fa-flip-horizontal.svelte-1mc5hvj{transform:scale(-1, 1)}.fa-flip-vertical.svelte-1mc5hvj{transform:scale(1, -1)}.fa-spin.svelte-1mc5hvj{animation:svelte-1mc5hvj-fa-spin 1s 0s infinite linear}.fa-inverse.svelte-1mc5hvj{color:#fff}.fa-pulse.svelte-1mc5hvj{animation:svelte-1mc5hvj-fa-spin 1s infinite steps(8)}@keyframes svelte-1mc5hvj-fa-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"); + } + function dM(e20) { + for (var t10, n10, r10, o10, i10 = e20[12].default, a10 = ei(i10, e20, e20[11], null), s10 = [{ version: "1.1" }, { class: n10 = "fa-icon " + e20[0] }, { width: e20[1] }, { height: e20[2] }, { "aria-label": e20[9] }, { role: r10 = e20[9] ? "img" : "presentation" }, { viewBox: e20[3] }, { style: e20[8] }, e20[10]], c10 = {}, l10 = 0; l10 < s10.length; l10 += 1) + c10 = Jo(c10, s10[l10]); + return { c: function() { + t10 = Si("svg"), a10 && a10.c(), Ri(t10, c10), zi(t10, "fa-spin", e20[4]), zi(t10, "fa-pulse", e20[6]), zi(t10, "fa-inverse", e20[5]), zi(t10, "fa-flip-horizontal", "horizontal" === e20[7]), zi(t10, "fa-flip-vertical", "vertical" === e20[7]), zi(t10, "svelte-1mc5hvj", true); + }, m: function(e21, n11) { + ki(e21, t10, n11), a10 && a10.m(t10, null), o10 = true; + }, p: function(e21, l11) { + var u10 = jo(l11, 1)[0]; + a10 && a10.p && (!o10 || 2048 & u10) && ri(a10, i10, e21, e21[11], o10 ? ni(i10, e21[11], u10, null) : oi(e21[11]), null), Ri(t10, c10 = Ma(s10, [{ version: "1.1" }, (!o10 || 1 & u10 && n10 !== (n10 = "fa-icon " + e21[0])) && { class: n10 }, (!o10 || 2 & u10) && { width: e21[1] }, (!o10 || 4 & u10) && { height: e21[2] }, (!o10 || 512 & u10) && { "aria-label": e21[9] }, (!o10 || 512 & u10 && r10 !== (r10 = e21[9] ? "img" : "presentation")) && { role: r10 }, (!o10 || 8 & u10) && { viewBox: e21[3] }, (!o10 || 256 & u10) && { style: e21[8] }, 1024 & u10 && e21[10]])), zi(t10, "fa-spin", e21[4]), zi(t10, "fa-pulse", e21[6]), zi(t10, "fa-inverse", e21[5]), zi(t10, "fa-flip-horizontal", "horizontal" === e21[7]), zi(t10, "fa-flip-vertical", "vertical" === e21[7]), zi(t10, "svelte-1mc5hvj", true); + }, i: function(e21) { + o10 || (wa(a10, e21), o10 = true); + }, o: function(e21) { + xa(a10, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), a10 && a10.d(e21); + } }; + } + function hM(e20, t10, n10) { + var r10 = ["class", "width", "height", "box", "spin", "inverse", "pulse", "flip", "style", "label"], o10 = ai(t10, r10), i10 = t10, a10 = i10.$$slots, s10 = void 0 === a10 ? {} : a10, c10 = i10.$$scope, l10 = t10.class, u10 = void 0 === l10 ? "" : l10, f10 = t10.width, d10 = t10.height, h10 = t10.box, v10 = void 0 === h10 ? "0 0 0 0" : h10, p10 = t10.spin, m10 = void 0 !== p10 && p10, g10 = t10.inverse, y10 = void 0 !== g10 && g10, b10 = t10.pulse, k10 = void 0 !== b10 && b10, w10 = t10.flip, x10 = void 0 === w10 ? "none" : w10, j10 = t10.style, S10 = void 0 === j10 ? "" : j10, C10 = t10.label, $10 = void 0 === C10 ? "" : C10; + return e20.$$set = function(e21) { + t10 = Jo(Jo({}, t10), ii(e21)), n10(10, o10 = ai(t10, r10)), "class" in e21 && n10(0, u10 = e21.class), "width" in e21 && n10(1, f10 = e21.width), "height" in e21 && n10(2, d10 = e21.height), "box" in e21 && n10(3, v10 = e21.box), "spin" in e21 && n10(4, m10 = e21.spin), "inverse" in e21 && n10(5, y10 = e21.inverse), "pulse" in e21 && n10(6, k10 = e21.pulse), "flip" in e21 && n10(7, x10 = e21.flip), "style" in e21 && n10(8, S10 = e21.style), "label" in e21 && n10(9, $10 = e21.label), "$$scope" in e21 && n10(11, c10 = e21.$$scope); + }, [u10, f10, d10, v10, m10, y10, k10, x10, S10, $10, o10, c10, s10]; + } + var vM = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, hM, dM, Xo, { class: 0, width: 1, height: 2, box: 3, spin: 4, inverse: 5, pulse: 6, flip: 7, style: 8, label: 9 }, fM), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function pM(e20, t10, n10) { + var r10 = e20.slice(); + return r10[24] = t10[n10], r10; + } + function mM(e20, t10, n10) { + var r10 = e20.slice(); + return r10[27] = t10[n10], r10; + } + function gM(e20) { + for (var t10, n10 = [e20[27]], r10 = {}, o10 = 0; o10 < n10.length; o10 += 1) + r10 = Jo(r10, n10[o10]); + return { c: function() { + Ri(t10 = Si("path"), r10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, o11) { + Ri(t10, r10 = Ma(n10, [64 & o11 && e21[27]])); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function yM(e20) { + for (var t10, n10 = [e20[24]], r10 = {}, o10 = 0; o10 < n10.length; o10 += 1) + r10 = Jo(r10, n10[o10]); + return { c: function() { + Ri(t10 = Si("polygon"), r10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, o11) { + Ri(t10, r10 = Ma(n10, [64 & o11 && e21[24]])); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function bM(e20) { + var t10, n10, r10; + function o10(t11) { + e20[16](t11); + } + var i10 = {}; + return void 0 !== e20[6] && (i10.data = e20[6]), t10 = new uM({ props: i10 }), na.push(function() { + return Aa(t10, "data", o10); + }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, n11) { + Ta(t10, e21, n11), r10 = true; + }, p: function(e21, r11) { + var o11 = {}; + !n10 && 64 & r11 && (n10 = true, o11.data = e21[6], ua(function() { + return n10 = false; + })), t10.$set(o11); + }, i: function(e21) { + r10 || (wa(t10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function kM(e20) { + var t10, n10 = e20[15].default, r10 = ei(n10, e20, e20[17], null), o10 = r10 || function(e21) { + for (var t11, n11, r11, o11, i10, a10, s10, c10 = Ca((null === (t11 = e21[6]) || void 0 === t11 ? void 0 : t11.paths) || []), l10 = [], u10 = 0; u10 < c10.length; u10 += 1) + l10[u10] = gM(mM(e21, c10, u10)); + for (var f10 = Ca((null === (n11 = e21[6]) || void 0 === n11 ? void 0 : n11.polygons) || []), d10 = [], h10 = 0; h10 < f10.length; h10 += 1) + d10[h10] = yM(pM(e21, f10, h10)); + var v10 = (null === (r11 = e21[6]) || void 0 === r11 ? void 0 : r11.raw) && bM(e21); + return { c: function() { + for (var e23 = 0; e23 < l10.length; e23 += 1) + l10[e23].c(); + o11 = $i(); + for (var t12 = 0; t12 < d10.length; t12 += 1) + d10[t12].c(); + i10 = $i(), v10 && v10.c(), a10 = _i(); + }, m: function(e23, t12) { + for (var n12 = 0; n12 < l10.length; n12 += 1) + l10[n12] && l10[n12].m(e23, t12); + ki(e23, o11, t12); + for (var r12 = 0; r12 < d10.length; r12 += 1) + d10[r12] && d10[r12].m(e23, t12); + ki(e23, i10, t12), v10 && v10.m(e23, t12), ki(e23, a10, t12), s10 = true; + }, p: function(e23, t12) { + var n12; + if (64 & t12) { + var r12, s11; + for (c10 = Ca((null === (r12 = e23[6]) || void 0 === r12 ? void 0 : r12.paths) || []), s11 = 0; s11 < c10.length; s11 += 1) { + var u11 = mM(e23, c10, s11); + l10[s11] ? l10[s11].p(u11, t12) : (l10[s11] = gM(u11), l10[s11].c(), l10[s11].m(o11.parentNode, o11)); + } + for (; s11 < l10.length; s11 += 1) + l10[s11].d(1); + l10.length = c10.length; + } + if (64 & t12) { + var h11, p10; + for (f10 = Ca((null === (h11 = e23[6]) || void 0 === h11 ? void 0 : h11.polygons) || []), p10 = 0; p10 < f10.length; p10 += 1) { + var m10 = pM(e23, f10, p10); + d10[p10] ? d10[p10].p(m10, t12) : (d10[p10] = yM(m10), d10[p10].c(), d10[p10].m(i10.parentNode, i10)); + } + for (; p10 < d10.length; p10 += 1) + d10[p10].d(1); + d10.length = f10.length; + } + null !== (n12 = e23[6]) && void 0 !== n12 && n12.raw ? v10 ? (v10.p(e23, t12), 64 & t12 && wa(v10, 1)) : ((v10 = bM(e23)).c(), wa(v10, 1), v10.m(a10.parentNode, a10)) : v10 && (ba(), xa(v10, 1, 1, function() { + v10 = null; + }), ka()); + }, i: function(e23) { + s10 || (wa(v10), s10 = true); + }, o: function(e23) { + xa(v10), s10 = false; + }, d: function(e23) { + e23 && (wi(o11), wi(i10), wi(a10)), xi(l10, e23), xi(d10, e23), v10 && v10.d(e23); + } }; + }(e20); + return { c: function() { + o10 && o10.c(); + }, m: function(e21, n11) { + o10 && o10.m(e21, n11), t10 = true; + }, p: function(e21, i10) { + r10 ? r10.p && (!t10 || 131072 & i10) && ri(r10, n10, e21, e21[17], t10 ? ni(n10, e21[17], i10, null) : oi(e21[17]), null) : o10 && o10.p && (!t10 || 64 & i10) && o10.p(e21, t10 ? i10 : -1); + }, i: function(e21) { + t10 || (wa(o10, e21), t10 = true); + }, o: function(e21) { + xa(o10, e21), t10 = false; + }, d: function(e21) { + o10 && o10.d(e21); + } }; + } + function wM(e20) { + for (var t10, n10, r10 = [{ label: e20[5] }, { width: e20[7] }, { height: e20[8] }, { box: e20[10] }, { style: e20[9] }, { spin: e20[1] }, { flip: e20[4] }, { inverse: e20[2] }, { pulse: e20[3] }, { class: e20[0] }, e20[11]], o10 = { $$slots: { default: [kM] }, $$scope: { ctx: e20 } }, i10 = 0; i10 < r10.length; i10 += 1) + o10 = Jo(o10, r10[i10]); + return t10 = new vM({ props: o10 }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r11) { + Ta(t10, e21, r11), n10 = true; + }, p: function(e21, n11) { + var o11 = jo(n11, 1)[0], i11 = 4031 & o11 ? Ma(r10, [32 & o11 && { label: e21[5] }, 128 & o11 && { width: e21[7] }, 256 & o11 && { height: e21[8] }, 1024 & o11 && { box: e21[10] }, 512 & o11 && { style: e21[9] }, 2 & o11 && { spin: e21[1] }, 16 & o11 && { flip: e21[4] }, 4 & o11 && { inverse: e21[2] }, 8 & o11 && { pulse: e21[3] }, 1 & o11 && { class: e21[0] }, 2048 & o11 && Ea(e21[11])]) : {}; + 131136 & o11 && (i11.$$scope = { dirty: o11, ctx: e21 }), t10.$set(i11); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function xM(e20, t10, n10) { + var r10, o10, i10, a10 = ["class", "data", "scale", "spin", "inverse", "pulse", "flip", "label", "style"], s10 = ai(t10, a10), c10 = t10, l10 = c10.$$slots, u10 = void 0 === l10 ? {} : l10, f10 = c10.$$scope, d10 = t10.class, h10 = void 0 === d10 ? "" : d10, v10 = t10.data, p10 = t10.scale, m10 = void 0 === p10 ? 1 : p10, g10 = t10.spin, y10 = void 0 !== g10 && g10, b10 = t10.inverse, k10 = void 0 !== b10 && b10, w10 = t10.pulse, x10 = void 0 !== w10 && w10, j10 = t10.flip, S10 = void 0 === j10 ? void 0 : j10, C10 = t10.label, $10 = void 0 === C10 ? "" : C10, _10 = t10.style, O10 = void 0 === _10 ? "" : _10, M10 = 10, E10 = 10; + function A10() { + var e21 = 1; + return void 0 !== m10 && (e21 = Number(m10)), isNaN(e21) || e21 <= 0 ? (console.warn('Invalid prop: prop "scale" should be a number over 0.'), 1) : 1 * e21; + } + function P10() { + return r10 ? Math.max(r10.width, r10.height) / 16 : 1; + } + return e20.$$set = function(e21) { + t10 = Jo(Jo({}, t10), ii(e21)), n10(11, s10 = ai(t10, a10)), "class" in e21 && n10(0, h10 = e21.class), "data" in e21 && n10(12, v10 = e21.data), "scale" in e21 && n10(13, m10 = e21.scale), "spin" in e21 && n10(1, y10 = e21.spin), "inverse" in e21 && n10(2, k10 = e21.inverse), "pulse" in e21 && n10(3, x10 = e21.pulse), "flip" in e21 && n10(4, S10 = e21.flip), "label" in e21 && n10(5, $10 = e21.label), "style" in e21 && n10(14, O10 = e21.style), "$$scope" in e21 && n10(17, f10 = e21.$$scope); + }, e20.$$.update = function() { + 28672 & e20.$$.dirty && (n10(6, r10 = function(e21) { + var t11; + if (e21) { + if (!("definition" in e21)) { + if ("iconName" in e21 && "icon" in e21) { + e21.iconName; + var n11 = jo(e21.icon, 5), r11 = n11[0], o11 = n11[1], i11 = n11[4]; + t11 = { width: r11, height: o11, paths: (Array.isArray(i11) ? i11 : [i11]).map(function(e23) { + return { d: e23 }; + }) }; + } else + t11 = e21[Object.keys(e21)[0]]; + return t11; + } + console.error("`import faIconName from '@fortawesome/package-name/faIconName` not supported - Please use `import { faIconName } from '@fortawesome/package-name/faIconName'` instead"); + } + }(v10)), n10(7, M10 = r10 ? r10.width / P10() * A10() : 0), n10(8, E10 = r10 ? r10.height / P10() * A10() : 0), n10(9, o10 = function() { + var e21 = ""; + null !== O10 && (e21 += O10); + var t11 = A10(); + return 1 === t11 ? 0 === e21.length ? "" : e21 : ("" === e21 || e21.endsWith(";") || (e21 += "; "), "".concat(e21, "font-size: ").concat(t11, "em")); + }()), n10(10, i10 = r10 ? "0 0 ".concat(r10.width, " ").concat(r10.height) : "0 0 ".concat(M10, " ").concat(E10))); + }, [h10, y10, k10, x10, S10, $10, r10, M10, E10, o10, i10, s10, v10, m10, O10, u10, function(e21) { + n10(6, r10 = e21), n10(12, v10), n10(14, O10), n10(13, m10); + }, f10]; + } + var jM = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, xM, wM, Xo, { class: 0, data: 12, scale: 13, spin: 1, inverse: 2, pulse: 3, flip: 4, label: 5, style: 14 }), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function SM(e20) { + mi(e20, "svelte-68vtq4", ".jse-boolean-toggle.svelte-68vtq4{padding:0;margin:1px 0 0;vertical-align:top;display:inline-flex;color:var(--jse-value-color-boolean, #ff8c00)}.jse-boolean-toggle.svelte-68vtq4:not(.jse-readonly){cursor:pointer}"); + } + function CM(e20) { + var t10, n10, r10, o10, i10, a10, s10; + return n10 = new jM({ props: { data: true === e20[0] ? iM : aM } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "role", "checkbox"), Ai(t10, "tabindex", "-1"), Ai(t10, "aria-checked", r10 = true === e20[0]), Ai(t10, "class", "jse-boolean-toggle svelte-68vtq4"), Ai(t10, "title", o10 = e20[1] ? "Boolean value ".concat(e20[0]) : "Click to toggle this boolean value"), zi(t10, "jse-readonly", e20[1]); + }, m: function(r11, o11) { + ki(r11, t10, o11), Ta(n10, t10, null), i10 = true, a10 || (s10 = Oi(t10, "mousedown", e20[2]), a10 = true); + }, p: function(e21, a11) { + var s11 = jo(a11, 1)[0], c10 = {}; + 1 & s11 && (c10.data = true === e21[0] ? iM : aM), n10.$set(c10), (!i10 || 1 & s11 && r10 !== (r10 = true === e21[0])) && Ai(t10, "aria-checked", r10), (!i10 || 3 & s11 && o10 !== (o10 = e21[1] ? "Boolean value ".concat(e21[0]) : "Click to toggle this boolean value")) && Ai(t10, "title", o10), (!i10 || 2 & s11) && zi(t10, "jse-readonly", e21[1]); + }, i: function(e21) { + i10 || (wa(n10.$$.fragment, e21), i10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), i10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), a10 = false, s10(); + } }; + } + function $M(e20, t10, n10) { + var r10 = t10.path, o10 = t10.value, i10 = t10.readOnly, a10 = t10.onPatch, s10 = t10.focus; + return e20.$$set = function(e21) { + "path" in e21 && n10(3, r10 = e21.path), "value" in e21 && n10(0, o10 = e21.value), "readOnly" in e21 && n10(1, i10 = e21.readOnly), "onPatch" in e21 && n10(4, a10 = e21.onPatch), "focus" in e21 && n10(5, s10 = e21.focus); + }, [o10, i10, function(e21) { + e21.stopPropagation(), i10 || (a10([{ op: "replace", path: Zs(r10), value: !o10 }]), s10()); + }, r10, a10, s10]; + } + var _M = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, $M, CM, Zo, { path: 3, value: 0, readOnly: 1, onPatch: 4, focus: 5 }, SM), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function OM(e20) { + mi(e20, "svelte-1f4ayrt", ".jse-color-picker-popup.svelte-1f4ayrt .picker_wrapper.popup,.jse-color-picker-popup.svelte-1f4ayrt .picker_wrapper.popup .picker_arrow::before,.jse-color-picker-popup.svelte-1f4ayrt .picker_wrapper.popup .picker_arrow::after{background:var(--jse-color-picker-background, var(--jse-panel-background, #ebebeb));line-height:normal}.jse-color-picker-popup.svelte-1f4ayrt .picker_slider,.jse-color-picker-popup.svelte-1f4ayrt .picker_sl,.jse-color-picker-popup.svelte-1f4ayrt .picker_editor input,.jse-color-picker-popup.svelte-1f4ayrt .picker_sample,.jse-color-picker-popup.svelte-1f4ayrt .picker_done button{box-shadow:var(--jse-color-picker-border-box-shadow, #cbcbcb 0 0 0 1px)}.jse-color-picker-popup.svelte-1f4ayrt .picker_editor input{background:var(--jse-background-color, #fff);color:var(--jse-text-color, #4d4d4d)}.jse-color-picker-popup.svelte-1f4ayrt .picker_done button{background:var(--jse-button-background, #e0e0e0);color:var(--jse-button-color, var(--jse-text-color, #4d4d4d))}.jse-color-picker-popup.svelte-1f4ayrt .picker_done button:hover{background:var(--jse-button-background-highlight, #e7e7e7)}"); + } + function MM(e20) { + var t10; + return { c: function() { + Ai(t10 = ji("div"), "class", "jse-color-picker-popup svelte-1f4ayrt"); + }, m: function(n10, r10) { + ki(n10, t10, r10), e20[4](t10); + }, p: Wo, i: Wo, o: Wo, d: function(n10) { + n10 && wi(t10), e20[4](null); + } }; + } + function EM(e20, t10, n10) { + var r10, o10 = t10.color, i10 = t10.onChange, a10 = t10.showOnTop, s10 = function() { + }; + return Gi(xo(ko().mark(function e21() { + var t11, n11, c10; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return e23.next = 2, Promise.resolve().then(function() { + return ote; + }); + case 2: + if (e23.t1 = t11 = e23.sent, e23.t0 = null === e23.t1, e23.t0) { + e23.next = 6; + break; + } + e23.t0 = void 0 === t11; + case 6: + if (!e23.t0) { + e23.next = 10; + break; + } + e23.t2 = void 0, e23.next = 11; + break; + case 10: + e23.t2 = t11.default; + case 11: + n11 = e23.t2, c10 = new n11({ parent: r10, color: o10, popup: a10 ? "top" : "bottom", onDone: function(e24) { + var t12 = 1 === e24.rgba[3] ? e24.hex.substring(0, 7) : e24.hex; + i10(t12); + } }), c10.show(), s10 = function() { + c10.destroy(); + }; + case 15: + case "end": + return e23.stop(); + } + }, e21); + }))), Qi(function() { + s10(); + }), e20.$$set = function(e21) { + "color" in e21 && n10(1, o10 = e21.color), "onChange" in e21 && n10(2, i10 = e21.onChange), "showOnTop" in e21 && n10(3, a10 = e21.showOnTop); + }, [r10, o10, i10, a10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(0, r10 = e21); + }); + }]; + } + var AM = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, EM, MM, Xo, { color: 1, onChange: 2, showOnTop: 3 }, OM), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function PM(e20) { + mi(e20, "svelte-1zzxwe", ".jse-color-picker-button.svelte-1zzxwe{font-size:var(--jse-font-size-mono, 14px);width:var(--jse-color-picker-button-size, 1em);height:var(--jse-color-picker-button-size, 1em);box-sizing:border-box;padding:0;margin:2px 0 0;display:inline-flex;vertical-align:top;border:1px solid var(--jse-text-color, #4d4d4d);border-radius:2px;background:inherit;outline:none}.jse-color-picker-button.svelte-1zzxwe:not(.jse-readonly){cursor:pointer}"); + } + function TM(e20) { + var t10, n10, r10, o10; + return { c: function() { + Ai(t10 = ji("button"), "type", "button"), Ai(t10, "class", "jse-color-picker-button svelte-1zzxwe"), Di(t10, "background", e20[2]), Ai(t10, "title", n10 = e20[1] ? "Color ".concat(e20[0]) : "Click to open a color picker"), zi(t10, "jse-readonly", e20[1]); + }, m: function(n11, i10) { + ki(n11, t10, i10), r10 || (o10 = Oi(t10, "click", e20[3]), r10 = true); + }, p: function(e21, r11) { + var o11 = jo(r11, 1)[0]; + 4 & o11 && Di(t10, "background", e21[2]), 3 & o11 && n10 !== (n10 = e21[1] ? "Color ".concat(e21[0]) : "Click to open a color picker") && Ai(t10, "title", n10), 2 & o11 && zi(t10, "jse-readonly", e21[1]); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10), r10 = false, o10(); + } }; + } + function RM(e20, t10, n10) { + var r10, o10 = Zi("absolute-popup").openAbsolutePopup, i10 = t10.path, a10 = t10.value, s10 = t10.readOnly, c10 = t10.onPatch, l10 = t10.focus; + function u10(e21) { + c10([{ op: "replace", path: Zs(i10), value: e21 }]), f10(); + } + function f10() { + l10(); + } + return e20.$$set = function(e21) { + "path" in e21 && n10(4, i10 = e21.path), "value" in e21 && n10(0, a10 = e21.value), "readOnly" in e21 && n10(1, s10 = e21.readOnly), "onPatch" in e21 && n10(5, c10 = e21.onPatch), "focus" in e21 && n10(6, l10 = e21.focus); + }, e20.$$.update = function() { + 1 & e20.$$.dirty && n10(2, r10 = Xl(a10)); + }, [a10, s10, r10, function(e21) { + var t11, n11; + if (!s10) { + var r11 = e21.target, i11 = r11.getBoundingClientRect().top, c11 = null !== (t11 = null === (n11 = SO(r11)) || void 0 === n11 ? void 0 : n11.innerHeight) && void 0 !== t11 ? t11 : 0; + o10(AM, { color: a10, onChange: u10, showOnTop: c11 - i11 < 300 && i11 > 300 }, { anchor: r11, closeOnOuterClick: true, onClose: f10, offsetTop: 18, offsetLeft: -8, height: 300 }); + } + }, i10, c10, l10]; + } + var NM = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, RM, TM, Zo, { path: 4, value: 0, readOnly: 1, onPatch: 5, focus: 6 }, PM), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function IM(e20) { + for (var t10 = GS(e20, function(e21) { + return e21.start; + }), n10 = [t10[0]], r10 = 0; r10 < t10.length; r10++) { + var o10 = n10.length - 1, i10 = n10[o10], a10 = t10[r10]; + a10.start <= i10.end ? n10[o10] = { start: Math.min(i10.start, a10.start), end: Math.max(i10.end, a10.end) } : n10.push(a10); + } + return n10; + } + function DM(e20, t10) { + return e20.some(function(e21) { + return t10 >= e21.start && t10 < e21.end; + }); + } + function qM(e20) { + return zM(e20) + ls; + } + function zM(e20) { + return Math.floor(e20 / ls) * ls; + } + function BM(e20) { + var t10 = { expandedMap: {}, enforceStringMap: {}, visibleSectionsMap: {}, selection: null, sortedColumn: null }; + return null != e20 && e20.select && void 0 !== e20.json && (t10 = Ro(Ro({}, t10), {}, { selection: e20.select(e20.json, t10) })), null != e20 && e20.expand && (t10 = HM(e20.json, t10, [], e20.expand)), t10; + } + function LM(e20, t10) { + return e20.visibleSectionsMap[t10] || ds; + } + function FM(e20, t10, n10) { + t10.forEach(function(t11) { + var r10 = t11.start, o10 = t11.end; + R_(r10, Math.min(e20.length, o10), n10); + }); + } + function VM(e20, t10, n10) { + for (var r10 = Ro({}, t10.expandedMap), o10 = Ro({}, t10.visibleSectionsMap), i10 = 0; i10 < n10.length; i10++) { + var a10 = n10.slice(0, i10), s10 = Zs(a10), c10 = Ws(e20, a10); + if (Ql(c10) && (r10[s10] = true), Array.isArray(c10) && i10 < n10.length) { + var l10 = o10[s10] || ds, u10 = Ul(n10[i10]); + if (!DM(l10, u10)) { + var f10 = zM(u10), d10 = { start: f10, end: qM(f10) }; + o10[s10] = IM(l10.concat(d10)); + } + } + } + return Ro(Ro({}, t10), {}, { expandedMap: r10, visibleSectionsMap: o10 }); + } + function HM(e20, t10, n10, r10) { + var o10 = Ro({}, t10.expandedMap); + var i10 = n10.slice(), a10 = void 0 !== e20 ? Ws(e20, n10) : e20; + return void 0 !== a10 && function e21(n11) { + var a11 = i10.length; + if (Array.isArray(n11)) { + if (r10(i10)) { + var s10 = Zs(i10); + if (o10[s10] = true, n11.length > 0) { + var c10 = LM(t10, s10); + FM(n11, c10, function(t11) { + i10[a11] = String(t11), e21(n11[t11]); + }), i10.pop(); + } + } + } else if (Gl(n11) && r10(i10)) { + o10[Zs(i10)] = true; + var l10 = Object.keys(n11); + if (l10.length > 0) { + var u10, f10 = bo(l10); + try { + for (f10.s(); !(u10 = f10.n()).done; ) { + var d10 = u10.value; + i10[a11] = d10, e21(n11[d10]); + } + } catch (e23) { + f10.e(e23); + } finally { + f10.f(); + } + i10.pop(); + } + } + }(a10), Ro(Ro({}, t10), {}, { expandedMap: o10 }); + } + function WM(e20, t10) { + var n10 = QM(e20.expandedMap, t10), r10 = QM(e20.enforceStringMap, t10), o10 = QM(e20.visibleSectionsMap, t10); + return Ro(Ro({}, e20), {}, { expandedMap: n10, enforceStringMap: r10, visibleSectionsMap: o10 }); + } + function UM(e20, t10, n10) { + if (n10) { + var r10 = Ro({}, e20.enforceStringMap); + return r10[t10] = n10, Ro(Ro({}, e20), {}, { enforceStringMap: r10 }); + } + if ("boolean" == typeof e20.enforceStringMap[t10]) { + var o10 = Ro({}, e20.enforceStringMap); + return delete o10[t10], Ro(Ro({}, e20), {}, { enforceStringMap: o10 }); + } + return e20; + } + function JM(e20, t10, n10) { + var r10 = rc(e20, n10), o10 = n10.reduce(function(e21, t11) { + return Ns(t11) ? KM(r10, e21, t11) : Is(t11) ? GM(r10, e21, t11) : Ds(t11) ? function(e23, t12, n11) { + var r11 = n11.path, o11 = tE(e23, t12.expandedMap), i10 = tE(e23, t12.enforceStringMap), a10 = tE(e23, t12.visibleSectionsMap); + Rs(n11.value) || Ts(n11.value) || delete o11[r11]; + Ts(n11.value) || delete a10[r11]; + (Rs(n11.value) || Ts(n11.value)) && delete i10[r11]; + return Ro(Ro({}, t12), {}, { expandedMap: o11, enforceStringMap: i10, visibleSectionsMap: a10 }); + }(r10, e21, t11) : qs(t11) || zs(t11) ? function(e23, t12, n11) { + if (zs(n11) && n11.from === n11.path) + return t12; + var r11 = function(e24) { + return n11.path + e24.substring(n11.from.length); + }, o11 = ZM(YM(t12.expandedMap, n11.from), r11), i10 = ZM(YM(t12.enforceStringMap, n11.from), r11), a10 = ZM(YM(t12.visibleSectionsMap, n11.from), r11), s10 = t12; + zs(n11) && (s10 = GM(e23, s10, { op: "remove", path: n11.from })); + s10 = KM(e23, s10, { op: "add", path: n11.path, value: null }); + var c10 = XM(s10.expandedMap, o11), l10 = XM(s10.enforceStringMap, i10), u10 = XM(s10.visibleSectionsMap, a10); + return Ro(Ro({}, t12), {}, { expandedMap: c10, enforceStringMap: l10, visibleSectionsMap: u10 }); + }(r10, e21, t11) : e21; + }, t10); + return { json: r10, documentState: o10 }; + } + function KM(e20, t10, n10) { + var r10 = dc(e20, n10.path), o10 = Qk(r10), i10 = Zs(o10); + if (Ts(Ws(e20, o10))) { + var a10 = Ul(vb(r10)), s10 = eE(t10.expandedMap, o10, a10, 1), c10 = eE(t10.enforceStringMap, o10, a10, 1), l10 = eE(t10.visibleSectionsMap, o10, a10, 1); + return l10 = nE(l10, i10, function(e21) { + return rE(e21, a10, 1); + }), Ro(Ro({}, t10), {}, { expandedMap: s10, enforceStringMap: c10, visibleSectionsMap: l10 }); + } + return t10; + } + function GM(e20, t10, n10) { + var r10 = dc(e20, n10.path), o10 = Qk(r10), i10 = Zs(o10), a10 = Ws(e20, o10), s10 = t10.expandedMap, c10 = t10.enforceStringMap, l10 = t10.visibleSectionsMap; + if (s10 = QM(s10, r10), c10 = QM(c10, r10), l10 = QM(l10, r10), Ts(a10)) { + var u10 = Ul(vb(r10)); + s10 = eE(s10, o10, u10, -1), c10 = eE(c10, o10, u10, -1), l10 = nE(l10 = eE(l10, o10, u10, -1), i10, function(e21) { + return rE(e21, u10, -1); + }); + } + return Ro(Ro({}, t10), {}, { expandedMap: s10, enforceStringMap: c10, visibleSectionsMap: l10 }); + } + function QM(e20, t10) { + var n10 = {}, r10 = Zs(t10); + return Object.keys(e20).forEach(function(t11) { + nc(t11, r10) || (n10[t11] = e20[t11]); + }), n10; + } + function YM(e20, t10) { + var n10 = {}; + return Object.keys(e20).forEach(function(r10) { + nc(r10, t10) && (n10[r10] = e20[r10]); + }), n10; + } + function XM(e20, t10) { + return Ro(Ro({}, e20), t10); + } + function ZM(e20, t10) { + var n10 = {}; + return Object.keys(e20).forEach(function(r10) { + var o10 = t10(r10); + n10[o10] = e20[r10]; + }), n10; + } + function eE(e20, t10, n10, r10) { + for (var o10 = t10.length, i10 = Zs(t10), a10 = [], s10 = 0, c10 = Object.keys(e20); s10 < c10.length; s10++) { + var l10 = c10[s10]; + if (nc(l10, i10)) { + var u10 = Xs(l10), f10 = Ul(u10[o10]); + f10 >= n10 && (u10[o10] = String(f10 + r10), a10.push({ oldPointer: l10, newPointer: Zs(u10), value: e20[l10] })); + } + } + if (0 === a10.length) + return e20; + var d10 = Ro({}, e20); + return a10.forEach(function(e21) { + delete d10[e21.oldPointer]; + }), a10.forEach(function(e21) { + d10[e21.newPointer] = e21.value; + }), d10; + } + function tE(e20, t10) { + var n10 = {}; + return Object.keys(t10).filter(function(t11) { + return Ys(e20, dc(e20, t11)); + }).forEach(function(e21) { + n10[e21] = t10[e21]; + }), n10; + } + function nE(e20, t10, n10) { + var r10 = e20[t10]; + if (t10 in e20) { + var o10 = n10(r10); + if (!Ow(r10, o10)) { + var i10 = Ro({}, e20); + return void 0 === o10 ? delete i10[t10] : i10[t10] = o10, i10; + } + } + return e20; + } + function rE(e20, t10, n10) { + return function(e21) { + var t11 = e21.slice(0), n11 = 1; + for (; n11 < t11.length; ) + t11[n11 - 1].end === t11[n11].start && (t11[n11 - 1] = { start: t11[n11 - 1].start, end: t11[n11].end }, t11.splice(n11)), n11++; + return t11; + }(e20.map(function(e21) { + return { start: e21.start > t10 ? e21.start + n10 : e21.start, end: e21.end > t10 ? e21.end + n10 : e21.end }; + })); + } + function oE(e20, t10, n10, r10) { + var o10 = t10 ? t10[n10] : void 0; + return "boolean" == typeof o10 ? o10 : function(e21, t11) { + return "string" == typeof e21 && "string" != typeof ru(e21, t11); + }(e20, r10); + } + function iE(e20, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], r10 = e20.indexOf(t10); + return -1 !== r10 ? n10 ? e20.slice(r10) : e20.slice(r10 + 1) : []; + } + function aE(e20, t10) { + var n10 = []; + return function e21(r10, o10) { + n10.push(o10); + var i10 = Zs(o10); + if (r10 && true === t10.expandedMap[i10]) { + if (Ts(r10)) { + var a10 = LM(t10, i10); + FM(r10, a10, function(t11) { + e21(r10[t11], o10.concat(String(t11))); + }); + } + Rs(r10) && Object.keys(r10).forEach(function(t11) { + e21(r10[t11], o10.concat(t11)); + }); + } + }(e20, []), n10; + } + function sE(e20, t10) { + var n10 = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], r10 = []; + return function e21(o10, i10) { + r10.push({ path: i10, type: Xa.value }); + var a10 = Zs(i10); + if (o10 && true === t10.expandedMap[a10]) { + if (n10 && r10.push({ path: i10, type: Xa.inside }), Ts(o10)) { + var s10 = LM(t10, a10); + FM(o10, s10, function(t11) { + var a11 = i10.concat(String(t11)); + e21(o10[t11], a11), n10 && r10.push({ path: a11, type: Xa.after }); + }); + } + if (Rs(o10)) + Object.keys(o10).forEach(function(t11) { + var a11 = i10.concat(t11); + r10.push({ path: a11, type: Xa.key }), e21(o10[t11], a11), n10 && r10.push({ path: a11, type: Xa.after }); + }); + } + }(e20, []), r10; + } + function cE(e20, t10, n10) { + var r10 = aE(e20, t10), o10 = r10.map(Zs).indexOf(Zs(n10)); + return -1 !== o10 && o10 < r10.length - 1 ? r10[o10 + 1] : null; + } + function lE(e20, t10, n10) { + var r10 = Ws(e20, n10); + return void 0 === r10 ? t10 : HM(e20, t10, n10, !X_({ json: r10 }, ms) ? fE : uE); + } + function uE(e20) { + return 0 === e20.length || 1 === e20.length && "0" === e20[0]; + } + function fE() { + return true; + } + function dE(e20) { + return e20 && e20.type === Ya.after || false; + } + function hE(e20) { + return e20 && e20.type === Ya.inside || false; + } + function vE(e20) { + return e20 && e20.type === Ya.key || false; + } + function pE(e20) { + return e20 && e20.type === Ya.value || false; + } + function mE(e20) { + return e20 && e20.type === Ya.multi || false; + } + function gE(e20) { + return mE(e20) && Ow(e20.focusPath, e20.anchorPath); + } + function yE(e20) { + return mE(e20) || dE(e20) || hE(e20) || vE(e20) || pE(e20); + } + function bE(e20) { + return e20 && e20.type === Ya.text || false; + } + function kE(e20, t10) { + var n10 = []; + return function(e21, t11, n11) { + if (!t11) + return; + var r10 = KE(t11), o10 = JE(t11); + if (Ow(r10, o10)) + return n11(r10); + if (void 0 === e21) + return; + var i10 = OE(r10, o10); + if (r10.length === i10.length || o10.length === i10.length) + return n11(i10); + var a10 = DE(r10, o10), s10 = xE(e21, a10), c10 = jE(e21, a10), l10 = UE(e21, a10, s10), u10 = UE(e21, a10, c10); + if (-1 === l10 || -1 === u10) + return; + var f10 = Ws(e21, i10); + if (Rs(f10)) { + for (var d10 = Object.keys(f10), h10 = l10; h10 <= u10; h10++) { + var v10 = n11(i10.concat(d10[h10])); + if (void 0 !== v10) + return v10; + } + return; + } + if (Ts(f10)) { + for (var p10 = l10; p10 <= u10; p10++) { + var m10 = n11(i10.concat(String(p10))); + if (void 0 !== m10) + return m10; + } + return; + } + throw new Error("Failed to create selection"); + }(e20, t10, function(e21) { + n10.push(e21); + }), n10; + } + function wE(e20) { + return hE(e20) ? e20.path : Qk(JE(e20)); + } + function xE(e20, t10) { + if (!mE(t10)) + return t10.path; + var n10 = UE(e20, t10, t10.anchorPath); + return UE(e20, t10, t10.focusPath) < n10 ? t10.focusPath : t10.anchorPath; + } + function jE(e20, t10) { + if (!mE(t10)) + return t10.path; + var n10 = UE(e20, t10, t10.anchorPath); + return UE(e20, t10, t10.focusPath) > n10 ? t10.focusPath : t10.anchorPath; + } + function SE(e20, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], r10 = t10.selection; + if (!r10) + return null; + var o10 = n10 ? JE(r10) : xE(e20, r10), i10 = function(e21, t11, n11) { + var r11 = aE(e21, t11), o11 = r11.map(Zs), i11 = Zs(n11), a11 = o11.indexOf(i11); + return -1 !== a11 && a11 > 0 ? r11[a11 - 1] : null; + }(e20, t10, o10); + if (n10) + return hE(r10) || dE(r10) ? null !== i10 ? DE(o10, o10) : null : null !== i10 ? DE(KE(r10), i10) : null; + if (dE(r10)) + return RE(o10, false); + if (hE(r10)) + return RE(o10, false); + if (vE(r10)) { + if (null == i10 || 0 === i10.length) + return null; + var a10 = Ws(e20, Qk(i10)); + return Array.isArray(a10) || _w(i10) ? RE(i10, false) : TE(i10, false); + } + return pE(r10), null !== i10 ? RE(i10, false) : null; + } + function CE(e20, t10, n10) { + var r10 = t10.selection; + if (!r10) + return { caret: null, previous: null, next: null }; + var o10 = sE(e20, t10, n10), i10 = o10.findIndex(function(e21) { + return Ow(e21.path, JE(r10)) && String(e21.type) === String(r10.type); + }); + return { caret: -1 !== i10 ? o10[i10] : null, previous: -1 !== i10 && i10 > 0 ? o10[i10 - 1] : null, next: -1 !== i10 && i10 < o10.length - 1 ? o10[i10 + 1] : null }; + } + function $E(e20, t10) { + for (var n10 = aE(e20, t10), r10 = 0; r10 < n10.length - 1 && n10[r10 + 1].length > n10[r10].length; ) + r10++; + var o10 = n10[r10]; + return void 0 === o10 || 0 === o10.length || Array.isArray(Ws(e20, Qk(o10))) ? RE(o10, false) : TE(o10, false); + } + function _E(e20, t10) { + if (1 === t10.length) { + var n10 = ck(t10); + if ("replace" === n10.op) + return RE(dc(e20, n10.path), false); + } + if (!_w(t10) && t10.every(function(e21) { + return "move" === e21.op; + })) { + var r10 = ck(t10), o10 = t10.slice(1); + if ((qs(r10) || zs(r10)) && r10.from !== r10.path && o10.every(function(e21) { + return (qs(e21) || zs(e21)) && e21.from === e21.path; + })) + return TE(dc(e20, r10.path), false); + } + var i10 = t10.filter(function(e21) { + return "test" !== e21.op && "remove" !== e21.op && ("move" !== e21.op || e21.from !== e21.path) && "string" == typeof e21.path; + }).map(function(t11) { + return dc(e20, t11.path); + }); + return _w(i10) ? null : { type: Ya.multi, anchorPath: ck(i10), focusPath: vb(i10) }; + } + function OE(e20, t10) { + for (var n10 = 0; n10 < e20.length && n10 < t10.length && e20[n10] === t10[n10]; ) + n10++; + return e20.slice(0, n10); + } + function ME(e20) { + return vE(e20) || pE(e20) || gE(e20); + } + function EE(e20, t10) { + return ME(t10) && Ql(Ws(e20, JE(t10))) ? JE(t10) : Qk(JE(t10)); + } + function AE(e20, t10) { + if (e20.length < t10.length) + return false; + for (var n10 = 0; n10 < t10.length; n10++) + if (e20[n10] !== t10[n10]) + return false; + return true; + } + function PE(e20) { + var t10 = e20.selection; + return (vE(t10) || pE(t10)) && t10.edit ? Ro(Ro({}, e20), {}, { selection: Ro(Ro({}, t10), {}, { edit: false }) }) : e20; + } + function TE(e20, t10) { + return { type: Ya.key, path: e20, edit: t10 }; + } + function RE(e20, t10) { + return { type: Ya.value, path: e20, edit: t10 }; + } + function NE(e20) { + return { type: Ya.inside, path: e20 }; + } + function IE(e20) { + return { type: Ya.after, path: e20 }; + } + function DE(e20, t10) { + var n10 = OE(e20, t10), r10 = e20.length > n10.length && t10.length > n10.length; + return { type: Ya.multi, anchorPath: r10 ? n10.concat(e20[n10.length]) : n10, focusPath: r10 ? n10.concat(t10[n10.length]) : n10 }; + } + function qE(e20, t10, n10, r10) { + if (vE(t10)) + return String(vb(t10.path)); + if (pE(t10)) { + var o10, i10 = Ws(e20, t10.path); + return "string" == typeof i10 ? i10 : null !== (o10 = r10.stringify(i10, null, n10)) && void 0 !== o10 ? o10 : null; + } + if (mE(t10)) { + var a10; + if (_w(t10.focusPath)) + return null !== (a10 = r10.stringify(e20, null, n10)) && void 0 !== a10 ? a10 : null; + var s10 = wE(t10), c10 = Ws(e20, s10); + if (Array.isArray(c10)) { + if (gE(t10)) { + var l10, u10 = Ws(e20, t10.focusPath); + return null !== (l10 = r10.stringify(u10, null, n10)) && void 0 !== l10 ? l10 : null; + } + return kE(e20, t10).map(function(t11) { + var o11 = Ws(e20, t11); + return "".concat(r10.stringify(o11, null, n10), ","); + }).join("\n"); + } + return kE(e20, t10).map(function(t11) { + var o11 = vb(t11), i11 = Ws(e20, t11); + return "".concat(r10.stringify(o11), ": ").concat(r10.stringify(i11, null, n10), ","); + }).join("\n"); + } + return null; + } + function zE(e20) { + return (vE(e20) || pE(e20)) && true === e20.edit; + } + function BE(e20) { + return vE(e20) || pE(e20) || mE(e20); + } + function LE(e20) { + return vE(e20) || pE(e20) || gE(e20); + } + function FE(e20) { + switch (e20.type) { + case Xa.key: + return TE(e20.path, false); + case Xa.value: + return RE(e20.path, false); + case Xa.after: + return IE(e20.path); + case Xa.inside: + return NE(e20.path); + } + } + function VE(e20, t10, n10) { + switch (t10) { + case Ya.key: + return TE(n10, false); + case Ya.value: + return RE(n10, false); + case Ya.after: + return IE(n10); + case Ya.inside: + return NE(n10); + case Ya.multi: + case Ya.text: + return DE(n10, n10); + } + } + function HE(e20, t10, n10) { + return t10 && (WE(e20, t10, n10) || AE(mE(t10) ? Qk(t10.focusPath) : t10.path, n10)) ? t10 : null; + } + function WE(e20, t10, n10) { + if (void 0 === e20 || !t10) + return false; + if (vE(t10) || hE(t10) || dE(t10)) + return Ow(t10.path, n10); + if (pE(t10)) + return AE(n10, t10.path); + if (mE(t10)) { + var r10 = xE(e20, t10), o10 = jE(e20, t10), i10 = Qk(t10.focusPath); + if (!AE(n10, i10) || n10.length <= i10.length) + return false; + var a10 = UE(e20, t10, r10), s10 = UE(e20, t10, o10), c10 = UE(e20, t10, n10); + return -1 !== c10 && c10 >= a10 && c10 <= s10; + } + return false; + } + function UE(e20, t10, n10) { + var r10 = Qk(t10.focusPath); + if (!AE(n10, r10) || n10.length <= r10.length) + return -1; + var o10 = n10[r10.length], i10 = Ws(e20, r10); + if (Rs(i10)) + return Object.keys(i10).indexOf(o10); + if (Ts(i10)) { + var a10 = Ul(o10); + if (a10 < i10.length) + return a10; + } + return -1; + } + function JE(e20) { + return mE(e20) ? e20.focusPath : e20.path; + } + function KE(e20) { + return mE(e20) ? e20.anchorPath : e20.path; + } + function GE() { + for (var e20 = [], t10 = arguments.length, n10 = new Array(t10), r10 = 0; r10 < t10; r10++) + n10[r10] = arguments[r10]; + for (var o10 = 0, i10 = n10; o10 < i10.length; o10++) { + var a10 = i10[o10]; + if ("string" == typeof a10 && e20.push(a10), a10 && "object" === Ho(a10)) + for (var s10 in a10) + Object.hasOwnProperty.call(a10, s10) && a10[s10] && e20.push(s10); + } + return e20.join(" "); + } + function QE(e20, t10) { + return GE("jse-value", "jse-" + eu(e20, t10), { "jse-url": nu(e20), "jse-empty": "string" == typeof e20 && 0 === e20.length }); + } + function YE(e20) { + mi(e20, "svelte-zwlnit", ".jse-value.jse-string.svelte-zwlnit{color:var(--jse-value-color-string, #008000)}.jse-value.jse-object.svelte-zwlnit,.jse-value.jse-array.svelte-zwlnit{min-width:16px;color:var(--jse-delimiter-color, rgba(0, 0, 0, 0.38))}.jse-value.jse-number.svelte-zwlnit{color:var(--jse-value-color-number, #ee422e)}.jse-value.jse-boolean.svelte-zwlnit{color:var(--jse-value-color-boolean, #ff8c00)}.jse-value.jse-null.svelte-zwlnit{color:var(--jse-value-color-null, #004ed0)}.jse-value.jse-invalid.svelte-zwlnit{color:var(--jse-text-color, #4d4d4d)}.jse-value.jse-url.svelte-zwlnit{color:var(--jse-value-color-url, #008000);text-decoration:underline}div.jse-editable-div.svelte-zwlnit{min-width:2em;padding:0 5px;box-sizing:border-box;outline:none;border-radius:1px;vertical-align:top;cursor:text !important;word-break:normal;white-space:pre-wrap;overflow-wrap:anywhere}div.jse-editable-div.jse-short-text.svelte-zwlnit{overflow-wrap:normal}div.jse-editable-div[contenteditable=true].svelte-zwlnit{outline:var(--jse-edit-outline, 2px solid #656565);background:inherit !important;position:relative;border-radius:0;z-index:3}div.jse-editable-div.jse-empty.svelte-zwlnit:not(:focus){outline:1px dotted var(--jse-tag-background, rgba(0, 0, 0, 0.2));-moz-outline-radius:2px}div.jse-editable-div.jse-empty.svelte-zwlnit::after{pointer-events:none;color:var(--jse-tag-background, rgba(0, 0, 0, 0.2))}"); + } + function XE(e20) { + var t10, n10, r10, o10; + return { c: function() { + Ai(t10 = ji("div"), "role", "textbox"), Ai(t10, "tabindex", "0"), Ai(t10, "class", n10 = si(GE("jse-editable-div", e20[2], { "jse-short-text": e20[0] })) + " svelte-zwlnit"), Ai(t10, "contenteditable", "true"), Ai(t10, "spellcheck", "false"); + }, m: function(n11, i10) { + ki(n11, t10, i10), e20[13](t10), r10 || (o10 = [Oi(t10, "input", e20[3]), Oi(t10, "keydown", e20[4]), Oi(t10, "paste", e20[5]), Oi(t10, "blur", e20[6])], r10 = true); + }, p: function(e21, r11) { + 5 & jo(r11, 1)[0] && n10 !== (n10 = si(GE("jse-editable-div", e21[2], { "jse-short-text": e21[0] })) + " svelte-zwlnit") && Ai(t10, "class", n10); + }, i: Wo, o: Wo, d: function(n11) { + n11 && wi(t10), e20[13](null), r10 = false, Qo(o10); + } }; + } + function ZE(e20, t10, n10) { + var r10, o10, i10 = Da("jsoneditor:EditableDiv"), a10 = t10.value, s10 = t10.shortText, c10 = void 0 !== s10 && s10, l10 = t10.onChange, u10 = t10.onCancel, f10 = t10.onFind, d10 = t10.onPaste, h10 = void 0 === d10 ? Mf : d10, v10 = t10.onValueClass, p10 = void 0 === v10 ? function() { + return ""; + } : v10, m10 = false; + function g10() { + return r10 ? function(e21) { + return e21.replace(/\n$/, ""); + }(r10.innerText) : ""; + } + function y10(e21) { + r10 && n10(1, r10.innerText = gO(e21), r10); + } + function b10() { + var e21 = g10(); + "" === e21 && y10(""), n10(2, o10 = p10(e21)); + } + function k10() { + m10 = true, u10(); + } + return Gi(function() { + i10("onMount", { value: a10 }), y10(a10), r10 && (xO(r10), n10(1, r10.refresh = b10, r10), n10(1, r10.cancel = k10, r10)); + }), Qi(function() { + var e21 = g10(); + i10("onDestroy", { closed: m10, value: a10, newValue: e21 }), m10 || e21 === a10 || l10(e21, ns.no); + }), e20.$$set = function(e21) { + "value" in e21 && n10(7, a10 = e21.value), "shortText" in e21 && n10(0, c10 = e21.shortText), "onChange" in e21 && n10(8, l10 = e21.onChange), "onCancel" in e21 && n10(9, u10 = e21.onCancel), "onFind" in e21 && n10(10, f10 = e21.onFind), "onPaste" in e21 && n10(11, h10 = e21.onPaste), "onValueClass" in e21 && n10(12, p10 = e21.onValueClass); + }, e20.$$.update = function() { + 4224 & e20.$$.dirty && n10(2, o10 = p10(a10)); + }, [c10, r10, o10, b10, function(e21) { + e21.stopPropagation(); + var t11 = PO(e21); + if ("Escape" === t11 && k10(), "Enter" === t11 || "Tab" === t11) { + m10 = true; + var n11 = g10(); + l10(n11, ns.nextInside); + } + "Ctrl+F" === t11 && (e21.preventDefault(), f10(false)), "Ctrl+H" === t11 && (e21.preventDefault(), f10(true)); + }, function(e21) { + if (e21.stopPropagation(), h10 && e21.clipboardData) { + var t11 = e21.clipboardData.getData("text/plain"); + h10(t11); + } + }, function() { + var e21 = document.hasFocus(), t11 = g10(); + i10("handleBlur", { hasFocus: e21, closed: m10, value: a10, newValue: t11 }), document.hasFocus() && !m10 && (m10 = true, t11 !== a10 && l10(t11, ns.self)); + }, a10, l10, u10, f10, h10, p10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(1, r10 = e21); + }); + }]; + } + var eA = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, ZE, XE, Zo, { value: 7, shortText: 0, onChange: 8, onCancel: 9, onFind: 10, onPaste: 11, onValueClass: 12 }, YE), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function tA(e20) { + var t10, n10; + return t10 = new eA({ props: { value: e20[1].escapeValue(e20[0]), onChange: e20[3], onCancel: e20[4], onPaste: e20[5], onFind: e20[2], onValueClass: e20[6] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = jo(n11, 1)[0], o10 = {}; + 3 & r10 && (o10.value = e21[1].escapeValue(e21[0])), 4 & r10 && (o10.onFind = e21[2]), t10.$set(o10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function nA(e20, t10, n10) { + var r10 = t10.path, o10 = t10.value, i10 = t10.parser, a10 = t10.normalization, s10 = t10.enforceString, c10 = t10.onPatch, l10 = t10.onPasteJson, u10 = t10.onSelect, f10 = t10.onFind, d10 = t10.focus, h10 = t10.findNextInside; + function v10(e21) { + return s10 ? e21 : ru(e21, i10); + } + return e20.$$set = function(e21) { + "path" in e21 && n10(7, r10 = e21.path), "value" in e21 && n10(0, o10 = e21.value), "parser" in e21 && n10(8, i10 = e21.parser), "normalization" in e21 && n10(1, a10 = e21.normalization), "enforceString" in e21 && n10(9, s10 = e21.enforceString), "onPatch" in e21 && n10(10, c10 = e21.onPatch), "onPasteJson" in e21 && n10(11, l10 = e21.onPasteJson), "onSelect" in e21 && n10(12, u10 = e21.onSelect), "onFind" in e21 && n10(2, f10 = e21.onFind), "focus" in e21 && n10(13, d10 = e21.focus), "findNextInside" in e21 && n10(14, h10 = e21.findNextInside); + }, [o10, a10, f10, function(e21, t11) { + c10([{ op: "replace", path: Zs(r10), value: v10(a10.unescapeValue(e21)) }], function(e23, n11) { + if (!n11.selection || Ow(r10, JE(n11.selection))) { + var o11 = t11 === ns.nextInside ? h10(r10) : RE(r10, false); + return { state: Ro(Ro({}, n11), {}, { selection: o11 }) }; + } + }), d10(); + }, function() { + u10(RE(r10, false)), d10(); + }, function(e21) { + try { + var t11 = i10.parse(e21); + Ql(t11) && l10({ path: r10, contents: t11 }); + } catch (e23) { + } + }, function(e21) { + return QE(v10(a10.unescapeValue(e21)), i10); + }, r10, i10, s10, c10, l10, u10, d10, h10]; + } + var rA = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, nA, tA, Zo, { path: 7, value: 0, parser: 8, normalization: 1, enforceString: 9, onPatch: 10, onPasteJson: 11, onSelect: 12, onFind: 2, focus: 13, findNextInside: 14 }), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function oA(e20, t10, n10) { + var r10 = Qk(t10), o10 = Ws(e20, r10); + if (Ts(o10)) { + var i10 = Ul(vb(t10)); + return n10.map(function(e21, t11) { + return { op: "add", path: Zs(r10.concat(String(i10 + t11))), value: e21.value }; + }); + } + if (Rs(o10)) { + var a10 = vb(t10), s10 = Object.keys(o10), c10 = void 0 !== a10 ? iE(s10, a10, true) : []; + return [].concat(Bo(n10.map(function(e21) { + var t11 = eM(e21.key, s10); + return { op: "add", path: Zs(r10.concat(t11)), value: e21.value }; + })), Bo(c10.map(function(e21) { + return uA(r10, e21); + }))); + } + throw new Error("Cannot create insert operations: parent must be an Object or Array"); + } + function iA(e20, t10, n10) { + var r10 = Ws(e20, t10); + if (Array.isArray(r10)) { + var o10 = r10.length; + return n10.map(function(e21, n11) { + return { op: "add", path: Zs(t10.concat(String(o10 + n11))), value: e21.value }; + }); + } + return n10.map(function(e21) { + var n11 = eM(e21.key, Object.keys(r10)); + return { op: "add", path: Zs(t10.concat(n11)), value: e21.value }; + }); + } + function aA(e20, t10, n10, r10) { + var o10 = eM(r10, t10.filter(function(e21) { + return e21 !== n10; + })), i10 = iE(t10, n10, false); + return [{ op: "move", from: Zs(e20.concat(n10)), path: Zs(e20.concat(o10)) }].concat(Bo(i10.map(function(t11) { + return uA(e20, t11); + }))); + } + function sA(e20, t10) { + var n10 = vb(t10); + if (_w(n10)) + throw new Error("Cannot duplicate root object"); + var r10 = Qk(n10), o10 = vb(n10), i10 = Ws(e20, r10); + if (Ts(i10)) { + var a10 = vb(t10), s10 = a10 ? Ul(vb(a10)) + 1 : 0; + return Bo(t10.map(function(e21, t11) { + return { op: "copy", from: Zs(e21), path: Zs(r10.concat(String(t11 + s10))) }; + })); + } + if (Rs(i10)) { + var c10 = Object.keys(i10), l10 = void 0 !== o10 ? iE(c10, o10, false) : []; + return [].concat(Bo(t10.map(function(e21) { + var t11 = eM(vb(e21), c10); + return { op: "copy", from: Zs(e21), path: Zs(r10.concat(t11)) }; + })), Bo(l10.map(function(e21) { + return uA(r10, e21); + }))); + } + throw new Error("Cannot create duplicate operations: parent must be an Object or Array"); + } + function cA(e20, t10, n10, r10) { + if (vE(t10)) { + var o10 = B_(n10, r10), i10 = Qk(t10.path), a10 = Ws(e20, i10); + return aA(i10, Object.keys(a10), vb(t10.path), "string" == typeof o10 ? o10 : n10); + } + if (pE(t10) || mE(t10) && _w(t10.focusPath)) + try { + return [{ op: "replace", path: Zs(JE(t10)), value: L_(n10, function(e21) { + return z_(e21, r10); + }) }]; + } catch (e21) { + return [{ op: "replace", path: Zs(JE(t10)), value: n10 }]; + } + if (mE(t10)) { + var s10 = fA(n10, r10); + return function(e21, t11, n11) { + var r11 = Qk(ck(t11)), o11 = Ws(e21, r11); + if (Ts(o11)) { + var i11 = ck(t11), a11 = i11 ? Ul(vb(i11)) : 0; + return [].concat(Bo(lA(t11)), Bo(n11.map(function(e23, t12) { + return { op: "add", path: Zs(r11.concat(String(t12 + a11))), value: e23.value }; + }))); + } + if (Rs(o11)) { + var s11 = vb(t11), c11 = Qk(s11), l11 = vb(s11), u11 = Object.keys(o11), f11 = void 0 !== l11 ? iE(u11, l11, false) : [], d11 = new Set(t11.map(function(e23) { + return vb(e23); + })), h11 = u11.filter(function(e23) { + return !d11.has(e23); + }); + return [].concat(Bo(lA(t11)), Bo(n11.map(function(e23) { + var t12 = eM(e23.key, h11); + return { op: "add", path: Zs(c11.concat(t12)), value: e23.value }; + })), Bo(f11.map(function(e23) { + return uA(c11, e23); + }))); + } + throw new Error("Cannot create replace operations: parent must be an Object or Array"); + }(e20, kE(e20, t10), s10); + } + if (dE(t10)) { + var c10 = fA(n10, r10), l10 = t10.path, u10 = Qk(l10), f10 = Ws(e20, u10); + if (Ts(f10)) { + var d10 = Ul(vb(l10)); + return oA(e20, u10.concat(String(d10 + 1)), c10); + } + if (Rs(f10)) { + var h10 = String(vb(l10)), v10 = Object.keys(f10); + if (_w(v10) || vb(v10) === h10) + return iA(e20, u10, c10); + var p10 = v10.indexOf(h10), m10 = v10[p10 + 1]; + return oA(e20, u10.concat(m10), c10); + } + throw new Error("Cannot create insert operations: parent must be an Object or Array"); + } + if (hE(t10)) { + var g10 = fA(n10, r10), y10 = t10.path, b10 = Ws(e20, y10); + if (Ts(b10)) + return oA(e20, y10.concat("0"), g10); + if (Rs(b10)) { + var k10 = Object.keys(b10); + if (_w(k10)) + return iA(e20, y10, g10); + var w10 = ck(k10); + return oA(e20, y10.concat(w10), g10); + } + throw new Error("Cannot create insert operations: parent must be an Object or Array"); + } + throw new Error("Cannot insert: unsupported type of selection " + JSON.stringify(t10)); + } + function lA(e20) { + return e20.map(function(e21) { + return { op: "remove", path: Zs(e21) }; + }).reverse(); + } + function uA(e20, t10) { + return { op: "move", from: Zs(e20.concat(t10)), path: Zs(e20.concat(t10)) }; + } + function fA(e20, t10) { + var n10 = /^\s*{/.test(e20), r10 = /^\s*\[/.test(e20), o10 = B_(e20, t10), i10 = void 0 !== o10 ? o10 : L_(e20, function(e21) { + return z_(e21, t10); + }); + return n10 && Gl(i10) || r10 && Array.isArray(i10) ? [{ key: "New item", value: i10 }] : Array.isArray(i10) ? i10.map(function(e21, t11) { + return { key: "New item " + t11, value: e21 }; + }) : Gl(i10) ? Object.keys(i10).map(function(e21) { + return { key: e21, value: i10[e21] }; + }) : [{ key: "New item", value: i10 }]; + } + function dA(e20, t10) { + if (vE(t10)) { + var n10 = Qk(t10.path), r10 = Ws(e20, n10), o10 = aA(n10, Object.keys(r10), vb(t10.path), ""); + return { operations: o10, newSelection: _E(e20, o10) }; + } + if (pE(t10)) + return { operations: [{ op: "replace", path: Zs(t10.path), value: "" }], newSelection: t10 }; + if (mE(t10)) { + var i10 = kE(e20, t10), a10 = lA(i10), s10 = vb(i10); + if (_w(s10)) { + return { operations: [{ op: "replace", path: "", value: "" }], newSelection: RE([], false) }; + } + var c10 = Qk(s10), l10 = Ws(e20, c10); + if (Ts(l10)) { + var u10 = Ul(vb(ck(i10))); + return { operations: a10, newSelection: 0 === u10 ? NE(c10) : IE(c10.concat(String(u10 - 1))) }; + } + if (Rs(l10)) { + var f10 = Object.keys(l10), d10 = vb(ck(i10)), h10 = f10.indexOf(d10), v10 = f10[h10 - 1]; + return { operations: a10, newSelection: 0 === h10 ? NE(c10) : IE(c10.concat(v10)) }; + } + throw new Error("Cannot create remove operations: parent must be an Object or Array"); + } + throw new Error("Cannot remove: unsupported type of selection " + JSON.stringify(t10)); + } + function hA(e20, t10) { + return vc(e20, t10, { before: function(e21, t11, n10) { + if (Is(t11)) { + var r10 = Xs(t11.path); + return { revertOperations: [].concat(Bo(n10), Bo(vA(e21, r10))) }; + } + if (zs(t11)) { + var o10 = Xs(t11.from); + return { revertOperations: [].concat(Bo(n10), Bo(vA(e21, o10))) }; + } + return { document: e21 }; + } }); + } + function vA(e20, t10) { + var n10 = Qk(t10), r10 = vb(t10), o10 = Ws(e20, n10); + return Rs(o10) ? iE(Object.keys(o10), r10, false).map(function(e21) { + return uA(n10, e21); + }) : []; + } + function pA(e20) { + var t10 = e20.activeIndex < e20.items.length - 1 ? e20.activeIndex + 1 : e20.items.length > 0 ? 0 : -1, n10 = e20.items[t10], r10 = e20.items.map(function(e21, n11) { + return Ro(Ro({}, e21), {}, { active: n11 === t10 }); + }); + return Ro(Ro({}, e20), {}, { items: r10, itemsMap: Ak(r10, function(e21) { + return Zs(e21.path); + }), activeItem: n10, activeIndex: t10 }); + } + function mA(e20) { + var t10 = e20.activeIndex > 0 ? e20.activeIndex - 1 : e20.items.length - 1, n10 = e20.items[t10], r10 = e20.items.map(function(e21, n11) { + return Ro(Ro({}, e21), {}, { active: n11 === t10 }); + }); + return Ro(Ro({}, e20), {}, { items: r10, itemsMap: Ak(r10, function(e21) { + return Zs(e21.path); + }), activeItem: n10, activeIndex: t10 }); + } + function gA(e20, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1 / 0, r10 = [], o10 = []; + function i10(e21) { + r10.length < n10 && r10.push(e21); + } + "string" == typeof e20 && "" !== e20 && function e21(t11, a10) { + if (Ts(a10)) { + var s10 = o10.length; + o10.push("0"); + for (var c10 = 0; c10 < a10.length; c10++) + if (o10[s10] = String(c10), e21(t11, a10[c10]), r10.length >= n10) + return; + o10.pop(); + } else if (Rs(a10)) { + var l10 = Object.keys(a10), u10 = o10.length; + o10.push(""); + for (var f10 = 0, d10 = l10; f10 < d10.length; f10++) { + var h10 = d10[f10]; + if (o10[u10] = h10, yA(h10, t11, o10, es.key, i10), e21(t11, a10[h10]), r10.length >= n10) + return; + } + o10.pop(); + } else + yA(String(a10), t11, o10, es.value, i10); + }(e20.toLowerCase(), t10); + return r10; + } + function yA(e20, t10, n10, r10, o10) { + var i10 = e20.toLowerCase(), a10 = 0, s10 = -1, c10 = -1; + do { + -1 !== (c10 = i10.indexOf(t10, s10)) && (s10 = c10 + t10.length, o10({ path: n10.slice(0), field: r10, fieldIndex: a10, start: c10, end: s10 }), a10++); + } while (-1 !== c10); + } + function bA(e20, t10, n10, r10) { + return e20.substring(0, n10) + t10 + e20.substring(r10); + } + function kA(e20, t10, n10) { + var r10 = e20; + return Ab(n10, function(e21) { + r10 = bA(r10, t10, e21.start, e21.end); + }), r10; + } + function wA(e20, t10, n10, r10, o10) { + var i10 = r10.field, a10 = r10.path, s10 = r10.start, c10 = r10.end; + if (i10 === es.key) { + var l10 = Qk(a10), u10 = Ws(e20, l10), f10 = vb(a10), d10 = aA(l10, Object.keys(u10), f10, bA(f10, n10, s10, c10)); + return { newSelection: _E(e20, d10), operations: d10 }; + } + if (i10 === es.value) { + var h10 = Ws(e20, a10); + if (void 0 === h10) + throw new Error("Cannot replace: path not found ".concat(Zs(a10))); + var v10 = "string" == typeof h10 ? h10 : String(h10), p10 = Zs(a10), m10 = oE(h10, t10.enforceStringMap, p10, o10), g10 = bA(v10, n10, s10, c10), y10 = [{ op: "replace", path: Zs(a10), value: m10 ? g10 : ru(g10, o10) }]; + return { newSelection: _E(e20, y10), operations: y10 }; + } + throw new Error("Cannot replace: unknown type of search result field ".concat(i10)); + } + function xA(e20, t10, n10, r10, o10) { + for (var i10 = gA(n10, e20, 1 / 0), a10 = [], s10 = 0; s10 < i10.length; s10++) { + var c10 = i10[s10 - 1], l10 = i10[s10]; + 0 !== s10 && l10.field === c10.field && Ow(l10.path, c10.path) ? vb(a10).items.push(l10) : a10.push({ path: l10.path, field: l10.field, items: [l10] }); + } + a10.sort(function(e21, t11) { + return e21.field !== t11.field ? e21.field === es.key ? 1 : -1 : t11.path.length - e21.path.length; + }); + var u10 = [], f10 = null; + return a10.forEach(function(n11) { + var i11 = n11.field, a11 = n11.path, s11 = n11.items; + if (i11 === es.key) { + var c11 = Qk(a11), l11 = Ws(e20, c11), d10 = vb(a11), h10 = aA(c11, Object.keys(l11), d10, kA(d10, r10, s11)); + u10 = u10.concat(h10), f10 = _E(e20, h10); + } else { + if (i11 !== es.value) + throw new Error("Cannot replace: unknown type of search result field ".concat(i11)); + var v10 = Ws(e20, a11); + if (void 0 === v10) + throw new Error("Cannot replace: path not found ".concat(Zs(a11))); + var p10 = "string" == typeof v10 ? v10 : String(v10), m10 = Zs(a11), g10 = oE(v10, t10.enforceStringMap, m10, o10), y10 = kA(p10, r10, s11), b10 = [{ op: "replace", path: Zs(a11), value: g10 ? y10 : ru(y10, o10) }]; + u10 = u10.concat(b10), f10 = _E(e20, b10); + } + }), { operations: u10, newSelection: f10 }; + } + function jA(e20) { + return e20.path.concat(e20.field, String(e20.fieldIndex)); + } + function SA(e20, t10) { + var n10, r10 = null == e20 || null === (n10 = e20[t10]) || void 0 === n10 ? void 0 : n10.filter(function(e21) { + return e21.field === es.key; + }); + if (r10 && 0 !== r10.length) + return r10; + } + function CA(e20, t10) { + var n10, r10 = null == e20 || null === (n10 = e20[t10]) || void 0 === n10 ? void 0 : n10.filter(function(e21) { + return e21.field === es.value; + }); + if (r10 && 0 !== r10.length) + return r10; + } + function $A(e20) { + mi(e20, "svelte-1n1l5ny", ".jse-highlight.svelte-1n1l5ny{background-color:var(--jse-search-match-color, #ffe665);outline:var(--jse-search-match-outline, 1px solid #ffd700)}.jse-highlight.jse-active.svelte-1n1l5ny{background-color:var(--jse-search-match-active-color, #ffd700);outline:var(--jse-search-match-active-outline, 1px solid #e1be00)}"); + } + function _A(e20, t10, n10) { + var r10 = e20.slice(); + return r10[3] = t10[n10], r10; + } + function OA(e20) { + var t10, n10, r10 = gO(e20[3].text) + ""; + return { c: function() { + t10 = ji("span"), n10 = Ci(r10), Ai(t10, "class", "jse-highlight svelte-1n1l5ny"), zi(t10, "jse-active", e20[3].active); + }, m: function(e21, r11) { + ki(e21, t10, r11), pi(t10, n10); + }, p: function(e21, o10) { + 1 & o10 && r10 !== (r10 = gO(e21[3].text) + "") && Ni(n10, r10), 1 & o10 && zi(t10, "jse-active", e21[3].active); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function MA(e20) { + var t10, n10 = e20[3].text + ""; + return { c: function() { + t10 = Ci(n10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, r10) { + 1 & r10 && n10 !== (n10 = e21[3].text + "") && Ni(t10, n10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function EA(e20) { + var t10; + function n10(e21, t11) { + return "normal" === e21[3].type ? MA : OA; + } + var r10 = n10(e20), o10 = r10(e20); + return { c: function() { + o10.c(), t10 = _i(); + }, m: function(e21, n11) { + o10.m(e21, n11), ki(e21, t10, n11); + }, p: function(e21, i10) { + r10 === (r10 = n10(e21)) && o10 ? o10.p(e21, i10) : (o10.d(1), (o10 = r10(e21)) && (o10.c(), o10.m(t10.parentNode, t10))); + }, d: function(e21) { + e21 && wi(t10), o10.d(e21); + } }; + } + function AA(e20) { + for (var t10, n10 = Ca(e20[0]), r10 = [], o10 = 0; o10 < n10.length; o10 += 1) + r10[o10] = EA(_A(e20, n10, o10)); + return { c: function() { + for (var e21 = 0; e21 < r10.length; e21 += 1) + r10[e21].c(); + t10 = _i(); + }, m: function(e21, n11) { + for (var o11 = 0; o11 < r10.length; o11 += 1) + r10[o11] && r10[o11].m(e21, n11); + ki(e21, t10, n11); + }, p: function(e21, o11) { + var i10 = jo(o11, 1)[0]; + if (1 & i10) { + var a10; + for (n10 = Ca(e21[0]), a10 = 0; a10 < n10.length; a10 += 1) { + var s10 = _A(e21, n10, a10); + r10[a10] ? r10[a10].p(s10, i10) : (r10[a10] = EA(s10), r10[a10].c(), r10[a10].m(t10.parentNode, t10)); + } + for (; a10 < r10.length; a10 += 1) + r10[a10].d(1); + r10.length = n10.length; + } + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10), xi(r10, e21); + } }; + } + function PA(e20, t10, n10) { + var r10, o10 = t10.text, i10 = t10.searchResultItems; + return e20.$$set = function(e21) { + "text" in e21 && n10(1, o10 = e21.text), "searchResultItems" in e21 && n10(2, i10 = e21.searchResultItems); + }, e20.$$.update = function() { + 6 & e20.$$.dirty && n10(0, r10 = function(e21, t11) { + var n11, r11 = [], o11 = 0, i11 = bo(t11); + try { + for (i11.s(); !(n11 = i11.n()).done; ) { + var a10 = n11.value, s10 = e21.slice(o11, a10.start); + "" !== s10 && r11.push({ type: "normal", text: s10, active: false }); + var c10 = e21.slice(a10.start, a10.end); + r11.push({ type: "highlight", text: c10, active: a10.active }), o11 = a10.end; + } + } catch (e23) { + i11.e(e23); + } finally { + i11.f(); + } + var l10 = vb(t11); + return l10 && l10.end < e21.length && r11.push({ type: "normal", text: e21.slice(l10.end), active: false }), r11; + }(String(o10), i10)); + }, [r10, o10, i10]; + } + var TA = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, PA, AA, Xo, { text: 1, searchResultItems: 2 }, $A), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function RA(e20) { + mi(e20, "svelte-1v88515", '.jse-value.jse-string.svelte-1v88515{color:var(--jse-value-color-string, #008000)}.jse-value.jse-object.svelte-1v88515,.jse-value.jse-array.svelte-1v88515{min-width:16px;color:var(--jse-delimiter-color, rgba(0, 0, 0, 0.38))}.jse-value.jse-number.svelte-1v88515{color:var(--jse-value-color-number, #ee422e)}.jse-value.jse-boolean.svelte-1v88515{color:var(--jse-value-color-boolean, #ff8c00)}.jse-value.jse-null.svelte-1v88515{color:var(--jse-value-color-null, #004ed0)}.jse-value.jse-invalid.svelte-1v88515{color:var(--jse-text-color, #4d4d4d)}.jse-value.jse-url.svelte-1v88515{color:var(--jse-value-color-url, #008000);text-decoration:underline}.jse-value.svelte-1v88515{min-width:2em;padding:0 5px;box-sizing:border-box;outline:none;border-radius:1px;vertical-align:top;cursor:var(--jse-contents-cursor, pointer);word-break:normal;overflow-wrap:anywhere;white-space:pre-wrap}.jse-value.svelte-1v88515:hover{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06))}.jse-value.jse-empty.svelte-1v88515{min-width:4em;outline:1px dotted var(--jse-tag-background, rgba(0, 0, 0, 0.2));-moz-outline-radius:2px}.jse-value.jse-empty.svelte-1v88515::after{pointer-events:none;color:var(--jse-tag-background, rgba(0, 0, 0, 0.2));content:"value"}'); + } + function NA(e20) { + var t10, n10 = gO(e20[1].escapeValue(e20[0])) + ""; + return { c: function() { + t10 = Ci(n10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, r10) { + 3 & r10 && n10 !== (n10 = gO(e21[1].escapeValue(e21[0])) + "") && Ni(t10, n10); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function IA(e20) { + var t10, n10; + return t10 = new TA({ props: { text: e20[1].escapeValue(e20[0]), searchResultItems: e20[3] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 3 & n11 && (r10.text = e21[1].escapeValue(e21[0])), 8 & n11 && (r10.searchResultItems = e21[3]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function DA(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = [IA, NA], u10 = []; + function f10(e21, t11) { + return e21[3] ? 0 : 1; + } + return n10 = f10(e20), r10 = u10[n10] = l10[n10](e20), { c: function() { + t10 = ji("div"), r10.c(), Ai(t10, "role", "button"), Ai(t10, "tabindex", "-1"), Ai(t10, "data-type", "selectable-value"), Ai(t10, "class", o10 = si(QE(e20[0], e20[2])) + " svelte-1v88515"), Ai(t10, "title", i10 = e20[4] ? "Ctrl+Click or Ctrl+Enter to open url in new window" : null); + }, m: function(r11, o11) { + ki(r11, t10, o11), u10[n10].m(t10, null), a10 = true, s10 || (c10 = [Oi(t10, "click", e20[5]), Oi(t10, "dblclick", e20[6])], s10 = true); + }, p: function(e21, s11) { + var c11 = jo(s11, 1)[0], d10 = n10; + (n10 = f10(e21)) === d10 ? u10[n10].p(e21, c11) : (ba(), xa(u10[d10], 1, 1, function() { + u10[d10] = null; + }), ka(), (r10 = u10[n10]) ? r10.p(e21, c11) : (r10 = u10[n10] = l10[n10](e21)).c(), wa(r10, 1), r10.m(t10, null)), (!a10 || 5 & c11 && o10 !== (o10 = si(QE(e21[0], e21[2])) + " svelte-1v88515")) && Ai(t10, "class", o10), (!a10 || 16 & c11 && i10 !== (i10 = e21[4] ? "Ctrl+Click or Ctrl+Enter to open url in new window" : null)) && Ai(t10, "title", i10); + }, i: function(e21) { + a10 || (wa(r10), a10 = true); + }, o: function(e21) { + xa(r10), a10 = false; + }, d: function(e21) { + e21 && wi(t10), u10[n10].d(), s10 = false, Qo(c10); + } }; + } + function qA(e20, t10, n10) { + var r10, o10 = t10.path, i10 = t10.value, a10 = t10.readOnly, s10 = t10.normalization, c10 = t10.parser, l10 = t10.onSelect, u10 = t10.searchResultItems; + return e20.$$set = function(e21) { + "path" in e21 && n10(7, o10 = e21.path), "value" in e21 && n10(0, i10 = e21.value), "readOnly" in e21 && n10(8, a10 = e21.readOnly), "normalization" in e21 && n10(1, s10 = e21.normalization), "parser" in e21 && n10(2, c10 = e21.parser), "onSelect" in e21 && n10(9, l10 = e21.onSelect), "searchResultItems" in e21 && n10(3, u10 = e21.searchResultItems); + }, e20.$$.update = function() { + 1 & e20.$$.dirty && n10(4, r10 = nu(i10)); + }, [i10, s10, c10, u10, r10, function(e21) { + "string" == typeof i10 && r10 && e21.ctrlKey && (e21.preventDefault(), e21.stopPropagation(), window.open(i10, "_blank")); + }, function(e21) { + a10 || (e21.preventDefault(), l10(RE(o10, true))); + }, o10, a10, l10]; + } + var zA = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, qA, DA, Zo, { path: 7, value: 0, readOnly: 8, normalization: 1, parser: 2, onSelect: 9, searchResultItems: 3 }, RA), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function BA(e20) { + mi(e20, "svelte-1sftg37", '.jse-tooltip.svelte-1sftg37{font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px);border-radius:3px;background:var(--jse-context-menu-background, #656565);color:var(--jse-context-menu-color, var(--jse-text-color-inverse, #fff));white-space:nowrap;box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24))}'); + } + function LA(e20) { + var t10, n10; + return { c: function() { + t10 = ji("div"), n10 = Ci(e20[0]), Ai(t10, "class", "jse-tooltip svelte-1sftg37"); + }, m: function(e21, r10) { + ki(e21, t10, r10), pi(t10, n10); + }, p: function(e21, t11) { + 1 & jo(t11, 1)[0] && Ni(n10, e21[0]); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function FA(e20, t10, n10) { + var r10 = t10.text; + return e20.$$set = function(e21) { + "text" in e21 && n10(0, r10 = e21.text); + }, [r10]; + } + var VA = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, FA, LA, Xo, { text: 0 }, BA), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function HA(e20, t10) { + var n10, r10 = t10.text, o10 = t10.openAbsolutePopup, i10 = t10.closeAbsolutePopup; + function a10() { + n10 = o10(VA, { text: r10 }, { position: "top", width: 10 * r10.length, offsetTop: 3, anchor: e20, closeOnOuterClick: true }); + } + function s10() { + i10(n10); + } + return e20.addEventListener("mouseenter", a10), e20.addEventListener("mouseleave", s10), { destroy: function() { + e20.removeEventListener("mouseenter", a10), e20.removeEventListener("mouseleave", s10); + } }; + } + function WA(e20) { + mi(e20, "svelte-1sqrs1u", ".jse-timestamp.svelte-1sqrs1u{padding:0;margin:0;vertical-align:middle;display:inline-flex;color:var(--jse-value-color-number, #ee422e)}"); + } + function UA(e20) { + var t10, n10, r10, o10, i10, a10; + return n10 = new jM({ props: { data: sM } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-timestamp svelte-1sqrs1u"); + }, m: function(s10, c10) { + ki(s10, t10, c10), Ta(n10, t10, null), o10 = true, i10 || (a10 = ci(r10 = HA.call(null, t10, Ro({ text: e20[0] }, e20[1]))), i10 = true); + }, p: function(e21, t11) { + var n11 = jo(t11, 1)[0]; + r10 && Yo(r10.update) && 1 & n11 && r10.update.call(null, Ro({ text: e21[0] }, e21[1])); + }, i: function(e21) { + o10 || (wa(n10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), i10 = false, a10(); + } }; + } + function JA(e20, t10, n10) { + var r10, o10 = Zi("absolute-popup"), i10 = t10.value; + return e20.$$set = function(e21) { + "value" in e21 && n10(2, i10 = e21.value); + }, e20.$$.update = function() { + 4 & e20.$$.dirty && n10(0, r10 = "Time: ".concat(new Date(i10).toString())); + }, [r10, o10, i10]; + } + var KA = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, JA, UA, Zo, { value: 2 }, WA), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function GA(e20) { + var t10 = e20.path, n10 = e20.value, r10 = e20.readOnly, o10 = e20.enforceString, i10 = e20.searchResultItems, a10 = e20.isEditing, s10 = e20.parser, c10 = e20.normalization, l10 = e20.onPatch, u10 = e20.onPasteJson, f10 = e20.onSelect, d10 = e20.onFind, h10 = e20.findNextInside, v10 = e20.focus, p10 = []; + return !a10 && /* @__PURE__ */ function(e21) { + return true === e21 || false === e21; + }(n10) && p10.push({ component: _M, props: { path: t10, value: n10, readOnly: r10, onPatch: l10, focus: v10 } }), !a10 && function(e21) { + return "string" == typeof e21 && e21.length < 99 && !!Xl(e21); + }(n10) && p10.push({ component: NM, props: { path: t10, value: n10, readOnly: r10, onPatch: l10, focus: v10 } }), a10 && p10.push({ component: rA, props: { path: t10, value: n10, enforceString: o10, parser: s10, normalization: c10, onPatch: l10, onPasteJson: u10, onSelect: f10, onFind: d10, findNextInside: h10, focus: v10 } }), a10 || p10.push({ component: zA, props: { path: t10, value: n10, readOnly: r10, parser: s10, normalization: c10, searchResultItems: i10, onSelect: f10 } }), !a10 && Yl(n10) && p10.push({ component: KA, props: { value: n10 } }), p10; + } + var QA = { prefix: "fas", iconName: "trash-can", icon: [448, 512, [61460, "trash-alt"], "f2ed", "M135.2 17.7C140.6 6.8 151.7 0 163.8 0H284.2c12.1 0 23.2 6.8 28.6 17.7L320 32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32h96l7.2-14.3zM32 128H416V448c0 35.3-28.7 64-64 64H96c-35.3 0-64-28.7-64-64V128zm96 64c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16z"] }; + var YA = { prefix: "fas", iconName: "caret-right", icon: [256, 512, [], "f0da", "M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z"] }; + var XA = { prefix: "fas", iconName: "paste", icon: [512, 512, ["file-clipboard"], "f0ea", "M160 0c-23.7 0-44.4 12.9-55.4 32H48C21.5 32 0 53.5 0 80V400c0 26.5 21.5 48 48 48H192V176c0-44.2 35.8-80 80-80h48V80c0-26.5-21.5-48-48-48H215.4C204.4 12.9 183.7 0 160 0zM272 128c-26.5 0-48 21.5-48 48V448v16c0 26.5 21.5 48 48 48H464c26.5 0 48-21.5 48-48V243.9c0-12.7-5.1-24.9-14.1-33.9l-67.9-67.9c-9-9-21.2-14.1-33.9-14.1H320 272zM160 40a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"] }; + var ZA = { prefix: "fas", iconName: "circle-notch", icon: [512, 512, [], "f1ce", "M222.7 32.1c5 16.9-4.6 34.8-21.5 39.8C121.8 95.6 64 169.1 64 256c0 106 86 192 192 192s192-86 192-192c0-86.9-57.8-160.4-137.1-184.1c-16.9-5-26.6-22.9-21.5-39.8s22.9-26.6 39.8-21.5C434.9 42.1 512 140 512 256c0 141.4-114.6 256-256 256S0 397.4 0 256C0 140 77.1 42.1 182.9 10.6c16.9-5 34.8 4.6 39.8 21.5z"] }; + var eP = { prefix: "fas", iconName: "scissors", icon: [512, 512, [9984, 9986, 9988, "cut"], "f0c4", "M256 192l-39.5-39.5c4.9-12.6 7.5-26.2 7.5-40.5C224 50.1 173.9 0 112 0S0 50.1 0 112s50.1 112 112 112c14.3 0 27.9-2.7 40.5-7.5L192 256l-39.5 39.5c-12.6-4.9-26.2-7.5-40.5-7.5C50.1 288 0 338.1 0 400s50.1 112 112 112s112-50.1 112-112c0-14.3-2.7-27.9-7.5-40.5L499.2 76.8c7.1-7.1 7.1-18.5 0-25.6c-28.3-28.3-74.1-28.3-102.4 0L256 192zm22.6 150.6L396.8 460.8c28.3 28.3 74.1 28.3 102.4 0c7.1-7.1 7.1-18.5 0-25.6L342.6 278.6l-64 64zM64 112a48 48 0 1 1 96 0 48 48 0 1 1 -96 0zm48 240a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"] }; + var tP = { prefix: "fas", iconName: "square-caret-down", icon: [448, 512, ["caret-square-down"], "f150", "M384 480c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0zM224 352c-6.7 0-13-2.8-17.6-7.7l-104-112c-6.5-7-8.2-17.2-4.4-25.9s12.5-14.4 22-14.4l208 0c9.5 0 18.2 5.7 22 14.4s2.1 18.9-4.4 25.9l-104 112c-4.5 4.9-10.9 7.7-17.6 7.7z"] }; + var nP = { prefix: "fas", iconName: "caret-left", icon: [256, 512, [], "f0d9", "M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z"] }; + var rP = { prefix: "fas", iconName: "pen-to-square", icon: [512, 512, ["edit"], "f044", "M471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7zm-299.2 220c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3 172.4 241.7zM96 64C43 64 0 107 0 160V416c0 53 43 96 96 96H352c53 0 96-43 96-96V320c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H96z"] }; + var oP = { prefix: "fas", iconName: "chevron-up", icon: [512, 512, [], "f077", "M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"] }; + var iP = { prefix: "fas", iconName: "angle-right", icon: [320, 512, [8250], "f105", "M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"] }; + var aP = { prefix: "fas", iconName: "square-caret-up", icon: [448, 512, ["caret-square-up"], "f151", "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zM224 160c6.7 0 13 2.8 17.6 7.7l104 112c6.5 7 8.2 17.2 4.4 25.9s-12.5 14.4-22 14.4H120c-9.5 0-18.2-5.7-22-14.4s-2.1-18.9 4.4-25.9l104-112c4.5-4.9 10.9-7.7 17.6-7.7z"] }; + var sP = { prefix: "fas", iconName: "caret-up", icon: [320, 512, [], "f0d8", "M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8H288c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z"] }; + var cP = { prefix: "fas", iconName: "filter", icon: [512, 512, [], "f0b0", "M3.9 54.9C10.5 40.9 24.5 32 40 32H472c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9V448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6V320.9L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"] }; + var lP = { prefix: "fas", iconName: "code", icon: [640, 512, [], "f121", "M392.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm80.6 120.1c-12.5 12.5-12.5 32.8 0 45.3L562.7 256l-89.4 89.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l112-112c12.5-12.5 12.5-32.8 0-45.3l-112-112c-12.5-12.5-32.8-12.5-45.3 0zm-306.7 0c-12.5-12.5-32.8-12.5-45.3 0l-112 112c-12.5 12.5-12.5 32.8 0 45.3l112 112c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256l89.4-89.4c12.5-12.5 12.5-32.8 0-45.3z"] }; + var uP = { prefix: "fas", iconName: "wrench", icon: [512, 512, [128295], "f0ad", "M352 320c88.4 0 160-71.6 160-160c0-15.3-2.2-30.1-6.2-44.2c-3.1-10.8-16.4-13.2-24.3-5.3l-76.8 76.8c-3 3-7.1 4.7-11.3 4.7H336c-8.8 0-16-7.2-16-16V118.6c0-4.2 1.7-8.3 4.7-11.3l76.8-76.8c7.9-7.9 5.4-21.2-5.3-24.3C382.1 2.2 367.3 0 352 0C263.6 0 192 71.6 192 160c0 19.1 3.4 37.5 9.5 54.5L19.9 396.1C7.2 408.8 0 426.1 0 444.1C0 481.6 30.4 512 67.9 512c18 0 35.3-7.2 48-19.9L297.5 310.5c17 6.2 35.4 9.5 54.5 9.5zM80 408a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"] }; + var fP = { prefix: "fas", iconName: "eye", icon: [576, 512, [128065], "f06e", "M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM144 256a144 144 0 1 1 288 0 144 144 0 1 1 -288 0zm144-64c0 35.3-28.7 64-64 64c-7.1 0-13.9-1.2-20.3-3.3c-5.5-1.8-11.9 1.6-11.7 7.4c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3z"] }; + var dP = { prefix: "fas", iconName: "pen", icon: [512, 512, [128394], "f304", "M362.7 19.3L314.3 67.7 444.3 197.7l48.4-48.4c25-25 25-65.5 0-90.5L453.3 19.3c-25-25-65.5-25-90.5 0zm-71 71L58.6 323.5c-10.4 10.4-18 23.3-22.2 37.4L1 481.2C-1.5 489.7 .8 498.8 7 505s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2L421.7 220.3 291.7 90.3z"] }; + var hP = { prefix: "fas", iconName: "arrow-rotate-right", icon: [512, 512, [8635, "arrow-right-rotate", "arrow-rotate-forward", "redo"], "f01e", "M386.3 160H336c-17.7 0-32 14.3-32 32s14.3 32 32 32H464c17.7 0 32-14.3 32-32V64c0-17.7-14.3-32-32-32s-32 14.3-32 32v51.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0s-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3s163.8-62.5 226.3 0L386.3 160z"] }; + var vP = { prefix: "fas", iconName: "arrow-rotate-left", icon: [512, 512, [8634, "arrow-left-rotate", "arrow-rotate-back", "arrow-rotate-backward", "undo"], "f0e2", "M125.7 160H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H48c-17.7 0-32-14.3-32-32V64c0-17.7 14.3-32 32-32s32 14.3 32 32v51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"] }; + var pP = { prefix: "fas", iconName: "crop-simple", icon: [512, 512, ["crop-alt"], "f565", "M128 32c0-17.7-14.3-32-32-32S64 14.3 64 32V64H32C14.3 64 0 78.3 0 96s14.3 32 32 32H64V384c0 35.3 28.7 64 64 64H352V384H128V32zM384 480c0 17.7 14.3 32 32 32s32-14.3 32-32V448h32c17.7 0 32-14.3 32-32s-14.3-32-32-32H448l0-256c0-35.3-28.7-64-64-64L160 64v64l224 0 0 352z"] }; + var mP = { prefix: "fas", iconName: "gear", icon: [512, 512, [9881, "cog"], "f013", "M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z"] }; + var gP = { prefix: "fas", iconName: "caret-down", icon: [320, 512, [], "f0d7", "M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"] }; + var yP = { prefix: "fas", iconName: "ellipsis-vertical", icon: [128, 512, ["ellipsis-v"], "f142", "M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"] }; + var bP = { prefix: "fas", iconName: "arrow-right-arrow-left", icon: [448, 512, [8644, "exchange"], "f0ec", "M438.6 150.6c12.5-12.5 12.5-32.8 0-45.3l-96-96c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.7 96 32 96C14.3 96 0 110.3 0 128s14.3 32 32 32l306.7 0-41.4 41.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l96-96zm-333.3 352c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 416 416 416c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0 41.4-41.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3l96 96z"] }; + var kP = { prefix: "fas", iconName: "arrow-down-short-wide", icon: [576, 512, ["sort-amount-desc", "sort-amount-down-alt"], "f884", "M151.6 469.6C145.5 476.2 137 480 128 480s-17.5-3.8-23.6-10.4l-88-96c-11.9-13-11.1-33.3 2-45.2s33.3-11.1 45.2 2L96 365.7V64c0-17.7 14.3-32 32-32s32 14.3 32 32V365.7l32.4-35.4c11.9-13 32.2-13.9 45.2-2s13.9 32.2 2 45.2l-88 96zM320 32h32c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 128h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 128H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 128H544c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32s14.3-32 32-32z"] }; + var wP = { prefix: "fas", iconName: "angle-down", icon: [448, 512, [8964], "f107", "M201.4 342.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 274.7 86.6 137.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"] }; + var xP = { prefix: "fas", iconName: "arrow-down", icon: [384, 512, [8595], "f063", "M169.4 470.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 370.8 224 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 306.7L54.6 265.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"] }; + var jP = { prefix: "fas", iconName: "magnifying-glass", icon: [512, 512, [128269, "search"], "f002", "M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"] }; + var SP = { prefix: "fas", iconName: "chevron-down", icon: [512, 512, [], "f078", "M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"] }; + var CP = { prefix: "fas", iconName: "copy", icon: [448, 512, [], "f0c5", "M208 0H332.1c12.7 0 24.9 5.1 33.9 14.1l67.9 67.9c9 9 14.1 21.2 14.1 33.9V336c0 26.5-21.5 48-48 48H208c-26.5 0-48-21.5-48-48V48c0-26.5 21.5-48 48-48zM48 128h80v64H64V448H256V416h64v48c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V176c0-26.5 21.5-48 48-48z"] }; + var $P = { prefix: "fas", iconName: "plus", icon: [448, 512, [10133, 61543, "add"], "2b", "M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z"] }; + var _P = { prefix: "fas", iconName: "xmark", icon: [384, 512, [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], "f00d", "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"] }; + var OP = _P; + var MP = _P; + var EP = { prefix: "fas", iconName: "rotate", icon: [512, 512, [128260, "sync-alt"], "f2f1", "M142.9 142.9c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8H463.5c0 0 0 0 0 0H472c13.3 0 24-10.7 24-24V72c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1C73.2 122 55.6 150.7 44.8 181.4c-5.9 16.7 2.9 34.9 19.5 40.8s34.9-2.9 40.8-19.5c7.7-21.8 20.2-42.3 37.8-59.8zM16 312v7.6 .7V440c0 9.7 5.8 18.5 14.8 22.2s19.3 1.7 26.2-5.2l41.6-41.6c87.6 86.5 228.7 86.2 315.8-1c24.4-24.4 42.1-53.1 52.9-83.7c5.9-16.7-2.9-34.9-19.5-40.8s-34.9 2.9-40.8 19.5c-7.7 21.8-20.2 42.3-37.8 59.8c-62.2 62.2-162.7 62.5-225.3 1L185 329c6.9-6.9 8.9-17.2 5.2-26.2s-12.5-14.8-22.2-14.8H48.4h-.7H40c-13.3 0-24 10.7-24 24z"] }; + var AP = { prefix: "fas", iconName: "clone", icon: [512, 512, [], "f24d", "M288 448H64V224h64V160H64c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H288c35.3 0 64-28.7 64-64V384H288v64zm-64-96H448c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H224c-35.3 0-64 28.7-64 64V288c0 35.3 28.7 64 64 64z"] }; + var PP = { prefix: "fas", iconName: "check", icon: [448, 512, [10003, 10004], "f00c", "M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"] }; + var TP = { prefix: "fas", iconName: "triangle-exclamation", icon: [512, 512, [9888, "exclamation-triangle", "warning"], "f071", "M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"] }; + var RP = {}; + var NP = { showWizard: true, showOriginal: true }; + var IP = Math.min; + var DP = Math.max; + var qP = Math.round; + var zP = Math.floor; + var BP = function(e20) { + return { x: e20, y: e20 }; + }; + var LP = { left: "right", right: "left", bottom: "top", top: "bottom" }; + var FP = { start: "end", end: "start" }; + function VP(e20, t10, n10) { + return DP(e20, IP(t10, n10)); + } + function HP(e20, t10) { + return "function" == typeof e20 ? e20(t10) : e20; + } + function WP(e20) { + return e20.split("-")[0]; + } + function UP(e20) { + return e20.split("-")[1]; + } + function JP(e20) { + return "x" === e20 ? "y" : "x"; + } + function KP(e20) { + return "y" === e20 ? "height" : "width"; + } + function GP(e20) { + return ["top", "bottom"].includes(WP(e20)) ? "y" : "x"; + } + function QP(e20) { + return JP(GP(e20)); + } + function YP(e20, t10, n10) { + void 0 === n10 && (n10 = false); + var r10 = UP(e20), o10 = QP(e20), i10 = KP(o10), a10 = "x" === o10 ? r10 === (n10 ? "end" : "start") ? "right" : "left" : "start" === r10 ? "bottom" : "top"; + return t10.reference[i10] > t10.floating[i10] && (a10 = tT(a10)), [a10, tT(a10)]; + } + function XP(e20) { + var t10 = tT(e20); + return [ZP(e20), t10, ZP(t10)]; + } + function ZP(e20) { + return e20.replace(/start|end/g, function(e21) { + return FP[e21]; + }); + } + function eT(e20, t10, n10, r10) { + var o10 = UP(e20), i10 = function(e21, t11, n11) { + var r11 = ["left", "right"], o11 = ["right", "left"]; + switch (e21) { + case "top": + case "bottom": + return n11 ? t11 ? o11 : r11 : t11 ? r11 : o11; + case "left": + case "right": + return t11 ? ["top", "bottom"] : ["bottom", "top"]; + default: + return []; + } + }(WP(e20), "start" === n10, r10); + return o10 && (i10 = i10.map(function(e21) { + return e21 + "-" + o10; + }), t10 && (i10 = i10.concat(i10.map(ZP)))), i10; + } + function tT(e20) { + return e20.replace(/left|right|bottom|top/g, function(e21) { + return LP[e21]; + }); + } + function nT(e20) { + return "number" != typeof e20 ? function(e21) { + return Ro({ top: 0, right: 0, bottom: 0, left: 0 }, e21); + }(e20) : { top: e20, right: e20, bottom: e20, left: e20 }; + } + function rT(e20) { + return Ro(Ro({}, e20), {}, { top: e20.y, left: e20.x, right: e20.x + e20.width, bottom: e20.y + e20.height }); + } + function oT(e20, t10, n10) { + var r10, o10 = e20.reference, i10 = e20.floating, a10 = GP(t10), s10 = QP(t10), c10 = KP(s10), l10 = WP(t10), u10 = "y" === a10, f10 = o10.x + o10.width / 2 - i10.width / 2, d10 = o10.y + o10.height / 2 - i10.height / 2, h10 = o10[c10] / 2 - i10[c10] / 2; + switch (l10) { + case "top": + r10 = { x: f10, y: o10.y - i10.height }; + break; + case "bottom": + r10 = { x: f10, y: o10.y + o10.height }; + break; + case "right": + r10 = { x: o10.x + o10.width, y: d10 }; + break; + case "left": + r10 = { x: o10.x - i10.width, y: d10 }; + break; + default: + r10 = { x: o10.x, y: o10.y }; + } + switch (UP(t10)) { + case "start": + r10[s10] -= h10 * (n10 && u10 ? -1 : 1); + break; + case "end": + r10[s10] += h10 * (n10 && u10 ? -1 : 1); + } + return r10; + } + var iT = function() { + var e20 = xo(ko().mark(function e21(t10, n10, r10) { + var o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, _10, O10, M10; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return o10 = r10.placement, i10 = void 0 === o10 ? "bottom" : o10, a10 = r10.strategy, s10 = void 0 === a10 ? "absolute" : a10, c10 = r10.middleware, l10 = void 0 === c10 ? [] : c10, u10 = r10.platform, f10 = l10.filter(Boolean), e23.next = 4, null == u10.isRTL ? void 0 : u10.isRTL(n10); + case 4: + return d10 = e23.sent, e23.next = 7, u10.getElementRects({ reference: t10, floating: n10, strategy: s10 }); + case 7: + h10 = e23.sent, v10 = oT(h10, i10, d10), p10 = v10.x, m10 = v10.y, g10 = i10, y10 = {}, b10 = 0, k10 = 0; + case 13: + if (!(k10 < f10.length)) { + e23.next = 46; + break; + } + return w10 = f10[k10], x10 = w10.name, j10 = w10.fn, e23.next = 17, j10({ x: p10, y: m10, initialPlacement: i10, placement: g10, strategy: s10, middlewareData: y10, rects: h10, platform: u10, elements: { reference: t10, floating: n10 } }); + case 17: + if (S10 = e23.sent, C10 = S10.x, $10 = S10.y, _10 = S10.data, O10 = S10.reset, p10 = null != C10 ? C10 : p10, m10 = null != $10 ? $10 : m10, y10 = Ro(Ro({}, y10), {}, qo({}, x10, Ro(Ro({}, y10[x10]), _10))), !(O10 && b10 <= 50)) { + e23.next = 43; + break; + } + if (b10++, "object" !== Ho(O10)) { + e23.next = 41; + break; + } + if (O10.placement && (g10 = O10.placement), !O10.rects) { + e23.next = 38; + break; + } + if (true !== O10.rects) { + e23.next = 36; + break; + } + return e23.next = 33, u10.getElementRects({ reference: t10, floating: n10, strategy: s10 }); + case 33: + e23.t0 = e23.sent, e23.next = 37; + break; + case 36: + e23.t0 = O10.rects; + case 37: + h10 = e23.t0; + case 38: + M10 = oT(h10, g10, d10), p10 = M10.x, m10 = M10.y; + case 41: + return k10 = -1, e23.abrupt("continue", 43); + case 43: + k10++, e23.next = 13; + break; + case 46: + return e23.abrupt("return", { x: p10, y: m10, placement: g10, strategy: s10, middlewareData: y10 }); + case 47: + case "end": + return e23.stop(); + } + }, e21); + })); + return function(t10, n10, r10) { + return e20.apply(this, arguments); + }; + }(); + function aT(e20, t10) { + return sT.apply(this, arguments); + } + function sT() { + return sT = xo(ko().mark(function e20(t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, _10; + return ko().wrap(function(e21) { + for (; ; ) + switch (e21.prev = e21.next) { + case 0: + return void 0 === n10 && (n10 = {}), o10 = t10.x, i10 = t10.y, a10 = t10.platform, s10 = t10.rects, c10 = t10.elements, l10 = t10.strategy, u10 = HP(n10, t10), f10 = u10.boundary, d10 = void 0 === f10 ? "clippingAncestors" : f10, h10 = u10.rootBoundary, v10 = void 0 === h10 ? "viewport" : h10, p10 = u10.elementContext, m10 = void 0 === p10 ? "floating" : p10, g10 = u10.altBoundary, y10 = void 0 !== g10 && g10, b10 = u10.padding, k10 = nT(void 0 === b10 ? 0 : b10), w10 = "floating" === m10 ? "reference" : "floating", x10 = c10[y10 ? w10 : m10], e21.t0 = rT, e21.t1 = a10, e21.next = 10, null == a10.isElement ? void 0 : a10.isElement(x10); + case 10: + if (e21.t2 = r10 = e21.sent, null == e21.t2) { + e21.next = 15; + break; + } + e21.t3 = r10, e21.next = 16; + break; + case 15: + e21.t3 = true; + case 16: + if (!e21.t3) { + e21.next = 20; + break; + } + e21.t4 = x10, e21.next = 26; + break; + case 20: + if (e21.t5 = x10.contextElement, e21.t5) { + e21.next = 25; + break; + } + return e21.next = 24, null == a10.getDocumentElement ? void 0 : a10.getDocumentElement(c10.floating); + case 24: + e21.t5 = e21.sent; + case 25: + e21.t4 = e21.t5; + case 26: + return e21.t6 = e21.t4, e21.t7 = d10, e21.t8 = v10, e21.t9 = l10, e21.t10 = { element: e21.t6, boundary: e21.t7, rootBoundary: e21.t8, strategy: e21.t9 }, e21.next = 33, e21.t1.getClippingRect.call(e21.t1, e21.t10); + case 33: + return e21.t11 = e21.sent, j10 = (0, e21.t0)(e21.t11), S10 = "floating" === m10 ? Ro(Ro({}, s10.floating), {}, { x: o10, y: i10 }) : s10.reference, e21.next = 38, null == a10.getOffsetParent ? void 0 : a10.getOffsetParent(c10.floating); + case 38: + return C10 = e21.sent, e21.next = 41, null == a10.isElement ? void 0 : a10.isElement(C10); + case 41: + if (!e21.sent) { + e21.next = 50; + break; + } + return e21.next = 44, null == a10.getScale ? void 0 : a10.getScale(C10); + case 44: + if (e21.t13 = e21.sent, e21.t13) { + e21.next = 47; + break; + } + e21.t13 = { x: 1, y: 1 }; + case 47: + e21.t12 = e21.t13, e21.next = 51; + break; + case 50: + e21.t12 = { x: 1, y: 1 }; + case 51: + if ($10 = e21.t12, e21.t14 = rT, !a10.convertOffsetParentRelativeRectToViewportRelativeRect) { + e21.next = 59; + break; + } + return e21.next = 56, a10.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: S10, offsetParent: C10, strategy: l10 }); + case 56: + e21.t15 = e21.sent, e21.next = 60; + break; + case 59: + e21.t15 = S10; + case 60: + return e21.t16 = e21.t15, _10 = (0, e21.t14)(e21.t16), e21.abrupt("return", { top: (j10.top - _10.top + k10.top) / $10.y, bottom: (_10.bottom - j10.bottom + k10.bottom) / $10.y, left: (j10.left - _10.left + k10.left) / $10.x, right: (_10.right - j10.right + k10.right) / $10.x }); + case 63: + case "end": + return e21.stop(); + } + }, e20); + })), sT.apply(this, arguments); + } + function cT(e20, t10) { + return lT.apply(this, arguments); + } + function lT() { + return lT = xo(ko().mark(function e20(t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10; + return ko().wrap(function(e21) { + for (; ; ) + switch (e21.prev = e21.next) { + case 0: + return r10 = t10.placement, o10 = t10.platform, i10 = t10.elements, e21.next = 3, null == o10.isRTL ? void 0 : o10.isRTL(i10.floating); + case 3: + return a10 = e21.sent, s10 = WP(r10), c10 = UP(r10), l10 = "y" === GP(r10), u10 = ["left", "top"].includes(s10) ? -1 : 1, f10 = a10 && l10 ? -1 : 1, d10 = HP(n10, t10), h10 = "number" == typeof d10 ? { mainAxis: d10, crossAxis: 0, alignmentAxis: null } : Ro({ mainAxis: 0, crossAxis: 0, alignmentAxis: null }, d10), v10 = h10.mainAxis, p10 = h10.crossAxis, m10 = h10.alignmentAxis, c10 && "number" == typeof m10 && (p10 = "end" === c10 ? -1 * m10 : m10), e21.abrupt("return", l10 ? { x: p10 * f10, y: v10 * u10 } : { x: v10 * u10, y: p10 * f10 }); + case 13: + case "end": + return e21.stop(); + } + }, e20); + })), lT.apply(this, arguments); + } + function uT(e20) { + return hT(e20) ? (e20.nodeName || "").toLowerCase() : "#document"; + } + function fT(e20) { + var t10; + return (null == e20 || null == (t10 = e20.ownerDocument) ? void 0 : t10.defaultView) || window; + } + function dT(e20) { + var t10; + return null == (t10 = (hT(e20) ? e20.ownerDocument : e20.document) || window.document) ? void 0 : t10.documentElement; + } + function hT(e20) { + return e20 instanceof Node || e20 instanceof fT(e20).Node; + } + function vT(e20) { + return e20 instanceof Element || e20 instanceof fT(e20).Element; + } + function pT(e20) { + return e20 instanceof HTMLElement || e20 instanceof fT(e20).HTMLElement; + } + function mT(e20) { + return "undefined" != typeof ShadowRoot && (e20 instanceof ShadowRoot || e20 instanceof fT(e20).ShadowRoot); + } + function gT(e20) { + var t10 = xT(e20), n10 = t10.overflow, r10 = t10.overflowX, o10 = t10.overflowY, i10 = t10.display; + return /auto|scroll|overlay|hidden|clip/.test(n10 + o10 + r10) && !["inline", "contents"].includes(i10); + } + function yT(e20) { + return ["table", "td", "th"].includes(uT(e20)); + } + function bT(e20) { + var t10 = kT(), n10 = xT(e20); + return "none" !== n10.transform || "none" !== n10.perspective || !!n10.containerType && "normal" !== n10.containerType || !t10 && !!n10.backdropFilter && "none" !== n10.backdropFilter || !t10 && !!n10.filter && "none" !== n10.filter || ["transform", "perspective", "filter"].some(function(e21) { + return (n10.willChange || "").includes(e21); + }) || ["paint", "layout", "strict", "content"].some(function(e21) { + return (n10.contain || "").includes(e21); + }); + } + function kT() { + return !("undefined" == typeof CSS || !CSS.supports) && CSS.supports("-webkit-backdrop-filter", "none"); + } + function wT(e20) { + return ["html", "body", "#document"].includes(uT(e20)); + } + function xT(e20) { + return fT(e20).getComputedStyle(e20); + } + function jT(e20) { + return vT(e20) ? { scrollLeft: e20.scrollLeft, scrollTop: e20.scrollTop } : { scrollLeft: e20.pageXOffset, scrollTop: e20.pageYOffset }; + } + function ST(e20) { + if ("html" === uT(e20)) + return e20; + var t10 = e20.assignedSlot || e20.parentNode || mT(e20) && e20.host || dT(e20); + return mT(t10) ? t10.host : t10; + } + function CT(e20) { + var t10 = ST(e20); + return wT(t10) ? e20.ownerDocument ? e20.ownerDocument.body : e20.body : pT(t10) && gT(t10) ? t10 : CT(t10); + } + function $T(e20, t10, n10) { + var r10; + void 0 === t10 && (t10 = []), void 0 === n10 && (n10 = true); + var o10 = CT(e20), i10 = o10 === (null == (r10 = e20.ownerDocument) ? void 0 : r10.body), a10 = fT(o10); + return i10 ? t10.concat(a10, a10.visualViewport || [], gT(o10) ? o10 : [], a10.frameElement && n10 ? $T(a10.frameElement) : []) : t10.concat(o10, $T(o10, [], n10)); + } + function _T(e20) { + var t10 = xT(e20), n10 = parseFloat(t10.width) || 0, r10 = parseFloat(t10.height) || 0, o10 = pT(e20), i10 = o10 ? e20.offsetWidth : n10, a10 = o10 ? e20.offsetHeight : r10, s10 = qP(n10) !== i10 || qP(r10) !== a10; + return s10 && (n10 = i10, r10 = a10), { width: n10, height: r10, $: s10 }; + } + function OT(e20) { + return vT(e20) ? e20 : e20.contextElement; + } + function MT(e20) { + var t10 = OT(e20); + if (!pT(t10)) + return BP(1); + var n10 = t10.getBoundingClientRect(), r10 = _T(t10), o10 = r10.width, i10 = r10.height, a10 = r10.$, s10 = (a10 ? qP(n10.width) : n10.width) / o10, c10 = (a10 ? qP(n10.height) : n10.height) / i10; + return s10 && Number.isFinite(s10) || (s10 = 1), c10 && Number.isFinite(c10) || (c10 = 1), { x: s10, y: c10 }; + } + var ET = BP(0); + function AT(e20) { + var t10 = fT(e20); + return kT() && t10.visualViewport ? { x: t10.visualViewport.offsetLeft, y: t10.visualViewport.offsetTop } : ET; + } + function PT(e20, t10, n10, r10) { + void 0 === t10 && (t10 = false), void 0 === n10 && (n10 = false); + var o10 = e20.getBoundingClientRect(), i10 = OT(e20), a10 = BP(1); + t10 && (r10 ? vT(r10) && (a10 = MT(r10)) : a10 = MT(e20)); + var s10 = function(e21, t11, n11) { + return void 0 === t11 && (t11 = false), !(!n11 || t11 && n11 !== fT(e21)) && t11; + }(i10, n10, r10) ? AT(i10) : BP(0), c10 = (o10.left + s10.x) / a10.x, l10 = (o10.top + s10.y) / a10.y, u10 = o10.width / a10.x, f10 = o10.height / a10.y; + if (i10) + for (var d10 = fT(i10), h10 = r10 && vT(r10) ? fT(r10) : r10, v10 = d10.frameElement; v10 && r10 && h10 !== d10; ) { + var p10 = MT(v10), m10 = v10.getBoundingClientRect(), g10 = xT(v10), y10 = m10.left + (v10.clientLeft + parseFloat(g10.paddingLeft)) * p10.x, b10 = m10.top + (v10.clientTop + parseFloat(g10.paddingTop)) * p10.y; + c10 *= p10.x, l10 *= p10.y, u10 *= p10.x, f10 *= p10.y, c10 += y10, l10 += b10, v10 = fT(v10).frameElement; + } + return rT({ width: u10, height: f10, x: c10, y: l10 }); + } + function TT(e20) { + return PT(dT(e20)).left + jT(e20).scrollLeft; + } + function RT(e20, t10, n10) { + var r10; + if ("viewport" === t10) + r10 = function(e21, t11) { + var n11 = fT(e21), r11 = dT(e21), o11 = n11.visualViewport, i10 = r11.clientWidth, a10 = r11.clientHeight, s10 = 0, c10 = 0; + if (o11) { + i10 = o11.width, a10 = o11.height; + var l10 = kT(); + (!l10 || l10 && "fixed" === t11) && (s10 = o11.offsetLeft, c10 = o11.offsetTop); + } + return { width: i10, height: a10, x: s10, y: c10 }; + }(e20, n10); + else if ("document" === t10) + r10 = function(e21) { + var t11 = dT(e21), n11 = jT(e21), r11 = e21.ownerDocument.body, o11 = DP(t11.scrollWidth, t11.clientWidth, r11.scrollWidth, r11.clientWidth), i10 = DP(t11.scrollHeight, t11.clientHeight, r11.scrollHeight, r11.clientHeight), a10 = -n11.scrollLeft + TT(e21), s10 = -n11.scrollTop; + return "rtl" === xT(r11).direction && (a10 += DP(t11.clientWidth, r11.clientWidth) - o11), { width: o11, height: i10, x: a10, y: s10 }; + }(dT(e20)); + else if (vT(t10)) + r10 = function(e21, t11) { + var n11 = PT(e21, true, "fixed" === t11), r11 = n11.top + e21.clientTop, o11 = n11.left + e21.clientLeft, i10 = pT(e21) ? MT(e21) : BP(1); + return { width: e21.clientWidth * i10.x, height: e21.clientHeight * i10.y, x: o11 * i10.x, y: r11 * i10.y }; + }(t10, n10); + else { + var o10 = AT(e20); + r10 = Ro(Ro({}, t10), {}, { x: t10.x - o10.x, y: t10.y - o10.y }); + } + return rT(r10); + } + function NT(e20, t10) { + var n10 = ST(e20); + return !(n10 === t10 || !vT(n10) || wT(n10)) && ("fixed" === xT(n10).position || NT(n10, t10)); + } + function IT(e20, t10, n10) { + var r10 = pT(t10), o10 = dT(t10), i10 = "fixed" === n10, a10 = PT(e20, true, i10, t10), s10 = { scrollLeft: 0, scrollTop: 0 }, c10 = BP(0); + if (r10 || !r10 && !i10) + if (("body" !== uT(t10) || gT(o10)) && (s10 = jT(t10)), r10) { + var l10 = PT(t10, true, i10, t10); + c10.x = l10.x + t10.clientLeft, c10.y = l10.y + t10.clientTop; + } else + o10 && (c10.x = TT(o10)); + return { x: a10.left + s10.scrollLeft - c10.x, y: a10.top + s10.scrollTop - c10.y, width: a10.width, height: a10.height }; + } + function DT(e20, t10) { + return pT(e20) && "fixed" !== xT(e20).position ? t10 ? t10(e20) : e20.offsetParent : null; + } + function qT(e20, t10) { + var n10 = fT(e20); + if (!pT(e20)) + return n10; + for (var r10 = DT(e20, t10); r10 && yT(r10) && "static" === xT(r10).position; ) + r10 = DT(r10, t10); + return r10 && ("html" === uT(r10) || "body" === uT(r10) && "static" === xT(r10).position && !bT(r10)) ? n10 : r10 || function(e21) { + for (var t11 = ST(e21); pT(t11) && !wT(t11); ) { + if (bT(t11)) + return t11; + t11 = ST(t11); + } + return null; + }(e20) || n10; + } + var zT = { convertOffsetParentRelativeRectToViewportRelativeRect: function(e20) { + var t10 = e20.rect, n10 = e20.offsetParent, r10 = e20.strategy, o10 = pT(n10), i10 = dT(n10); + if (n10 === i10) + return t10; + var a10 = { scrollLeft: 0, scrollTop: 0 }, s10 = BP(1), c10 = BP(0); + if ((o10 || !o10 && "fixed" !== r10) && (("body" !== uT(n10) || gT(i10)) && (a10 = jT(n10)), pT(n10))) { + var l10 = PT(n10); + s10 = MT(n10), c10.x = l10.x + n10.clientLeft, c10.y = l10.y + n10.clientTop; + } + return { width: t10.width * s10.x, height: t10.height * s10.y, x: t10.x * s10.x - a10.scrollLeft * s10.x + c10.x, y: t10.y * s10.y - a10.scrollTop * s10.y + c10.y }; + }, getDocumentElement: dT, getClippingRect: function(e20) { + var t10 = e20.element, n10 = e20.boundary, r10 = e20.rootBoundary, o10 = e20.strategy, i10 = "clippingAncestors" === n10 ? function(e21, t11) { + var n11 = t11.get(e21); + if (n11) + return n11; + for (var r11 = $T(e21, [], false).filter(function(e23) { + return vT(e23) && "body" !== uT(e23); + }), o11 = null, i11 = "fixed" === xT(e21).position, a11 = i11 ? ST(e21) : e21; vT(a11) && !wT(a11); ) { + var s11 = xT(a11), c11 = bT(a11); + c11 || "fixed" !== s11.position || (o11 = null), (i11 ? !c11 && !o11 : !c11 && "static" === s11.position && o11 && ["absolute", "fixed"].includes(o11.position) || gT(a11) && !c11 && NT(e21, a11)) ? r11 = r11.filter(function(e23) { + return e23 !== a11; + }) : o11 = s11, a11 = ST(a11); + } + return t11.set(e21, r11), r11; + }(t10, this._c) : [].concat(n10), a10 = [].concat(Bo(i10), [r10]), s10 = a10[0], c10 = a10.reduce(function(e21, n11) { + var r11 = RT(t10, n11, o10); + return e21.top = DP(r11.top, e21.top), e21.right = IP(r11.right, e21.right), e21.bottom = IP(r11.bottom, e21.bottom), e21.left = DP(r11.left, e21.left), e21; + }, RT(t10, s10, o10)); + return { width: c10.right - c10.left, height: c10.bottom - c10.top, x: c10.left, y: c10.top }; + }, getOffsetParent: qT, getElementRects: function() { + var e20 = xo(ko().mark(function e21(t10) { + var n10, r10, o10, i10, a10; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return n10 = t10.reference, r10 = t10.floating, o10 = t10.strategy, i10 = this.getOffsetParent || qT, a10 = this.getDimensions, e23.t0 = IT, e23.t1 = n10, e23.next = 7, i10(r10); + case 7: + return e23.t2 = e23.sent, e23.t3 = o10, e23.t4 = (0, e23.t0)(e23.t1, e23.t2, e23.t3), e23.t5 = Ro, e23.t6 = { x: 0, y: 0 }, e23.next = 14, a10(r10); + case 14: + return e23.t7 = e23.sent, e23.t8 = (0, e23.t5)(e23.t6, e23.t7), e23.abrupt("return", { reference: e23.t4, floating: e23.t8 }); + case 17: + case "end": + return e23.stop(); + } + }, e21, this); + })); + return function(t10) { + return e20.apply(this, arguments); + }; + }(), getClientRects: function(e20) { + return Array.from(e20.getClientRects()); + }, getDimensions: function(e20) { + var t10 = _T(e20); + return { width: t10.width, height: t10.height }; + }, getScale: MT, isElement: vT, isRTL: function(e20) { + return "rtl" === xT(e20).direction; + } }; + function BT(e20, t10, n10, r10) { + void 0 === r10 && (r10 = {}); + var o10 = r10, i10 = o10.ancestorScroll, a10 = void 0 === i10 || i10, s10 = o10.ancestorResize, c10 = void 0 === s10 || s10, l10 = o10.elementResize, u10 = void 0 === l10 ? "function" == typeof ResizeObserver : l10, f10 = o10.layoutShift, d10 = void 0 === f10 ? "function" == typeof IntersectionObserver : f10, h10 = o10.animationFrame, v10 = void 0 !== h10 && h10, p10 = OT(e20), m10 = a10 || c10 ? [].concat(Bo(p10 ? $T(p10) : []), Bo($T(t10))) : []; + m10.forEach(function(e21) { + a10 && e21.addEventListener("scroll", n10, { passive: true }), c10 && e21.addEventListener("resize", n10); + }); + var g10, y10 = p10 && d10 ? function(e21, t11) { + var n11, r11 = null, o11 = dT(e21); + function i11() { + clearTimeout(n11), r11 && r11.disconnect(), r11 = null; + } + return function a11(s11, c11) { + void 0 === s11 && (s11 = false), void 0 === c11 && (c11 = 1), i11(); + var l11 = e21.getBoundingClientRect(), u11 = l11.left, f11 = l11.top, d11 = l11.width, h11 = l11.height; + if (s11 || t11(), d11 && h11) { + var v11 = { rootMargin: -zP(f11) + "px " + -zP(o11.clientWidth - (u11 + d11)) + "px " + -zP(o11.clientHeight - (f11 + h11)) + "px " + -zP(u11) + "px", threshold: DP(0, IP(1, c11)) || 1 }, p11 = true; + try { + r11 = new IntersectionObserver(m11, Ro(Ro({}, v11), {}, { root: o11.ownerDocument })); + } catch (e23) { + r11 = new IntersectionObserver(m11, v11); + } + r11.observe(e21); + } + function m11(e23) { + var t12 = e23[0].intersectionRatio; + if (t12 !== c11) { + if (!p11) + return a11(); + t12 ? a11(false, t12) : n11 = setTimeout(function() { + a11(false, 1e-7); + }, 100); + } + p11 = false; + } + }(true), i11; + }(p10, n10) : null, b10 = -1, k10 = null; + u10 && (k10 = new ResizeObserver(function(e21) { + var r11 = jo(e21, 1)[0]; + r11 && r11.target === p10 && k10 && (k10.unobserve(t10), cancelAnimationFrame(b10), b10 = requestAnimationFrame(function() { + k10 && k10.observe(t10); + })), n10(); + }), p10 && !v10 && k10.observe(p10), k10.observe(t10)); + var w10 = v10 ? PT(e20) : null; + return v10 && function t11() { + var r11 = PT(e20); + !w10 || r11.x === w10.x && r11.y === w10.y && r11.width === w10.width && r11.height === w10.height || n10(); + w10 = r11, g10 = requestAnimationFrame(t11); + }(), n10(), function() { + m10.forEach(function(e21) { + a10 && e21.removeEventListener("scroll", n10), c10 && e21.removeEventListener("resize", n10); + }), y10 && y10(), k10 && k10.disconnect(), k10 = null, v10 && cancelAnimationFrame(g10); + }; + } + var LT = function(e20) { + return void 0 === e20 && (e20 = {}), { name: "shift", options: e20, fn: function(t10) { + return xo(ko().mark(function n10() { + var r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10; + return ko().wrap(function(n11) { + for (; ; ) + switch (n11.prev = n11.next) { + case 0: + return r10 = t10.x, o10 = t10.y, i10 = t10.placement, a10 = HP(e20, t10), s10 = a10.mainAxis, c10 = void 0 === s10 || s10, l10 = a10.crossAxis, u10 = void 0 !== l10 && l10, f10 = a10.limiter, d10 = void 0 === f10 ? { fn: function(e21) { + return { x: e21.x, y: e21.y }; + } } : f10, h10 = yo(a10, po), v10 = { x: r10, y: o10 }, n11.next = 5, aT(t10, h10); + case 5: + return p10 = n11.sent, m10 = GP(WP(i10)), g10 = JP(m10), y10 = v10[g10], b10 = v10[m10], c10 && (k10 = "y" === g10 ? "bottom" : "right", w10 = y10 + p10["y" === g10 ? "top" : "left"], x10 = y10 - p10[k10], y10 = VP(w10, y10, x10)), u10 && (j10 = "y" === m10 ? "bottom" : "right", S10 = b10 + p10["y" === m10 ? "top" : "left"], C10 = b10 - p10[j10], b10 = VP(S10, b10, C10)), $10 = d10.fn(Ro(Ro({}, t10), {}, qo(qo({}, g10, y10), m10, b10))), n11.abrupt("return", Ro(Ro({}, $10), {}, { data: { x: $10.x - r10, y: $10.y - o10 } })); + case 14: + case "end": + return n11.stop(); + } + }, n10); + }))(); + } }; + }; + var FT = function(e20) { + return void 0 === e20 && (e20 = {}), { name: "flip", options: e20, fn: function(t10) { + return xo(ko().mark(function n10() { + var r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, _10, O10, M10, E10, A10, P10, T8, R8, N8, I10, D10, q10, z10; + return ko().wrap(function(n11) { + for (; ; ) + switch (n11.prev = n11.next) { + case 0: + if (i10 = t10.placement, a10 = t10.middlewareData, s10 = t10.rects, c10 = t10.initialPlacement, l10 = t10.platform, u10 = t10.elements, f10 = HP(e20, t10), d10 = f10.mainAxis, h10 = void 0 === d10 || d10, v10 = f10.crossAxis, p10 = void 0 === v10 || v10, m10 = f10.fallbackPlacements, g10 = f10.fallbackStrategy, y10 = void 0 === g10 ? "bestFit" : g10, b10 = f10.fallbackAxisSideDirection, k10 = void 0 === b10 ? "none" : b10, w10 = f10.flipAlignment, x10 = void 0 === w10 || w10, j10 = yo(f10, vo), null == (r10 = a10.arrow) || !r10.alignmentOffset) { + n11.next = 4; + break; + } + return n11.abrupt("return", {}); + case 4: + return S10 = WP(i10), C10 = WP(c10) === c10, n11.next = 8, null == l10.isRTL ? void 0 : l10.isRTL(u10.floating); + case 8: + return $10 = n11.sent, _10 = m10 || (C10 || !x10 ? [tT(c10)] : XP(c10)), m10 || "none" === k10 || _10.push.apply(_10, Bo(eT(c10, x10, k10, $10))), O10 = [c10].concat(Bo(_10)), n11.next = 14, aT(t10, j10); + case 14: + if (M10 = n11.sent, E10 = [], A10 = (null == (o10 = a10.flip) ? void 0 : o10.overflows) || [], h10 && E10.push(M10[S10]), p10 && (P10 = YP(i10, s10, $10), E10.push(M10[P10[0]], M10[P10[1]])), A10 = [].concat(Bo(A10), [{ placement: i10, overflows: E10 }]), E10.every(function(e21) { + return e21 <= 0; + })) { + n11.next = 37; + break; + } + if (N8 = ((null == (T8 = a10.flip) ? void 0 : T8.index) || 0) + 1, !(I10 = O10[N8])) { + n11.next = 25; + break; + } + return n11.abrupt("return", { data: { index: N8, overflows: A10 }, reset: { placement: I10 } }); + case 25: + if (D10 = null == (R8 = A10.filter(function(e21) { + return e21.overflows[0] <= 0; + }).sort(function(e21, t11) { + return e21.overflows[1] - t11.overflows[1]; + })[0]) ? void 0 : R8.placement) { + n11.next = 35; + break; + } + n11.t0 = y10, n11.next = "bestFit" === n11.t0 ? 30 : "initialPlacement" === n11.t0 ? 33 : 35; + break; + case 30: + return z10 = null == (q10 = A10.map(function(e21) { + return [e21.placement, e21.overflows.filter(function(e23) { + return e23 > 0; + }).reduce(function(e23, t11) { + return e23 + t11; + }, 0)]; + }).sort(function(e21, t11) { + return e21[1] - t11[1]; + })[0]) ? void 0 : q10[0], z10 && (D10 = z10), n11.abrupt("break", 35); + case 33: + return D10 = c10, n11.abrupt("break", 35); + case 35: + if (i10 === D10) { + n11.next = 37; + break; + } + return n11.abrupt("return", { reset: { placement: D10 } }); + case 37: + return n11.abrupt("return", {}); + case 38: + case "end": + return n11.stop(); + } + }, n10); + }))(); + } }; + }; + var VT = function(e20, t10, n10) { + var r10 = /* @__PURE__ */ new Map(), o10 = Ro({ platform: zT }, n10), i10 = Ro(Ro({}, o10.platform), {}, { _c: r10 }); + return iT(e20, t10, Ro(Ro({}, o10), {}, { platform: i10 })); + }; + function HT(e20) { + var t10 = e20.loadOptions, n10 = e20.filterText, r10 = e20.items, o10 = e20.multiple, i10 = e20.value, a10 = e20.itemId, s10 = e20.groupBy, c10 = e20.filterSelectedItems, l10 = e20.itemFilter, u10 = e20.convertStringItemsToObjects, f10 = e20.filterGroupedItems, d10 = e20.label; + if (r10 && t10) + return r10; + if (!r10) + return []; + r10 && r10.length > 0 && "object" !== Ho(r10[0]) && (r10 = u10(r10)); + var h10 = r10.filter(function(e21) { + var t11 = l10(e21[d10], n10, e21); + return t11 && o10 && null != i10 && i10.length && (t11 = !i10.some(function(t12) { + return !!c10 && t12[a10] === e21[a10]; + })), t11; + }); + return s10 && (h10 = f10(h10)), h10; + } + function WT(e20) { + return UT.apply(this, arguments); + } + function UT() { + return UT = xo(ko().mark(function e20(t10) { + var n10, r10, o10, i10, a10; + return ko().wrap(function(e21) { + for (; ; ) + switch (e21.prev = e21.next) { + case 0: + return n10 = t10.dispatch, r10 = t10.loadOptions, o10 = t10.convertStringItemsToObjects, i10 = t10.filterText, e21.next = 3, r10(i10).catch(function(e23) { + console.warn("svelte-select loadOptions error :>> ", e23), n10("error", { type: "loadOptions", details: e23 }); + }); + case 3: + if (!(a10 = e21.sent) || a10.cancelled) { + e21.next = 7; + break; + } + return a10 ? (a10 && a10.length > 0 && "object" !== Ho(a10[0]) && (a10 = o10(a10)), n10("loaded", { items: a10 })) : a10 = [], e21.abrupt("return", { filteredItems: a10, loading: false, focused: true, listOpen: true }); + case 7: + case "end": + return e21.stop(); + } + }, e20); + })), UT.apply(this, arguments); + } + function JT(e20) { + mi(e20, "svelte-qbd276", "svg.svelte-qbd276{width:var(--chevron-icon-width, 20px);height:var(--chevron-icon-width, 20px);color:var(--chevron-icon-colour, currentColor)}"); + } + function KT(e20) { + var t10, n10; + return { c: function() { + t10 = Si("svg"), Ai(n10 = Si("path"), "fill", "currentColor"), Ai(n10, "d", "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747\n 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0\n 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502\n 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0\n 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"), Ai(t10, "width", "100%"), Ai(t10, "height", "100%"), Ai(t10, "viewBox", "0 0 20 20"), Ai(t10, "focusable", "false"), Ai(t10, "aria-hidden", "true"), Ai(t10, "class", "svelte-qbd276"); + }, m: function(e21, r10) { + ki(e21, t10, r10), pi(t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + var GT = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, null, KT, Xo, {}, JT), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function QT(e20) { + mi(e20, "svelte-whdbu1", "svg.svelte-whdbu1{width:var(--clear-icon-width, 20px);height:var(--clear-icon-width, 20px);color:var(--clear-icon-color, currentColor)}"); + } + function YT(e20) { + var t10, n10; + return { c: function() { + t10 = Si("svg"), Ai(n10 = Si("path"), "fill", "currentColor"), Ai(n10, "d", "M34.923,37.251L24,26.328L13.077,37.251L9.436,33.61l10.923-10.923L9.436,11.765l3.641-3.641L24,19.047L34.923,8.124\n l3.641,3.641L27.641,22.688L38.564,33.61L34.923,37.251z"), Ai(t10, "width", "100%"), Ai(t10, "height", "100%"), Ai(t10, "viewBox", "-2 -2 50 50"), Ai(t10, "focusable", "false"), Ai(t10, "aria-hidden", "true"), Ai(t10, "role", "presentation"), Ai(t10, "class", "svelte-whdbu1"); + }, m: function(e21, r10) { + ki(e21, t10, r10), pi(t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + var XT = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, null, YT, Xo, {}, QT), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function ZT(e20) { + mi(e20, "svelte-1p3nqvd", ".loading.svelte-1p3nqvd{width:var(--spinner-width, 20px);height:var(--spinner-height, 20px);color:var(--spinner-color, var(--icons-color));animation:svelte-1p3nqvd-rotate 0.75s linear infinite;transform-origin:center center;transform:none}.circle_path.svelte-1p3nqvd{stroke-dasharray:90;stroke-linecap:round}@keyframes svelte-1p3nqvd-rotate{100%{transform:rotate(360deg)}}"); + } + function eR(e20) { + var t10, n10; + return { c: function() { + t10 = Si("svg"), Ai(n10 = Si("circle"), "class", "circle_path svelte-1p3nqvd"), Ai(n10, "cx", "50"), Ai(n10, "cy", "50"), Ai(n10, "r", "20"), Ai(n10, "fill", "none"), Ai(n10, "stroke", "currentColor"), Ai(n10, "stroke-width", "5"), Ai(n10, "stroke-miterlimit", "10"), Ai(t10, "class", "loading svelte-1p3nqvd"), Ai(t10, "viewBox", "25 25 50 50"); + }, m: function(e21, r10) { + ki(e21, t10, r10), pi(t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + var tR = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, null, eR, Xo, {}, ZT), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function nR(e20) { + mi(e20, "svelte-82qwg8", ".svelte-select.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{--borderRadius:var(--border-radius);--clearSelectColor:var(--clear-select-color);--clearSelectWidth:var(--clear-select-width);--disabledBackground:var(--disabled-background);--disabledBorderColor:var(--disabled-border-color);--disabledColor:var(--disabled-color);--disabledPlaceholderColor:var(--disabled-placeholder-color);--disabledPlaceholderOpacity:var(--disabled-placeholder-opacity);--errorBackground:var(--error-background);--errorBorder:var(--error-border);--groupItemPaddingLeft:var(--group-item-padding-left);--groupTitleColor:var(--group-title-color);--groupTitleFontSize:var(--group-title-font-size);--groupTitleFontWeight:var(--group-title-font-weight);--groupTitlePadding:var(--group-title-padding);--groupTitleTextTransform:var(--group-title-text-transform);--groupTitleBorderColor:var(--group-title-border-color);--groupTitleBorderWidth:var(--group-title-border-width);--groupTitleBorderStyle:var(--group-title-border-style);--indicatorColor:var(--chevron-color);--indicatorHeight:var(--chevron-height);--indicatorWidth:var(--chevron-width);--inputColor:var(--input-color);--inputLeft:var(--input-left);--inputLetterSpacing:var(--input-letter-spacing);--inputMargin:var(--input-margin);--inputPadding:var(--input-padding);--itemActiveBackground:var(--item-active-background);--itemColor:var(--item-color);--itemFirstBorderRadius:var(--item-first-border-radius);--itemHoverBG:var(--item-hover-bg);--itemHoverColor:var(--item-hover-color);--itemIsActiveBG:var(--item-is-active-bg);--itemIsActiveColor:var(--item-is-active-color);--itemIsNotSelectableColor:var(--item-is-not-selectable-color);--itemPadding:var(--item-padding);--listBackground:var(--list-background);--listBorder:var(--list-border);--listBorderRadius:var(--list-border-radius);--listEmptyColor:var(--list-empty-color);--listEmptyPadding:var(--list-empty-padding);--listEmptyTextAlign:var(--list-empty-text-align);--listMaxHeight:var(--list-max-height);--listPosition:var(--list-position);--listShadow:var(--list-shadow);--listZIndex:var(--list-z-index);--multiItemBG:var(--multi-item-bg);--multiItemBorderRadius:var(--multi-item-border-radius);--multiItemDisabledHoverBg:var(--multi-item-disabled-hover-bg);--multiItemDisabledHoverColor:var(--multi-item-disabled-hover-color);--multiItemHeight:var(--multi-item-height);--multiItemMargin:var(--multi-item-margin);--multiItemPadding:var(--multi-item-padding);--multiSelectInputMargin:var(--multi-select-input-margin);--multiSelectInputPadding:var(--multi-select-input-padding);--multiSelectPadding:var(--multi-select-padding);--placeholderColor:var(--placeholder-color);--placeholderOpacity:var(--placeholder-opacity);--selectedItemPadding:var(--selected-item-padding);--spinnerColor:var(--spinner-color);--spinnerHeight:var(--spinner-height);--spinnerWidth:var(--spinner-width);--internal-padding:0 0 0 16px;border:var(--border, 1px solid #d8dbdf);border-radius:var(--border-radius, 6px);min-height:var(--height, 42px);position:relative;display:flex;align-items:stretch;padding:var(--padding, var(--internal-padding));background:var(--background, #fff);margin:var(--margin, 0);width:var(--width, 100%);font-size:var(--font-size, 16px);max-height:var(--max-height)}.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{box-sizing:var(--box-sizing, border-box)}.svelte-select.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:hover{border:var(--border-hover, 1px solid #b2b8bf)}.value-container.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{display:flex;flex:1 1 0%;flex-wrap:wrap;align-items:center;gap:5px 10px;padding:var(--value-container-padding, 5px 0);position:relative;overflow:var(--value-container-overflow, hidden);align-self:stretch}.prepend.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8,.indicators.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{display:flex;flex-shrink:0;align-items:center}.indicators.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{position:var(--indicators-position);top:var(--indicators-top);right:var(--indicators-right);bottom:var(--indicators-bottom)}input.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{position:absolute;cursor:default;border:none;color:var(--input-color, var(--item-color));padding:var(--input-padding, 0);letter-spacing:var(--input-letter-spacing, inherit);margin:var(--input-margin, 0);min-width:10px;top:0;right:0;bottom:0;left:0;background:transparent;font-size:var(--font-size, 16px)}.svelte-82qwg8:not(.multi)>.value-container.svelte-82qwg8>input.svelte-82qwg8{width:100%;height:100%}input.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8::placeholder{color:var(--placeholder-color, #78848f);opacity:var(--placeholder-opacity, 1)}input.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:focus{outline:none}.svelte-select.focused.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{border:var(--border-focused, 1px solid #006fe8);border-radius:var(--border-radius-focused, var(--border-radius, 6px))}.disabled.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{background:var(--disabled-background, #ebedef);border-color:var(--disabled-border-color, #ebedef);color:var(--disabled-color, #c1c6cc)}.disabled.svelte-82qwg8 input.svelte-82qwg8.svelte-82qwg8::placeholder{color:var(--disabled-placeholder-color, #c1c6cc);opacity:var(--disabled-placeholder-opacity, 1)}.selected-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{position:relative;overflow:var(--selected-item-overflow, hidden);padding:var(--selected-item-padding, 0 20px 0 0);text-overflow:ellipsis;white-space:nowrap;color:var(--selected-item-color, inherit);font-size:var(--font-size, 16px)}.multi.svelte-82qwg8 .selected-item.svelte-82qwg8.svelte-82qwg8{position:absolute;line-height:var(--height, 42px);height:var(--height, 42px)}.selected-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:focus{outline:none}.hide-selected-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{opacity:0}.icon.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{display:flex;align-items:center;justify-content:center}.clear-select.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{all:unset;display:flex;align-items:center;justify-content:center;width:var(--clear-select-width, 40px);height:var(--clear-select-height, 100%);color:var(--clear-select-color, var(--icons-color));margin:var(--clear-select-margin, 0);pointer-events:all;flex-shrink:0}.clear-select.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:focus{outline:var(--clear-select-focus-outline, 1px solid #006fe8)}.loading.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{width:var(--loading-width, 40px);height:var(--loading-height);color:var(--loading-color, var(--icons-color));margin:var(--loading--margin, 0);flex-shrink:0}.chevron.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{width:var(--chevron-width, 40px);height:var(--chevron-height, 40px);background:var(--chevron-background, transparent);pointer-events:var(--chevron-pointer-events, none);color:var(--chevron-color, var(--icons-color));border:var(--chevron-border, 0 0 0 1px solid #d8dbdf);flex-shrink:0}.multi.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{padding:var(--multi-select-padding, var(--internal-padding))}.multi.svelte-82qwg8 input.svelte-82qwg8.svelte-82qwg8{padding:var(--multi-select-input-padding, 0);position:relative;margin:var(--multi-select-input-margin, 5px 0);flex:1 1 40px}.svelte-select.error.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{border:var(--error-border, 1px solid #ff2d55);background:var(--error-background, #fff)}.a11y-text.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{z-index:9999;border:0px;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0px;white-space:nowrap}.multi-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{background:var(--multi-item-bg, #ebedef);margin:var(--multi-item-margin, 0);outline:var(--multi-item-outline, 1px solid #ddd);border-radius:var(--multi-item-border-radius, 4px);height:var(--multi-item-height, 25px);line-height:var(--multi-item-height, 25px);display:flex;cursor:default;padding:var(--multi-item-padding, 0 5px);overflow:hidden;gap:var(--multi-item-gap, 4px);outline-offset:-1px;max-width:var(--multi-max-width, none);color:var(--multi-item-color, var(--item-color))}.multi-item.disabled.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:hover{background:var(--multi-item-disabled-hover-bg, #ebedef);color:var(--multi-item-disabled-hover-color, #c1c6cc)}.multi-item-text.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.multi-item-clear.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{display:flex;align-items:center;justify-content:center;--clear-icon-color:var(--multi-item-clear-icon-color, #000)}.multi-item.active.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{outline:var(--multi-item-active-outline, 1px solid #006fe8)}.svelte-select-list.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{box-shadow:var(--list-shadow, 0 2px 3px 0 rgba(44, 62, 80, 0.24));border-radius:var(--list-border-radius, 4px);max-height:var(--list-max-height, 252px);overflow-y:auto;background:var(--list-background, #fff);position:var(--list-position, absolute);z-index:var(--list-z-index, 2);border:var(--list-border)}.prefloat.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{opacity:0;pointer-events:none}.list-group-title.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{color:var(--group-title-color, #8f8f8f);cursor:default;font-size:var(--group-title-font-size, 16px);font-weight:var(--group-title-font-weight, 600);height:var(--height, 42px);line-height:var(--height, 42px);padding:var(--group-title-padding, 0 20px);text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap;text-transform:var(--group-title-text-transform, uppercase);border-width:var(--group-title-border-width, medium);border-style:var(--group-title-border-style, none);border-color:var(--group-title-border-color, color)}.empty.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{text-align:var(--list-empty-text-align, center);padding:var(--list-empty-padding, 20px 0);color:var(--list-empty-color, #78848f)}.item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{cursor:default;height:var(--item-height, var(--height, 42px));line-height:var(--item-line-height, var(--height, 42px));padding:var(--item-padding, 0 20px);color:var(--item-color, inherit);text-overflow:ellipsis;overflow:hidden;white-space:nowrap;transition:var(--item-transition, all 0.2s);align-items:center;width:100%}.item.group-item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{padding-left:var(--group-item-padding-left, 40px)}.item.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:active{background:var(--item-active-background, #b9daff)}.item.active.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{background:var(--item-is-active-bg, #007aff);color:var(--item-is-active-color, #fff)}.item.first.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{border-radius:var(--item-first-border-radius, 4px 4px 0 0)}.item.hover.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:not(.active){background:var(--item-hover-bg, #e7f2ff);color:var(--item-hover-color, inherit)}.item.not-selectable.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8,.item.hover.item.not-selectable.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8,.item.active.item.not-selectable.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8,.item.not-selectable.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8:active{color:var(--item-is-not-selectable-color, #999);background:transparent}.required.svelte-82qwg8.svelte-82qwg8.svelte-82qwg8{opacity:0;z-index:-1;position:absolute;top:0;left:0;bottom:0;right:0}"); + } + var rR = function(e20) { + return { value: 8 & e20[0] }; + }; + var oR = function(e20) { + return { value: e20[3] }; + }; + var iR = function(e20) { + return { value: 8 & e20[0] }; + }; + var aR = function(e20) { + return { value: e20[3] }; + }; + var sR = function(e20) { + return { listOpen: 64 & e20[0] }; + }; + var cR = function(e20) { + return { listOpen: e20[6] }; + }; + var lR = function(e20) { + return {}; + }; + var uR = function(e20) { + return {}; + }; + var fR = function(e20) { + return {}; + }; + var dR = function(e20) { + return {}; + }; + var hR = function(e20) { + return { selection: 8 & e20[0] }; + }; + var vR = function(e20) { + return { selection: e20[3] }; + }; + function pR(e20, t10, n10) { + var r10 = e20.slice(); + return r10[126] = t10[n10], r10[128] = n10, r10; + } + var mR = function(e20) { + return {}; + }; + var gR = function(e20) { + return {}; + }; + var yR = function(e20) { + return { selection: 8 & e20[0] }; + }; + var bR = function(e20) { + return { selection: e20[126], index: e20[128] }; + }; + var kR = function(e20) { + return {}; + }; + var wR = function(e20) { + return {}; + }; + var xR = function(e20) { + return {}; + }; + var jR = function(e20) { + return {}; + }; + var SR = function(e20) { + return {}; + }; + var CR = function(e20) { + return {}; + }; + function $R(e20, t10, n10) { + var r10 = e20.slice(); + return r10[126] = t10[n10], r10[128] = n10, r10; + } + var _R = function(e20) { + return { item: 16777216 & e20[0] }; + }; + var OR = function(e20) { + return { item: e20[126], index: e20[128] }; + }; + var MR = function(e20) { + return { filteredItems: 16777216 & e20[0] }; + }; + var ER = function(e20) { + return { filteredItems: e20[24] }; + }; + var AR = function(e20) { + return {}; + }; + var PR = function(e20) { + return {}; + }; + function TR(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = e20[50]["list-prepend"] && RR(e20), u10 = [DR, IR, NR], f10 = []; + function d10(e21, t11) { + return e21[50].list ? 0 : e21[24].length > 0 ? 1 : e21[19] ? -1 : 2; + } + ~(r10 = d10(e20)) && (o10 = f10[r10] = u10[r10](e20)); + var h10 = e20[50]["list-append"] && zR(e20); + return { c: function() { + t10 = ji("div"), l10 && l10.c(), n10 = $i(), o10 && o10.c(), i10 = $i(), h10 && h10.c(), Ai(t10, "class", "svelte-select-list svelte-82qwg8"), Ai(t10, "role", "none"), zi(t10, "prefloat", e20[28]); + }, m: function(o11, u11) { + ki(o11, t10, u11), l10 && l10.m(t10, null), pi(t10, n10), ~r10 && f10[r10].m(t10, null), pi(t10, i10), h10 && h10.m(t10, null), e20[91](t10), a10 = true, s10 || (c10 = [ci(e20[49].call(null, t10)), Oi(t10, "scroll", e20[41]), Oi(t10, "pointerup", Ei(Mi(e20[85]))), Oi(t10, "mousedown", Ei(Mi(e20[86])))], s10 = true); + }, p: function(e21, s11) { + e21[50]["list-prepend"] ? l10 ? (l10.p(e21, s11), 524288 & s11[1] && wa(l10, 1)) : ((l10 = RR(e21)).c(), wa(l10, 1), l10.m(t10, n10)) : l10 && (ba(), xa(l10, 1, 1, function() { + l10 = null; + }), ka()); + var c11 = r10; + (r10 = d10(e21)) === c11 ? ~r10 && f10[r10].p(e21, s11) : (o10 && (ba(), xa(f10[c11], 1, 1, function() { + f10[c11] = null; + }), ka()), ~r10 ? ((o10 = f10[r10]) ? o10.p(e21, s11) : (o10 = f10[r10] = u10[r10](e21)).c(), wa(o10, 1), o10.m(t10, i10)) : o10 = null), e21[50]["list-append"] ? h10 ? (h10.p(e21, s11), 524288 & s11[1] && wa(h10, 1)) : ((h10 = zR(e21)).c(), wa(h10, 1), h10.m(t10, null)) : h10 && (ba(), xa(h10, 1, 1, function() { + h10 = null; + }), ka()), (!a10 || 268435456 & s11[0]) && zi(t10, "prefloat", e21[28]); + }, i: function(e21) { + a10 || (wa(l10), wa(o10), wa(h10), a10 = true); + }, o: function(e21) { + xa(l10), xa(o10), xa(h10), a10 = false; + }, d: function(n11) { + n11 && wi(t10), l10 && l10.d(), ~r10 && f10[r10].d(), h10 && h10.d(), e20[91](null), s10 = false, Qo(c10); + } }; + } + function RR(e20) { + var t10, n10 = e20[83]["list-prepend"], r10 = ei(n10, e20, e20[82], PR); + return { c: function() { + r10 && r10.c(); + }, m: function(e21, n11) { + r10 && r10.m(e21, n11), t10 = true; + }, p: function(e21, o10) { + r10 && r10.p && (!t10 || 1048576 & o10[2]) && ri(r10, n10, e21, e21[82], t10 ? ni(n10, e21[82], o10, AR) : oi(e21[82]), PR); + }, i: function(e21) { + t10 || (wa(r10, e21), t10 = true); + }, o: function(e21) { + xa(r10, e21), t10 = false; + }, d: function(e21) { + r10 && r10.d(e21); + } }; + } + function NR(e20) { + var t10, n10, r10 = e20[83].empty, o10 = ei(r10, e20, e20[82], CR), i10 = o10 || { c: function() { + (n10 = ji("div")).textContent = "No options", Ai(n10, "class", "empty svelte-82qwg8"); + }, m: function(e21, t11) { + ki(e21, n10, t11); + }, p: Wo, d: function(e21) { + e21 && wi(n10); + } }; + return { c: function() { + i10 && i10.c(); + }, m: function(e21, n11) { + i10 && i10.m(e21, n11), t10 = true; + }, p: function(e21, n11) { + o10 && o10.p && (!t10 || 1048576 & n11[2]) && ri(o10, r10, e21, e21[82], t10 ? ni(r10, e21[82], n11, SR) : oi(e21[82]), CR); + }, i: function(e21) { + t10 || (wa(i10, e21), t10 = true); + }, o: function(e21) { + xa(i10, e21), t10 = false; + }, d: function(e21) { + i10 && i10.d(e21); + } }; + } + function IR(e20) { + for (var t10, n10, r10 = Ca(e20[24]), o10 = [], i10 = 0; i10 < r10.length; i10 += 1) + o10[i10] = qR($R(e20, r10, i10)); + var a10 = function(e21) { + return xa(o10[e21], 1, 1, function() { + o10[e21] = null; + }); + }; + return { c: function() { + for (var e21 = 0; e21 < o10.length; e21 += 1) + o10[e21].c(); + t10 = _i(); + }, m: function(e21, r11) { + for (var i11 = 0; i11 < o10.length; i11 += 1) + o10[i11] && o10[i11].m(e21, r11); + ki(e21, t10, r11), n10 = true; + }, p: function(e21, n11) { + if (1627402376 & n11[0] | 28672 & n11[1] | 1048576 & n11[2]) { + var i11; + for (r10 = Ca(e21[24]), i11 = 0; i11 < r10.length; i11 += 1) { + var s10 = $R(e21, r10, i11); + o10[i11] ? (o10[i11].p(s10, n11), wa(o10[i11], 1)) : (o10[i11] = qR(s10), o10[i11].c(), wa(o10[i11], 1), o10[i11].m(t10.parentNode, t10)); + } + for (ba(), i11 = r10.length; i11 < o10.length; i11 += 1) + a10(i11); + ka(); + } + }, i: function(e21) { + if (!n10) { + for (var t11 = 0; t11 < r10.length; t11 += 1) + wa(o10[t11]); + n10 = true; + } + }, o: function(e21) { + o10 = o10.filter(Boolean); + for (var t11 = 0; t11 < o10.length; t11 += 1) + xa(o10[t11]); + n10 = false; + }, d: function(e21) { + e21 && wi(t10), xi(o10, e21); + } }; + } + function DR(e20) { + var t10, n10 = e20[83].list, r10 = ei(n10, e20, e20[82], ER); + return { c: function() { + r10 && r10.c(); + }, m: function(e21, n11) { + r10 && r10.m(e21, n11), t10 = true; + }, p: function(e21, o10) { + r10 && r10.p && (!t10 || 16777216 & o10[0] | 1048576 & o10[2]) && ri(r10, n10, e21, e21[82], t10 ? ni(n10, e21[82], o10, MR) : oi(e21[82]), ER); + }, i: function(e21) { + t10 || (wa(r10, e21), t10 = true); + }, o: function(e21) { + xa(r10, e21), t10 = false; + }, d: function(e21) { + r10 && r10.d(e21); + } }; + } + function qR(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = e20[83].item, u10 = ei(l10, e20, e20[82], OR), f10 = u10 || function(e21) { + var t11, n11, r11 = (null === (t11 = e21[126]) || void 0 === t11 ? void 0 : t11[e21[12]]) + ""; + return { c: function() { + n11 = Ci(r11); + }, m: function(e23, t12) { + ki(e23, n11, t12); + }, p: function(e23, t12) { + var o11; + 16781312 & t12[0] && r11 !== (r11 = (null === (o11 = e23[126]) || void 0 === o11 ? void 0 : o11[e23[12]]) + "") && Ni(n11, r11); + }, d: function(e23) { + e23 && wi(n11); + } }; + }(e20); + function d10() { + return e20[88](e20[128]); + } + function h10() { + return e20[89](e20[128]); + } + function v10() { + return e20[90](e20[126], e20[128]); + } + return { c: function() { + var r11; + t10 = ji("div"), n10 = ji("div"), f10 && f10.c(), i10 = $i(), Ai(n10, "class", "item svelte-82qwg8"), zi(n10, "list-group-title", e20[126].groupHeader), zi(n10, "active", e20[45](e20[126], e20[3], e20[13])), zi(n10, "first", 0 === e20[128]), zi(n10, "hover", e20[7] === e20[128]), zi(n10, "group-item", e20[126].groupItem), zi(n10, "not-selectable", false === (null === (r11 = e20[126]) || void 0 === r11 ? void 0 : r11.selectable)), Ai(t10, "class", "list-item svelte-82qwg8"), Ai(t10, "tabindex", "-1"), Ai(t10, "role", "none"); + }, m: function(l11, u11) { + ki(l11, t10, u11), pi(t10, n10), f10 && f10.m(n10, null), pi(t10, i10), a10 = true, s10 || (c10 = [ci(r10 = e20[46].call(null, n10, { scroll: e20[45](e20[126], e20[3], e20[13]), listDom: e20[30] })), ci(o10 = e20[47].call(null, n10, { scroll: e20[29] === e20[128], listDom: e20[30] })), Oi(t10, "mouseover", d10), Oi(t10, "focus", h10), Oi(t10, "click", Ei(v10)), Oi(t10, "keydown", Ei(Mi(e20[87])))], s10 = true); + }, p: function(t11, i11) { + var s11; + (e20 = t11, u10 ? u10.p && (!a10 || 16777216 & i11[0] | 1048576 & i11[2]) && ri(u10, l10, e20, e20[82], a10 ? ni(l10, e20[82], i11, _R) : oi(e20[82]), OR) : f10 && f10.p && (!a10 || 16781312 & i11[0]) && f10.p(e20, a10 ? i11 : [-1, -1, -1, -1, -1]), r10 && Yo(r10.update) && 1090527240 & i11[0] && r10.update.call(null, { scroll: e20[45](e20[126], e20[3], e20[13]), listDom: e20[30] }), o10 && Yo(o10.update) && 1610612736 & i11[0] && o10.update.call(null, { scroll: e20[29] === e20[128], listDom: e20[30] }), (!a10 || 16777216 & i11[0]) && zi(n10, "list-group-title", e20[126].groupHeader), (!a10 || 16785416 & i11[0] | 16384 & i11[1]) && zi(n10, "active", e20[45](e20[126], e20[3], e20[13])), (!a10 || 128 & i11[0]) && zi(n10, "hover", e20[7] === e20[128]), (!a10 || 16777216 & i11[0]) && zi(n10, "group-item", e20[126].groupItem), !a10 || 16777216 & i11[0]) && zi(n10, "not-selectable", false === (null === (s11 = e20[126]) || void 0 === s11 ? void 0 : s11.selectable)); + }, i: function(e21) { + a10 || (wa(f10, e21), a10 = true); + }, o: function(e21) { + xa(f10, e21), a10 = false; + }, d: function(e21) { + e21 && wi(t10), f10 && f10.d(e21), s10 = false, Qo(c10); + } }; + } + function zR(e20) { + var t10, n10 = e20[83]["list-append"], r10 = ei(n10, e20, e20[82], jR); + return { c: function() { + r10 && r10.c(); + }, m: function(e21, n11) { + r10 && r10.m(e21, n11), t10 = true; + }, p: function(e21, o10) { + r10 && r10.p && (!t10 || 1048576 & o10[2]) && ri(r10, n10, e21, e21[82], t10 ? ni(n10, e21[82], o10, xR) : oi(e21[82]), jR); + }, i: function(e21) { + t10 || (wa(r10, e21), t10 = true); + }, o: function(e21) { + xa(r10, e21), t10 = false; + }, d: function(e21) { + r10 && r10.d(e21); + } }; + } + function BR(e20) { + var t10, n10, r10, o10, i10; + return { c: function() { + t10 = ji("span"), n10 = Ci(e20[32]), r10 = $i(), o10 = ji("span"), i10 = Ci(e20[31]), Ai(t10, "id", "aria-selection"), Ai(t10, "class", "svelte-82qwg8"), Ai(o10, "id", "aria-context"), Ai(o10, "class", "svelte-82qwg8"); + }, m: function(e21, a10) { + ki(e21, t10, a10), pi(t10, n10), ki(e21, r10, a10), ki(e21, o10, a10), pi(o10, i10); + }, p: function(e21, t11) { + 2 & t11[1] && Ni(n10, e21[32]), 1 & t11[1] && Ni(i10, e21[31]); + }, d: function(e21) { + e21 && (wi(t10), wi(r10), wi(o10)); + } }; + } + function LR(e20) { + var t10, n10, r10, o10, i10 = [VR, FR], a10 = []; + function s10(e21, t11) { + return e21[9] ? 0 : 1; + } + return t10 = s10(e20), n10 = a10[t10] = i10[t10](e20), { c: function() { + n10.c(), r10 = _i(); + }, m: function(e21, n11) { + a10[t10].m(e21, n11), ki(e21, r10, n11), o10 = true; + }, p: function(e21, o11) { + var c10 = t10; + (t10 = s10(e21)) === c10 ? a10[t10].p(e21, o11) : (ba(), xa(a10[c10], 1, 1, function() { + a10[c10] = null; + }), ka(), (n10 = a10[t10]) ? n10.p(e21, o11) : (n10 = a10[t10] = i10[t10](e21)).c(), wa(n10, 1), n10.m(r10.parentNode, r10)); + }, i: function(e21) { + o10 || (wa(n10), o10 = true); + }, o: function(e21) { + xa(n10), o10 = false; + }, d: function(e21) { + e21 && wi(r10), a10[t10].d(e21); + } }; + } + function FR(e20) { + var t10, n10, r10 = e20[83].selection, o10 = ei(r10, e20, e20[82], vR), i10 = o10 || function(e21) { + var t11, n11 = e21[3][e21[12]] + ""; + return { c: function() { + t11 = Ci(n11); + }, m: function(e23, n12) { + ki(e23, t11, n12); + }, p: function(e23, r11) { + 4104 & r11[0] && n11 !== (n11 = e23[3][e23[12]] + "") && Ni(t11, n11); + }, d: function(e23) { + e23 && wi(t11); + } }; + }(e20); + return { c: function() { + t10 = ji("div"), i10 && i10.c(), Ai(t10, "class", "selected-item svelte-82qwg8"), zi(t10, "hide-selected-item", e20[35]); + }, m: function(e21, r11) { + ki(e21, t10, r11), i10 && i10.m(t10, null), n10 = true; + }, p: function(e21, a10) { + o10 ? o10.p && (!n10 || 8 & a10[0] | 1048576 & a10[2]) && ri(o10, r10, e21, e21[82], n10 ? ni(r10, e21[82], a10, hR) : oi(e21[82]), vR) : i10 && i10.p && (!n10 || 4104 & a10[0]) && i10.p(e21, n10 ? a10 : [-1, -1, -1, -1, -1]), (!n10 || 16 & a10[1]) && zi(t10, "hide-selected-item", e21[35]); + }, i: function(e21) { + n10 || (wa(i10, e21), n10 = true); + }, o: function(e21) { + xa(i10, e21), n10 = false; + }, d: function(e21) { + e21 && wi(t10), i10 && i10.d(e21); + } }; + } + function VR(e20) { + for (var t10, n10, r10 = Ca(e20[3]), o10 = [], i10 = 0; i10 < r10.length; i10 += 1) + o10[i10] = WR(pR(e20, r10, i10)); + var a10 = function(e21) { + return xa(o10[e21], 1, 1, function() { + o10[e21] = null; + }); + }; + return { c: function() { + for (var e21 = 0; e21 < o10.length; e21 += 1) + o10[e21].c(); + t10 = _i(); + }, m: function(e21, r11) { + for (var i11 = 0; i11 < o10.length; i11 += 1) + o10[i11] && o10[i11].m(e21, r11); + ki(e21, t10, r11), n10 = true; + }, p: function(e21, n11) { + if (67116040 & n11[0] | 32 & n11[1] | 1048576 & n11[2]) { + var i11; + for (r10 = Ca(e21[3]), i11 = 0; i11 < r10.length; i11 += 1) { + var s10 = pR(e21, r10, i11); + o10[i11] ? (o10[i11].p(s10, n11), wa(o10[i11], 1)) : (o10[i11] = WR(s10), o10[i11].c(), wa(o10[i11], 1), o10[i11].m(t10.parentNode, t10)); + } + for (ba(), i11 = r10.length; i11 < o10.length; i11 += 1) + a10(i11); + ka(); + } + }, i: function(e21) { + if (!n10) { + for (var t11 = 0; t11 < r10.length; t11 += 1) + wa(o10[t11]); + n10 = true; + } + }, o: function(e21) { + o10 = o10.filter(Boolean); + for (var t11 = 0; t11 < o10.length; t11 += 1) + xa(o10[t11]); + n10 = false; + }, d: function(e21) { + e21 && wi(t10), xi(o10, e21); + } }; + } + function HR(e20) { + var t10, n10, r10, o10, i10 = e20[83]["multi-clear-icon"], a10 = ei(i10, e20, e20[82], gR), s10 = a10 || function(e21) { + var t11, n11; + return t11 = new XT({}), { c: function() { + Pa(t11.$$.fragment); + }, m: function(e23, r11) { + Ta(t11, e23, r11), n11 = true; + }, i: function(e23) { + n11 || (wa(t11.$$.fragment, e23), n11 = true); + }, o: function(e23) { + xa(t11.$$.fragment, e23), n11 = false; + }, d: function(e23) { + Ra(t11, e23); + } }; + }(); + function c10() { + return e20[92](e20[128]); + } + return { c: function() { + t10 = ji("div"), s10 && s10.c(), Ai(t10, "class", "multi-item-clear svelte-82qwg8"); + }, m: function(e21, i11) { + ki(e21, t10, i11), s10 && s10.m(t10, null), n10 = true, r10 || (o10 = Oi(t10, "pointerup", Ei(Mi(c10))), r10 = true); + }, p: function(t11, r11) { + e20 = t11, a10 && a10.p && (!n10 || 1048576 & r11[2]) && ri(a10, i10, e20, e20[82], n10 ? ni(i10, e20[82], r11, mR) : oi(e20[82]), gR); + }, i: function(e21) { + n10 || (wa(s10, e21), n10 = true); + }, o: function(e21) { + xa(s10, e21), n10 = false; + }, d: function(e21) { + e21 && wi(t10), s10 && s10.d(e21), r10 = false, o10(); + } }; + } + function WR(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10 = e20[83].selection, l10 = ei(c10, e20, e20[82], bR), u10 = l10 || function(e21) { + var t11, n11 = e21[126][e21[12]] + ""; + return { c: function() { + t11 = Ci(n11); + }, m: function(e23, n12) { + ki(e23, t11, n12); + }, p: function(e23, r11) { + 4104 & r11[0] && n11 !== (n11 = e23[126][e23[12]] + "") && Ni(t11, n11); + }, d: function(e23) { + e23 && wi(t11); + } }; + }(e20), f10 = !e20[11] && !e20[10] && XT && HR(e20); + function d10() { + return e20[93](e20[128]); + } + return { c: function() { + t10 = ji("div"), n10 = ji("span"), u10 && u10.c(), r10 = $i(), f10 && f10.c(), o10 = $i(), Ai(n10, "class", "multi-item-text svelte-82qwg8"), Ai(t10, "class", "multi-item svelte-82qwg8"), Ai(t10, "role", "none"), zi(t10, "active", e20[26] === e20[128]), zi(t10, "disabled", e20[11]); + }, m: function(c11, l11) { + ki(c11, t10, l11), pi(t10, n10), u10 && u10.m(n10, null), pi(t10, r10), f10 && f10.m(t10, null), pi(t10, o10), i10 = true, a10 || (s10 = [Oi(t10, "click", Mi(d10)), Oi(t10, "keydown", Ei(Mi(e20[84])))], a10 = true); + }, p: function(n11, r11) { + e20 = n11, l10 ? l10.p && (!i10 || 8 & r11[0] | 1048576 & r11[2]) && ri(l10, c10, e20, e20[82], i10 ? ni(c10, e20[82], r11, yR) : oi(e20[82]), bR) : u10 && u10.p && (!i10 || 4104 & r11[0]) && u10.p(e20, i10 ? r11 : [-1, -1, -1, -1, -1]), e20[11] || e20[10] || !XT ? f10 && (ba(), xa(f10, 1, 1, function() { + f10 = null; + }), ka()) : f10 ? (f10.p(e20, r11), 3072 & r11[0] && wa(f10, 1)) : ((f10 = HR(e20)).c(), wa(f10, 1), f10.m(t10, o10)), (!i10 || 67108864 & r11[0]) && zi(t10, "active", e20[26] === e20[128]), (!i10 || 2048 & r11[0]) && zi(t10, "disabled", e20[11]); + }, i: function(e21) { + i10 || (wa(u10, e21), wa(f10), i10 = true); + }, o: function(e21) { + xa(u10, e21), xa(f10), i10 = false; + }, d: function(e21) { + e21 && wi(t10), u10 && u10.d(e21), f10 && f10.d(), a10 = false, Qo(s10); + } }; + } + function UR(e20) { + var t10, n10, r10 = e20[83]["loading-icon"], o10 = ei(r10, e20, e20[82], dR), i10 = o10 || function(e21) { + var t11, n11; + return t11 = new tR({}), { c: function() { + Pa(t11.$$.fragment); + }, m: function(e23, r11) { + Ta(t11, e23, r11), n11 = true; + }, i: function(e23) { + n11 || (wa(t11.$$.fragment, e23), n11 = true); + }, o: function(e23) { + xa(t11.$$.fragment, e23), n11 = false; + }, d: function(e23) { + Ra(t11, e23); + } }; + }(); + return { c: function() { + t10 = ji("div"), i10 && i10.c(), Ai(t10, "class", "icon loading svelte-82qwg8"), Ai(t10, "aria-hidden", "true"); + }, m: function(e21, r11) { + ki(e21, t10, r11), i10 && i10.m(t10, null), n10 = true; + }, p: function(e21, t11) { + o10 && o10.p && (!n10 || 1048576 & t11[2]) && ri(o10, r10, e21, e21[82], n10 ? ni(r10, e21[82], t11, fR) : oi(e21[82]), dR); + }, i: function(e21) { + n10 || (wa(i10, e21), n10 = true); + }, o: function(e21) { + xa(i10, e21), n10 = false; + }, d: function(e21) { + e21 && wi(t10), i10 && i10.d(e21); + } }; + } + function JR(e20) { + var t10, n10, r10, o10, i10 = e20[83]["clear-icon"], a10 = ei(i10, e20, e20[82], uR), s10 = a10 || function(e21) { + var t11, n11; + return t11 = new XT({}), { c: function() { + Pa(t11.$$.fragment); + }, m: function(e23, r11) { + Ta(t11, e23, r11), n11 = true; + }, i: function(e23) { + n11 || (wa(t11.$$.fragment, e23), n11 = true); + }, o: function(e23) { + xa(t11.$$.fragment, e23), n11 = false; + }, d: function(e23) { + Ra(t11, e23); + } }; + }(); + return { c: function() { + t10 = ji("button"), s10 && s10.c(), Ai(t10, "type", "button"), Ai(t10, "class", "icon clear-select svelte-82qwg8"); + }, m: function(i11, a11) { + ki(i11, t10, a11), s10 && s10.m(t10, null), n10 = true, r10 || (o10 = Oi(t10, "click", e20[22]), r10 = true); + }, p: function(e21, t11) { + a10 && a10.p && (!n10 || 1048576 & t11[2]) && ri(a10, i10, e21, e21[82], n10 ? ni(i10, e21[82], t11, lR) : oi(e21[82]), uR); + }, i: function(e21) { + n10 || (wa(s10, e21), n10 = true); + }, o: function(e21) { + xa(s10, e21), n10 = false; + }, d: function(e21) { + e21 && wi(t10), s10 && s10.d(e21), r10 = false, o10(); + } }; + } + function KR(e20) { + var t10, n10, r10 = e20[83]["chevron-icon"], o10 = ei(r10, e20, e20[82], cR), i10 = o10 || function(e21) { + var t11, n11; + return t11 = new GT({}), { c: function() { + Pa(t11.$$.fragment); + }, m: function(e23, r11) { + Ta(t11, e23, r11), n11 = true; + }, i: function(e23) { + n11 || (wa(t11.$$.fragment, e23), n11 = true); + }, o: function(e23) { + xa(t11.$$.fragment, e23), n11 = false; + }, d: function(e23) { + Ra(t11, e23); + } }; + }(); + return { c: function() { + t10 = ji("div"), i10 && i10.c(), Ai(t10, "class", "icon chevron svelte-82qwg8"), Ai(t10, "aria-hidden", "true"); + }, m: function(e21, r11) { + ki(e21, t10, r11), i10 && i10.m(t10, null), n10 = true; + }, p: function(e21, t11) { + o10 && o10.p && (!n10 || 64 & t11[0] | 1048576 & t11[2]) && ri(o10, r10, e21, e21[82], n10 ? ni(r10, e21[82], t11, sR) : oi(e21[82]), cR); + }, i: function(e21) { + n10 || (wa(i10, e21), n10 = true); + }, o: function(e21) { + xa(i10, e21), n10 = false; + }, d: function(e21) { + e21 && wi(t10), i10 && i10.d(e21); + } }; + } + function GR(e20) { + var t10, n10, r10 = e20[83].required, o10 = ei(r10, e20, e20[82], oR), i10 = o10 || { c: function() { + Ai(n10 = ji("select"), "class", "required svelte-82qwg8"), n10.required = true, Ai(n10, "tabindex", "-1"), Ai(n10, "aria-hidden", "true"); + }, m: function(e21, t11) { + ki(e21, n10, t11); + }, p: Wo, d: function(e21) { + e21 && wi(n10); + } }; + return { c: function() { + i10 && i10.c(); + }, m: function(e21, n11) { + i10 && i10.m(e21, n11), t10 = true; + }, p: function(e21, n11) { + o10 && o10.p && (!t10 || 8 & n11[0] | 1048576 & n11[2]) && ri(o10, r10, e21, e21[82], t10 ? ni(r10, e21[82], n11, rR) : oi(e21[82]), oR); + }, i: function(e21) { + t10 || (wa(i10, e21), t10 = true); + }, o: function(e21) { + xa(i10, e21), t10 = false; + }, d: function(e21) { + i10 && i10.d(e21); + } }; + } + function QR(e20) { + for (var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10 = e20[6] && TR(e20), x10 = e20[2] && BR(e20), j10 = e20[83].prepend, S10 = ei(j10, e20, e20[82], wR), C10 = e20[25] && LR(e20), $10 = [{ readOnly: u10 = !e20[17] }, e20[27], { placeholder: e20[33] }, { style: e20[18] }, { disabled: e20[11] }], _10 = {}, O10 = 0; O10 < $10.length; O10 += 1) + _10 = Jo(_10, $10[O10]); + var M10 = e20[5] && UR(e20), E10 = e20[34] && JR(e20), A10 = e20[20] && KR(e20), P10 = e20[83]["input-hidden"], T8 = ei(P10, e20, e20[82], aR), R8 = T8 || /* @__PURE__ */ function(e21) { + var t11, n11; + return { c: function() { + Ai(t11 = ji("input"), "name", e21[8]), Ai(t11, "type", "hidden"), t11.value = n11 = e21[3] ? JSON.stringify(e21[3]) : null, Ai(t11, "class", "svelte-82qwg8"); + }, m: function(e23, n12) { + ki(e23, t11, n12); + }, p: function(e23, r11) { + 256 & r11[0] && Ai(t11, "name", e23[8]), 8 & r11[0] && n11 !== (n11 = e23[3] ? JSON.stringify(e23[3]) : null) && (t11.value = n11); + }, d: function(e23) { + e23 && wi(t11); + } }; + }(e20), N8 = e20[16] && (!e20[3] || 0 === e20[3].length) && GR(e20); + return { c: function() { + t10 = ji("div"), w10 && w10.c(), n10 = $i(), r10 = ji("span"), x10 && x10.c(), o10 = $i(), i10 = ji("div"), S10 && S10.c(), a10 = $i(), s10 = ji("div"), C10 && C10.c(), c10 = $i(), l10 = ji("input"), f10 = $i(), d10 = ji("div"), M10 && M10.c(), h10 = $i(), E10 && E10.c(), v10 = $i(), A10 && A10.c(), p10 = $i(), R8 && R8.c(), m10 = $i(), N8 && N8.c(), Ai(r10, "aria-live", "polite"), Ai(r10, "aria-atomic", "false"), Ai(r10, "aria-relevant", "additions text"), Ai(r10, "class", "a11y-text svelte-82qwg8"), Ai(i10, "class", "prepend svelte-82qwg8"), Ti(l10, _10), zi(l10, "svelte-82qwg8", true), Ai(s10, "class", "value-container svelte-82qwg8"), Ai(d10, "class", "indicators svelte-82qwg8"), Ai(t10, "class", g10 = "svelte-select " + e20[21] + " svelte-82qwg8"), Ai(t10, "style", e20[14]), Ai(t10, "role", "none"), zi(t10, "multi", e20[9]), zi(t10, "disabled", e20[11]), zi(t10, "focused", e20[2]), zi(t10, "list-open", e20[6]), zi(t10, "show-chevron", e20[20]), zi(t10, "error", e20[15]); + }, m: function(u11, g11) { + ki(u11, t10, g11), w10 && w10.m(t10, null), pi(t10, n10), pi(t10, r10), x10 && x10.m(r10, null), pi(t10, o10), pi(t10, i10), S10 && S10.m(i10, null), pi(t10, a10), pi(t10, s10), C10 && C10.m(s10, null), pi(s10, c10), pi(s10, l10), l10.autofocus && l10.focus(), e20[94](l10), Ii(l10, e20[4]), pi(t10, f10), pi(t10, d10), M10 && M10.m(d10, null), pi(d10, h10), E10 && E10.m(d10, null), pi(d10, v10), A10 && A10.m(d10, null), pi(t10, p10), R8 && R8.m(t10, null), pi(t10, m10), N8 && N8.m(t10, null), e20[96](t10), y10 = true, b10 || (k10 = [Oi(window, "click", e20[42]), Oi(window, "keydown", e20[37]), Oi(l10, "keydown", e20[37]), Oi(l10, "blur", e20[39]), Oi(l10, "focus", e20[38]), Oi(l10, "input", e20[95]), Oi(t10, "pointerup", Mi(e20[40])), ci(e20[48].call(null, t10))], b10 = true); + }, p: function(e21, o11) { + e21[6] ? w10 ? (w10.p(e21, o11), 64 & o11[0] && wa(w10, 1)) : ((w10 = TR(e21)).c(), wa(w10, 1), w10.m(t10, n10)) : w10 && (ba(), xa(w10, 1, 1, function() { + w10 = null; + }), ka()), e21[2] ? x10 ? x10.p(e21, o11) : ((x10 = BR(e21)).c(), x10.m(r10, null)) : x10 && (x10.d(1), x10 = null), S10 && S10.p && (!y10 || 1048576 & o11[2]) && ri(S10, j10, e21, e21[82], y10 ? ni(j10, e21[82], o11, kR) : oi(e21[82]), wR), e21[25] ? C10 ? (C10.p(e21, o11), 33554432 & o11[0] && wa(C10, 1)) : ((C10 = LR(e21)).c(), wa(C10, 1), C10.m(s10, c10)) : C10 && (ba(), xa(C10, 1, 1, function() { + C10 = null; + }), ka()), Ti(l10, _10 = Ma($10, [(!y10 || 131072 & o11[0] && u10 !== (u10 = !e21[17])) && { readOnly: u10 }, 134217728 & o11[0] && e21[27], (!y10 || 4 & o11[1]) && { placeholder: e21[33] }, (!y10 || 262144 & o11[0]) && { style: e21[18] }, (!y10 || 2048 & o11[0]) && { disabled: e21[11] }])), 16 & o11[0] && l10.value !== e21[4] && Ii(l10, e21[4]), zi(l10, "svelte-82qwg8", true), e21[5] ? M10 ? (M10.p(e21, o11), 32 & o11[0] && wa(M10, 1)) : ((M10 = UR(e21)).c(), wa(M10, 1), M10.m(d10, h10)) : M10 && (ba(), xa(M10, 1, 1, function() { + M10 = null; + }), ka()), e21[34] ? E10 ? (E10.p(e21, o11), 8 & o11[1] && wa(E10, 1)) : ((E10 = JR(e21)).c(), wa(E10, 1), E10.m(d10, v10)) : E10 && (ba(), xa(E10, 1, 1, function() { + E10 = null; + }), ka()), e21[20] ? A10 ? (A10.p(e21, o11), 1048576 & o11[0] && wa(A10, 1)) : ((A10 = KR(e21)).c(), wa(A10, 1), A10.m(d10, null)) : A10 && (ba(), xa(A10, 1, 1, function() { + A10 = null; + }), ka()), T8 ? T8.p && (!y10 || 8 & o11[0] | 1048576 & o11[2]) && ri(T8, P10, e21, e21[82], y10 ? ni(P10, e21[82], o11, iR) : oi(e21[82]), aR) : R8 && R8.p && (!y10 || 264 & o11[0]) && R8.p(e21, y10 ? o11 : [-1, -1, -1, -1, -1]), !e21[16] || e21[3] && 0 !== e21[3].length ? N8 && (ba(), xa(N8, 1, 1, function() { + N8 = null; + }), ka()) : N8 ? (N8.p(e21, o11), 65544 & o11[0] && wa(N8, 1)) : ((N8 = GR(e21)).c(), wa(N8, 1), N8.m(t10, null)), (!y10 || 2097152 & o11[0] && g10 !== (g10 = "svelte-select " + e21[21] + " svelte-82qwg8")) && Ai(t10, "class", g10), (!y10 || 16384 & o11[0]) && Ai(t10, "style", e21[14]), (!y10 || 2097664 & o11[0]) && zi(t10, "multi", e21[9]), (!y10 || 2099200 & o11[0]) && zi(t10, "disabled", e21[11]), (!y10 || 2097156 & o11[0]) && zi(t10, "focused", e21[2]), (!y10 || 2097216 & o11[0]) && zi(t10, "list-open", e21[6]), (!y10 || 3145728 & o11[0]) && zi(t10, "show-chevron", e21[20]), (!y10 || 2129920 & o11[0]) && zi(t10, "error", e21[15]); + }, i: function(e21) { + y10 || (wa(w10), wa(S10, e21), wa(C10), wa(M10), wa(E10), wa(A10), wa(R8, e21), wa(N8), y10 = true); + }, o: function(e21) { + xa(w10), xa(S10, e21), xa(C10), xa(M10), xa(E10), xa(A10), xa(R8, e21), xa(N8), y10 = false; + }, d: function(n11) { + n11 && wi(t10), w10 && w10.d(), x10 && x10.d(), S10 && S10.d(n11), C10 && C10.d(), e20[94](null), M10 && M10.d(), E10 && E10.d(), A10 && A10.d(), R8 && R8.d(n11), N8 && N8.d(), e20[96](null), b10 = false, Qo(k10); + } }; + } + function YR(e20) { + return e20.map(function(e21, t10) { + return { index: t10, value: e21, label: "".concat(e21) }; + }); + } + function XR(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10 = t10.$$slots, k10 = void 0 === b10 ? {} : b10, w10 = t10.$$scope, x10 = function(e21) { + var t11 = {}; + for (var n11 in e21) + t11[n11] = true; + return t11; + }(k10), j10 = Yi(), S10 = t10.justValue, C10 = void 0 === S10 ? null : S10, $10 = t10.filter, _10 = void 0 === $10 ? HT : $10, O10 = t10.getItems, M10 = void 0 === O10 ? WT : O10, E10 = t10.id, A10 = void 0 === E10 ? null : E10, P10 = t10.name, T8 = void 0 === P10 ? null : P10, R8 = t10.container, N8 = void 0 === R8 ? void 0 : R8, I10 = t10.input, D10 = void 0 === I10 ? void 0 : I10, q10 = t10.multiple, z10 = void 0 !== q10 && q10, B10 = t10.multiFullItemClearable, L10 = void 0 !== B10 && B10, F10 = t10.disabled, V10 = void 0 !== F10 && F10, H10 = t10.focused, W10 = void 0 !== H10 && H10, U10 = t10.value, J10 = void 0 === U10 ? null : U10, K10 = t10.filterText, G10 = void 0 === K10 ? "" : K10, Q10 = t10.placeholder, Y10 = void 0 === Q10 ? "Please select" : Q10, X10 = t10.placeholderAlwaysShow, Z10 = void 0 !== X10 && X10, ee2 = t10.items, te2 = void 0 === ee2 ? null : ee2, ne2 = t10.label, re2 = void 0 === ne2 ? "label" : ne2, oe2 = t10.itemFilter, ie2 = void 0 === oe2 ? function(e21, t11, n11) { + return "".concat(e21).toLowerCase().includes(t11.toLowerCase()); + } : oe2, ae2 = t10.groupBy, se2 = void 0 === ae2 ? void 0 : ae2, ce2 = t10.groupFilter, le2 = void 0 === ce2 ? function(e21) { + return e21; + } : ce2, ue2 = t10.groupHeaderSelectable, fe2 = void 0 !== ue2 && ue2, de2 = t10.itemId, he2 = void 0 === de2 ? "value" : de2, ve2 = t10.loadOptions, pe2 = void 0 === ve2 ? void 0 : ve2, me2 = t10.containerStyles, ge2 = void 0 === me2 ? "" : me2, ye2 = t10.hasError, be2 = void 0 !== ye2 && ye2, ke2 = t10.filterSelectedItems, we2 = void 0 === ke2 || ke2, xe2 = t10.required, je2 = void 0 !== xe2 && xe2, Se2 = t10.closeListOnChange, Ce2 = void 0 === Se2 || Se2, $e2 = t10.clearFilterTextOnBlur, _e2 = void 0 === $e2 || $e2, Oe2 = t10.createGroupHeaderItem, Me2 = void 0 === Oe2 ? function(e21, t11) { + return qo({ value: e21 }, re2, e21); + } : Oe2, Ee2 = t10.searchable, Ae2 = void 0 === Ee2 || Ee2, Pe2 = t10.inputStyles, Te2 = void 0 === Pe2 ? "" : Pe2, Re2 = t10.clearable, Ne2 = void 0 === Re2 || Re2, Ie2 = t10.loading, De2 = void 0 !== Ie2 && Ie2, qe2 = t10.listOpen, ze2 = void 0 !== qe2 && qe2, Be2 = t10.debounce, Le2 = void 0 === Be2 ? function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; + clearTimeout(d10), d10 = setTimeout(e21, t11); + } : Be2, Fe2 = t10.debounceWait, Ve2 = void 0 === Fe2 ? 300 : Fe2, He2 = t10.hideEmptyState, We2 = void 0 !== He2 && He2, Ue2 = t10.inputAttributes, Je2 = void 0 === Ue2 ? {} : Ue2, Ke2 = t10.listAutoWidth, Ge2 = void 0 === Ke2 || Ke2, Qe2 = t10.showChevron, Ye2 = void 0 !== Qe2 && Qe2, Xe2 = t10.listOffset, Ze2 = void 0 === Xe2 ? 5 : Xe2, et2 = t10.hoverItemIndex, tt2 = void 0 === et2 ? 0 : et2, nt2 = t10.floatingConfig, rt2 = void 0 === nt2 ? {} : nt2, ot2 = t10.class, it2 = void 0 === ot2 ? "" : ot2; + function at2(e21) { + var t11 = [], n11 = {}; + e21.forEach(function(e23) { + var r12 = se2(e23); + t11.includes(r12) || (t11.push(r12), n11[r12] = [], r12 && n11[r12].push(Object.assign(Me2(r12, e23), { id: r12, groupHeader: true, selectable: fe2 }))), n11[r12].push(Object.assign({ groupItem: !!r12 }, e23)); + }); + var r11 = []; + return le2(t11).forEach(function(e23) { + n11[e23] && r11.push.apply(r11, Bo(n11[e23])); + }), r11; + } + function st2() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, t11 = arguments.length > 1 ? arguments[1] : void 0; + n10(7, tt2 = e21 < 0 ? 0 : e21), !t11 && se2 && l10[tt2] && !l10[tt2].selectable && Mt2(1); + } + function ct2() { + var e21 = true; + if (J10) { + var t11 = [], r11 = []; + J10.forEach(function(n11) { + t11.includes(n11[he2]) ? e21 = false : (t11.push(n11[he2]), r11.push(n11)); + }), e21 || n10(3, J10 = r11); + } + return e21; + } + function lt2(e21) { + var t11 = e21 ? e21[he2] : J10[he2]; + return te2.find(function(e23) { + return e23[he2] === t11; + }); + } + function ut2(e21) { + return ft2.apply(this, arguments); + } + function ft2() { + return ft2 = xo(ko().mark(function e21(t11) { + var r11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + r11 = J10[t11], 1 === J10.length ? n10(3, J10 = void 0) : n10(3, J10 = J10.filter(function(e24) { + return e24 !== r11; + })), j10("clear", r11); + case 3: + case "end": + return e23.stop(); + } + }, e21); + })), ft2.apply(this, arguments); + } + function dt2(e21) { + var t11, r11; + W10 && D10 === (null === (t11 = document) || void 0 === t11 ? void 0 : t11.activeElement) || (e21 && j10("focus", e21), null === (r11 = D10) || void 0 === r11 || r11.focus(), n10(2, W10 = true)); + } + function ht2(e21) { + return vt2.apply(this, arguments); + } + function vt2() { + return (vt2 = xo(ko().mark(function e21(t11) { + var r11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (!Ct2) { + e23.next = 2; + break; + } + return e23.abrupt("return"); + case 2: + (ze2 || W10) && (j10("blur", t11), pt2(), n10(2, W10 = false), n10(26, h10 = void 0), null === (r11 = D10) || void 0 === r11 || r11.blur()); + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function pt2() { + _e2 && n10(4, G10 = ""), n10(6, ze2 = false); + } + y10 = xo(ko().mark(function e21() { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + n10(78, v10 = J10), n10(79, p10 = G10), n10(80, m10 = z10); + case 3: + case "end": + return e23.stop(); + } + }, e21); + })), Ki().$$.before_update.push(y10), Gi(function() { + ze2 && n10(2, W10 = true), W10 && D10 && D10.focus(); + }); + var mt2 = t10.ariaValues, gt2 = void 0 === mt2 ? function(e21) { + return "Option ".concat(e21, ", selected."); + } : mt2, yt2 = t10.ariaListOpen, bt2 = void 0 === yt2 ? function(e21, t11) { + return "You are currently focused on option ".concat(e21, ". There are ").concat(t11, " results available."); + } : yt2, kt2 = t10.ariaFocused, wt2 = void 0 === kt2 ? function() { + return "Select is focused, type to refine list, press down to open the menu."; + } : kt2; + var xt2, jt2 = null; + function St2() { + clearTimeout(xt2), xt2 = setTimeout(function() { + Ct2 = false; + }, 100); + } + Qi(function() { + var e21; + null === (e21 = jt2) || void 0 === e21 || e21.remove(); + }); + var Ct2 = false; + function $t2(e21) { + e21 && false !== e21.selectable && function(e23) { + if (e23) { + n10(4, G10 = ""); + var t11 = Object.assign({}, e23); + if (t11.groupHeader && !t11.selectable) + return; + n10(3, J10 = z10 ? J10 ? J10.concat([t11]) : [t11] : n10(3, J10 = t11)), setTimeout(function() { + Ce2 && pt2(), n10(26, h10 = void 0), j10("change", J10), j10("select", e23); + }); + } + }(e21); + } + function _t2(e21) { + Ct2 || n10(7, tt2 = e21); + } + function Ot2(e21) { + var t11 = e21.item, r11 = e21.i; + if (false !== (null == t11 ? void 0 : t11.selectable)) + return J10 && !z10 && J10[he2] === t11[he2] ? pt2() : void (function(e23) { + return e23.groupHeader && e23.selectable || e23.selectable || !e23.hasOwnProperty("selectable"); + }(t11) && (n10(7, tt2 = r11), $t2(t11))); + } + function Mt2(e21) { + if (0 === l10.filter(function(e23) { + return !Object.hasOwn(e23, "selectable") || true === e23.selectable; + }).length) + return n10(7, tt2 = 0); + e21 > 0 && tt2 === l10.length - 1 ? n10(7, tt2 = 0) : n10(7, e21 < 0 && 0 === tt2 ? tt2 = l10.length - 1 : tt2 += e21); + var t11 = l10[tt2]; + t11 && false === t11.selectable && (1 !== e21 && -1 !== e21 || Mt2(e21)); + } + var Et2 = Pt2, At2 = Pt2; + function Pt2(e21) { + return { update: function(t11) { + t11.scroll && (St2(), e21.scrollIntoView({ behavior: "auto", block: "nearest" })); + } }; + } + var Tt2, Rt2 = { strategy: "absolute", placement: "bottom-start", middleware: [(Tt2 = Ze2, void 0 === Tt2 && (Tt2 = 0), { name: "offset", options: Tt2, fn: function(e21) { + return xo(ko().mark(function t11() { + var n11, r11, o11, i11, a11, s11, c11; + return ko().wrap(function(t12) { + for (; ; ) + switch (t12.prev = t12.next) { + case 0: + return o11 = e21.x, i11 = e21.y, a11 = e21.placement, s11 = e21.middlewareData, t12.next = 3, cT(e21, Tt2); + case 3: + if (c11 = t12.sent, a11 !== (null == (n11 = s11.offset) ? void 0 : n11.placement) || null == (r11 = s11.arrow) || !r11.alignmentOffset) { + t12.next = 6; + break; + } + return t12.abrupt("return", {}); + case 6: + return t12.abrupt("return", { x: o11 + c11.x, y: i11 + c11.y, data: Ro(Ro({}, c11), {}, { placement: a11 }) }); + case 7: + case "end": + return t12.stop(); + } + }, t11); + }))(); + } }), FT(), LT()], autoUpdate: false }, Nt2 = /* @__PURE__ */ function(e21) { + var t11, n11, r11 = { autoUpdate: true }, o11 = e21, i11 = function(t12) { + return Ro(Ro(Ro({}, r11), e21 || {}), t12 || {}); + }, a11 = function(e23) { + t11 && n11 && (o11 = i11(e23), VT(t11, n11, o11).then(function(e24) { + var t12; + Object.assign(n11.style, { position: e24.strategy, left: "".concat(e24.x, "px"), top: "".concat(e24.y, "px") }), (null === (t12 = o11) || void 0 === t12 ? void 0 : t12.onComputed) && o11.onComputed(e24); + })); + }, s11 = function(e23) { + Qi(e23.subscribe(function(e24) { + void 0 === t11 ? (t11 = e24, a11()) : (Object.assign(t11, e24), a11()); + })); + }; + return [function(e23) { + if ("subscribe" in e23) + return s11(e23), {}; + t11 = e23, a11(); + }, function(e23, r12) { + var s12; + n11 = e23, o11 = i11(r12), setTimeout(function() { + return a11(r12); + }, 0), a11(r12); + var c11 = function() { + s12 && (s12(), s12 = void 0); + }, l11 = function() { + var e24 = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : o11 || {}).autoUpdate; + c11(), false !== e24 && ca().then(function() { + return BT(t11, n11, function() { + return a11(o11); + }, true === e24 ? {} : e24); + }); + }; + return s12 = l11(), { update: function(e24) { + a11(e24), s12 = l11(e24); + }, destroy: function() { + c11(); + } }; + }, a11]; + }(Rt2), It2 = jo(Nt2, 3), Dt2 = It2[0], qt2 = It2[1], zt2 = It2[2], Bt2 = true; + return e20.$$set = function(e21) { + "justValue" in e21 && n10(52, C10 = e21.justValue), "filter" in e21 && n10(53, _10 = e21.filter), "getItems" in e21 && n10(54, M10 = e21.getItems), "id" in e21 && n10(55, A10 = e21.id), "name" in e21 && n10(8, T8 = e21.name), "container" in e21 && n10(0, N8 = e21.container), "input" in e21 && n10(1, D10 = e21.input), "multiple" in e21 && n10(9, z10 = e21.multiple), "multiFullItemClearable" in e21 && n10(10, L10 = e21.multiFullItemClearable), "disabled" in e21 && n10(11, V10 = e21.disabled), "focused" in e21 && n10(2, W10 = e21.focused), "value" in e21 && n10(3, J10 = e21.value), "filterText" in e21 && n10(4, G10 = e21.filterText), "placeholder" in e21 && n10(56, Y10 = e21.placeholder), "placeholderAlwaysShow" in e21 && n10(57, Z10 = e21.placeholderAlwaysShow), "items" in e21 && n10(51, te2 = e21.items), "label" in e21 && n10(12, re2 = e21.label), "itemFilter" in e21 && n10(58, ie2 = e21.itemFilter), "groupBy" in e21 && n10(59, se2 = e21.groupBy), "groupFilter" in e21 && n10(60, le2 = e21.groupFilter), "groupHeaderSelectable" in e21 && n10(61, fe2 = e21.groupHeaderSelectable), "itemId" in e21 && n10(13, he2 = e21.itemId), "loadOptions" in e21 && n10(62, pe2 = e21.loadOptions), "containerStyles" in e21 && n10(14, ge2 = e21.containerStyles), "hasError" in e21 && n10(15, be2 = e21.hasError), "filterSelectedItems" in e21 && n10(63, we2 = e21.filterSelectedItems), "required" in e21 && n10(16, je2 = e21.required), "closeListOnChange" in e21 && n10(64, Ce2 = e21.closeListOnChange), "clearFilterTextOnBlur" in e21 && n10(65, _e2 = e21.clearFilterTextOnBlur), "createGroupHeaderItem" in e21 && n10(66, Me2 = e21.createGroupHeaderItem), "searchable" in e21 && n10(17, Ae2 = e21.searchable), "inputStyles" in e21 && n10(18, Te2 = e21.inputStyles), "clearable" in e21 && n10(68, Ne2 = e21.clearable), "loading" in e21 && n10(5, De2 = e21.loading), "listOpen" in e21 && n10(6, ze2 = e21.listOpen), "debounce" in e21 && n10(69, Le2 = e21.debounce), "debounceWait" in e21 && n10(70, Ve2 = e21.debounceWait), "hideEmptyState" in e21 && n10(19, We2 = e21.hideEmptyState), "inputAttributes" in e21 && n10(71, Je2 = e21.inputAttributes), "listAutoWidth" in e21 && n10(72, Ge2 = e21.listAutoWidth), "showChevron" in e21 && n10(20, Ye2 = e21.showChevron), "listOffset" in e21 && n10(73, Ze2 = e21.listOffset), "hoverItemIndex" in e21 && n10(7, tt2 = e21.hoverItemIndex), "floatingConfig" in e21 && n10(74, rt2 = e21.floatingConfig), "class" in e21 && n10(21, it2 = e21.class), "ariaValues" in e21 && n10(75, gt2 = e21.ariaValues), "ariaListOpen" in e21 && n10(76, bt2 = e21.ariaListOpen), "ariaFocused" in e21 && n10(77, wt2 = e21.ariaFocused), "$$scope" in e21 && n10(82, w10 = e21.$$scope); + }, e20.$$.update = function() { + var t11, d11, y11, b11, k11; + (8 & e20.$$.dirty[0] | 1048576 & e20.$$.dirty[1] && J10 && function() { + if ("string" == typeof J10) { + var e21 = (te2 || []).find(function(e23) { + return e23[he2] === J10; + }); + n10(3, J10 = e21 || qo(qo({}, he2, J10), "label", J10)); + } else + z10 && Array.isArray(J10) && J10.length > 0 && n10(3, J10 = J10.map(function(e23) { + return "string" == typeof e23 ? { value: e23, label: e23 } : e23; + })); + }(), 131072 & e20.$$.dirty[0] | 512 & e20.$$.dirty[2] && (!Je2 && Ae2 || (n10(27, g10 = Object.assign({ autocapitalize: "none", autocomplete: "off", autocorrect: "off", spellcheck: false, tabindex: 0, type: "text", "aria-autocomplete": "list" }, Je2)), A10 && n10(27, g10.id = A10, g10), Ae2 || n10(27, g10.readonly = true, g10))), 512 & e20.$$.dirty[0] && z10 && J10 && (Array.isArray(J10) ? n10(3, J10 = Bo(J10)) : n10(3, J10 = [J10])), 512 & e20.$$.dirty[0] | 262144 & e20.$$.dirty[2] && m10 && !z10 && J10 && n10(3, J10 = null), 520 & e20.$$.dirty[0] && z10 && J10 && J10.length > 1 && ct2(), 8 & e20.$$.dirty[0] && J10 && (z10 ? JSON.stringify(J10) !== JSON.stringify(v10) && ct2() && j10("input", J10) : v10 && JSON.stringify(J10[he2]) === JSON.stringify(v10[he2]) || j10("input", J10)), 520 & e20.$$.dirty[0] | 65536 & e20.$$.dirty[2] && !J10 && z10 && v10 && j10("input", J10), 6 & e20.$$.dirty[0] && !W10 && D10 && pt2(), 16 & e20.$$.dirty[0] | 131072 & e20.$$.dirty[2] && G10 !== p10 && (pe2 || 0 !== G10.length) && (pe2 ? Le2(xo(ko().mark(function e21() { + var t12; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return n10(5, De2 = true), e23.next = 3, M10({ dispatch: j10, loadOptions: pe2, convertStringItemsToObjects: YR, filterText: G10 }); + case 3: + (t12 = e23.sent) ? (n10(5, De2 = t12.loading), n10(6, ze2 = ze2 ? t12.listOpen : G10.length > 0), n10(2, W10 = ze2 && t12.focused), n10(51, te2 = se2 ? at2(t12.filteredItems) : t12.filteredItems)) : (n10(5, De2 = false), n10(2, W10 = true), n10(6, ze2 = true)); + case 5: + case "end": + return e23.stop(); + } + }, e21); + })), Ve2) : (n10(6, ze2 = true), z10 && n10(26, h10 = void 0))), 12824 & e20.$$.dirty[0] | 407896064 & e20.$$.dirty[1] | 3 & e20.$$.dirty[2] && n10(24, l10 = _10({ loadOptions: pe2, filterText: G10, items: te2, multiple: z10, value: J10, itemId: he2, groupBy: se2, label: re2, filterSelectedItems: we2, itemFilter: ie2, convertStringItemsToObjects: YR, filterGroupedItems: at2 })), 16777800 & e20.$$.dirty[0] && !z10 && ze2 && J10 && l10 && (t11 = l10.findIndex(function(e21) { + return e21[he2] === J10[he2]; + }), st2(t11, true)), 576 & e20.$$.dirty[0] && ze2 && z10 && n10(7, tt2 = 0), 16 & e20.$$.dirty[0] && G10 && n10(7, tt2 = 0), 128 & e20.$$.dirty[0] && function(e21) { + j10("hoverItem", e21); + }(tt2), 520 & e20.$$.dirty[0] && n10(25, r10 = z10 ? J10 && J10.length > 0 : J10), 33554448 & e20.$$.dirty[0] && n10(35, o10 = r10 && G10.length > 0), 33556512 & e20.$$.dirty[0] | 64 & e20.$$.dirty[2] && n10(34, i10 = r10 && Ne2 && !V10 && !De2), 520 & e20.$$.dirty[0] | 100663296 & e20.$$.dirty[1]) && n10(33, a10 = Z10 && z10 || z10 && 0 === (null === (d11 = J10) || void 0 === d11 ? void 0 : d11.length) ? Y10 : J10 ? "" : Y10); + (520 & e20.$$.dirty[0] && n10(32, s10 = J10 ? (y11 = void 0, y11 = z10 && J10.length > 0 ? J10.map(function(e21) { + return e21[re2]; + }).join(", ") : J10[re2], gt2(y11)) : ""), 16777412 & e20.$$.dirty[0] && n10(31, c10 = function() { + if (!l10 || 0 === l10.length) + return ""; + var e21 = l10[tt2]; + if (ze2 && e21) { + var t12 = l10 ? l10.length : 0; + return bt2(e21[re2], t12); + } + return wt2(); + }()), 1048576 & e20.$$.dirty[1] && function(e21) { + e21 && 0 !== e21.length && !e21.some(function(e23) { + return "object" !== Ho(e23); + }) && J10 && (z10 ? !J10.some(function(e23) { + return !e23 || !e23[he2]; + }) : J10[he2]) && (Array.isArray(J10) ? n10(3, J10 = J10.map(function(e23) { + return lt2(e23) || e23; + })) : n10(3, J10 = lt2() || J10)); + }(te2), 8712 & e20.$$.dirty[0] && n10(52, C10 = z10 ? J10 ? J10.map(function(e21) { + return e21[he2]; + }) : null : J10 ? J10[he2] : J10), 520 & e20.$$.dirty[0] | 65536 & e20.$$.dirty[2] && (z10 || !v10 || J10 || j10("input", J10)), 16777800 & e20.$$.dirty[0] && ze2 && l10 && !z10 && !J10 && st2(), 16777216 & e20.$$.dirty[0] && function(e21) { + ze2 && j10("filter", e21); + }(l10), 1 & e20.$$.dirty[0] | 4096 & e20.$$.dirty[2]) && (N8 && void 0 === (null === (b11 = rt2) || void 0 === b11 ? void 0 : b11.autoUpdate) && n10(81, Rt2.autoUpdate = true, Rt2)); + 1 & e20.$$.dirty[0] | 528384 & e20.$$.dirty[2] && N8 && rt2 && zt2(Object.assign(Rt2, rt2)), 8388608 & e20.$$.dirty[0] && n10(30, u10 = !!jt2), 8388672 & e20.$$.dirty[0] && function(e21, t12) { + if (!e21 || !t12) + return n10(28, Bt2 = true); + setTimeout(function() { + n10(28, Bt2 = false); + }, 0); + }(jt2, ze2), 8388673 & e20.$$.dirty[0] && ze2 && N8 && jt2 && (k11 = N8.getBoundingClientRect().width, n10(23, jt2.style.width = Ge2 ? k11 + "px" : "auto", jt2)), 128 & e20.$$.dirty[0] && n10(29, f10 = tt2), 70 & e20.$$.dirty[0] && D10 && ze2 && !W10 && dt2(); + }, [N8, D10, W10, J10, G10, De2, ze2, tt2, T8, z10, L10, V10, re2, he2, ge2, be2, je2, Ae2, Te2, We2, Ye2, it2, function() { + j10("clear", J10), n10(3, J10 = void 0), pt2(), dt2(); + }, jt2, l10, r10, h10, g10, Bt2, f10, u10, c10, s10, a10, i10, o10, ut2, function(e21) { + if (W10) + switch (e21.stopPropagation(), e21.key) { + case "Escape": + e21.preventDefault(), pt2(); + break; + case "Enter": + if (e21.preventDefault(), ze2) { + if (0 === l10.length) + break; + var t11 = l10[tt2]; + if (J10 && !z10 && J10[he2] === t11[he2]) { + pt2(); + break; + } + $t2(l10[tt2]); + } + break; + case "ArrowDown": + e21.preventDefault(), ze2 ? Mt2(1) : (n10(6, ze2 = true), n10(26, h10 = void 0)); + break; + case "ArrowUp": + e21.preventDefault(), ze2 ? Mt2(-1) : (n10(6, ze2 = true), n10(26, h10 = void 0)); + break; + case "Tab": + if (ze2 && W10) { + if (0 === l10.length || J10 && J10[he2] === l10[tt2][he2]) + return pt2(); + e21.preventDefault(), $t2(l10[tt2]), pt2(); + } + break; + case "Backspace": + if (!z10 || G10.length > 0) + return; + if (z10 && J10 && J10.length > 0) { + if (ut2(void 0 !== h10 ? h10 : J10.length - 1), 0 === h10 || void 0 === h10) + break; + n10(26, h10 = J10.length > h10 ? h10 - 1 : void 0); + } + break; + case "ArrowLeft": + if (!J10 || !z10 || G10.length > 0) + return; + void 0 === h10 ? n10(26, h10 = J10.length - 1) : J10.length > h10 && 0 !== h10 && n10(26, h10 -= 1); + break; + case "ArrowRight": + if (!J10 || !z10 || G10.length > 0 || void 0 === h10) + return; + h10 === J10.length - 1 ? n10(26, h10 = void 0) : h10 < J10.length - 1 && n10(26, h10 += 1); + } + }, dt2, ht2, function() { + if (!V10) + return G10.length > 0 ? n10(6, ze2 = true) : void n10(6, ze2 = !ze2); + }, St2, function(e21) { + var t11; + ze2 || W10 || !N8 || N8.contains(e21.target) || null !== (t11 = jt2) && void 0 !== t11 && t11.contains(e21.target) || ht2(); + }, _t2, Ot2, function(e21, t11, n11) { + if (!z10) + return t11 && t11[n11] === e21[n11]; + }, Et2, At2, Dt2, qt2, x10, te2, C10, _10, M10, A10, Y10, Z10, ie2, se2, le2, fe2, pe2, we2, Ce2, _e2, Me2, function() { + return l10; + }, Ne2, Le2, Ve2, Je2, Ge2, Ze2, rt2, gt2, bt2, wt2, v10, p10, m10, Rt2, w10, k10, function(t11) { + ea.call(this, e20, t11); + }, function(t11) { + ea.call(this, e20, t11); + }, function(t11) { + ea.call(this, e20, t11); + }, function(t11) { + ea.call(this, e20, t11); + }, function(e21) { + return _t2(e21); + }, function(e21) { + return _t2(e21); + }, function(e21, t11) { + return Ot2({ item: e21, i: t11 }); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(23, jt2 = e21); + }); + }, function(e21) { + return ut2(e21); + }, function(e21) { + return L10 ? ut2(e21) : {}; + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(1, D10 = e21); + }); + }, function() { + G10 = this.value, n10(4, G10); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(0, N8 = e21); + }); + }]; + } + var ZR = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, XR, QR, Xo, { justValue: 52, filter: 53, getItems: 54, id: 55, name: 8, container: 0, input: 1, multiple: 9, multiFullItemClearable: 10, disabled: 11, focused: 2, value: 3, filterText: 4, placeholder: 56, placeholderAlwaysShow: 57, items: 51, label: 12, itemFilter: 58, groupBy: 59, groupFilter: 60, groupHeaderSelectable: 61, itemId: 13, loadOptions: 62, containerStyles: 14, hasError: 15, filterSelectedItems: 63, required: 16, closeListOnChange: 64, clearFilterTextOnBlur: 65, createGroupHeaderItem: 66, getFilteredItems: 67, searchable: 17, inputStyles: 18, clearable: 68, loading: 5, listOpen: 6, debounce: 69, debounceWait: 70, hideEmptyState: 19, inputAttributes: 71, listAutoWidth: 72, showChevron: 20, listOffset: 73, hoverItemIndex: 7, floatingConfig: 74, class: 21, handleClear: 22, ariaValues: 75, ariaListOpen: 76, ariaFocused: 77 }, nR, [-1, -1, -1, -1, -1]), n10; + } + return Ao(t10, Ia), Do(t10, [{ key: "getFilteredItems", get: function() { + return this.$$.ctx[67]; + } }, { key: "handleClear", get: function() { + return this.$$.ctx[22]; + } }]), t10; + }(); + function eN(e20) { + mi(e20, "svelte-ijtq0l", "table.jse-transform-wizard.svelte-ijtq0l.svelte-ijtq0l{border-collapse:collapse;border-spacing:0;width:100%}table.jse-transform-wizard.svelte-ijtq0l input.svelte-ijtq0l{font-family:inherit;font-size:inherit}table.jse-transform-wizard.svelte-ijtq0l tr th.svelte-ijtq0l{font-weight:normal;text-align:left;width:60px}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l{width:100%;display:flex;flex-direction:row;margin-bottom:calc(0.5 * var(--jse-padding, 10px))}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select .multi-item{align-items:center}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select .value-container{gap:0 !important}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-filter-path{flex:4;margin-right:calc(0.5 * var(--jse-padding, 10px))}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-filter-relation{flex:1.5;margin-right:calc(0.5 * var(--jse-padding, 10px))}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-sort-path{flex:3;margin-right:calc(0.5 * var(--jse-padding, 10px))}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-sort-direction{flex:1}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select.jse-projection-paths{flex:1}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal.svelte-ijtq0l .svelte-select input{box-sizing:border-box}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal .jse-filter-value.svelte-ijtq0l{flex:4;padding:4px 8px;border:var(--jse-input-border, 1px solid #d8dbdf);border-radius:var(--jse-input-radius, 3px);outline:none;background:var(--jse-input-background, var(--jse-background-color, #fff));color:inherit}table.jse-transform-wizard.svelte-ijtq0l tr td .jse-horizontal .jse-filter-value.svelte-ijtq0l:focus{border:var(--jse-input-border-focus, 1px solid var(--jse-input-border-focus, var(--jse-theme-color, #3883fa)))}"); + } + function tN(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, _10, O10, M10, E10, A10, P10, T8, R8, N8; + function I10(t11) { + e20[16](t11); + } + var D10 = { class: "jse-filter-path", showChevron: true, items: e20[7] }; + function q10(t11) { + e20[17](t11); + } + void 0 !== e20[0] && (D10.value = e20[0]), s10 = new ZR({ props: D10 }), na.push(function() { + return Aa(s10, "value", I10); + }); + var z10 = { class: "jse-filter-relation", showChevron: true, items: e20[8] }; + function B10(t11) { + e20[19](t11); + } + void 0 !== e20[1] && (z10.value = e20[1]), u10 = new ZR({ props: z10 }), na.push(function() { + return Aa(u10, "value", q10); + }); + var L10 = { class: "jse-sort-path", showChevron: true, items: e20[7] }; + function F10(t11) { + e20[20](t11); + } + void 0 !== e20[3] && (L10.value = e20[3]), k10 = new ZR({ props: L10 }), na.push(function() { + return Aa(k10, "value", B10); + }); + var V10 = { class: "jse-sort-direction", showChevron: true, items: e20[9] }; + function H10(t11) { + e20[21](t11); + } + void 0 !== e20[4] && (V10.value = e20[4]), j10 = new ZR({ props: V10 }), na.push(function() { + return Aa(j10, "value", F10); + }); + var W10 = { class: "jse-projection-paths", multiple: true, showChevron: true, items: e20[6] }; + return void 0 !== e20[5] && (W10.value = e20[5]), A10 = new ZR({ props: W10 }), na.push(function() { + return Aa(A10, "value", H10); + }), { c: function() { + t10 = ji("table"), n10 = ji("tr"), (r10 = ji("th")).textContent = "Filter", o10 = $i(), i10 = ji("td"), a10 = ji("div"), Pa(s10.$$.fragment), l10 = $i(), Pa(u10.$$.fragment), d10 = $i(), h10 = ji("input"), v10 = $i(), p10 = ji("tr"), (m10 = ji("th")).textContent = "Sort", g10 = $i(), y10 = ji("td"), b10 = ji("div"), Pa(k10.$$.fragment), x10 = $i(), Pa(j10.$$.fragment), C10 = $i(), $10 = ji("tr"), (_10 = ji("th")).textContent = "Pick", O10 = $i(), M10 = ji("td"), E10 = ji("div"), Pa(A10.$$.fragment), Ai(r10, "class", "svelte-ijtq0l"), Ai(h10, "class", "jse-filter-value svelte-ijtq0l"), Ai(a10, "class", "jse-horizontal svelte-ijtq0l"), Ai(m10, "class", "svelte-ijtq0l"), Ai(b10, "class", "jse-horizontal svelte-ijtq0l"), Ai(_10, "class", "svelte-ijtq0l"), Ai(E10, "class", "jse-horizontal svelte-ijtq0l"), Ai(t10, "class", "jse-transform-wizard svelte-ijtq0l"); + }, m: function(c11, f11) { + ki(c11, t10, f11), pi(t10, n10), pi(n10, r10), pi(n10, o10), pi(n10, i10), pi(i10, a10), Ta(s10, a10, null), pi(a10, l10), Ta(u10, a10, null), pi(a10, d10), pi(a10, h10), Ii(h10, e20[2]), pi(t10, v10), pi(t10, p10), pi(p10, m10), pi(p10, g10), pi(p10, y10), pi(y10, b10), Ta(k10, b10, null), pi(b10, x10), Ta(j10, b10, null), pi(t10, C10), pi(t10, $10), pi($10, _10), pi($10, O10), pi($10, M10), pi(M10, E10), Ta(A10, E10, null), T8 = true, R8 || (N8 = Oi(h10, "input", e20[18]), R8 = true); + }, p: function(e21, t11) { + var n11 = jo(t11, 1)[0], r11 = {}; + 128 & n11 && (r11.items = e21[7]), !c10 && 1 & n11 && (c10 = true, r11.value = e21[0], ua(function() { + return c10 = false; + })), s10.$set(r11); + var o11 = {}; + !f10 && 2 & n11 && (f10 = true, o11.value = e21[1], ua(function() { + return f10 = false; + })), u10.$set(o11), 4 & n11 && h10.value !== e21[2] && Ii(h10, e21[2]); + var i11 = {}; + 128 & n11 && (i11.items = e21[7]), !w10 && 8 & n11 && (w10 = true, i11.value = e21[3], ua(function() { + return w10 = false; + })), k10.$set(i11); + var a11 = {}; + !S10 && 16 & n11 && (S10 = true, a11.value = e21[4], ua(function() { + return S10 = false; + })), j10.$set(a11); + var l11 = {}; + 64 & n11 && (l11.items = e21[6]), !P10 && 32 & n11 && (P10 = true, l11.value = e21[5], ua(function() { + return P10 = false; + })), A10.$set(l11); + }, i: function(e21) { + T8 || (wa(s10.$$.fragment, e21), wa(u10.$$.fragment, e21), wa(k10.$$.fragment, e21), wa(j10.$$.fragment, e21), wa(A10.$$.fragment, e21), T8 = true); + }, o: function(e21) { + xa(s10.$$.fragment, e21), xa(u10.$$.fragment, e21), xa(k10.$$.fragment, e21), xa(j10.$$.fragment, e21), xa(A10.$$.fragment, e21), T8 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(s10), Ra(u10), Ra(k10), Ra(j10), Ra(A10), R8 = false, N8(); + } }; + } + function nN(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10 = Da("jsoneditor:TransformWizard"), p10 = t10.json, m10 = t10.queryOptions, g10 = void 0 === m10 ? {} : m10, y10 = t10.onChange, b10 = ["==", "!=", "<", "<=", ">", ">="].map(function(e21) { + return { value: e21, label: e21 }; + }), k10 = [{ value: "asc", label: "ascending" }, { value: "desc", label: "descending" }], w10 = null !== (r10 = g10) && void 0 !== r10 && null !== (r10 = r10.filter) && void 0 !== r10 && r10.path ? GO(g10.filter.path) : null, x10 = null !== (o10 = g10) && void 0 !== o10 && null !== (o10 = o10.filter) && void 0 !== o10 && o10.relation ? b10.find(function(e21) { + var t11; + return e21.value === (null === (t11 = g10.filter) || void 0 === t11 ? void 0 : t11.relation); + }) : null, j10 = (null === (i10 = g10) || void 0 === i10 || null === (i10 = i10.filter) || void 0 === i10 ? void 0 : i10.value) || "", S10 = null !== (a10 = g10) && void 0 !== a10 && null !== (a10 = a10.sort) && void 0 !== a10 && a10.path ? GO(g10.sort.path) : null, C10 = null !== (s10 = g10) && void 0 !== s10 && null !== (s10 = s10.sort) && void 0 !== s10 && s10.direction ? k10.find(function(e21) { + var t11; + return e21.value === (null === (t11 = g10.sort) || void 0 === t11 ? void 0 : t11.direction); + }) : null; + return e20.$$set = function(e21) { + "json" in e21 && n10(11, p10 = e21.json), "queryOptions" in e21 && n10(10, g10 = e21.queryOptions), "onChange" in e21 && n10(12, y10 = e21.onChange); + }, e20.$$.update = function() { + var t11, r11, o11, i11, a11, s11, m11, b11, k11, $10, _10, O10, M10; + (2048 & e20.$$.dirty && n10(15, c10 = Array.isArray(p10)), 34816 & e20.$$.dirty && n10(14, l10 = c10 ? T_(p10) : []), 34816 & e20.$$.dirty && n10(13, u10 = c10 ? T_(p10, true) : []), 16384 & e20.$$.dirty && n10(7, f10 = l10.map(GO)), 8192 & e20.$$.dirty && n10(6, d10 = u10 ? u10.map(GO) : []), 1088 & e20.$$.dirty) && n10(5, h10 = null !== (t11 = g10) && void 0 !== t11 && null !== (t11 = t11.projection) && void 0 !== t11 && t11.paths && d10 ? g10.projection.paths.map(function(e21) { + return d10.find(function(t12) { + return Ow(t12.value, e21); + }); + }).filter(function(e21) { + return !!e21; + }) : null); + 1 & e20.$$.dirty && (o11 = null === (r11 = w10) || void 0 === r11 ? void 0 : r11.value, Ow(null === (i11 = g10) || void 0 === i11 || null === (i11 = i11.filter) || void 0 === i11 ? void 0 : i11.path, o11) || (v10("changeFilterPath", o11), n10(10, g10 = Us(g10, ["filter", "path"], o11, true)), y10(g10))); + 2 & e20.$$.dirty && (s11 = null === (a11 = x10) || void 0 === a11 ? void 0 : a11.value, Ow(null === (m11 = g10) || void 0 === m11 || null === (m11 = m11.filter) || void 0 === m11 ? void 0 : m11.relation, s11) || (v10("changeFilterRelation", s11), n10(10, g10 = Us(g10, ["filter", "relation"], s11, true)), y10(g10))); + (4 & e20.$$.dirty && (b11 = j10, Ow(null === (k11 = g10) || void 0 === k11 || null === (k11 = k11.filter) || void 0 === k11 ? void 0 : k11.value, b11) || (v10("changeFilterValue", b11), n10(10, g10 = Us(g10, ["filter", "value"], b11, true)), y10(g10))), 8 & e20.$$.dirty) && function(e21) { + var t12; + Ow(null === (t12 = g10) || void 0 === t12 || null === (t12 = t12.sort) || void 0 === t12 ? void 0 : t12.path, e21) || (v10("changeSortPath", e21), n10(10, g10 = Us(g10, ["sort", "path"], e21, true)), y10(g10)); + }(null === ($10 = S10) || void 0 === $10 ? void 0 : $10.value); + 16 & e20.$$.dirty && (O10 = null === (_10 = C10) || void 0 === _10 ? void 0 : _10.value, Ow(null === (M10 = g10) || void 0 === M10 || null === (M10 = M10.sort) || void 0 === M10 ? void 0 : M10.direction, O10) || (v10("changeSortDirection", O10), n10(10, g10 = Us(g10, ["sort", "direction"], O10, true)), y10(g10))); + 32 & e20.$$.dirty && function(e21) { + var t12; + Ow(null === (t12 = g10) || void 0 === t12 || null === (t12 = t12.projection) || void 0 === t12 ? void 0 : t12.paths, e21) || (v10("changeProjectionPaths", e21), n10(10, g10 = Us(g10, ["projection", "paths"], e21, true)), y10(g10)); + }(h10 ? h10.map(function(e21) { + return e21.value; + }) : void 0); + }, [w10, x10, j10, S10, C10, h10, d10, f10, b10, k10, g10, p10, y10, u10, l10, c10, function(e21) { + n10(0, w10 = e21); + }, function(e21) { + n10(1, x10 = e21); + }, function() { + j10 = this.value, n10(2, j10); + }, function(e21) { + n10(3, S10 = e21); + }, function(e21) { + n10(4, C10 = e21); + }, function(e21) { + n10(5, h10 = e21), n10(10, g10), n10(6, d10), n10(13, u10), n10(15, c10), n10(11, p10); + }]; + } + var rN = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, nN, tN, Zo, { json: 11, queryOptions: 10, onChange: 12 }, eN), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function oN(e20) { + mi(e20, "svelte-1wg043c", '.jse-select-query-language.svelte-1wg043c.svelte-1wg043c{position:relative;width:32px}.jse-select-query-language.svelte-1wg043c .jse-select-query-language-container.svelte-1wg043c{position:absolute;top:0;right:0;display:flex;flex-direction:column;box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24))}.jse-select-query-language.svelte-1wg043c .jse-select-query-language-container .jse-query-language.svelte-1wg043c{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;text-align:left;padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));white-space:nowrap;color:var(--jse-context-menu-color, var(--jse-text-color-inverse, #fff));background:var(--jse-context-menu-background, #656565)}.jse-select-query-language.svelte-1wg043c .jse-select-query-language-container .jse-query-language.svelte-1wg043c:hover{background:var(--jse-context-menu-background-highlight, #7a7a7a)}'); + } + function iN(e20, t10, n10) { + var r10 = e20.slice(); + return r10[5] = t10[n10], r10; + } + function aN(e20) { + var t10, n10; + return t10 = new jM({ props: { data: aM } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function sN(e20) { + var t10, n10; + return t10 = new jM({ props: { data: iM } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function cN(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10 = e20[5].name + "", d10 = [sN, aN], h10 = []; + function v10(e21, t11) { + return e21[5].id === e21[0] ? 0 : 1; + } + function p10() { + return e20[4](e20[5]); + } + return n10 = v10(e20), r10 = h10[n10] = d10[n10](e20), { c: function() { + t10 = ji("button"), r10.c(), o10 = $i(), i10 = Ci(f10), a10 = $i(), Ai(t10, "type", "button"), Ai(t10, "class", "jse-query-language svelte-1wg043c"), Ai(t10, "title", s10 = "Select ".concat(e20[5].name, " as query language")), zi(t10, "selected", e20[5].id === e20[0]); + }, m: function(e21, r11) { + ki(e21, t10, r11), h10[n10].m(t10, null), pi(t10, o10), pi(t10, i10), pi(t10, a10), c10 = true, l10 || (u10 = Oi(t10, "click", p10), l10 = true); + }, p: function(a11, l11) { + var u11 = n10; + (n10 = v10(e20 = a11)) !== u11 && (ba(), xa(h10[u11], 1, 1, function() { + h10[u11] = null; + }), ka(), (r10 = h10[n10]) || (r10 = h10[n10] = d10[n10](e20)).c(), wa(r10, 1), r10.m(t10, o10)), (!c10 || 2 & l11) && f10 !== (f10 = e20[5].name + "") && Ni(i10, f10), (!c10 || 2 & l11 && s10 !== (s10 = "Select ".concat(e20[5].name, " as query language"))) && Ai(t10, "title", s10), (!c10 || 3 & l11) && zi(t10, "selected", e20[5].id === e20[0]); + }, i: function(e21) { + c10 || (wa(r10), c10 = true); + }, o: function(e21) { + xa(r10), c10 = false; + }, d: function(e21) { + e21 && wi(t10), h10[n10].d(), l10 = false, u10(); + } }; + } + function lN(e20) { + for (var t10, n10, r10, o10 = Ca(e20[1]), i10 = [], a10 = 0; a10 < o10.length; a10 += 1) + i10[a10] = cN(iN(e20, o10, a10)); + var s10 = function(e21) { + return xa(i10[e21], 1, 1, function() { + i10[e21] = null; + }); + }; + return { c: function() { + t10 = ji("div"), n10 = ji("div"); + for (var e21 = 0; e21 < i10.length; e21 += 1) + i10[e21].c(); + Ai(n10, "class", "jse-select-query-language-container svelte-1wg043c"), Ai(t10, "class", "jse-select-query-language svelte-1wg043c"); + }, m: function(e21, o11) { + ki(e21, t10, o11), pi(t10, n10); + for (var a11 = 0; a11 < i10.length; a11 += 1) + i10[a11] && i10[a11].m(n10, null); + r10 = true; + }, p: function(e21, t11) { + var r11 = jo(t11, 1)[0]; + if (7 & r11) { + var a11; + for (o10 = Ca(e21[1]), a11 = 0; a11 < o10.length; a11 += 1) { + var c10 = iN(e21, o10, a11); + i10[a11] ? (i10[a11].p(c10, r11), wa(i10[a11], 1)) : (i10[a11] = cN(c10), i10[a11].c(), wa(i10[a11], 1), i10[a11].m(n10, null)); + } + for (ba(), a11 = o10.length; a11 < i10.length; a11 += 1) + s10(a11); + ka(); + } + }, i: function(e21) { + if (!r10) { + for (var t11 = 0; t11 < o10.length; t11 += 1) + wa(i10[t11]); + r10 = true; + } + }, o: function(e21) { + i10 = i10.filter(Boolean); + for (var t11 = 0; t11 < i10.length; t11 += 1) + xa(i10[t11]); + r10 = false; + }, d: function(e21) { + e21 && wi(t10), xi(i10, e21); + } }; + } + function uN(e20, t10, n10) { + var r10 = t10.queryLanguages, o10 = t10.queryLanguageId, i10 = t10.onChangeQueryLanguage; + function a10(e21) { + n10(0, o10 = e21), i10(e21); + } + return e20.$$set = function(e21) { + "queryLanguages" in e21 && n10(1, r10 = e21.queryLanguages), "queryLanguageId" in e21 && n10(0, o10 = e21.queryLanguageId), "onChangeQueryLanguage" in e21 && n10(3, i10 = e21.onChangeQueryLanguage); + }, [o10, r10, a10, i10, function(e21) { + return a10(e21.id); + }]; + } + var fN = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, uN, lN, Xo, { queryLanguages: 1, queryLanguageId: 0, onChangeQueryLanguage: 3 }, oN), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function dN(e20) { + mi(e20, "svelte-1n68mbh", ".jse-header.svelte-1n68mbh.svelte-1n68mbh{display:flex;background:var(--jse-theme-color, #3883fa);color:var(--jse-menu-color, var(--jse-text-color-inverse, #fff))}.jse-header.svelte-1n68mbh .jse-title.svelte-1n68mbh{flex:1;padding:5px;vertical-align:middle}.jse-header.svelte-1n68mbh button.svelte-1n68mbh{border:none;background:transparent;min-width:32px;color:inherit;cursor:pointer}.jse-header.svelte-1n68mbh button.svelte-1n68mbh:hover{background:rgba(255, 255, 255, 0.1)}"); + } + function hN(e20) { + var t10, n10, r10, o10, i10; + return n10 = new jM({ props: { data: mP } }), { c: function() { + t10 = ji("button"), Pa(n10.$$.fragment), Ai(t10, "type", "button"), Ai(t10, "class", "jse-config svelte-1n68mbh"), Ai(t10, "title", "Select a query language"); + }, m: function(a10, s10) { + ki(a10, t10, s10), Ta(n10, t10, null), e20[6](t10), r10 = true, o10 || (i10 = Oi(t10, "click", e20[3]), o10 = true); + }, p: Wo, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(r11) { + r11 && wi(t10), Ra(n10), e20[6](null), o10 = false, i10(); + } }; + } + function vN(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10 = e20[0].length > 1 && hN(e20); + return a10 = new jM({ props: { data: MP } }), { c: function() { + t10 = ji("div"), (n10 = ji("div")).textContent = "Transform", r10 = $i(), u10 && u10.c(), o10 = $i(), i10 = ji("button"), Pa(a10.$$.fragment), Ai(n10, "class", "jse-title svelte-1n68mbh"), Ai(i10, "type", "button"), Ai(i10, "class", "jse-close svelte-1n68mbh"), Ai(t10, "class", "jse-header svelte-1n68mbh"); + }, m: function(f10, d10) { + ki(f10, t10, d10), pi(t10, n10), pi(t10, r10), u10 && u10.m(t10, null), pi(t10, o10), pi(t10, i10), Ta(a10, i10, null), s10 = true, c10 || (l10 = Oi(i10, "click", e20[7]), c10 = true); + }, p: function(e21, n11) { + var r11 = jo(n11, 1)[0]; + e21[0].length > 1 ? u10 ? (u10.p(e21, r11), 1 & r11 && wa(u10, 1)) : ((u10 = hN(e21)).c(), wa(u10, 1), u10.m(t10, o10)) : u10 && (ba(), xa(u10, 1, 1, function() { + u10 = null; + }), ka()); + }, i: function(e21) { + s10 || (wa(u10), wa(a10.$$.fragment, e21), s10 = true); + }, o: function(e21) { + xa(u10), xa(a10.$$.fragment, e21), s10 = false; + }, d: function(e21) { + e21 && wi(t10), u10 && u10.d(), Ra(a10), c10 = false, l10(); + } }; + } + function pN(e20, t10, n10) { + var r10, o10, i10 = t10.queryLanguages, a10 = t10.queryLanguageId, s10 = t10.onChangeQueryLanguage, c10 = Zi("simple-modal").close, l10 = Zi("absolute-popup"), u10 = l10.openAbsolutePopup, f10 = l10.closeAbsolutePopup; + return e20.$$set = function(e21) { + "queryLanguages" in e21 && n10(0, i10 = e21.queryLanguages), "queryLanguageId" in e21 && n10(4, a10 = e21.queryLanguageId), "onChangeQueryLanguage" in e21 && n10(5, s10 = e21.onChangeQueryLanguage); + }, [i10, r10, c10, function() { + var e21 = { queryLanguages: i10, queryLanguageId: a10, onChangeQueryLanguage: function(e23) { + f10(o10), s10(e23); + } }; + o10 = u10(fN, e21, { offsetTop: -2, offsetLeft: 0, anchor: r10, closeOnOuterClick: true }); + }, a10, s10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(1, r10 = e21); + }); + }, function() { + return c10(); + }]; + } + var mN = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, pN, vN, Zo, { queryLanguages: 0, queryLanguageId: 4, onChangeQueryLanguage: 5 }, dN), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var gN = Da("jsoneditor:AutoScrollHandler"); + var yN = function(e20, t10, n10, r10) { + return (e20 /= r10 / 2) < 1 ? n10 / 2 * e20 * e20 + t10 : -n10 / 2 * (--e20 * (e20 - 2) - 1) + t10; + }; + var bN = function() { + var e20, t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10; + function h10(t11) { + return t11.getBoundingClientRect().top - (e20.getBoundingClientRect ? e20.getBoundingClientRect().top : 0) + n10; + } + function v10(t11) { + e20.scrollTo ? e20.scrollTo(e20.scrollLeft, t11) : e20.scrollTop = t11; + } + function p10(e21) { + l10 || (l10 = e21), v10(i10(u10 = e21 - l10, n10, s10, c10)), d10 = true, u10 < c10 ? requestAnimationFrame(p10) : function() { + if (v10(n10 + s10), t10 && a10) { + t10.setAttribute("tabindex", "-1"), t10.focus(); + } + "function" == typeof f10 && f10(); + l10 = 0, d10 = false; + }(); + } + return function(u11) { + var v11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + switch (c10 = 1e3, o10 = v11.offset || 0, f10 = v11.callback, i10 = v11.easing || yN, a10 = v11.a11y || false, Ho(v11.container)) { + case "object": + e20 = v11.container; + break; + case "string": + e20 = document.querySelector(v11.container); + break; + default: + e20 = window.document.documentElement; + } + switch (n10 = e20.scrollTop, Ho(u11)) { + case "number": + t10 = void 0, a10 = false, r10 = n10 + u11; + break; + case "object": + r10 = h10(t10 = u11); + break; + case "string": + t10 = document.querySelector(u11), r10 = h10(t10); + } + switch (s10 = r10 - n10 + o10, Ho(v11.duration)) { + case "number": + c10 = v11.duration; + break; + case "function": + c10 = v11.duration(s10); + } + d10 ? l10 = 0 : requestAnimationFrame(p10); + }; + }; + var kN = 1e3; + var wN = Da("jsoneditor:History"); + function xN() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, t10 = e20.maxItems || kN, n10 = [], r10 = 0; + function o10() { + return r10 < n10.length; + } + function i10() { + return r10 > 0; + } + function a10() { + return { canUndo: o10(), canRedo: i10(), length: n10.length }; + } + function s10() { + e20.onChange && e20.onChange(a10()); + } + return { add: function(e21) { + wN("add", e21), n10 = [e21].concat(n10.slice(r10)).slice(0, t10), r10 = 0, s10(); + }, clear: function() { + wN("clear"), n10 = [], r10 = 0, s10(); + }, getState: a10, undo: function() { + if (o10()) { + var e21 = n10[r10]; + return r10 += 1, wN("undo", e21), s10(), e21; + } + }, redo: function() { + if (i10()) + return wN("redo", n10[r10 -= 1]), s10(), n10[r10]; + } }; + } + function jN(e20, t10) { + var n10 = Date.now(), r10 = e20(); + return t10(Date.now() - n10), r10; + } + var SN = Da("validation"); + function CN(e20, t10, n10, r10) { + if (SN("validateJSON"), !t10) + return []; + if (n10 !== r10) { + var o10 = n10.stringify(e20); + return t10(void 0 !== o10 ? r10.parse(o10) : void 0); + } + return t10(e20); + } + function $N(e20, t10, n10, r10) { + if (SN("validateText"), e20.length > hs) + return { validationErrors: [{ path: [], message: "Validation turned off: the document is too large", severity: Za.info }] }; + if (0 === e20.length) + return null; + try { + var o10 = jN(function() { + return n10.parse(e20); + }, function(e21) { + return SN("validate: parsed json in ".concat(e21, " ms")); + }); + if (!t10) + return null; + var i10 = n10 === r10 ? o10 : jN(function() { + return r10.parse(e20); + }, function(e21) { + return SN("validate: parsed json with the validationParser in ".concat(e21, " ms")); + }), a10 = jN(function() { + return t10(i10); + }, function(e21) { + return SN("validate: validated json in ".concat(e21, " ms")); + }); + return _w(a10) ? null : { validationErrors: a10 }; + } catch (t11) { + var s10 = jN(function() { + return function(e21, t12) { + if (e21.length > vs) + return false; + try { + return t12.parse(Hl(e21)), true; + } catch (e23) { + return false; + } + }(e20, n10); + }, function(e21) { + return SN("validate: checked whether repairable in ".concat(e21, " ms")); + }); + return { parseError: H_(e20, t11.message || t11.toString()), isRepairable: s10 }; + } + } + var _N = Da("jsoneditor:FocusTracker"); + function ON(e20) { + var t10, n10 = e20.onMount, r10 = e20.onDestroy, o10 = e20.getWindow, i10 = e20.hasFocus, a10 = e20.onFocus, s10 = e20.onBlur, c10 = false; + function l10() { + var e21 = i10(); + e21 && (clearTimeout(t10), c10 || (_N("focus"), a10(), c10 = e21)); + } + function u10() { + c10 && (clearTimeout(t10), t10 = setTimeout(function() { + i10() || (_N("blur"), c10 = false, s10()); + })); + } + n10(function() { + _N("mount FocusTracker"); + var e21 = o10(); + e21 && (e21.addEventListener("focusin", l10, true), e21.addEventListener("focusout", u10, true)); + }), r10(function() { + _N("destroy FocusTracker"); + var e21 = o10(); + e21 && (e21.removeEventListener("focusin", l10, true), e21.removeEventListener("focusout", u10, true)); + }); + } + function MN(e20) { + mi(e20, "svelte-p1zf9f", '.jse-message.svelte-p1zf9f.svelte-p1zf9f{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);padding:var(--jse-padding, 10px);display:flex;gap:var(--jse-padding, 10px);flex-wrap:wrap;align-items:stretch}.jse-message.jse-success.svelte-p1zf9f.svelte-p1zf9f{background:var(--message-success-background, #9ac45d);color:var(--jse-message-success-color, #fff)}.jse-message.svelte-p1zf9f .jse-text.svelte-p1zf9f{display:flex;flex:1;min-width:60%;align-items:center}.jse-message.svelte-p1zf9f .jse-text.jse-clickable.svelte-p1zf9f{cursor:pointer}.jse-message.svelte-p1zf9f .jse-text.jse-clickable.svelte-p1zf9f:hover{background-color:rgba(255, 255, 255, 0.1)}.jse-message.jse-error.svelte-p1zf9f.svelte-p1zf9f{background:var(--jse-message-error-background, var(--jse-error-color, #ee5341));color:var(--jse-message-error-color, #fff)}.jse-message.jse-warning.svelte-p1zf9f.svelte-p1zf9f{background:var(--jse-message-warning-background, #ffde5c);color:var(--jse-message-warning-color, #4d4d4d)}.jse-message.jse-info.svelte-p1zf9f.svelte-p1zf9f{background:var(--jse-message-info-background, #4f91ff);color:var(--jse-message-info-color, #fff)}.jse-message.svelte-p1zf9f .jse-actions.svelte-p1zf9f{display:flex;gap:var(--jse-padding, 10px)}.jse-message.svelte-p1zf9f .jse-actions button.jse-action.svelte-p1zf9f{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-message-action-background, rgba(255, 255, 255, 0.2));color:inherit;padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px)}.jse-message.svelte-p1zf9f .jse-actions button.jse-action.svelte-p1zf9f:hover{background:var(--jse-message-action-background-highlight, rgba(255, 255, 255, 0.3))}'); + } + function EN(e20, t10, n10) { + var r10 = e20.slice(); + return r10[9] = t10[n10], r10; + } + function AN(e20) { + var t10, n10; + return t10 = new jM({ props: { data: e20[1] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 2 & n11 && (r10.data = e21[1]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function PN(e20) { + var t10, n10; + return t10 = new jM({ props: { data: e20[9].icon } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 8 & n11 && (r10.data = e21[9].icon), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function TN(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10 = e20[9].text + "", f10 = e20[9].icon && PN(e20); + function d10() { + return e20[7](e20[9]); + } + function h10() { + return e20[8](e20[9]); + } + return { c: function() { + t10 = ji("button"), f10 && f10.c(), n10 = $i(), r10 = Ci(u10), o10 = $i(), Ai(t10, "type", "button"), Ai(t10, "class", "jse-button jse-action jse-primary svelte-p1zf9f"), Ai(t10, "title", i10 = e20[9].title), t10.disabled = a10 = e20[9].disabled; + }, m: function(e21, i11) { + ki(e21, t10, i11), f10 && f10.m(t10, null), pi(t10, n10), pi(t10, r10), pi(t10, o10), s10 = true, c10 || (l10 = [Oi(t10, "click", d10), Oi(t10, "mousedown", h10)], c10 = true); + }, p: function(o11, c11) { + (e20 = o11)[9].icon ? f10 ? (f10.p(e20, c11), 8 & c11 && wa(f10, 1)) : ((f10 = PN(e20)).c(), wa(f10, 1), f10.m(t10, n10)) : f10 && (ba(), xa(f10, 1, 1, function() { + f10 = null; + }), ka()), (!s10 || 8 & c11) && u10 !== (u10 = e20[9].text + "") && Ni(r10, u10), (!s10 || 8 & c11 && i10 !== (i10 = e20[9].title)) && Ai(t10, "title", i10), (!s10 || 8 & c11 && a10 !== (a10 = e20[9].disabled)) && (t10.disabled = a10); + }, i: function(e21) { + s10 || (wa(f10), s10 = true); + }, o: function(e21) { + xa(f10), s10 = false; + }, d: function(e21) { + e21 && wi(t10), f10 && f10.d(), c10 = false, Qo(l10); + } }; + } + function RN(e20) { + for (var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10 = e20[1] && AN(e20), h10 = Ca(e20[3]), v10 = [], p10 = 0; p10 < h10.length; p10 += 1) + v10[p10] = TN(EN(e20, h10, p10)); + var m10 = function(e21) { + return xa(v10[e21], 1, 1, function() { + v10[e21] = null; + }); + }; + return { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = ji("div"), d10 && d10.c(), o10 = $i(), i10 = Ci(e20[2]), a10 = $i(), s10 = ji("div"); + for (var l11 = 0; l11 < v10.length; l11 += 1) + v10[l11].c(); + Ai(r10, "class", "jse-text-centered"), Ai(n10, "role", "button"), Ai(n10, "tabindex", "-1"), Ai(n10, "class", "jse-text svelte-p1zf9f"), zi(n10, "jse-clickable", !!e20[4]), Ai(s10, "class", "jse-actions svelte-p1zf9f"), Ai(t10, "class", c10 = "jse-message jse-" + e20[0] + " svelte-p1zf9f"); + }, m: function(c11, h11) { + ki(c11, t10, h11), pi(t10, n10), pi(n10, r10), d10 && d10.m(r10, null), pi(r10, o10), pi(r10, i10), pi(t10, a10), pi(t10, s10); + for (var p11 = 0; p11 < v10.length; p11 += 1) + v10[p11] && v10[p11].m(s10, null); + l10 = true, u10 || (f10 = Oi(n10, "click", e20[5]), u10 = true); + }, p: function(e21, a11) { + var u11 = jo(a11, 1)[0]; + if (e21[1] ? d10 ? (d10.p(e21, u11), 2 & u11 && wa(d10, 1)) : ((d10 = AN(e21)).c(), wa(d10, 1), d10.m(r10, o10)) : d10 && (ba(), xa(d10, 1, 1, function() { + d10 = null; + }), ka()), (!l10 || 4 & u11) && Ni(i10, e21[2]), (!l10 || 16 & u11) && zi(n10, "jse-clickable", !!e21[4]), 8 & u11) { + var f11; + for (h10 = Ca(e21[3]), f11 = 0; f11 < h10.length; f11 += 1) { + var p11 = EN(e21, h10, f11); + v10[f11] ? (v10[f11].p(p11, u11), wa(v10[f11], 1)) : (v10[f11] = TN(p11), v10[f11].c(), wa(v10[f11], 1), v10[f11].m(s10, null)); + } + for (ba(), f11 = h10.length; f11 < v10.length; f11 += 1) + m10(f11); + ka(); + } + (!l10 || 1 & u11 && c10 !== (c10 = "jse-message jse-" + e21[0] + " svelte-p1zf9f")) && Ai(t10, "class", c10); + }, i: function(e21) { + if (!l10) { + wa(d10); + for (var t11 = 0; t11 < h10.length; t11 += 1) + wa(v10[t11]); + l10 = true; + } + }, o: function(e21) { + xa(d10), v10 = v10.filter(Boolean); + for (var t11 = 0; t11 < v10.length; t11 += 1) + xa(v10[t11]); + l10 = false; + }, d: function(e21) { + e21 && wi(t10), d10 && d10.d(), xi(v10, e21), u10 = false, f10(); + } }; + } + function NN(e20, t10, n10) { + var r10 = t10.type, o10 = void 0 === r10 ? "success" : r10, i10 = t10.icon, a10 = void 0 === i10 ? void 0 : i10, s10 = t10.message, c10 = void 0 === s10 ? void 0 : s10, l10 = t10.actions, u10 = void 0 === l10 ? [] : l10, f10 = t10.onClick, d10 = void 0 === f10 ? void 0 : f10, h10 = t10.onClose, v10 = void 0 === h10 ? void 0 : h10; + v10 && Qi(v10); + return e20.$$set = function(e21) { + "type" in e21 && n10(0, o10 = e21.type), "icon" in e21 && n10(1, a10 = e21.icon), "message" in e21 && n10(2, c10 = e21.message), "actions" in e21 && n10(3, u10 = e21.actions), "onClick" in e21 && n10(4, d10 = e21.onClick), "onClose" in e21 && n10(6, v10 = e21.onClose); + }, [o10, a10, c10, u10, d10, function() { + d10 && d10(); + }, v10, function(e21) { + e21.onClick && e21.onClick(); + }, function(e21) { + e21.onMouseDown && e21.onMouseDown(); + }]; + } + var IN = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, NN, RN, Zo, { type: 0, icon: 1, message: 2, actions: 3, onClick: 4, onClose: 6 }, MN), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function DN(e20) { + mi(e20, "svelte-1ifg4t0", '.jse-validation-errors-overview.svelte-1ifg4t0.svelte-1ifg4t0{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);background:var(--jse-message-warning-background, #ffde5c);color:var(--jse-message-warning-color, #4d4d4d);overflow:auto;max-height:25%}.jse-validation-errors-overview.svelte-1ifg4t0 table.svelte-1ifg4t0{border-collapse:collapse;width:100%}.jse-validation-errors-overview.svelte-1ifg4t0 table tr.svelte-1ifg4t0{cursor:pointer}.jse-validation-errors-overview.svelte-1ifg4t0 table tr.svelte-1ifg4t0:hover{background-color:rgba(255, 255, 255, 0.1)}.jse-validation-errors-overview.svelte-1ifg4t0 table tr td.svelte-1ifg4t0{padding:4px var(--jse-padding, 10px);vertical-align:middle}.jse-validation-errors-overview.svelte-1ifg4t0 table tr td.jse-validation-error-icon.svelte-1ifg4t0{width:36px;box-sizing:border-box}.jse-validation-errors-overview.svelte-1ifg4t0 table tr td.jse-validation-error-action.svelte-1ifg4t0{width:36px;box-sizing:border-box;padding:0}.jse-validation-errors-overview.svelte-1ifg4t0 table tr td.jse-validation-error-action button.jse-validation-errors-collapse.svelte-1ifg4t0{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;width:36px;height:26px;cursor:pointer}.jse-validation-errors-overview.svelte-1ifg4t0 table tr td.jse-validation-error-action button.jse-validation-errors-collapse.svelte-1ifg4t0:hover{background-color:rgba(255, 255, 255, 0.2)}.jse-validation-errors-overview.svelte-1ifg4t0 table tr td div.jse-validation-errors-expand.svelte-1ifg4t0{display:inline-block;position:relative;top:3px}'); + } + function qN(e20, t10, n10) { + var r10 = e20.slice(); + return r10[7] = t10[n10], r10[9] = n10, r10; + } + function zN(e20) { + var t10, n10, r10, o10, i10 = [LN, BN], a10 = []; + function s10(e21, t11) { + return e21[2] || 1 === e21[3] ? 0 : 1; + } + return n10 = s10(e20), r10 = a10[n10] = i10[n10](e20), { c: function() { + t10 = ji("div"), r10.c(), Ai(t10, "class", "jse-validation-errors-overview svelte-1ifg4t0"); + }, m: function(e21, r11) { + ki(e21, t10, r11), a10[n10].m(t10, null), o10 = true; + }, p: function(e21, o11) { + var c10 = n10; + (n10 = s10(e21)) === c10 ? a10[n10].p(e21, o11) : (ba(), xa(a10[c10], 1, 1, function() { + a10[c10] = null; + }), ka(), (r10 = a10[n10]) ? r10.p(e21, o11) : (r10 = a10[n10] = i10[n10](e21)).c(), wa(r10, 1), r10.m(t10, null)); + }, i: function(e21) { + o10 || (wa(r10), o10 = true); + }, o: function(e21) { + xa(r10), o10 = false; + }, d: function(e21) { + e21 && wi(t10), a10[n10].d(); + } }; + } + function BN(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10; + return i10 = new jM({ props: { data: TP } }), f10 = new jM({ props: { data: iP } }), { c: function() { + t10 = ji("table"), n10 = ji("tbody"), r10 = ji("tr"), o10 = ji("td"), Pa(i10.$$.fragment), a10 = $i(), s10 = ji("td"), c10 = Ci(e20[3]), l10 = Ci(" validation errors\n "), u10 = ji("div"), Pa(f10.$$.fragment), Ai(o10, "class", "jse-validation-error-icon svelte-1ifg4t0"), Ai(u10, "class", "jse-validation-errors-expand svelte-1ifg4t0"), Ai(s10, "class", "jse-validation-error-count svelte-1ifg4t0"), Ai(r10, "class", "jse-validation-error svelte-1ifg4t0"), Ai(t10, "class", "jse-validation-errors-overview-collapsed svelte-1ifg4t0"); + }, m: function(p10, m10) { + ki(p10, t10, m10), pi(t10, n10), pi(n10, r10), pi(r10, o10), Ta(i10, o10, null), pi(r10, a10), pi(r10, s10), pi(s10, c10), pi(s10, l10), pi(s10, u10), Ta(f10, u10, null), d10 = true, h10 || (v10 = Oi(r10, "click", e20[5]), h10 = true); + }, p: function(e21, t11) { + (!d10 || 8 & t11) && Ni(c10, e21[3]); + }, i: function(e21) { + d10 || (wa(i10.$$.fragment, e21), wa(f10.$$.fragment, e21), d10 = true); + }, o: function(e21) { + xa(i10.$$.fragment, e21), xa(f10.$$.fragment, e21), d10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(i10), Ra(f10), h10 = false, v10(); + } }; + } + function LN(e20) { + for (var t10, n10, r10, o10, i10 = Ca(N_(e20[0], us)), a10 = [], s10 = 0; s10 < i10.length; s10 += 1) + a10[s10] = VN(qN(e20, i10, s10)); + var c10 = function(e21) { + return xa(a10[e21], 1, 1, function() { + a10[e21] = null; + }); + }, l10 = e20[3] > us && HN(e20); + return { c: function() { + t10 = ji("table"), n10 = ji("tbody"); + for (var e21 = 0; e21 < a10.length; e21 += 1) + a10[e21].c(); + r10 = $i(), l10 && l10.c(), Ai(t10, "class", "jse-validation-errors-overview-expanded svelte-1ifg4t0"); + }, m: function(e21, i11) { + ki(e21, t10, i11), pi(t10, n10); + for (var s11 = 0; s11 < a10.length; s11 += 1) + a10[s11] && a10[s11].m(n10, null); + pi(n10, r10), l10 && l10.m(n10, null), o10 = true; + }, p: function(e21, t11) { + if (19 & t11) { + var o11; + for (i10 = Ca(N_(e21[0], us)), o11 = 0; o11 < i10.length; o11 += 1) { + var s11 = qN(e21, i10, o11); + a10[o11] ? (a10[o11].p(s11, t11), wa(a10[o11], 1)) : (a10[o11] = VN(s11), a10[o11].c(), wa(a10[o11], 1), a10[o11].m(n10, r10)); + } + for (ba(), o11 = i10.length; o11 < a10.length; o11 += 1) + c10(o11); + ka(); + } + e21[3] > us ? l10 ? l10.p(e21, t11) : ((l10 = HN(e21)).c(), l10.m(n10, null)) : l10 && (l10.d(1), l10 = null); + }, i: function(e21) { + if (!o10) { + for (var t11 = 0; t11 < i10.length; t11 += 1) + wa(a10[t11]); + o10 = true; + } + }, o: function(e21) { + a10 = a10.filter(Boolean); + for (var t11 = 0; t11 < a10.length; t11 += 1) + xa(a10[t11]); + o10 = false; + }, d: function(e21) { + e21 && wi(t10), xi(a10, e21), l10 && l10.d(); + } }; + } + function FN(e20) { + var t10, n10, r10, o10, i10; + return n10 = new jM({ props: { data: wP } }), { c: function() { + t10 = ji("button"), Pa(n10.$$.fragment), Ai(t10, "type", "button"), Ai(t10, "class", "jse-validation-errors-collapse svelte-1ifg4t0"), Ai(t10, "title", "Collapse validation errors"); + }, m: function(a10, s10) { + ki(a10, t10, s10), Ta(n10, t10, null), r10 = true, o10 || (i10 = Oi(t10, "click", Ei(e20[4])), o10 = true); + }, p: Wo, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), o10 = false, i10(); + } }; + } + function VN(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10 = JO(e20[7].path) + "", m10 = e20[7].message + ""; + r10 = new jM({ props: { data: TP } }); + var g10 = 0 === e20[9] && e20[0].length > 1 && FN(e20); + function y10() { + return e20[6](e20[7]); + } + return { c: function() { + t10 = ji("tr"), n10 = ji("td"), Pa(r10.$$.fragment), o10 = $i(), i10 = ji("td"), a10 = Ci(p10), s10 = $i(), c10 = ji("td"), l10 = Ci(m10), u10 = $i(), f10 = ji("td"), g10 && g10.c(), Ai(n10, "class", "jse-validation-error-icon svelte-1ifg4t0"), Ai(i10, "class", "jse-validation-error-path svelte-1ifg4t0"), Ai(c10, "class", "jse-validation-error-message svelte-1ifg4t0"), Ai(f10, "class", "jse-validation-error-action svelte-1ifg4t0"), Ai(t10, "class", "jse-validation-error svelte-1ifg4t0"); + }, m: function(e21, p11) { + ki(e21, t10, p11), pi(t10, n10), Ta(r10, n10, null), pi(t10, o10), pi(t10, i10), pi(i10, a10), pi(t10, s10), pi(t10, c10), pi(c10, l10), pi(t10, u10), pi(t10, f10), g10 && g10.m(f10, null), d10 = true, h10 || (v10 = Oi(t10, "click", y10), h10 = true); + }, p: function(t11, n11) { + e20 = t11, (!d10 || 1 & n11) && p10 !== (p10 = JO(e20[7].path) + "") && Ni(a10, p10), (!d10 || 1 & n11) && m10 !== (m10 = e20[7].message + "") && Ni(l10, m10), 0 === e20[9] && e20[0].length > 1 ? g10 ? (g10.p(e20, n11), 1 & n11 && wa(g10, 1)) : ((g10 = FN(e20)).c(), wa(g10, 1), g10.m(f10, null)) : g10 && (ba(), xa(g10, 1, 1, function() { + g10 = null; + }), ka()); + }, i: function(e21) { + d10 || (wa(r10.$$.fragment, e21), wa(g10), d10 = true); + }, o: function(e21) { + xa(r10.$$.fragment, e21), xa(g10), d10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(r10), g10 && g10.d(), h10 = false, v10(); + } }; + } + function HN(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10 = e20[3] - us + ""; + return { c: function() { + t10 = ji("tr"), n10 = ji("td"), r10 = $i(), o10 = ji("td"), i10 = $i(), a10 = ji("td"), s10 = Ci("(and "), c10 = Ci(d10), l10 = Ci(" more errors)"), u10 = $i(), f10 = ji("td"), Ai(n10, "class", "svelte-1ifg4t0"), Ai(o10, "class", "svelte-1ifg4t0"), Ai(a10, "class", "svelte-1ifg4t0"), Ai(f10, "class", "svelte-1ifg4t0"), Ai(t10, "class", "jse-validation-error svelte-1ifg4t0"); + }, m: function(e21, d11) { + ki(e21, t10, d11), pi(t10, n10), pi(t10, r10), pi(t10, o10), pi(t10, i10), pi(t10, a10), pi(a10, s10), pi(a10, c10), pi(a10, l10), pi(t10, u10), pi(t10, f10); + }, p: function(e21, t11) { + 8 & t11 && d10 !== (d10 = e21[3] - us + "") && Ni(c10, d10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function WN(e20) { + var t10, n10, r10 = !_w(e20[0]), o10 = r10 && zN(e20); + return { c: function() { + o10 && o10.c(), t10 = _i(); + }, m: function(e21, r11) { + o10 && o10.m(e21, r11), ki(e21, t10, r11), n10 = true; + }, p: function(e21, n11) { + var i10 = jo(n11, 1)[0]; + 1 & i10 && (r10 = !_w(e21[0])), r10 ? o10 ? (o10.p(e21, i10), 1 & i10 && wa(o10, 1)) : ((o10 = zN(e21)).c(), wa(o10, 1), o10.m(t10.parentNode, t10)) : o10 && (ba(), xa(o10, 1, 1, function() { + o10 = null; + }), ka()); + }, i: function(e21) { + n10 || (wa(o10), n10 = true); + }, o: function(e21) { + xa(o10), n10 = false; + }, d: function(e21) { + e21 && wi(t10), o10 && o10.d(e21); + } }; + } + function UN(e20, t10, n10) { + var r10, o10 = t10.validationErrors, i10 = t10.selectError, a10 = true; + return e20.$$set = function(e21) { + "validationErrors" in e21 && n10(0, o10 = e21.validationErrors), "selectError" in e21 && n10(1, i10 = e21.selectError); + }, e20.$$.update = function() { + 1 & e20.$$.dirty && n10(3, r10 = o10.length); + }, [o10, i10, a10, r10, function() { + n10(2, a10 = false); + }, function() { + n10(2, a10 = true); + }, function(e21) { + setTimeout(function() { + return i10(e21); + }); + }]; + } + var JN = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, UN, WN, Zo, { validationErrors: 0, selectError: 1 }, DN), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var KN = "undefined" != typeof navigator && navigator.platform.toUpperCase().indexOf("MAC") >= 0; + function GN(e20) { + mi(e20, "svelte-1n68mbh", ".jse-header.svelte-1n68mbh.svelte-1n68mbh{display:flex;background:var(--jse-theme-color, #3883fa);color:var(--jse-menu-color, var(--jse-text-color-inverse, #fff))}.jse-header.svelte-1n68mbh .jse-title.svelte-1n68mbh{flex:1;padding:5px;vertical-align:middle}.jse-header.svelte-1n68mbh button.svelte-1n68mbh{border:none;background:transparent;min-width:32px;color:inherit;cursor:pointer}.jse-header.svelte-1n68mbh button.svelte-1n68mbh:hover{background:rgba(255, 255, 255, 0.1)}"); + } + function QN(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10; + return a10 = new jM({ props: { data: MP } }), { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = Ci(e20[0]), o10 = $i(), i10 = ji("button"), Pa(a10.$$.fragment), Ai(n10, "class", "jse-title svelte-1n68mbh"), Ai(i10, "type", "button"), Ai(i10, "class", "jse-close svelte-1n68mbh"), Ai(t10, "class", "jse-header svelte-1n68mbh"); + }, m: function(u10, f10) { + ki(u10, t10, f10), pi(t10, n10), pi(n10, r10), pi(t10, o10), pi(t10, i10), Ta(a10, i10, null), s10 = true, c10 || (l10 = Oi(i10, "click", e20[3]), c10 = true); + }, p: function(e21, t11) { + var n11 = jo(t11, 1)[0]; + (!s10 || 1 & n11) && Ni(r10, e21[0]); + }, i: function(e21) { + s10 || (wa(a10.$$.fragment, e21), s10 = true); + }, o: function(e21) { + xa(a10.$$.fragment, e21), s10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(a10), c10 = false, l10(); + } }; + } + function YN(e20, t10, n10) { + var r10 = t10.title, o10 = void 0 === r10 ? "Modal" : r10, i10 = t10.onClose, a10 = void 0 === i10 ? void 0 : i10, s10 = Zi("simple-modal").close; + return e20.$$set = function(e21) { + "title" in e21 && n10(0, o10 = e21.title), "onClose" in e21 && n10(1, a10 = e21.onClose); + }, [o10, a10, s10, function() { + a10 ? a10() : s10(); + }]; + } + var XN = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, YN, QN, Zo, { title: 0, onClose: 1 }, GN), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function ZN(e20) { + mi(e20, "svelte-18bor9q", '.jse-modal.svelte-18bor9q.svelte-18bor9q{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;background:var(--jse-modal-background, #f5f5f5);color:var(--jse-text-color, #4d4d4d)}.jse-modal.svelte-18bor9q .svelte-select{--border:var(--jse-svelte-select-border, 1px solid #d8dbdf);--item-is-active-bg:var(--jse-item-is-active-bg, #3883fa);--border-radius:var(--jse-svelte-select-border-radius, 3px);--background:var(--jse-svelte-select-background, #fff);--padding:var(--jse-svelte-select-padding, 0 10px);--multi-select-padding:var(--jse-svelte-select-multi-select-padding, 0 10px);--font-size:var(--jse-svelte-select-font-size, var(--jse-font-size, 16px));--height:36px;--multi-item-height:28px;--multi-item-margin:2px;--multi-item-padding:2px 8px;--multi-item-border-radius:6px;--indicator-top:8px}.jse-modal.svelte-18bor9q .jse-modal-contents.svelte-18bor9q{flex:1;display:flex;flex-direction:column;padding:20px;overflow:auto;min-width:0;min-height:0}.jse-modal.svelte-18bor9q .jse-modal-contents .jse-actions.svelte-18bor9q{display:flex;flex-direction:row;justify-content:flex-end;padding-top:var(--jse-padding, 10px)}.jse-modal.svelte-18bor9q .jse-modal-contents .jse-actions button.jse-primary.svelte-18bor9q{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-modal.svelte-18bor9q .jse-modal-contents .jse-actions button.jse-primary.svelte-18bor9q:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-modal.svelte-18bor9q .jse-modal-contents .jse-actions button.jse-primary.svelte-18bor9q:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}.bg.jse-modal-bg{width:100%;height:100%;top:0;left:0;background:var(--jse-overlay-background, rgba(0, 0, 0, 0.3))}.bg.jse-modal-bg .jse-modal-window-wrap{margin:0}.bg.jse-modal-bg .jse-modal-window{max-width:90%;margin:4rem auto 2rem auto;border-radius:2px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-sort{width:400px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-transform{width:1200px;height:1200px;max-height:80%;display:flex}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-jsoneditor{width:800px;height:auto;min-height:500px;max-height:calc(100vh - 6rem);display:flex}.bg.jse-modal-bg .jse-modal-container{flex:1;display:flex;flex-direction:column;padding:0}.jse-modal.jse-copy-paste.svelte-18bor9q .jse-shortcuts.svelte-18bor9q{display:flex;flex-wrap:wrap;justify-content:space-around;margin:calc(2 * var(--jse-padding, 10px)) 0}.jse-modal.jse-copy-paste.svelte-18bor9q .jse-shortcuts .jse-shortcut .jse-key.svelte-18bor9q{font-size:200%;color:var(--jse-theme-color, #3883fa)}'); + } + function eI(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10; + return n10 = new XN({ props: { title: "Copying and pasting" } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), r10 = $i(), o10 = ji("div"), (i10 = ji("div")).textContent = "These actions are unavailable via the menu. Please use:", a10 = $i(), s10 = ji("div"), c10 = ji("div"), (l10 = ji("div")).textContent = "".concat(e20[1], "+C"), u10 = Ci("\n for copy"), f10 = $i(), d10 = ji("div"), (h10 = ji("div")).textContent = "".concat(e20[1], "+X"), v10 = Ci("\n for cut"), p10 = $i(), m10 = ji("div"), (g10 = ji("div")).textContent = "".concat(e20[1], "+V"), y10 = Ci("\n for paste"), b10 = $i(), k10 = ji("div"), (w10 = ji("button")).textContent = "Close", Ai(l10, "class", "jse-key svelte-18bor9q"), Ai(c10, "class", "jse-shortcut"), Ai(h10, "class", "jse-key svelte-18bor9q"), Ai(d10, "class", "jse-shortcut"), Ai(g10, "class", "jse-key svelte-18bor9q"), Ai(m10, "class", "jse-shortcut"), Ai(s10, "class", "jse-shortcuts svelte-18bor9q"), Ai(w10, "type", "button"), Ai(w10, "class", "jse-primary svelte-18bor9q"), Ai(k10, "class", "jse-actions svelte-18bor9q"), Ai(o10, "class", "jse-modal-contents svelte-18bor9q"), Ai(t10, "class", "jse-modal jse-copy-paste svelte-18bor9q"); + }, m: function(C10, $10) { + ki(C10, t10, $10), Ta(n10, t10, null), pi(t10, r10), pi(t10, o10), pi(o10, i10), pi(o10, a10), pi(o10, s10), pi(s10, c10), pi(c10, l10), pi(c10, u10), pi(s10, f10), pi(s10, d10), pi(d10, h10), pi(d10, v10), pi(s10, p10), pi(s10, m10), pi(m10, g10), pi(m10, y10), pi(o10, b10), pi(o10, k10), pi(k10, w10), x10 = true, j10 || (S10 = Oi(w10, "click", e20[2]), j10 = true); + }, p: Wo, i: function(e21) { + x10 || (wa(n10.$$.fragment, e21), x10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), x10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), j10 = false, S10(); + } }; + } + function tI(e20) { + var t10 = Zi("simple-modal").close; + return [t10, KN ? "\u2318" : "Ctrl", function() { + return t10(); + }]; + } + var nI = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, tI, eI, Zo, {}, ZN), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function rI(e20) { + return !!e20 && ("space" === e20.type || true === e20.space); + } + function oI(e20) { + return !!e20 && ("separator" === e20.type || true === e20.separator); + } + function iI(e20) { + return !!e20 && ("label" === e20.type && "string" == typeof e20.text); + } + function aI(e20) { + return !!e20 && "function" == typeof e20.onClick; + } + function sI(e20) { + return !!e20 && ("dropdown-button" === e20.type && aI(e20.main) && Array.isArray(e20.items)); + } + function cI(e20) { + return !!e20 && ("row" === e20.type && Array.isArray(e20.items)); + } + function lI(e20) { + return !!e20 && ("column" === e20.type && Array.isArray(e20.items)); + } + function uI(e20) { + return Gl(e20) && Gl(e20.parseError); + } + function fI(e20) { + return Gl(e20) && Array.isArray(e20.validationErrors); + } + function dI(e20) { + return Gl(e20) && Array.isArray(e20.path) && "string" == typeof e20.message && "severity" in e20; + } + function hI(e20) { + return Gl(e20) && dI(e20) && "boolean" == typeof e20.isChildError; + } + function vI(e20) { + mi(e20, "svelte-7deygj", '.jse-menu.svelte-7deygj.svelte-7deygj{background:var(--jse-theme-color, #3883fa);font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size-main-menu, 14px);color:var(--jse-menu-color, var(--jse-text-color-inverse, #fff));display:flex;flex-wrap:wrap;align-items:stretch;position:relative}.jse-menu.svelte-7deygj .jse-button.svelte-7deygj{font-family:inherit;font-size:inherit;line-height:1.5em;border:none;background:transparent;color:inherit;cursor:pointer;width:var(--jse-menu-button-size, 32px);height:var(--jse-menu-button-size, 32px);padding:calc(0.5 * var(--jse-padding, 10px));margin:0;border-radius:0;display:inline-flex;align-items:center;text-align:center;justify-content:center}.jse-menu.svelte-7deygj .jse-button.svelte-7deygj:hover,.jse-menu.svelte-7deygj .jse-button.svelte-7deygj:focus{background:var(--jse-theme-color-highlight, #5f9dff)}.jse-menu.svelte-7deygj .jse-button.svelte-7deygj:disabled{color:var(--jse-menu-color, var(--jse-text-color-inverse, #fff));opacity:0.5;background:transparent}.jse-menu.svelte-7deygj .jse-button.jse-group-button.svelte-7deygj{width:auto;height:calc(var(--jse-menu-button-size, 32px) - var(--jse-padding, 10px));margin:calc(0.5 * var(--jse-padding, 10px)) 0;padding:0 calc(0.5 * var(--jse-padding, 10px)) 1px;border:1px solid var(--jse-menu-color, var(--jse-text-color-inverse, #fff))}.jse-menu.svelte-7deygj .jse-button.jse-group-button.svelte-7deygj:not(.jse-last){border-right:none}.jse-menu.svelte-7deygj .jse-button.jse-group-button.jse-first.svelte-7deygj{margin-left:calc(0.5 * var(--jse-padding, 10px))}.jse-menu.svelte-7deygj .jse-button.jse-group-button.jse-last.svelte-7deygj{margin-right:calc(0.5 * var(--jse-padding, 10px))}.jse-menu.svelte-7deygj .jse-button.jse-group-button.svelte-7deygj:hover,.jse-menu.svelte-7deygj .jse-button.jse-group-button.svelte-7deygj:focus{background:var(--jse-theme-color-highlight, #5f9dff)}.jse-menu.svelte-7deygj .jse-button.jse-group-button.jse-selected.svelte-7deygj{background:var(--jse-menu-color, var(--jse-text-color-inverse, #fff));color:var(--jse-theme-color, #3883fa)}.jse-menu.svelte-7deygj .jse-space.svelte-7deygj{flex:1}.jse-menu.svelte-7deygj .jse-separator.svelte-7deygj{background:var(--jse-menu-color, var(--jse-text-color-inverse, #fff));opacity:0.3;width:1px;margin:3px}'); + } + var pI = function(e20) { + return {}; + }; + var mI = function(e20) { + return {}; + }; + function gI(e20, t10, n10) { + var r10 = e20.slice(); + return r10[3] = t10[n10], r10; + } + var yI = function(e20) { + return {}; + }; + var bI = function(e20) { + return {}; + }; + function kI(e20) { + var t10, n10 = OI(e20[3]) + ""; + return { c: function() { + t10 = Ci(n10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, r10) { + 1 & r10 && n10 !== (n10 = OI(e21[3]) + "") && Ni(t10, n10); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function wI(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = e20[3].icon && SI(e20), u10 = e20[3].text && CI(e20); + return { c: function() { + t10 = ji("button"), l10 && l10.c(), n10 = $i(), u10 && u10.c(), Ai(t10, "type", "button"), Ai(t10, "class", r10 = "jse-button " + e20[3].className + " svelte-7deygj"), Ai(t10, "title", o10 = e20[3].title), t10.disabled = i10 = e20[3].disabled || false; + }, m: function(r11, o11) { + ki(r11, t10, o11), l10 && l10.m(t10, null), pi(t10, n10), u10 && u10.m(t10, null), a10 = true, s10 || (c10 = Oi(t10, "click", function() { + Yo(e20[3].onClick) && e20[3].onClick.apply(this, arguments); + }), s10 = true); + }, p: function(s11, c11) { + (e20 = s11)[3].icon ? l10 ? (l10.p(e20, c11), 1 & c11 && wa(l10, 1)) : ((l10 = SI(e20)).c(), wa(l10, 1), l10.m(t10, n10)) : l10 && (ba(), xa(l10, 1, 1, function() { + l10 = null; + }), ka()), e20[3].text ? u10 ? u10.p(e20, c11) : ((u10 = CI(e20)).c(), u10.m(t10, null)) : u10 && (u10.d(1), u10 = null), (!a10 || 1 & c11 && r10 !== (r10 = "jse-button " + e20[3].className + " svelte-7deygj")) && Ai(t10, "class", r10), (!a10 || 1 & c11 && o10 !== (o10 = e20[3].title)) && Ai(t10, "title", o10), (!a10 || 1 & c11 && i10 !== (i10 = e20[3].disabled || false)) && (t10.disabled = i10); + }, i: function(e21) { + a10 || (wa(l10), a10 = true); + }, o: function(e21) { + xa(l10), a10 = false; + }, d: function(e21) { + e21 && wi(t10), l10 && l10.d(), u10 && u10.d(), s10 = false, c10(); + } }; + } + function xI(e20) { + var t10; + return { c: function() { + Ai(t10 = ji("div"), "class", "jse-space svelte-7deygj"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function jI(e20) { + var t10; + return { c: function() { + Ai(t10 = ji("div"), "class", "jse-separator svelte-7deygj"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function SI(e20) { + var t10, n10; + return t10 = new jM({ props: { data: e20[3].icon } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.data = e21[3].icon), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function CI(e20) { + var t10, n10 = e20[3].text + ""; + return { c: function() { + t10 = Ci(n10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, r10) { + 1 & r10 && n10 !== (n10 = e21[3].text + "") && Ni(t10, n10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function $I(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10 = [jI, xI, wI, kI], l10 = []; + function u10(e21, o11) { + return 1 & o11 && (t10 = null), 1 & o11 && (n10 = null), 1 & o11 && (r10 = null), null == t10 && (t10 = !!oI(e21[3])), t10 ? 0 : (null == n10 && (n10 = !!rI(e21[3])), n10 ? 1 : (null == r10 && (r10 = !!aI(e21[3])), r10 ? 2 : 3)); + } + return o10 = u10(e20, -1), i10 = l10[o10] = c10[o10](e20), { c: function() { + i10.c(), a10 = _i(); + }, m: function(e21, t11) { + l10[o10].m(e21, t11), ki(e21, a10, t11), s10 = true; + }, p: function(e21, t11) { + var n11 = o10; + (o10 = u10(e21, t11)) === n11 ? l10[o10].p(e21, t11) : (ba(), xa(l10[n11], 1, 1, function() { + l10[n11] = null; + }), ka(), (i10 = l10[o10]) ? i10.p(e21, t11) : (i10 = l10[o10] = c10[o10](e21)).c(), wa(i10, 1), i10.m(a10.parentNode, a10)); + }, i: function(e21) { + s10 || (wa(i10), s10 = true); + }, o: function(e21) { + xa(i10), s10 = false; + }, d: function(e21) { + e21 && wi(a10), l10[o10].d(e21); + } }; + } + function _I(e20) { + for (var t10, n10, r10, o10, i10 = e20[2].left, a10 = ei(i10, e20, e20[1], bI), s10 = Ca(e20[0]), c10 = [], l10 = 0; l10 < s10.length; l10 += 1) + c10[l10] = $I(gI(e20, s10, l10)); + var u10 = function(e21) { + return xa(c10[e21], 1, 1, function() { + c10[e21] = null; + }); + }, f10 = e20[2].right, d10 = ei(f10, e20, e20[1], mI); + return { c: function() { + t10 = ji("div"), a10 && a10.c(), n10 = $i(); + for (var e21 = 0; e21 < c10.length; e21 += 1) + c10[e21].c(); + r10 = $i(), d10 && d10.c(), Ai(t10, "class", "jse-menu svelte-7deygj"); + }, m: function(e21, i11) { + ki(e21, t10, i11), a10 && a10.m(t10, null), pi(t10, n10); + for (var s11 = 0; s11 < c10.length; s11 += 1) + c10[s11] && c10[s11].m(t10, null); + pi(t10, r10), d10 && d10.m(t10, null), o10 = true; + }, p: function(e21, n11) { + var l11 = jo(n11, 1)[0]; + if (a10 && a10.p && (!o10 || 2 & l11) && ri(a10, i10, e21, e21[1], o10 ? ni(i10, e21[1], l11, yI) : oi(e21[1]), bI), 1 & l11) { + var h10; + for (s10 = Ca(e21[0]), h10 = 0; h10 < s10.length; h10 += 1) { + var v10 = gI(e21, s10, h10); + c10[h10] ? (c10[h10].p(v10, l11), wa(c10[h10], 1)) : (c10[h10] = $I(v10), c10[h10].c(), wa(c10[h10], 1), c10[h10].m(t10, r10)); + } + for (ba(), h10 = s10.length; h10 < c10.length; h10 += 1) + u10(h10); + ka(); + } + d10 && d10.p && (!o10 || 2 & l11) && ri(d10, f10, e21, e21[1], o10 ? ni(f10, e21[1], l11, pI) : oi(e21[1]), mI); + }, i: function(e21) { + if (!o10) { + wa(a10, e21); + for (var t11 = 0; t11 < s10.length; t11 += 1) + wa(c10[t11]); + wa(d10, e21), o10 = true; + } + }, o: function(e21) { + xa(a10, e21), c10 = c10.filter(Boolean); + for (var t11 = 0; t11 < c10.length; t11 += 1) + xa(c10[t11]); + xa(d10, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), a10 && a10.d(e21), xi(c10, e21), d10 && d10.d(e21); + } }; + } + function OI(e20) { + return console.error("Unknown type of menu item", e20), "???"; + } + function MI(e20, t10, n10) { + var r10 = t10.$$slots, o10 = void 0 === r10 ? {} : r10, i10 = t10.$$scope, a10 = t10.items, s10 = void 0 === a10 ? [] : a10; + return e20.$$set = function(e21) { + "items" in e21 && n10(0, s10 = e21.items), "$$scope" in e21 && n10(1, i10 = e21.$$scope); + }, [s10, i10, o10]; + } + var EI = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, MI, _I, Zo, { items: 0 }, vI), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function AI(e20) { + mi(e20, "svelte-1d84pok", '.jse-json-repair-component.svelte-1d84pok.svelte-1d84pok{flex:1;display:flex;flex-direction:column;background:var(--jse-background-color, #fff);color:var(--jse-text-color, #4d4d4d)}.jse-json-repair-component.svelte-1d84pok .jse-menu .jse-info.svelte-1d84pok{padding:calc(0.5 * var(--jse-padding, 10px));font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);vertical-align:center}.jse-json-repair-component.svelte-1d84pok .jse-json-text.svelte-1d84pok{flex:1;border:none;padding:2px;font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);background:var(--jse-input-background, var(--jse-background-color, #fff));color:var(--jse-text-color, #4d4d4d);resize:none;outline:none}'); + } + function PI(e20) { + var t10; + return { c: function() { + (t10 = ji("div")).textContent = "Repair invalid JSON, then click apply", Ai(t10, "slot", "left"), Ai(t10, "class", "jse-info svelte-1d84pok"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function TI(e20) { + var t10, n10; + return t10 = new IN({ props: { type: "success", message: "JSON is valid now and can be parsed.", actions: e20[5] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 32 & n11 && (r10.actions = e21[5]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function RI(e20) { + var t10, n10; + return t10 = new IN({ props: { type: "error", icon: TP, message: "Cannot parse JSON: ".concat(e20[2].message), actions: e20[6] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 4 & n11 && (r10.message = "Cannot parse JSON: ".concat(e21[2].message)), 64 & n11 && (r10.actions = e21[6]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function NI(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10; + n10 = new EI({ props: { items: e20[4], $$slots: { left: [PI] }, $$scope: { ctx: e20 } } }); + var f10 = [RI, TI], d10 = []; + function h10(e21, t11) { + return e21[2] ? 0 : 1; + } + return o10 = h10(e20), i10 = d10[o10] = f10[o10](e20), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), r10 = $i(), i10.c(), a10 = $i(), (s10 = ji("textarea")).readOnly = e20[1], Ai(s10, "class", "jse-json-text svelte-1d84pok"), Ai(s10, "autocomplete", "off"), Ai(s10, "autocapitalize", "off"), Ai(s10, "spellcheck", "false"), s10.value = e20[0], Ai(t10, "class", "jse-json-repair-component svelte-1d84pok"); + }, m: function(i11, f11) { + ki(i11, t10, f11), Ta(n10, t10, null), pi(t10, r10), d10[o10].m(t10, null), pi(t10, a10), pi(t10, s10), e20[16](s10), c10 = true, l10 || (u10 = Oi(s10, "input", e20[7]), l10 = true); + }, p: function(e21, r11) { + var l11 = jo(r11, 1)[0], u11 = {}; + 16 & l11 && (u11.items = e21[4]), 8388608 & l11 && (u11.$$scope = { dirty: l11, ctx: e21 }), n10.$set(u11); + var v10 = o10; + (o10 = h10(e21)) === v10 ? d10[o10].p(e21, l11) : (ba(), xa(d10[v10], 1, 1, function() { + d10[v10] = null; + }), ka(), (i10 = d10[o10]) ? i10.p(e21, l11) : (i10 = d10[o10] = f10[o10](e21)).c(), wa(i10, 1), i10.m(t10, a10)), (!c10 || 2 & l11) && (s10.readOnly = e21[1]), (!c10 || 1 & l11) && (s10.value = e21[0]); + }, i: function(e21) { + c10 || (wa(n10.$$.fragment, e21), wa(i10), c10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), xa(i10), c10 = false; + }, d: function(r11) { + r11 && wi(t10), Ra(n10), d10[o10].d(), e20[16](null), l10 = false, u10(); + } }; + } + function II(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10, f10 = t10.text, d10 = void 0 === f10 ? "" : f10, h10 = t10.readOnly, v10 = void 0 !== h10 && h10, p10 = t10.onParse, m10 = t10.onRepair, g10 = t10.onChange, y10 = void 0 === g10 ? null : g10, b10 = t10.onApply, k10 = t10.onCancel, w10 = Da("jsoneditor:JSONRepair"); + function x10() { + b10(d10); + } + return e20.$$set = function(e21) { + "text" in e21 && n10(0, d10 = e21.text), "readOnly" in e21 && n10(1, v10 = e21.readOnly), "onParse" in e21 && n10(8, p10 = e21.onParse), "onRepair" in e21 && n10(9, m10 = e21.onRepair), "onChange" in e21 && n10(10, y10 = e21.onChange), "onApply" in e21 && n10(11, b10 = e21.onApply), "onCancel" in e21 && n10(12, k10 = e21.onCancel); + }, e20.$$.update = function() { + 1 & e20.$$.dirty && n10(2, r10 = function(e21) { + try { + return p10(e21), null; + } catch (t11) { + return H_(e21, t11.message); + } + }(d10)), 1 & e20.$$.dirty && n10(15, o10 = function(e21) { + try { + return m10(e21), true; + } catch (e23) { + return false; + } + }(d10)), 4 & e20.$$.dirty && w10("error", r10), 4096 & e20.$$.dirty && n10(4, u10 = [{ type: "space" }, { type: "button", icon: MP, title: "Cancel repair", className: "jse-cancel", onClick: k10 }]), 57344 & e20.$$.dirty && n10(6, s10 = o10 ? [i10, a10] : [i10]), 2 & e20.$$.dirty && n10(5, c10 = [{ icon: PP, text: "Apply", title: "Apply fixed JSON", disabled: v10, onClick: x10 }]); + }, n10(13, i10 = { icon: xP, text: "Show me", title: "Scroll to the error location", onClick: function() { + if (l10 && r10) { + var e21 = null != r10.position ? r10.position : 0; + l10.setSelectionRange(e21, e21), l10.focus(); + } + } }), n10(14, a10 = { icon: uP, text: "Auto repair", title: "Automatically repair JSON", onClick: function() { + try { + n10(0, d10 = m10(d10)), y10 && y10(d10); + } catch (e21) { + } + } }), [d10, v10, r10, l10, u10, c10, s10, function(e21) { + w10("handleChange"); + var t11 = e21.target.value; + d10 !== t11 && (n10(0, d10 = t11), y10 && y10(d10)); + }, p10, m10, y10, b10, k10, i10, a10, o10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(3, l10 = e21); + }); + }]; + } + var DI = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, II, NI, Zo, { text: 0, readOnly: 1, onParse: 8, onRepair: 9, onChange: 10, onApply: 11, onCancel: 12 }, AI), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var qI = []; + function zI(e20) { + if ("Escape" === e20.key) { + var t10 = vb(qI); + t10 && t10(); + } + } + function BI(e20, t10) { + return _w(qI) && window.addEventListener("keydown", zI), qI.push(t10), { destroy: function() { + _w(qI = qI.filter(function(e21) { + return e21 !== t10; + })) && window.removeEventListener("keydown", zI); + } }; + } + function LI(e20) { + mi(e20, "svelte-rn18r0", '.jse-modal.jse-repair.svelte-rn18r0{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;background:var(--jse-modal-background, #f5f5f5);color:var(--jse-text-color, #4d4d4d)}'); + } + function FI(e20) { + var t10, n10, r10, o10, i10, a10; + function s10(t11) { + e20[7](t11); + } + var c10 = { onParse: e20[1], onRepair: e20[2], onApply: e20[4], onCancel: e20[5] }; + return void 0 !== e20[0] && (c10.text = e20[0]), n10 = new DI({ props: c10 }), na.push(function() { + return Aa(n10, "text", s10); + }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-modal jse-repair svelte-rn18r0"); + }, m: function(r11, s11) { + ki(r11, t10, s11), Ta(n10, t10, null), o10 = true, i10 || (a10 = ci(BI.call(null, t10, e20[3])), i10 = true); + }, p: function(e21, t11) { + var o11 = jo(t11, 1)[0], i11 = {}; + 2 & o11 && (i11.onParse = e21[1]), 4 & o11 && (i11.onRepair = e21[2]), !r10 && 1 & o11 && (r10 = true, i11.text = e21[0], ua(function() { + return r10 = false; + })), n10.$set(i11); + }, i: function(e21) { + o10 || (wa(n10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), i10 = false, a10(); + } }; + } + function VI(e20, t10, n10) { + var r10 = t10.text, o10 = t10.onParse, i10 = t10.onRepair, a10 = t10.onApply, s10 = Zi("simple-modal").close; + return e20.$$set = function(e21) { + "text" in e21 && n10(0, r10 = e21.text), "onParse" in e21 && n10(1, o10 = e21.onParse), "onRepair" in e21 && n10(2, i10 = e21.onRepair), "onApply" in e21 && n10(6, a10 = e21.onApply); + }, [r10, o10, i10, s10, function(e21) { + s10(), a10(e21); + }, function() { + s10(); + }, a10, function(e21) { + n10(0, r10 = e21); + }]; + } + var HI = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, VI, FI, Zo, { text: 0, onParse: 1, onRepair: 2, onApply: 6 }, LI), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function WI(e20) { + mi(e20, "svelte-szeu2l", 'button.jse-context-menu-button.svelte-szeu2l{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;flex:1;white-space:nowrap;padding:var(--jse-padding, 10px);color:inherit}button.jse-context-menu-button.svelte-szeu2l:hover{background:var(--jse-context-menu-background-highlight, #7a7a7a)}button.jse-context-menu-button.svelte-szeu2l:focus{background:var(--jse-context-menu-background-highlight, #7a7a7a);z-index:1}button.jse-context-menu-button.svelte-szeu2l:disabled{color:var(--jse-context-menu-color-disabled, #9d9d9d);background:unset}button.jse-context-menu-button.left.svelte-szeu2l{text-align:left}button.jse-context-menu-button.svelte-szeu2l svg{width:16px}'); + } + function UI(e20) { + var t10, n10; + return t10 = new jM({ props: { data: e20[0].icon } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.data = e21[0].icon), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function JI(e20) { + var t10, n10 = e20[0].text + ""; + return { c: function() { + t10 = Ci(n10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, r10) { + 1 & r10 && n10 !== (n10 = e21[0].text + "") && Ni(t10, n10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function KI(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = e20[0].icon && UI(e20), u10 = e20[0].text && JI(e20); + return { c: function() { + t10 = ji("button"), l10 && l10.c(), n10 = $i(), u10 && u10.c(), Ai(t10, "type", "button"), Ai(t10, "class", r10 = si(GE("jse-context-menu-button", e20[1], e20[0].className)) + " svelte-szeu2l"), Ai(t10, "title", o10 = e20[0].title), t10.disabled = i10 = e20[0].disabled || false; + }, m: function(r11, o11) { + ki(r11, t10, o11), l10 && l10.m(t10, null), pi(t10, n10), u10 && u10.m(t10, null), a10 = true, s10 || (c10 = Oi(t10, "click", e20[3]), s10 = true); + }, p: function(e21, s11) { + var c11 = jo(s11, 1)[0]; + e21[0].icon ? l10 ? (l10.p(e21, c11), 1 & c11 && wa(l10, 1)) : ((l10 = UI(e21)).c(), wa(l10, 1), l10.m(t10, n10)) : l10 && (ba(), xa(l10, 1, 1, function() { + l10 = null; + }), ka()), e21[0].text ? u10 ? u10.p(e21, c11) : ((u10 = JI(e21)).c(), u10.m(t10, null)) : u10 && (u10.d(1), u10 = null), (!a10 || 3 & c11 && r10 !== (r10 = si(GE("jse-context-menu-button", e21[1], e21[0].className)) + " svelte-szeu2l")) && Ai(t10, "class", r10), (!a10 || 1 & c11 && o10 !== (o10 = e21[0].title)) && Ai(t10, "title", o10), (!a10 || 1 & c11 && i10 !== (i10 = e21[0].disabled || false)) && (t10.disabled = i10); + }, i: function(e21) { + a10 || (wa(l10), a10 = true); + }, o: function(e21) { + xa(l10), a10 = false; + }, d: function(e21) { + e21 && wi(t10), l10 && l10.d(), u10 && u10.d(), s10 = false, c10(); + } }; + } + function GI(e20, t10, n10) { + var r10 = t10.item, o10 = t10.className, i10 = void 0 === o10 ? void 0 : o10, a10 = t10.onCloseContextMenu; + return e20.$$set = function(e21) { + "item" in e21 && n10(0, r10 = e21.item), "className" in e21 && n10(1, i10 = e21.className), "onCloseContextMenu" in e21 && n10(2, a10 = e21.onCloseContextMenu); + }, [r10, i10, a10, function(e21) { + a10(), r10.onClick(e21); + }]; + } + var QI = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, GI, KI, Xo, { item: 0, className: 1, onCloseContextMenu: 2 }, WI), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function YI(e20) { + mi(e20, "svelte-9i012w", '.jse-dropdown-button.svelte-9i012w.svelte-9i012w{flex:1;line-height:normal;border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;position:relative;padding:0;display:flex}.jse-dropdown-button.svelte-9i012w ul.svelte-9i012w{margin:0;padding:0}.jse-dropdown-button.svelte-9i012w ul li.svelte-9i012w{margin:0;padding:0;list-style-type:none}.jse-dropdown-button.svelte-9i012w button.jse-open-dropdown.svelte-9i012w{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;width:2em;background:var(--jse-context-menu-background, #656565);color:var(--jse-context-menu-color, var(--jse-text-color-inverse, #fff));border-radius:0}.jse-dropdown-button.svelte-9i012w button.jse-open-dropdown.jse-visible.svelte-9i012w{background:var(--jse-context-menu-background, #656565)}.jse-dropdown-button.svelte-9i012w button.jse-open-dropdown.svelte-9i012w:hover{background:var(--jse-context-menu-background-highlight, #7a7a7a)}.jse-dropdown-button.svelte-9i012w button.jse-open-dropdown.svelte-9i012w:focus{z-index:1}.jse-dropdown-button.svelte-9i012w button.jse-open-dropdown.svelte-9i012w:disabled{color:var(--jse-context-menu-color-disabled, #9d9d9d);background:unset}.jse-dropdown-button.svelte-9i012w .jse-dropdown-items.svelte-9i012w{display:none;position:absolute;top:100%;left:0;z-index:1;background:var(--jse-context-menu-background, #656565);color:var(--jse-context-menu-color, var(--jse-text-color-inverse, #fff));box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24))}.jse-dropdown-button.svelte-9i012w .jse-dropdown-items.jse-visible.svelte-9i012w{display:block}.jse-dropdown-button.svelte-9i012w .jse-dropdown-items button.svelte-9i012w{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;width:100%;text-align:left;padding:var(--jse-padding, 10px);margin:0}.jse-dropdown-button.svelte-9i012w .jse-dropdown-items button.svelte-9i012w:hover{background:var(--jse-context-menu-background-highlight, #7a7a7a)}.jse-dropdown-button.svelte-9i012w .jse-dropdown-items button.svelte-9i012w:disabled{color:var(--jse-context-menu-color-disabled, #9d9d9d);background:unset}'); + } + function XI(e20, t10, n10) { + var r10 = e20.slice(); + return r10[11] = t10[n10], r10; + } + var ZI = function(e20) { + return {}; + }; + var eD = function(e20) { + return {}; + }; + function tD(e20) { + var t10, n10; + return t10 = new jM({ props: { data: e20[11].icon } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.data = e21[11].icon), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function nD(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10 = e20[11].text + "", h10 = e20[11].icon && tD(e20); + function v10() { + for (var t11, n11 = arguments.length, r11 = new Array(n11), o11 = 0; o11 < n11; o11++) + r11[o11] = arguments[o11]; + return (t11 = e20)[9].apply(t11, [e20[11]].concat(r11)); + } + return { c: function() { + t10 = ji("li"), n10 = ji("button"), h10 && h10.c(), r10 = $i(), o10 = Ci(d10), c10 = $i(), Ai(n10, "type", "button"), Ai(n10, "title", i10 = e20[11].title), n10.disabled = a10 = e20[11].disabled, Ai(n10, "class", s10 = si(e20[11].className) + " svelte-9i012w"), Ai(t10, "class", "svelte-9i012w"); + }, m: function(e21, i11) { + ki(e21, t10, i11), pi(t10, n10), h10 && h10.m(n10, null), pi(n10, r10), pi(n10, o10), pi(t10, c10), l10 = true, u10 || (f10 = Oi(n10, "click", v10), u10 = true); + }, p: function(t11, c11) { + (e20 = t11)[11].icon ? h10 ? (h10.p(e20, c11), 1 & c11 && wa(h10, 1)) : ((h10 = tD(e20)).c(), wa(h10, 1), h10.m(n10, r10)) : h10 && (ba(), xa(h10, 1, 1, function() { + h10 = null; + }), ka()), (!l10 || 1 & c11) && d10 !== (d10 = e20[11].text + "") && Ni(o10, d10), (!l10 || 1 & c11 && i10 !== (i10 = e20[11].title)) && Ai(n10, "title", i10), (!l10 || 1 & c11 && a10 !== (a10 = e20[11].disabled)) && (n10.disabled = a10), (!l10 || 1 & c11 && s10 !== (s10 = si(e20[11].className) + " svelte-9i012w")) && Ai(n10, "class", s10); + }, i: function(e21) { + l10 || (wa(h10), l10 = true); + }, o: function(e21) { + xa(h10), l10 = false; + }, d: function(e21) { + e21 && wi(t10), h10 && h10.d(), u10 = false, f10(); + } }; + } + function rD(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10 = e20[8].defaultItem, d10 = ei(f10, e20, e20[7], eD); + o10 = new jM({ props: { data: gP } }); + for (var h10 = Ca(e20[0]), v10 = [], p10 = 0; p10 < h10.length; p10 += 1) + v10[p10] = nD(XI(e20, h10, p10)); + var m10 = function(e21) { + return xa(v10[e21], 1, 1, function() { + v10[e21] = null; + }); + }; + return { c: function() { + t10 = ji("div"), d10 && d10.c(), n10 = $i(), r10 = ji("button"), Pa(o10.$$.fragment), i10 = $i(), a10 = ji("div"), s10 = ji("ul"); + for (var c11 = 0; c11 < v10.length; c11 += 1) + v10[c11].c(); + Ai(r10, "type", "button"), Ai(r10, "class", "jse-open-dropdown svelte-9i012w"), Ai(r10, "data-type", "jse-open-dropdown"), r10.disabled = e20[4], zi(r10, "jse-visible", e20[3]), Ai(s10, "class", "svelte-9i012w"), Ai(a10, "class", "jse-dropdown-items svelte-9i012w"), Di(a10, "width", e20[2]), zi(a10, "jse-visible", e20[3]), Ai(t10, "role", "button"), Ai(t10, "tabindex", "0"), Ai(t10, "class", "jse-dropdown-button svelte-9i012w"), Ai(t10, "title", e20[1]); + }, m: function(f11, h11) { + ki(f11, t10, h11), d10 && d10.m(t10, null), pi(t10, n10), pi(t10, r10), Ta(o10, r10, null), pi(t10, i10), pi(t10, a10), pi(a10, s10); + for (var p11 = 0; p11 < v10.length; p11 += 1) + v10[p11] && v10[p11].m(s10, null); + c10 = true, l10 || (u10 = [Oi(r10, "click", e20[5]), Oi(t10, "click", e20[6])], l10 = true); + }, p: function(e21, n11) { + var o11 = jo(n11, 1)[0]; + if (d10 && d10.p && (!c10 || 128 & o11) && ri(d10, f10, e21, e21[7], c10 ? ni(f10, e21[7], o11, ZI) : oi(e21[7]), eD), (!c10 || 16 & o11) && (r10.disabled = e21[4]), (!c10 || 8 & o11) && zi(r10, "jse-visible", e21[3]), 1 & o11) { + var i11; + for (h10 = Ca(e21[0]), i11 = 0; i11 < h10.length; i11 += 1) { + var l11 = XI(e21, h10, i11); + v10[i11] ? (v10[i11].p(l11, o11), wa(v10[i11], 1)) : (v10[i11] = nD(l11), v10[i11].c(), wa(v10[i11], 1), v10[i11].m(s10, null)); + } + for (ba(), i11 = h10.length; i11 < v10.length; i11 += 1) + m10(i11); + ka(); + } + (!c10 || 4 & o11) && Di(a10, "width", e21[2]), (!c10 || 8 & o11) && zi(a10, "jse-visible", e21[3]), (!c10 || 2 & o11) && Ai(t10, "title", e21[1]); + }, i: function(e21) { + if (!c10) { + wa(d10, e21), wa(o10.$$.fragment, e21); + for (var t11 = 0; t11 < h10.length; t11 += 1) + wa(v10[t11]); + c10 = true; + } + }, o: function(e21) { + xa(d10, e21), xa(o10.$$.fragment, e21), v10 = v10.filter(Boolean); + for (var t11 = 0; t11 < v10.length; t11 += 1) + xa(v10[t11]); + c10 = false; + }, d: function(e21) { + e21 && wi(t10), d10 && d10.d(e21), Ra(o10), xi(v10, e21), l10 = false, Qo(u10); + } }; + } + function oD(e20, t10, n10) { + var r10, o10 = t10.$$slots, i10 = void 0 === o10 ? {} : o10, a10 = t10.$$scope, s10 = t10.items, c10 = void 0 === s10 ? [] : s10, l10 = t10.title, u10 = void 0 === l10 ? void 0 : l10, f10 = t10.width, d10 = void 0 === f10 ? "120px" : f10, h10 = false; + function v10() { + n10(3, h10 = false); + } + function p10(e21) { + "Escape" === PO(e21) && (e21.preventDefault(), n10(3, h10 = false)); + } + Gi(function() { + document.addEventListener("click", v10), document.addEventListener("keydown", p10); + }), Qi(function() { + document.removeEventListener("click", v10), document.removeEventListener("keydown", p10); + }); + return e20.$$set = function(e21) { + "items" in e21 && n10(0, c10 = e21.items), "title" in e21 && n10(1, u10 = e21.title), "width" in e21 && n10(2, d10 = e21.width), "$$scope" in e21 && n10(7, a10 = e21.$$scope); + }, e20.$$.update = function() { + 1 & e20.$$.dirty && n10(4, r10 = c10.every(function(e21) { + return true === e21.disabled; + })); + }, [c10, u10, d10, h10, r10, function() { + var e21 = h10; + setTimeout(function() { + return n10(3, h10 = !e21); + }); + }, v10, a10, i10, function(e21, t11) { + return e21.onClick(t11); + }]; + } + var iD = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, oD, rD, Zo, { items: 0, title: 1, width: 2 }, YI), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function aD(e20) { + mi(e20, "svelte-szeu2l", 'button.jse-context-menu-button.svelte-szeu2l{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;flex:1;white-space:nowrap;padding:var(--jse-padding, 10px);color:inherit}button.jse-context-menu-button.svelte-szeu2l:hover{background:var(--jse-context-menu-background-highlight, #7a7a7a)}button.jse-context-menu-button.svelte-szeu2l:focus{background:var(--jse-context-menu-background-highlight, #7a7a7a);z-index:1}button.jse-context-menu-button.svelte-szeu2l:disabled{color:var(--jse-context-menu-color-disabled, #9d9d9d);background:unset}button.jse-context-menu-button.left.svelte-szeu2l{text-align:left}button.jse-context-menu-button.svelte-szeu2l svg{width:16px}'); + } + function sD(e20) { + var t10, n10; + return t10 = new jM({ props: { data: e20[0].main.icon } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.data = e21[0].main.icon), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function cD(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10 = e20[0].main.text + "", f10 = e20[0].main.icon && sD(e20); + return { c: function() { + t10 = ji("button"), f10 && f10.c(), n10 = $i(), r10 = Ci(u10), Ai(t10, "class", o10 = si(GE("jse-context-menu-button", e20[1], e20[0].main.className)) + " svelte-szeu2l"), Ai(t10, "type", "button"), Ai(t10, "slot", "defaultItem"), Ai(t10, "title", i10 = e20[0].main.title), t10.disabled = a10 = e20[0].main.disabled || false; + }, m: function(o11, i11) { + ki(o11, t10, i11), f10 && f10.m(t10, null), pi(t10, n10), pi(t10, r10), s10 = true, c10 || (l10 = Oi(t10, "click", e20[3]), c10 = true); + }, p: function(e21, c11) { + e21[0].main.icon ? f10 ? (f10.p(e21, c11), 1 & c11 && wa(f10, 1)) : ((f10 = sD(e21)).c(), wa(f10, 1), f10.m(t10, n10)) : f10 && (ba(), xa(f10, 1, 1, function() { + f10 = null; + }), ka()), (!s10 || 1 & c11) && u10 !== (u10 = e21[0].main.text + "") && Ni(r10, u10), (!s10 || 3 & c11 && o10 !== (o10 = si(GE("jse-context-menu-button", e21[1], e21[0].main.className)) + " svelte-szeu2l")) && Ai(t10, "class", o10), (!s10 || 1 & c11 && i10 !== (i10 = e21[0].main.title)) && Ai(t10, "title", i10), (!s10 || 1 & c11 && a10 !== (a10 = e21[0].main.disabled || false)) && (t10.disabled = a10); + }, i: function(e21) { + s10 || (wa(f10), s10 = true); + }, o: function(e21) { + xa(f10), s10 = false; + }, d: function(e21) { + e21 && wi(t10), f10 && f10.d(), c10 = false, l10(); + } }; + } + function lD(e20) { + var t10, n10; + return t10 = new iD({ props: { width: e20[0].width, items: e20[0].items, $$slots: { defaultItem: [cD] }, $$scope: { ctx: e20 } } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = jo(n11, 1)[0], o10 = {}; + 1 & r10 && (o10.width = e21[0].width), 1 & r10 && (o10.items = e21[0].items), 23 & r10 && (o10.$$scope = { dirty: r10, ctx: e21 }), t10.$set(o10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function uD(e20, t10, n10) { + var r10 = t10.item, o10 = t10.className, i10 = void 0 === o10 ? void 0 : o10, a10 = t10.onCloseContextMenu; + return e20.$$set = function(e21) { + "item" in e21 && n10(0, r10 = e21.item), "className" in e21 && n10(1, i10 = e21.className), "onCloseContextMenu" in e21 && n10(2, a10 = e21.onCloseContextMenu); + }, [r10, i10, a10, function(e21) { + a10(), r10.main.onClick(e21); + }]; + } + var fD = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, uD, lD, Xo, { item: 0, className: 1, onCloseContextMenu: 2 }, aD), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function dD(e20) { + mi(e20, "svelte-vtd7md", '.jse-contextmenu.svelte-vtd7md.svelte-vtd7md{box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24));font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);background:var(--jse-context-menu-background, #656565);color:var(--jse-context-menu-color, var(--jse-text-color-inverse, #fff))}.jse-contextmenu.svelte-vtd7md .jse-row.svelte-vtd7md{display:flex;flex-direction:row;align-items:flex-start;justify-content:stretch}.jse-contextmenu.svelte-vtd7md .jse-row div.jse-label.svelte-vtd7md{flex:1;white-space:nowrap;padding:var(--jse-padding, 10px);color:var(--jse-context-menu-color-disabled, #9d9d9d);line-height:normal}.jse-contextmenu.svelte-vtd7md .jse-row div.jse-tip.svelte-vtd7md{flex:1;background:var(--jse-context-menu-tip-background, rgba(255, 255, 255, 0.2));color:var(--context-menu-tip-color, inherit);margin:calc(0.5 * var(--jse-padding, 10px));padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px);font-size:80%;line-height:1.3em;display:flex;flex-direction:row;align-items:start;gap:var(--jse-padding, 10px);border-radius:3px}.jse-contextmenu.svelte-vtd7md .jse-row div.jse-tip div.jse-tip-icon.svelte-vtd7md{padding-top:calc(0.5 * var(--jse-padding, 10px))}.jse-contextmenu.svelte-vtd7md .jse-column.svelte-vtd7md{flex:1;display:flex;flex-direction:column;align-items:stretch}.jse-contextmenu.svelte-vtd7md .jse-column.svelte-vtd7md:not(:last-child){border-right:1px solid var(--jse-context-menu-separator-color, #7a7a7a)}.jse-contextmenu.svelte-vtd7md .jse-separator.svelte-vtd7md{width:100%;height:1px;background:var(--jse-context-menu-separator-color, #7a7a7a)}'); + } + function hD(e20, t10, n10) { + var r10 = e20.slice(); + return r10[7] = t10[n10], r10; + } + function vD(e20, t10, n10) { + var r10 = e20.slice(); + return r10[10] = t10[n10], r10; + } + function pD(e20, t10, n10) { + var r10 = e20.slice(); + return r10[13] = t10[n10], r10; + } + function mD(e20) { + var t10, n10 = ID(e20[7]) + ""; + return { c: function() { + t10 = Ci(n10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, r10) { + 1 & r10 && n10 !== (n10 = ID(e21[7]) + "") && Ni(t10, n10); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function gD(e20) { + var t10; + return { c: function() { + Ai(t10 = ji("div"), "class", "jse-separator svelte-vtd7md"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function yD(e20) { + for (var t10, n10, r10 = Ca(e20[7].items), o10 = [], i10 = 0; i10 < r10.length; i10 += 1) + o10[i10] = PD(vD(e20, r10, i10)); + var a10 = function(e21) { + return xa(o10[e21], 1, 1, function() { + o10[e21] = null; + }); + }; + return { c: function() { + t10 = ji("div"); + for (var e21 = 0; e21 < o10.length; e21 += 1) + o10[e21].c(); + Ai(t10, "class", "jse-row svelte-vtd7md"); + }, m: function(e21, r11) { + ki(e21, t10, r11); + for (var i11 = 0; i11 < o10.length; i11 += 1) + o10[i11] && o10[i11].m(t10, null); + n10 = true; + }, p: function(e21, n11) { + if (3 & n11) { + var i11; + for (r10 = Ca(e21[7].items), i11 = 0; i11 < r10.length; i11 += 1) { + var s10 = vD(e21, r10, i11); + o10[i11] ? (o10[i11].p(s10, n11), wa(o10[i11], 1)) : (o10[i11] = PD(s10), o10[i11].c(), wa(o10[i11], 1), o10[i11].m(t10, null)); + } + for (ba(), i11 = r10.length; i11 < o10.length; i11 += 1) + a10(i11); + ka(); + } + }, i: function(e21) { + if (!n10) { + for (var t11 = 0; t11 < r10.length; t11 += 1) + wa(o10[t11]); + n10 = true; + } + }, o: function(e21) { + o10 = o10.filter(Boolean); + for (var t11 = 0; t11 < o10.length; t11 += 1) + xa(o10[t11]); + n10 = false; + }, d: function(e21) { + e21 && wi(t10), xi(o10, e21); + } }; + } + function bD(e20) { + var t10, n10; + return t10 = new fD({ props: { item: e20[7], onCloseContextMenu: e20[1] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.item = e21[7]), 2 & n11 && (r10.onCloseContextMenu = e21[1]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function kD(e20) { + var t10, n10; + return t10 = new QI({ props: { item: e20[7], onCloseContextMenu: e20[1] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.item = e21[7]), 2 & n11 && (r10.onCloseContextMenu = e21[1]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function wD(e20) { + var t10, n10 = ID(e20[10]) + ""; + return { c: function() { + t10 = Ci(n10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, r10) { + 1 & r10 && n10 !== (n10 = ID(e21[10]) + "") && Ni(t10, n10); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function xD(e20) { + var t10; + return { c: function() { + Ai(t10 = ji("div"), "class", "jse-separator svelte-vtd7md"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function jD(e20) { + for (var t10, n10, r10 = Ca(e20[10].items), o10 = [], i10 = 0; i10 < r10.length; i10 += 1) + o10[i10] = AD(pD(e20, r10, i10)); + var a10 = function(e21) { + return xa(o10[e21], 1, 1, function() { + o10[e21] = null; + }); + }; + return { c: function() { + t10 = ji("div"); + for (var e21 = 0; e21 < o10.length; e21 += 1) + o10[e21].c(); + Ai(t10, "class", "jse-column svelte-vtd7md"); + }, m: function(e21, r11) { + ki(e21, t10, r11); + for (var i11 = 0; i11 < o10.length; i11 += 1) + o10[i11] && o10[i11].m(t10, null); + n10 = true; + }, p: function(e21, n11) { + if (3 & n11) { + var i11; + for (r10 = Ca(e21[10].items), i11 = 0; i11 < r10.length; i11 += 1) { + var s10 = pD(e21, r10, i11); + o10[i11] ? (o10[i11].p(s10, n11), wa(o10[i11], 1)) : (o10[i11] = AD(s10), o10[i11].c(), wa(o10[i11], 1), o10[i11].m(t10, null)); + } + for (ba(), i11 = r10.length; i11 < o10.length; i11 += 1) + a10(i11); + ka(); + } + }, i: function(e21) { + if (!n10) { + for (var t11 = 0; t11 < r10.length; t11 += 1) + wa(o10[t11]); + n10 = true; + } + }, o: function(e21) { + o10 = o10.filter(Boolean); + for (var t11 = 0; t11 < o10.length; t11 += 1) + xa(o10[t11]); + n10 = false; + }, d: function(e21) { + e21 && wi(t10), xi(o10, e21); + } }; + } + function SD(e20) { + var t10, n10; + return t10 = new fD({ props: { item: e20[10], onCloseContextMenu: e20[1] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.item = e21[10]), 2 & n11 && (r10.onCloseContextMenu = e21[1]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function CD(e20) { + var t10, n10; + return t10 = new QI({ props: { item: e20[10], onCloseContextMenu: e20[1] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.item = e21[10]), 2 & n11 && (r10.onCloseContextMenu = e21[1]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function $D(e20) { + var t10, n10 = ID(e20[13]) + ""; + return { c: function() { + t10 = Ci(n10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, r10) { + 1 & r10 && n10 !== (n10 = ID(e21[13]) + "") && Ni(t10, n10); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function _D(e20) { + var t10, n10, r10 = e20[13].text + ""; + return { c: function() { + t10 = ji("div"), n10 = Ci(r10), Ai(t10, "class", "jse-label svelte-vtd7md"); + }, m: function(e21, r11) { + ki(e21, t10, r11), pi(t10, n10); + }, p: function(e21, t11) { + 1 & t11 && r10 !== (r10 = e21[13].text + "") && Ni(n10, r10); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function OD(e20) { + var t10; + return { c: function() { + Ai(t10 = ji("div"), "class", "jse-separator svelte-vtd7md"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function MD(e20) { + var t10, n10; + return t10 = new fD({ props: { className: "left", item: e20[13], onCloseContextMenu: e20[1] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.item = e21[13]), 2 & n11 && (r10.onCloseContextMenu = e21[1]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function ED(e20) { + var t10, n10; + return t10 = new QI({ props: { className: "left", item: e20[13], onCloseContextMenu: e20[1] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11 && (r10.item = e21[13]), 2 & n11 && (r10.onCloseContextMenu = e21[1]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function AD(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = [ED, MD, OD, _D, $D], u10 = []; + function f10(e21, i11) { + return 1 & i11 && (t10 = null), 1 & i11 && (n10 = null), 1 & i11 && (r10 = null), 1 & i11 && (o10 = null), null == t10 && (t10 = !!aI(e21[13])), t10 ? 0 : (null == n10 && (n10 = !!sI(e21[13])), n10 ? 1 : (null == r10 && (r10 = !!oI(e21[13])), r10 ? 2 : (null == o10 && (o10 = !!iI(e21[13])), o10 ? 3 : 4))); + } + return i10 = f10(e20, -1), a10 = u10[i10] = l10[i10](e20), { c: function() { + a10.c(), s10 = _i(); + }, m: function(e21, t11) { + u10[i10].m(e21, t11), ki(e21, s10, t11), c10 = true; + }, p: function(e21, t11) { + var n11 = i10; + (i10 = f10(e21, t11)) === n11 ? u10[i10].p(e21, t11) : (ba(), xa(u10[n11], 1, 1, function() { + u10[n11] = null; + }), ka(), (a10 = u10[i10]) ? a10.p(e21, t11) : (a10 = u10[i10] = l10[i10](e21)).c(), wa(a10, 1), a10.m(s10.parentNode, s10)); + }, i: function(e21) { + c10 || (wa(a10), c10 = true); + }, o: function(e21) { + xa(a10), c10 = false; + }, d: function(e21) { + e21 && wi(s10), u10[i10].d(e21); + } }; + } + function PD(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = [CD, SD, jD, xD, wD], u10 = []; + function f10(e21, i11) { + return 1 & i11 && (t10 = null), 1 & i11 && (n10 = null), 1 & i11 && (r10 = null), 1 & i11 && (o10 = null), null == t10 && (t10 = !!aI(e21[10])), t10 ? 0 : (null == n10 && (n10 = !!sI(e21[10])), n10 ? 1 : (null == r10 && (r10 = !!lI(e21[10])), r10 ? 2 : (null == o10 && (o10 = !!oI(e21[10])), o10 ? 3 : 4))); + } + return i10 = f10(e20, -1), a10 = u10[i10] = l10[i10](e20), { c: function() { + a10.c(), s10 = _i(); + }, m: function(e21, t11) { + u10[i10].m(e21, t11), ki(e21, s10, t11), c10 = true; + }, p: function(e21, t11) { + var n11 = i10; + (i10 = f10(e21, t11)) === n11 ? u10[i10].p(e21, t11) : (ba(), xa(u10[n11], 1, 1, function() { + u10[n11] = null; + }), ka(), (a10 = u10[i10]) ? a10.p(e21, t11) : (a10 = u10[i10] = l10[i10](e21)).c(), wa(a10, 1), a10.m(s10.parentNode, s10)); + }, i: function(e21) { + c10 || (wa(a10), c10 = true); + }, o: function(e21) { + xa(a10), c10 = false; + }, d: function(e21) { + e21 && wi(s10), u10[i10].d(e21); + } }; + } + function TD(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = [kD, bD, yD, gD, mD], u10 = []; + function f10(e21, i11) { + return 1 & i11 && (t10 = null), 1 & i11 && (n10 = null), 1 & i11 && (r10 = null), 1 & i11 && (o10 = null), null == t10 && (t10 = !!aI(e21[7])), t10 ? 0 : (null == n10 && (n10 = !!sI(e21[7])), n10 ? 1 : (null == r10 && (r10 = !!cI(e21[7])), r10 ? 2 : (null == o10 && (o10 = !!oI(e21[7])), o10 ? 3 : 4))); + } + return i10 = f10(e20, -1), a10 = u10[i10] = l10[i10](e20), { c: function() { + a10.c(), s10 = _i(); + }, m: function(e21, t11) { + u10[i10].m(e21, t11), ki(e21, s10, t11), c10 = true; + }, p: function(e21, t11) { + var n11 = i10; + (i10 = f10(e21, t11)) === n11 ? u10[i10].p(e21, t11) : (ba(), xa(u10[n11], 1, 1, function() { + u10[n11] = null; + }), ka(), (a10 = u10[i10]) ? a10.p(e21, t11) : (a10 = u10[i10] = l10[i10](e21)).c(), wa(a10, 1), a10.m(s10.parentNode, s10)); + }, i: function(e21) { + c10 || (wa(a10), c10 = true); + }, o: function(e21) { + xa(a10), c10 = false; + }, d: function(e21) { + e21 && wi(s10), u10[i10].d(e21); + } }; + } + function RD(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10; + return o10 = new jM({ props: { data: oM } }), { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = ji("div"), Pa(o10.$$.fragment), i10 = $i(), a10 = ji("div"), s10 = Ci(e20[2]), Ai(r10, "class", "jse-tip-icon svelte-vtd7md"), Ai(a10, "class", "jse-tip-text"), Ai(n10, "class", "jse-tip svelte-vtd7md"), Ai(t10, "class", "jse-row svelte-vtd7md"); + }, m: function(e21, l10) { + ki(e21, t10, l10), pi(t10, n10), pi(n10, r10), Ta(o10, r10, null), pi(n10, i10), pi(n10, a10), pi(a10, s10), c10 = true; + }, p: function(e21, t11) { + (!c10 || 4 & t11) && Ni(s10, e21[2]); + }, i: function(e21) { + c10 || (wa(o10.$$.fragment, e21), c10 = true); + }, o: function(e21) { + xa(o10.$$.fragment, e21), c10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(o10); + } }; + } + function ND(e20) { + for (var t10, n10, r10, o10, i10, a10 = Ca(e20[0]), s10 = [], c10 = 0; c10 < a10.length; c10 += 1) + s10[c10] = TD(hD(e20, a10, c10)); + var l10 = function(e21) { + return xa(s10[e21], 1, 1, function() { + s10[e21] = null; + }); + }, u10 = e20[2] && RD(e20); + return { c: function() { + t10 = ji("div"); + for (var e21 = 0; e21 < s10.length; e21 += 1) + s10[e21].c(); + n10 = $i(), u10 && u10.c(), Ai(t10, "role", "menu"), Ai(t10, "tabindex", "-1"), Ai(t10, "class", "jse-contextmenu svelte-vtd7md"); + }, m: function(a11, c11) { + ki(a11, t10, c11); + for (var l11 = 0; l11 < s10.length; l11 += 1) + s10[l11] && s10[l11].m(t10, null); + pi(t10, n10), u10 && u10.m(t10, null), e20[5](t10), r10 = true, o10 || (i10 = Oi(t10, "keydown", e20[4]), o10 = true); + }, p: function(e21, r11) { + var o11 = jo(r11, 1)[0]; + if (3 & o11) { + var i11; + for (a10 = Ca(e21[0]), i11 = 0; i11 < a10.length; i11 += 1) { + var c11 = hD(e21, a10, i11); + s10[i11] ? (s10[i11].p(c11, o11), wa(s10[i11], 1)) : (s10[i11] = TD(c11), s10[i11].c(), wa(s10[i11], 1), s10[i11].m(t10, n10)); + } + for (ba(), i11 = a10.length; i11 < s10.length; i11 += 1) + l10(i11); + ka(); + } + e21[2] ? u10 ? (u10.p(e21, o11), 4 & o11 && wa(u10, 1)) : ((u10 = RD(e21)).c(), wa(u10, 1), u10.m(t10, null)) : u10 && (ba(), xa(u10, 1, 1, function() { + u10 = null; + }), ka()); + }, i: function(e21) { + if (!r10) { + for (var t11 = 0; t11 < a10.length; t11 += 1) + wa(s10[t11]); + wa(u10), r10 = true; + } + }, o: function(e21) { + s10 = s10.filter(Boolean); + for (var t11 = 0; t11 < s10.length; t11 += 1) + xa(s10[t11]); + xa(u10), r10 = false; + }, d: function(n11) { + n11 && wi(t10), xi(s10, n11), u10 && u10.d(), e20[5](null), o10 = false, i10(); + } }; + } + function ID(e20) { + return console.error("Unknown type of context menu item", e20), "???"; + } + function DD(e20, t10, n10) { + var r10, o10 = t10.items, i10 = t10.onCloseContextMenu, a10 = t10.tip; + Gi(function() { + var e21 = Array.from(r10.querySelectorAll("button")).find(function(e23) { + return !e23.disabled; + }); + e21 && e21.focus(); + }); + var s10 = { ArrowUp: "Up", ArrowDown: "Down", ArrowLeft: "Left", ArrowRight: "Right" }; + return e20.$$set = function(e21) { + "items" in e21 && n10(0, o10 = e21.items), "onCloseContextMenu" in e21 && n10(1, i10 = e21.onCloseContextMenu), "tip" in e21 && n10(2, a10 = e21.tip); + }, [o10, i10, a10, r10, function(e21) { + var t11 = PO(e21), n11 = s10[t11]; + if (n11 && e21.target) { + e21.preventDefault(); + var o11 = EO({ allElements: Array.from(r10.querySelectorAll("button:not([disabled])")), currentElement: e21.target, direction: n11, hasPrio: function(e23) { + return "jse-open-dropdown" !== e23.getAttribute("data-type"); + } }); + o11 && o11.focus(); + } + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(3, r10 = e21); + }); + }]; + } + var qD = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, DD, ND, Zo, { items: 0, onCloseContextMenu: 1, tip: 2 }, dD), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function zD(e20) { + var t10, n10; + return t10 = new qD({ props: { items: e20[2], onCloseContextMenu: e20[1], tip: e20[0] ? "Tip: you can open this context menu via right-click or with Ctrl+Q" : void 0 } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 4 & n11[0] && (r10.items = e21[2]), 2 & n11[0] && (r10.onCloseContextMenu = e21[1]), 1 & n11[0] && (r10.tip = e21[0] ? "Tip: you can open this context menu via right-click or with Ctrl+Q" : void 0), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function BD(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10 = t10.json, C10 = t10.documentState, $10 = t10.parser, _10 = t10.showTip, O10 = t10.onCloseContextMenu, M10 = t10.onRenderContextMenu, E10 = t10.onEditKey, A10 = t10.onEditValue, P10 = t10.onToggleEnforceString, T8 = t10.onCut, R8 = t10.onCopy, N8 = t10.onPaste, I10 = t10.onRemove, D10 = t10.onDuplicate, q10 = t10.onExtract, z10 = t10.onInsertBefore, B10 = t10.onInsert, L10 = t10.onConvert, F10 = t10.onInsertAfter, V10 = t10.onSort, H10 = t10.onTransform; + function W10(e21) { + l10 ? L10(e21) : B10(e21); + } + return e20.$$set = function(e21) { + "json" in e21 && n10(3, S10 = e21.json), "documentState" in e21 && n10(4, C10 = e21.documentState), "parser" in e21 && n10(5, $10 = e21.parser), "showTip" in e21 && n10(0, _10 = e21.showTip), "onCloseContextMenu" in e21 && n10(1, O10 = e21.onCloseContextMenu), "onRenderContextMenu" in e21 && n10(6, M10 = e21.onRenderContextMenu), "onEditKey" in e21 && n10(7, E10 = e21.onEditKey), "onEditValue" in e21 && n10(8, A10 = e21.onEditValue), "onToggleEnforceString" in e21 && n10(9, P10 = e21.onToggleEnforceString), "onCut" in e21 && n10(10, T8 = e21.onCut), "onCopy" in e21 && n10(11, R8 = e21.onCopy), "onPaste" in e21 && n10(12, N8 = e21.onPaste), "onRemove" in e21 && n10(13, I10 = e21.onRemove), "onDuplicate" in e21 && n10(14, D10 = e21.onDuplicate), "onExtract" in e21 && n10(15, q10 = e21.onExtract), "onInsertBefore" in e21 && n10(16, z10 = e21.onInsertBefore), "onInsert" in e21 && n10(17, B10 = e21.onInsert), "onConvert" in e21 && n10(18, L10 = e21.onConvert), "onInsertAfter" in e21 && n10(19, F10 = e21.onInsertAfter), "onSort" in e21 && n10(20, V10 = e21.onSort), "onTransform" in e21 && n10(21, H10 = e21.onTransform); + }, e20.$$.update = function() { + 16 & e20.$$.dirty[0] && n10(39, r10 = C10.selection), 8 & e20.$$.dirty[0] && n10(41, o10 = void 0 !== S10), 256 & e20.$$.dirty[1] && n10(33, i10 = !!r10), 256 & e20.$$.dirty[1] && n10(23, a10 = !!r10 && _w(JE(r10))), 8 & e20.$$.dirty[0] | 256 & e20.$$.dirty[1] && n10(40, s10 = r10 ? Ws(S10, JE(r10)) : void 0), 512 & e20.$$.dirty[1] && n10(37, c10 = Array.isArray(s10) ? "Edit array" : Gl(s10) ? "Edit object" : "Edit value"), 1280 & e20.$$.dirty[1] && n10(24, l10 = o10 && (mE(r10) || vE(r10) || pE(r10))), 25165824 & e20.$$.dirty[0] | 1024 & e20.$$.dirty[1] && n10(32, u10 = o10 && l10 && !a10), 8388608 & e20.$$.dirty[0] | 1280 & e20.$$.dirty[1] && n10(31, f10 = o10 && null != r10 && (mE(r10) || pE(r10)) && !a10), 8388616 & e20.$$.dirty[0] | 1280 & e20.$$.dirty[1] && n10(38, d10 = o10 && null != r10 && ME(r10) && !a10 && !Array.isArray(Ws(S10, Qk(JE(r10))))), 1280 & e20.$$.dirty[1] && n10(36, h10 = o10 && null != r10 && ME(r10)), 544 & e20.$$.dirty[1] && n10(34, v10 = h10 && !Ql(s10)), 16777216 & e20.$$.dirty[0] && n10(27, p10 = l10), 134217728 & e20.$$.dirty[0] && n10(26, m10 = p10 ? "Convert to:" : "Insert:"), 134217728 & e20.$$.dirty[0] | 4 & e20.$$.dirty[1] && n10(30, g10 = !p10 && i10), 134217728 & e20.$$.dirty[0] | 772 & e20.$$.dirty[1] && n10(29, y10 = p10 ? LE(r10) && !Gl(s10) : i10), 134217728 & e20.$$.dirty[0] | 772 & e20.$$.dirty[1] && n10(28, b10 = p10 ? LE(r10) && !Array.isArray(s10) : i10), 134217728 & e20.$$.dirty[0] | 772 & e20.$$.dirty[1] && n10(25, k10 = p10 ? LE(r10) && Ql(s10) : i10), 48 & e20.$$.dirty[0] | 768 & e20.$$.dirty[1] && n10(35, w10 = !(null == r10 || !s10) && oE(s10, C10.enforceStringMap, Zs(JE(r10)), $10)), 2142896e3 & e20.$$.dirty[0] | 255 & e20.$$.dirty[1] && n10(22, j10 = [{ type: "row", items: [{ type: "button", onClick: function() { + return E10(); + }, icon: dP, text: "Edit key", title: "Edit the key (Double-click on the key)", disabled: !d10 }, { type: "dropdown-button", main: { type: "button", onClick: function() { + return A10(); + }, icon: dP, text: c10, title: "Edit the value (Double-click on the value)", disabled: !h10 }, width: "11em", items: [{ type: "button", icon: dP, text: c10, title: "Edit the value (Double-click on the value)", onClick: function() { + return A10(); + }, disabled: !h10 }, { type: "button", icon: w10 ? iM : aM, text: "Enforce string", title: "Enforce keeping the value as string when it contains a numeric value", onClick: function() { + return P10(); + }, disabled: !v10 }] }] }, { type: "separator" }, { type: "row", items: [{ type: "dropdown-button", main: { type: "button", onClick: function() { + return T8(true); + }, icon: eP, text: "Cut", title: "Cut selected contents, formatted with indentation (Ctrl+X)", disabled: !l10 }, width: "10em", items: [{ type: "button", icon: eP, text: "Cut formatted", title: "Cut selected contents, formatted with indentation (Ctrl+X)", onClick: function() { + return T8(true); + }, disabled: !l10 }, { type: "button", icon: eP, text: "Cut compacted", title: "Cut selected contents, without indentation (Ctrl+Shift+X)", onClick: function() { + return T8(false); + }, disabled: !l10 }] }, { type: "dropdown-button", main: { type: "button", onClick: function() { + return R8(true); + }, icon: CP, text: "Copy", title: "Copy selected contents, formatted with indentation (Ctrl+C)", disabled: !l10 }, width: "12em", items: [{ type: "button", icon: CP, text: "Copy formatted", title: "Copy selected contents, formatted with indentation (Ctrl+C)", onClick: function() { + return R8(true); + }, disabled: !l10 }, { type: "button", icon: CP, text: "Copy compacted", title: "Copy selected contents, without indentation (Ctrl+Shift+C)", onClick: function() { + return R8(false); + }, disabled: !l10 }] }, { type: "button", onClick: function() { + return N8(); + }, icon: XA, text: "Paste", title: "Paste clipboard contents (Ctrl+V)", disabled: !i10 }] }, { type: "separator" }, { type: "row", items: [{ type: "column", items: [{ type: "button", onClick: function() { + return D10(); + }, icon: AP, text: "Duplicate", title: "Duplicate selected contents (Ctrl+D)", disabled: !u10 }, { type: "button", onClick: function() { + return q10(); + }, icon: pP, text: "Extract", title: "Extract selected contents", disabled: !f10 }, { type: "button", onClick: function() { + return V10(); + }, icon: kP, text: "Sort", title: "Sort array or object contents", disabled: !l10 }, { type: "button", onClick: function() { + return H10(); + }, icon: cP, text: "Transform", title: "Transform array or object contents (filter, sort, project)", disabled: !l10 }, { type: "button", onClick: function() { + return I10(); + }, icon: QA, text: "Remove", title: "Remove selected contents (Delete)", disabled: !l10 }] }, { type: "column", items: [{ type: "label", text: m10 }, { type: "button", onClick: function() { + return W10("structure"); + }, icon: p10 ? bP : $P, text: "Structure", title: m10 + " structure", disabled: !g10 }, { type: "button", onClick: function() { + return W10("object"); + }, icon: p10 ? bP : $P, text: "Object", title: m10 + " structure", disabled: !y10 }, { type: "button", onClick: function() { + return W10("array"); + }, icon: p10 ? bP : $P, text: "Array", title: m10 + " array", disabled: !b10 }, { type: "button", onClick: function() { + return W10("value"); + }, icon: p10 ? bP : $P, text: "Value", title: m10 + " value", disabled: !k10 }] }] }, { type: "separator" }, { type: "row", items: [{ type: "button", onClick: function() { + return z10(); + }, icon: aP, text: "Insert before", title: "Select area before current entry to insert or paste contents", disabled: !l10 || a10 }, { type: "button", onClick: function() { + return F10(); + }, icon: tP, text: "Insert after", title: "Select area after current entry to insert or paste contents", disabled: !l10 || a10 }] }]), 4194368 & e20.$$.dirty[0] && n10(2, x10 = M10(j10)); + }, [_10, O10, x10, S10, C10, $10, M10, E10, A10, P10, T8, R8, N8, I10, D10, q10, z10, B10, L10, F10, V10, H10, j10, a10, l10, k10, m10, p10, b10, y10, g10, f10, u10, i10, v10, w10, h10, c10, d10, r10, s10, o10]; + } + var LD = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, BD, zD, Zo, { json: 3, documentState: 4, parser: 5, showTip: 0, onCloseContextMenu: 1, onRenderContextMenu: 6, onEditKey: 7, onEditValue: 8, onToggleEnforceString: 9, onCut: 10, onCopy: 11, onPaste: 12, onRemove: 13, onDuplicate: 14, onExtract: 15, onInsertBefore: 16, onInsert: 17, onConvert: 18, onInsertAfter: 19, onSort: 20, onTransform: 21 }, null, [-1, -1]), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function FD(e20) { + mi(e20, "svelte-lajpxi", 'div.jse-collapsed-items.svelte-lajpxi.svelte-lajpxi{margin-left:calc(var(--level) * var(--jse-indent-size, calc(1em + 4px)));font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);color:var(--jse-collapsed-items-link-color, rgba(0, 0, 0, 0.38));padding:calc(0.5 * var(--jse-padding, 10px));border:8px solid transparent;border-width:8px 0;background-color:var(--jse-contents-background-color, transparent);background-image:linear-gradient(var(--jse-collapsed-items-background-color, #f5f5f5), var(--jse-collapsed-items-background-color, #f5f5f5)), linear-gradient(to bottom right, transparent 50.5%, var(--jse-collapsed-items-background-color, #f5f5f5) 50.5%), linear-gradient(to bottom left, transparent 50.5%, var(--jse-collapsed-items-background-color, #f5f5f5) 50.5%), linear-gradient(to top right, transparent 50.5%, var(--jse-collapsed-items-background-color, #f5f5f5) 50.5%), linear-gradient(to top left, transparent 50.5%, var(--jse-collapsed-items-background-color, #f5f5f5) 50.5%);background-repeat:repeat, repeat-x, repeat-x, repeat-x, repeat-x;background-position:0 0, 8px 0, 8px 0, 8px 100%, 8px 100%;background-size:auto auto, 16px 16px, 16px 16px, 16px 16px, 16px 16px;background-clip:padding-box, border-box, border-box, border-box, border-box;background-origin:padding-box, border-box, border-box, border-box, border-box;display:flex}div.jse-collapsed-items.svelte-lajpxi div.jse-text.svelte-lajpxi,div.jse-collapsed-items.svelte-lajpxi button.jse-expand-items.svelte-lajpxi{margin:0 calc(0.5 * var(--jse-padding, 10px))}div.jse-collapsed-items.svelte-lajpxi div.jse-text.svelte-lajpxi{display:inline}div.jse-collapsed-items.svelte-lajpxi button.jse-expand-items.svelte-lajpxi{font-family:inherit;font-size:inherit;color:var(--jse-collapsed-items-link-color, rgba(0, 0, 0, 0.38));background:none;border:none;padding:0;text-decoration:underline;cursor:pointer}div.jse-collapsed-items.svelte-lajpxi button.jse-expand-items.svelte-lajpxi:hover,div.jse-collapsed-items.svelte-lajpxi button.jse-expand-items.svelte-lajpxi:focus{color:var(--jse-collapsed-items-link-color-highlight, #ee5341)}'); + } + function VD(e20, t10, n10) { + var r10 = e20.slice(); + return r10[13] = t10[n10], r10; + } + function HD(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = e20[13].start + "", u10 = e20[13].end + ""; + function f10() { + return e20[12](e20[13]); + } + return { c: function() { + t10 = ji("button"), n10 = Ci("show "), r10 = Ci(l10), o10 = Ci("-"), i10 = Ci(u10), a10 = $i(), Ai(t10, "type", "button"), Ai(t10, "class", "jse-expand-items svelte-lajpxi"); + }, m: function(e21, l11) { + ki(e21, t10, l11), pi(t10, n10), pi(t10, r10), pi(t10, o10), pi(t10, i10), pi(t10, a10), s10 || (c10 = Oi(t10, "click", f10), s10 = true); + }, p: function(t11, n11) { + e20 = t11, 16 & n11 && l10 !== (l10 = e20[13].start + "") && Ni(r10, l10), 16 & n11 && u10 !== (u10 = e20[13].end + "") && Ni(i10, u10); + }, d: function(e21) { + e21 && wi(t10), s10 = false, c10(); + } }; + } + function WD(e20) { + for (var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10 = Ca(e20[4]), d10 = [], h10 = 0; h10 < f10.length; h10 += 1) + d10[h10] = HD(VD(e20, f10, h10)); + return { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = ji("div"), o10 = Ci("Items "), i10 = Ci(e20[3]), a10 = Ci("-"), s10 = Ci(e20[2]), c10 = $i(); + for (var l11 = 0; l11 < d10.length; l11 += 1) + d10[l11].c(); + Ai(r10, "class", "jse-text svelte-lajpxi"), Ai(t10, "role", "none"), Ai(t10, "class", "jse-collapsed-items svelte-lajpxi"), zi(t10, "jse-selected", e20[5]), Di(t10, "--level", e20[0].length + 2); + }, m: function(e21, f11) { + ki(e21, t10, f11), pi(t10, n10), pi(n10, r10), pi(r10, o10), pi(r10, i10), pi(r10, a10), pi(r10, s10), pi(n10, c10); + for (var h11 = 0; h11 < d10.length; h11 += 1) + d10[h11] && d10[h11].m(n10, null); + l10 || (u10 = Oi(t10, "mousemove", UD), l10 = true); + }, p: function(e21, r11) { + var o11 = jo(r11, 1)[0]; + if (8 & o11 && Ni(i10, e21[3]), 4 & o11 && Ni(s10, e21[2]), 19 & o11) { + var a11; + for (f10 = Ca(e21[4]), a11 = 0; a11 < f10.length; a11 += 1) { + var c11 = VD(e21, f10, a11); + d10[a11] ? d10[a11].p(c11, o11) : (d10[a11] = HD(c11), d10[a11].c(), d10[a11].m(n10, null)); + } + for (; a11 < d10.length; a11 += 1) + d10[a11].d(1); + d10.length = f10.length; + } + 32 & o11 && zi(t10, "jse-selected", e21[5]), 1 & o11 && Di(t10, "--level", e21[0].length + 2); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10), xi(d10, e21), l10 = false, u10(); + } }; + } + function UD(e20) { + e20.stopPropagation(); + } + function JD(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10 = t10.visibleSections, l10 = t10.sectionIndex, u10 = t10.total, f10 = t10.path, d10 = t10.selection, h10 = t10.onExpandSection, v10 = t10.context; + return e20.$$set = function(e21) { + "visibleSections" in e21 && n10(6, c10 = e21.visibleSections), "sectionIndex" in e21 && n10(7, l10 = e21.sectionIndex), "total" in e21 && n10(8, u10 = e21.total), "path" in e21 && n10(0, f10 = e21.path), "selection" in e21 && n10(9, d10 = e21.selection), "onExpandSection" in e21 && n10(1, h10 = e21.onExpandSection), "context" in e21 && n10(10, v10 = e21.context); + }, e20.$$.update = function() { + 192 & e20.$$.dirty && n10(11, r10 = c10[l10]), 2048 & e20.$$.dirty && n10(3, o10 = r10.end), 448 & e20.$$.dirty && n10(2, i10 = c10[l10 + 1] ? c10[l10 + 1].start : u10), 1545 & e20.$$.dirty && n10(5, a10 = WE(v10.getJson(), d10, f10.concat(String(o10)))), 12 & e20.$$.dirty && n10(4, s10 = function(e21, t11) { + var n11 = { start: e21, end: Math.min(qM(e21), t11) }, r11 = Math.max(zM((e21 + t11) / 2), e21), o11 = { start: r11, end: Math.min(qM(r11), t11) }, i11 = zM(t11), a11 = i11 === t11 ? i11 - ls : i11, s11 = { start: Math.max(a11, e21), end: t11 }, c11 = [n11], l11 = o11.start >= n11.end && o11.end <= s11.start; + return l11 && c11.push(o11), s11.start >= (l11 ? o11.end : n11.end) && c11.push(s11), c11; + }(o10, i10)); + }, [f10, h10, i10, o10, s10, a10, c10, l10, u10, d10, v10, r10, function(e21) { + return h10(f10, e21); + }]; + } + var KD = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, JD, WD, Zo, { visibleSections: 6, sectionIndex: 7, total: 8, path: 0, selection: 9, onExpandSection: 1, context: 10 }, FD), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function GD(e20) { + mi(e20, "svelte-6k6355", ".jse-context-menu-pointer.svelte-6k6355{position:absolute;top:calc(-0.5 * var(--jse-context-menu-pointer-size, calc(1em + 4px)));right:calc(-0.5 * var(--jse-context-menu-pointer-size, calc(1em + 4px)));width:var(--jse-context-menu-pointer-size, calc(1em + 4px));height:var(--jse-context-menu-pointer-size, calc(1em + 4px));padding:0;margin:0;cursor:pointer;background:transparent;border-radius:2px;background:var(--jse-context-menu-pointer-background, var(--jse-context-menu-background, #656565));color:var(--jse-context-menu-pointer-color, var(--jse-context-menu-color, var(--jse-text-color-inverse, #fff)));border:none;box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24))}.jse-context-menu-pointer.svelte-6k6355:hover{background:var(--jse-context-menu-pointer-background-highlight, var(--jse-context-menu-background-highlight, #7a7a7a))}"); + } + function QD(e20) { + var t10, n10, r10, o10, i10; + return n10 = new jM({ props: { data: gP } }), { c: function() { + t10 = ji("button"), Pa(n10.$$.fragment), Ai(t10, "type", "button"), Ai(t10, "class", "jse-context-menu-pointer svelte-6k6355"), Ai(t10, "title", xs), zi(t10, "jse-selected", e20[0]); + }, m: function(a10, s10) { + ki(a10, t10, s10), Ta(n10, t10, null), r10 = true, o10 || (i10 = Oi(t10, "click", e20[1]), o10 = true); + }, p: function(e21, n11) { + var o11 = jo(n11, 1)[0]; + (!r10 || 1 & o11) && zi(t10, "jse-selected", e21[0]); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), o10 = false, i10(); + } }; + } + function YD(e20, t10, n10) { + var r10 = t10.selected, o10 = t10.onContextMenu; + return e20.$$set = function(e21) { + "selected" in e21 && n10(0, r10 = e21.selected), "onContextMenu" in e21 && n10(2, o10 = e21.onContextMenu); + }, [r10, function(e21) { + for (var t11 = e21.target; t11 && "BUTTON" !== t11.nodeName; ) + t11 = t11.parentNode; + t11 && o10({ anchor: t11, left: 0, top: 0, width: Ms, height: Os, offsetTop: 2, offsetLeft: 0, showTip: true }); + }, o10]; + } + var XD = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, YD, QD, Zo, { selected: 0, onContextMenu: 2 }, GD), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function ZD(e20) { + mi(e20, "svelte-10xe8tv", '.jse-key.svelte-10xe8tv{display:inline-block;min-width:2em;padding:0 5px;box-sizing:border-box;outline:none;border-radius:1px;vertical-align:top;color:var(--jse-key-color, #1a1a1a);cursor:var(--jse-contents-cursor, pointer);word-break:normal;overflow-wrap:normal;white-space:pre-wrap}.jse-key.svelte-10xe8tv:hover{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06))}.jse-key.svelte-10xe8tv:hover{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06))}.jse-key.jse-empty.svelte-10xe8tv{min-width:3em;outline:1px dotted var(--jse-tag-background, rgba(0, 0, 0, 0.2));-moz-outline-radius:2px}.jse-key.jse-empty.svelte-10xe8tv::after{pointer-events:none;color:var(--jse-tag-background, rgba(0, 0, 0, 0.2));content:"key"}'); + } + function eq(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10 = [rq, nq], l10 = []; + function u10(e21, t11) { + return e21[1] ? 0 : 1; + } + return n10 = u10(e20), r10 = l10[n10] = c10[n10](e20), { c: function() { + t10 = ji("div"), r10.c(), Ai(t10, "role", "none"), Ai(t10, "data-type", "selectable-key"), Ai(t10, "class", o10 = si(e20[6](e20[0])) + " svelte-10xe8tv"); + }, m: function(r11, o11) { + ki(r11, t10, o11), l10[n10].m(t10, null), i10 = true, a10 || (s10 = Oi(t10, "dblclick", e20[5]), a10 = true); + }, p: function(e21, a11) { + var s11 = n10; + (n10 = u10(e21)) === s11 ? l10[n10].p(e21, a11) : (ba(), xa(l10[s11], 1, 1, function() { + l10[s11] = null; + }), ka(), (r10 = l10[n10]) ? r10.p(e21, a11) : (r10 = l10[n10] = c10[n10](e21)).c(), wa(r10, 1), r10.m(t10, null)), (!i10 || 1 & a11 && o10 !== (o10 = si(e21[6](e21[0])) + " svelte-10xe8tv")) && Ai(t10, "class", o10); + }, i: function(e21) { + i10 || (wa(r10), i10 = true); + }, o: function(e21) { + xa(r10), i10 = false; + }, d: function(e21) { + e21 && wi(t10), l10[n10].d(), a10 = false, s10(); + } }; + } + function tq(e20) { + var t10, n10; + return t10 = new eA({ props: { value: e20[2].normalization.escapeValue(e20[0]), shortText: true, onChange: e20[7], onCancel: e20[8], onFind: e20[2].onFind } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 5 & n11 && (r10.value = e21[2].normalization.escapeValue(e21[0])), 4 & n11 && (r10.onFind = e21[2].onFind), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function nq(e20) { + var t10, n10 = gO(e20[2].normalization.escapeValue(e20[0])) + ""; + return { c: function() { + t10 = Ci(n10); + }, m: function(e21, n11) { + ki(e21, t10, n11); + }, p: function(e21, r10) { + 5 & r10 && n10 !== (n10 = gO(e21[2].normalization.escapeValue(e21[0])) + "") && Ni(t10, n10); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function rq(e20) { + var t10, n10; + return t10 = new TA({ props: { text: e20[2].normalization.escapeValue(e20[0]), searchResultItems: e20[1] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 5 & n11 && (r10.text = e21[2].normalization.escapeValue(e21[0])), 2 & n11 && (r10.searchResultItems = e21[1]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function oq(e20) { + var t10, n10; + return t10 = new XD({ props: { selected: true, onContextMenu: e20[2].onContextMenu } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 4 & n11 && (r10.onContextMenu = e21[2].onContextMenu), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function iq(e20) { + var t10, n10, r10, o10, i10, a10 = [tq, eq], s10 = []; + function c10(e21, t11) { + return !e21[2].readOnly && e21[4] ? 0 : 1; + } + t10 = c10(e20), n10 = s10[t10] = a10[t10](e20); + var l10 = !e20[2].readOnly && e20[3] && !e20[4] && oq(e20); + return { c: function() { + n10.c(), r10 = $i(), l10 && l10.c(), o10 = _i(); + }, m: function(e21, n11) { + s10[t10].m(e21, n11), ki(e21, r10, n11), l10 && l10.m(e21, n11), ki(e21, o10, n11), i10 = true; + }, p: function(e21, i11) { + var u10 = jo(i11, 1)[0], f10 = t10; + (t10 = c10(e21)) === f10 ? s10[t10].p(e21, u10) : (ba(), xa(s10[f10], 1, 1, function() { + s10[f10] = null; + }), ka(), (n10 = s10[t10]) ? n10.p(e21, u10) : (n10 = s10[t10] = a10[t10](e21)).c(), wa(n10, 1), n10.m(r10.parentNode, r10)), e21[2].readOnly || !e21[3] || e21[4] ? l10 && (ba(), xa(l10, 1, 1, function() { + l10 = null; + }), ka()) : l10 ? (l10.p(e21, u10), 28 & u10 && wa(l10, 1)) : ((l10 = oq(e21)).c(), wa(l10, 1), l10.m(o10.parentNode, o10)); + }, i: function(e21) { + i10 || (wa(n10), wa(l10), i10 = true); + }, o: function(e21) { + xa(n10), xa(l10), i10 = false; + }, d: function(e21) { + e21 && (wi(r10), wi(o10)), s10[t10].d(e21), l10 && l10.d(e21); + } }; + } + function aq(e20, t10, n10) { + var r10, o10, i10 = t10.path, a10 = t10.key, s10 = t10.selection, c10 = t10.searchResultItems, l10 = t10.onUpdateKey, u10 = t10.context; + return e20.$$set = function(e21) { + "path" in e21 && n10(9, i10 = e21.path), "key" in e21 && n10(0, a10 = e21.key), "selection" in e21 && n10(10, s10 = e21.selection), "searchResultItems" in e21 && n10(1, c10 = e21.searchResultItems), "onUpdateKey" in e21 && n10(11, l10 = e21.onUpdateKey), "context" in e21 && n10(2, u10 = e21.context); + }, e20.$$.update = function() { + 1536 & e20.$$.dirty && n10(3, r10 = !!s10 && (vE(s10) && Ow(s10.path, i10))), 1032 & e20.$$.dirty && n10(4, o10 = r10 && zE(s10)); + }, [a10, c10, u10, r10, o10, function(e21) { + o10 || u10.readOnly || (e21.preventDefault(), u10.onSelect(TE(i10, true))); + }, function(e21) { + return GE("jse-key", { "jse-empty": "" === e21 }); + }, function(e21, t11) { + var n11 = l10(a10, u10.normalization.unescapeValue(e21)), r11 = Qk(i10).concat(n11); + u10.onSelect(t11 === ns.nextInside ? RE(r11, false) : TE(r11, false)), t11 !== ns.self && u10.focus(); + }, function() { + u10.onSelect(TE(i10, false)), u10.focus(); + }, i10, s10, l10]; + } + var sq = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, aq, iq, Zo, { path: 9, key: 0, selection: 10, searchResultItems: 1, onUpdateKey: 11, context: 2 }, ZD), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function cq(e20, t10, n10) { + var r10 = e20.slice(); + return r10[8] = t10[n10], r10; + } + function lq(e20) { + var t10, n10, r10, o10 = [e20[8].props], i10 = e20[8].component; + function a10(e21, t11) { + var n11 = {}; + if (void 0 !== t11 && 1 & t11) + n11 = Ma(o10, [Ea(e21[8].props)]); + else + for (var r11 = 0; r11 < o10.length; r11 += 1) + n11 = Jo(n11, o10[r11]); + return { props: n11 }; + } + return i10 && (t10 = Li(i10, a10(e20))), { c: function() { + t10 && Pa(t10.$$.fragment), n10 = _i(); + }, m: function(e21, o11) { + t10 && Ta(t10, e21, o11), ki(e21, n10, o11), r10 = true; + }, p: function(e21, r11) { + if (1 & r11 && i10 !== (i10 = e21[8].component)) { + if (t10) { + ba(); + var s10 = t10; + xa(s10.$$.fragment, 1, 0, function() { + Ra(s10, 1); + }), ka(); + } + i10 ? (Pa((t10 = Li(i10, a10(e21, r11))).$$.fragment), wa(t10.$$.fragment, 1), Ta(t10, n10.parentNode, n10)) : t10 = null; + } else if (i10) { + var c10 = 1 & r11 ? Ma(o10, [Ea(e21[8].props)]) : {}; + t10.$set(c10); + } + }, i: function(e21) { + r10 || (t10 && wa(t10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + t10 && xa(t10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(n10), t10 && Ra(t10, e21); + } }; + } + function uq(e20) { + var t10, n10, r10 = e20[8].component, o10 = lq(e20); + return { c: function() { + o10.c(), t10 = _i(); + }, m: function(e21, r11) { + o10.m(e21, r11), ki(e21, t10, r11), n10 = true; + }, p: function(e21, n11) { + 1 & n11 && Zo(r10, r10 = e21[8].component) ? (ba(), xa(o10, 1, 1, Wo), ka(), (o10 = lq(e21)).c(), wa(o10, 1), o10.m(t10.parentNode, t10)) : o10.p(e21, n11); + }, i: function(e21) { + n10 || (wa(o10), n10 = true); + }, o: function(e21) { + xa(o10), n10 = false; + }, d: function(e21) { + e21 && wi(t10), o10.d(e21); + } }; + } + function fq(e20) { + for (var t10, n10, r10 = Ca(e20[0]), o10 = [], i10 = 0; i10 < r10.length; i10 += 1) + o10[i10] = uq(cq(e20, r10, i10)); + var a10 = function(e21) { + return xa(o10[e21], 1, 1, function() { + o10[e21] = null; + }); + }; + return { c: function() { + for (var e21 = 0; e21 < o10.length; e21 += 1) + o10[e21].c(); + t10 = _i(); + }, m: function(e21, r11) { + for (var i11 = 0; i11 < o10.length; i11 += 1) + o10[i11] && o10[i11].m(e21, r11); + ki(e21, t10, r11), n10 = true; + }, p: function(e21, n11) { + var i11 = jo(n11, 1)[0]; + if (1 & i11) { + var s10; + for (r10 = Ca(e21[0]), s10 = 0; s10 < r10.length; s10 += 1) { + var c10 = cq(e21, r10, s10); + o10[s10] ? (o10[s10].p(c10, i11), wa(o10[s10], 1)) : (o10[s10] = uq(c10), o10[s10].c(), wa(o10[s10], 1), o10[s10].m(t10.parentNode, t10)); + } + for (ba(), s10 = r10.length; s10 < o10.length; s10 += 1) + a10(s10); + ka(); + } + }, i: function(e21) { + if (!n10) { + for (var t11 = 0; t11 < r10.length; t11 += 1) + wa(o10[t11]); + n10 = true; + } + }, o: function(e21) { + o10 = o10.filter(Boolean); + for (var t11 = 0; t11 < o10.length; t11 += 1) + xa(o10[t11]); + n10 = false; + }, d: function(e21) { + e21 && wi(t10), xi(o10, e21); + } }; + } + function dq(e20, t10, n10) { + var r10, o10, i10 = t10.path, a10 = t10.value, s10 = t10.context, c10 = t10.enforceString, l10 = t10.selection, u10 = t10.searchResultItems; + return e20.$$set = function(e21) { + "path" in e21 && n10(1, i10 = e21.path), "value" in e21 && n10(2, a10 = e21.value), "context" in e21 && n10(3, s10 = e21.context), "enforceString" in e21 && n10(4, c10 = e21.enforceString), "selection" in e21 && n10(5, l10 = e21.selection), "searchResultItems" in e21 && n10(6, u10 = e21.searchResultItems); + }, e20.$$.update = function() { + 32 & e20.$$.dirty && n10(7, r10 = pE(l10) && zE(l10)), 254 & e20.$$.dirty && n10(0, o10 = s10.onRenderValue({ path: i10, value: a10, readOnly: s10.readOnly, enforceString: c10, isEditing: r10, parser: s10.parser, normalization: s10.normalization, selection: l10, searchResultItems: u10, onPatch: s10.onPatch, onPasteJson: s10.onPasteJson, onSelect: s10.onSelect, onFind: s10.onFind, findNextInside: s10.findNextInside, focus: s10.focus })); + }, [o10, i10, a10, s10, c10, l10, u10, r10]; + } + var hq = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, dq, fq, Zo, { path: 1, value: 2, context: 3, enforceString: 4, selection: 5, searchResultItems: 6 }), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var vq = hq; + var pq = { selecting: false, selectionAnchor: null, selectionAnchorType: null, selectionFocus: null, dragging: false }; + function mq(e20) { + var t10 = e20.json, n10 = e20.documentState, r10 = e20.deltaY, o10 = e20.items; + if (!n10.selection) + return { operations: void 0, updatedSelection: null, offset: 0 }; + var i10 = n10.selection, a10 = r10 < 0 ? function(e21) { + var t11 = e21.json, n11 = e21.items, r11 = e21.selection, o11 = e21.deltaY, i11 = xE(t11, r11), a11 = n11.findIndex(function(e23) { + return Ow(e23.path, i11); + }), s11 = function() { + var e23; + return null === (e23 = n11[c11 - 1]) || void 0 === e23 ? void 0 : e23.height; + }, c11 = a11, l11 = 0; + for (; void 0 !== s11() && Math.abs(o11) > l11 + s11() / 2; ) + l11 += s11(), c11 -= 1; + var u10 = n11[c11].path, f10 = c11 - a11; + return c11 !== a11 && void 0 !== n11[c11] ? { beforePath: u10, offset: f10 } : void 0; + }({ json: t10, selection: i10, deltaY: r10, items: o10 }) : function(e21) { + var t11, n11 = e21.json, r11 = e21.items, o11 = e21.selection, i11 = e21.deltaY, a11 = jE(n11, o11), s11 = r11.findIndex(function(e23) { + return Ow(e23.path, a11); + }), c11 = 0, l11 = s11, u10 = function() { + var e23; + return null === (e23 = r11[l11 + 1]) || void 0 === e23 ? void 0 : e23.height; + }; + for (; void 0 !== u10() && Math.abs(i11) > c11 + u10() / 2; ) + c11 += u10(), l11 += 1; + var f10 = Qk(a11), d10 = Ws(n11, f10), h10 = Array.isArray(d10), v10 = h10 ? l11 : l11 + 1, p10 = null === (t11 = r11[v10]) || void 0 === t11 ? void 0 : t11.path, m10 = l11 - s11; + return p10 ? { beforePath: p10, offset: m10 } : { append: true, offset: m10 }; + }({ json: t10, selection: i10, deltaY: r10, items: o10 }); + if (!a10 || 0 === a10.offset) + return { operations: void 0, updatedSelection: null, offset: 0 }; + var s10 = function(e21, t11, n11) { + if (!t11) + return []; + var r11 = "beforePath" in n11 ? n11.beforePath : void 0, o11 = "append" in n11 ? n11.append : void 0, i11 = Qk(JE(t11)), a11 = Ws(e21, i11); + if (!(o11 || r11 && AE(r11, i11) && r11.length > i11.length)) + return []; + var s11 = xE(e21, t11), c11 = jE(e21, t11), l11 = vb(s11), u10 = vb(c11), f10 = r11 ? r11[i11.length] : void 0; + if (!Rs(a11)) { + if (Ts(a11)) { + var d10 = Ul(l11), h10 = Ul(u10), v10 = void 0 !== f10 ? Ul(f10) : a11.length; + return YC(h10 - d10 + 1, v10 < d10 ? function(e23) { + return { op: "move", from: Zs(i11.concat(String(d10 + e23))), path: Zs(i11.concat(String(v10 + e23))) }; + } : function() { + return { op: "move", from: Zs(i11.concat(String(d10))), path: Zs(i11.concat(String(v10))) }; + }); + } + throw new Error("Cannot create move operations: parent must be an Object or Array"); + } + var p10 = Object.keys(a11), m10 = p10.indexOf(l11), g10 = p10.indexOf(u10), y10 = o11 ? p10.length : void 0 !== f10 ? p10.indexOf(f10) : -1; + return -1 !== m10 && -1 !== g10 && -1 !== y10 ? y10 > m10 ? [].concat(Bo(p10.slice(m10, g10 + 1)), Bo(p10.slice(y10, p10.length))).map(function(e23) { + return uA(i11, e23); + }) : [].concat(Bo(p10.slice(y10, m10)), Bo(p10.slice(g10 + 1, p10.length))).map(function(e23) { + return uA(i11, e23); + }) : []; + }(t10, i10, a10), c10 = Ws(t10, Qk(xE(t10, i10))); + if (Array.isArray(c10)) { + var l10 = function(e21) { + var t11, n11, r11 = e21.items, o11 = e21.json, i11 = e21.selection, a11 = e21.offset, s11 = xE(o11, i11), c11 = jE(o11, i11), l11 = r11.findIndex(function(e23) { + return Ow(e23.path, s11); + }), u10 = r11.findIndex(function(e23) { + return Ow(e23.path, c11); + }), f10 = null === (t11 = r11[l11 + a11]) || void 0 === t11 ? void 0 : t11.path, d10 = null === (n11 = r11[u10 + a11]) || void 0 === n11 ? void 0 : n11.path; + return DE(f10, d10); + }({ items: o10, json: t10, selection: i10, offset: a10.offset }); + return { operations: s10, updatedSelection: l10, offset: a10.offset }; + } + return { operations: s10, updatedSelection: null, offset: a10.offset }; + } + function gq(e20, t10) { + return function(e21, t11) { + if (e21) { + for (var n10 = {}, r10 = 0, o10 = Object.keys(e21); r10 < o10.length; r10++) { + var i10 = o10[r10]; + t11(i10, e21[i10]) && (n10[i10] = e21[i10]); + } + return Object.keys(n10).length > 0 ? n10 : void 0; + } + }(e20, function(e21) { + return nc(e21, t10); + }); + } + function yq(e20) { + mi(e20, "svelte-g0bfge", 'button.jse-validation-error.svelte-g0bfge{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;padding:0;margin:0;vertical-align:top;display:inline-flex;color:var(--jse-warning-color, #fdc539)}'); + } + function bq(e20) { + var t10, n10, r10, o10, i10, a10; + return n10 = new jM({ props: { data: TP } }), { c: function() { + t10 = ji("button"), Pa(n10.$$.fragment), Ai(t10, "type", "button"), Ai(t10, "class", "jse-validation-error svelte-g0bfge"); + }, m: function(s10, c10) { + ki(s10, t10, c10), Ta(n10, t10, null), o10 = true, i10 || (a10 = [Oi(t10, "click", function() { + Yo(e20[0]) && e20[0].apply(this, arguments); + }), ci(r10 = HA.call(null, t10, Ro({ text: e20[1] }, e20[2])))], i10 = true); + }, p: function(t11, n11) { + var o11 = jo(n11, 1)[0]; + e20 = t11, r10 && Yo(r10.update) && 2 & o11 && r10.update.call(null, Ro({ text: e20[1] }, e20[2])); + }, i: function(e21) { + o10 || (wa(n10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), i10 = false, Qo(a10); + } }; + } + function kq(e20, t10, n10) { + var r10, o10 = Zi("absolute-popup"), i10 = t10.validationError, a10 = t10.onExpand; + return e20.$$set = function(e21) { + "validationError" in e21 && n10(3, i10 = e21.validationError), "onExpand" in e21 && n10(0, a10 = e21.onExpand); + }, e20.$$.update = function() { + 8 & e20.$$.dirty && n10(1, r10 = hI(i10) && i10.isChildError ? "Contains invalid data" : i10.message); + }, [a10, r10, o10, i10]; + } + var wq = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, kq, bq, Xo, { validationError: 3, onExpand: 0 }, yq), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function xq(e20) { + mi(e20, "svelte-1koa14y", '.jse-json-node.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{position:relative;color:var(--jse-text-color, #4d4d4d)}.jse-json-node.jse-root.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{min-height:100%;padding-bottom:2px;box-sizing:border-box}.jse-json-node.jse-root.svelte-1koa14y>.jse-header-outer.svelte-1koa14y .jse-context-menu-pointer,.jse-json-node.jse-root.svelte-1koa14y>.jse-contents-outer.svelte-1koa14y>.jse-contents.svelte-1koa14y .jse-context-menu-pointer{top:0;right:calc(-2px - var(--jse-context-menu-pointer-size, calc(1em + 4px)))}.jse-json-node.jse-root.svelte-1koa14y>.jse-contents-outer.svelte-1koa14y>.jse-contents.svelte-1koa14y.svelte-1koa14y{padding-left:0}.jse-json-node.svelte-1koa14y .jse-props.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-items.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{position:relative}.jse-json-node.svelte-1koa14y .jse-header-outer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-footer-outer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;margin-left:calc(var(--level) * var(--jse-indent-size, calc(1em + 4px)))}.jse-json-node.svelte-1koa14y .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{position:relative}.jse-json-node.svelte-1koa14y .jse-header .jse-meta.svelte-1koa14y>.jse-meta-inner.svelte-1koa14y.svelte-1koa14y{display:flex;justify-content:center}.jse-json-node.svelte-1koa14y .jse-contents-outer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;margin-left:calc(var(--level) * var(--jse-indent-size, calc(1em + 4px)))}.jse-json-node.svelte-1koa14y .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;flex-direction:row;align-items:start}.jse-json-node.svelte-1koa14y .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{padding-left:var(--jse-indent-size, calc(1em + 4px))}.jse-json-node.svelte-1koa14y .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:inline-flex;padding-left:calc(var(--jse-indent-size, calc(1em + 4px)) + 5px)}.jse-json-node.svelte-1koa14y .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.svelte-1koa14y .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{background:var(--jse-contents-background-color, transparent)}.jse-json-node.svelte-1koa14y .jse-insert-selection-area.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{visibility:hidden;padding:0 calc(0.5 * var(--jse-padding, 10px));flex:1}.jse-json-node.svelte-1koa14y .jse-insert-selection-area.jse-inside.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:inline-flex;align-items:center}.jse-json-node.svelte-1koa14y .jse-insert-selection-area.jse-after.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;align-items:flex-end}.jse-json-node.svelte-1koa14y .jse-context-menu-pointer-anchor.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{position:relative}.jse-json-node.svelte-1koa14y .jse-insert-area.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{display:flex;position:relative;z-index:1;margin-left:calc(var(--level) * var(--jse-indent-size, calc(1em + 4px)));max-width:250px;min-width:100px;height:0;margin-right:calc(0.5 * var(--jse-padding, 10px));outline:1px solid}.jse-json-node.svelte-1koa14y .jse-insert-area.svelte-1koa14y .jse-context-menu-pointer{right:-1px;background:var(--jse-context-menu-pointer-hover-background, #b2b2b2)}.jse-json-node.svelte-1koa14y .jse-insert-area.jse-hovered.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{outline-color:var(--jse-context-menu-pointer-hover-background, #b2b2b2)}.jse-json-node.svelte-1koa14y:hover>.jse-contents-outer .jse-insert-selection-area.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y:not(.jse-selected),.jse-json-node.svelte-1koa14y .jse-header-outer.svelte-1koa14y:hover>.jse-insert-selection-area.svelte-1koa14y.svelte-1koa14y:not(.jse-selected),.jse-json-node.svelte-1koa14y .jse-footer-outer:hover .jse-insert-selection-area.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y:not(.jse-selected){visibility:visible}.jse-json-node.jse-hovered.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-hovered.svelte-1koa14y .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06))}.jse-json-node.jse-selected.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected.svelte-1koa14y .jse-key,.jse-json-node.jse-selected.svelte-1koa14y .jse-value{background:var(--jse-selection-background-color, #d3d3d3);cursor:var(--jse-contents-selected-cursor, grab)}.jse-json-node.jse-selected.svelte-1koa14y .jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{background:var(--jse-selection-background-color, #d3d3d3)}.jse-json-node.jse-selected-key.svelte-1koa14y>.jse-contents-outer.svelte-1koa14y>.jse-contents.svelte-1koa14y>.jse-identifier>.jse-key,.jse-json-node.jse-selected-key.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-identifier>.jse-key{background:var(--jse-selection-background-color, #d3d3d3);cursor:var(--jse-contents-selected-cursor, grab)}.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-contents-outer.svelte-1koa14y>.jse-contents.svelte-1koa14y>.jse-value{background:var(--jse-selection-background-color, #d3d3d3);cursor:var(--jse-contents-selected-cursor, grab)}.jse-json-node.svelte-1koa14y .jse-collapsed-items.jse-selected,.jse-json-node.jse-selected.svelte-1koa14y .jse-collapsed-items,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-collapsed-items{background-color:var(--jse-selection-background-color, #d3d3d3);--jse-collapsed-items-background-color:var(--jse-collapsed-items-selected-background-color, #c2c2c2)}.jse-json-node.jse-selected-value.svelte-1koa14y .jse-meta.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-footer-outer.svelte-1koa14y>.jse-footer.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-footer.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{background:var(--jse-selection-background-color, #d3d3d3)}.jse-json-node.jse-selected-value.svelte-1koa14y .jse-meta.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-meta.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-header-outer.svelte-1koa14y>.jse-header.svelte-1koa14y>.jse-meta.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-footer-outer.svelte-1koa14y>.jse-footer.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y>.jse-footer-outer.svelte-1koa14y>.jse-footer.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-contents.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-header.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-footer.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-footer.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-expand.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-props .jse-expand.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-contents.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-header.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-footer.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-footer.svelte-1koa14y .jse-value,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-expand.svelte-1koa14y .jse-key,.jse-json-node.jse-selected-value.svelte-1koa14y .jse-items .jse-expand.svelte-1koa14y .jse-value{background:var(--jse-selection-background-color, #d3d3d3);cursor:var(--jse-contents-selected-cursor, grab)}.jse-json-node.jse-readonly.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{--jse-contents-selected-cursor:pointer}.jse-json-node.svelte-1koa14y .jse-insert-area.jse-selected.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{outline-color:var(--jse-context-menu-pointer-background, var(--jse-context-menu-background, #656565))}.jse-json-node.svelte-1koa14y .jse-insert-area.jse-selected.svelte-1koa14y .jse-context-menu-pointer{background:var(--jse-context-menu-pointer-background, var(--jse-context-menu-background, #656565))}.jse-json-node.svelte-1koa14y .jse-insert-area.jse-selected.svelte-1koa14y .jse-context-menu-pointer:hover{background:var(--jse-context-menu-pointer-background-highlight, var(--jse-context-menu-background-highlight, #7a7a7a))}.jse-main:not(.jse-focus) .jse-json-node.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{--jse-selection-background-color:var(--jse-selection-background-inactive-color, #e8e8e8);--jse-context-menu-pointer-background:var(--jse-context-menu-pointer-hover-background, #b2b2b2)}.jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{width:var(--jse-indent-size, calc(1em + 4px));padding:0;margin:0;border:none;cursor:pointer;background:transparent;color:var(--jse-delimiter-color, rgba(0, 0, 0, 0.38));font-size:var(--jse-font-size-mono, 14px);height:var(--jse-line-height, calc(1em + 4px))}.jse-expand.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y:hover{opacity:0.8}.jse-meta.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-separator.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-index.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y,.jse-bracket.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{vertical-align:top;color:var(--jse-delimiter-color, rgba(0, 0, 0, 0.38))}.jse-index.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{padding:0 calc(0.5 * var(--jse-padding, 10px))}.jse-bracket.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{padding:0 2px}.jse-bracket.jse-expanded.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{padding-right:var(--jse-padding, 10px)}.jse-tag.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{border:none;font-size:80%;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);color:var(--jse-tag-color, var(--jse-text-color-inverse, #fff));background:var(--jse-tag-background, rgba(0, 0, 0, 0.2));border-radius:2px;cursor:pointer;display:inline-block;padding:0 4px;line-height:normal;margin:1px 0}.jse-tag.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y:hover{opacity:0.8}.jse-tag.jse-expanded.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{opacity:0.7;cursor:inherit}.jse-identifier.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y.svelte-1koa14y{vertical-align:top;position:relative}'); + } + var jq = function(e20) { + return {}; + }; + var Sq = function(e20) { + return {}; + }; + function Cq(e20, t10, n10) { + var r10 = e20.slice(); + return r10[52] = t10[n10], r10; + } + var $q = function(e20) { + return {}; + }; + var _q = function(e20) { + return {}; + }; + function Oq(e20, t10, n10) { + var r10 = e20.slice(); + return r10[46] = t10[n10], r10[48] = n10, r10; + } + function Mq(e20, t10, n10) { + var r10 = e20.slice(); + return r10[49] = t10[n10], r10; + } + var Eq = function(e20) { + return {}; + }; + var Aq = function(e20) { + return {}; + }; + function Pq(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10 = !e20[8].readOnly && e20[16] && e20[7] && (pE(e20[7]) || mE(e20[7])) && !zE(e20[7]) && Ow(JE(e20[7]), e20[1]), f10 = e20[33].identifier, d10 = ei(f10, e20, e20[34], Sq), h10 = !e20[17] && Nq(); + i10 = new vq({ props: { path: e20[1], value: e20[0], enforceString: e20[13] || false, selection: e20[16] ? e20[7] : null, searchResultItems: CA(e20[6], e20[9]), context: e20[8] } }); + var v10 = u10 && Iq(e20), p10 = e20[15] && Dq(e20), m10 = !e20[17] && qq(e20); + return { c: function() { + t10 = ji("div"), n10 = ji("div"), d10 && d10.c(), r10 = $i(), h10 && h10.c(), o10 = $i(), Pa(i10.$$.fragment), a10 = $i(), v10 && v10.c(), s10 = $i(), p10 && p10.c(), c10 = $i(), m10 && m10.c(), Ai(n10, "class", "jse-contents svelte-1koa14y"), Ai(t10, "class", "jse-contents-outer svelte-1koa14y"); + }, m: function(e21, u11) { + ki(e21, t10, u11), pi(t10, n10), d10 && d10.m(n10, null), pi(n10, r10), h10 && h10.m(n10, null), pi(n10, o10), Ta(i10, n10, null), pi(n10, a10), v10 && v10.m(n10, null), pi(t10, s10), p10 && p10.m(t10, null), pi(t10, c10), m10 && m10.m(t10, null), l10 = true; + }, p: function(e21, r11) { + d10 && d10.p && (!l10 || 8 & r11[1]) && ri(d10, f10, e21, e21[34], l10 ? ni(f10, e21[34], r11, jq) : oi(e21[34]), Sq), e21[17] ? h10 && (h10.d(1), h10 = null) : h10 || ((h10 = Nq()).c(), h10.m(n10, o10)); + var a11 = {}; + 2 & r11[0] && (a11.path = e21[1]), 1 & r11[0] && (a11.value = e21[0]), 8192 & r11[0] && (a11.enforceString = e21[13] || false), 65664 & r11[0] && (a11.selection = e21[16] ? e21[7] : null), 576 & r11[0] && (a11.searchResultItems = CA(e21[6], e21[9])), 256 & r11[0] && (a11.context = e21[8]), i10.$set(a11), 65922 & r11[0] && (u10 = !e21[8].readOnly && e21[16] && e21[7] && (pE(e21[7]) || mE(e21[7])) && !zE(e21[7]) && Ow(JE(e21[7]), e21[1])), u10 ? v10 ? (v10.p(e21, r11), 65922 & r11[0] && wa(v10, 1)) : ((v10 = Iq(e21)).c(), wa(v10, 1), v10.m(n10, null)) : v10 && (ba(), xa(v10, 1, 1, function() { + v10 = null; + }), ka()), e21[15] ? p10 ? (p10.p(e21, r11), 32768 & r11[0] && wa(p10, 1)) : ((p10 = Dq(e21)).c(), wa(p10, 1), p10.m(t10, c10)) : p10 && (ba(), xa(p10, 1, 1, function() { + p10 = null; + }), ka()), e21[17] ? m10 && (m10.d(1), m10 = null) : m10 ? m10.p(e21, r11) : ((m10 = qq(e21)).c(), m10.m(t10, null)); + }, i: function(e21) { + l10 || (wa(d10, e21), wa(i10.$$.fragment, e21), wa(v10), wa(p10), l10 = true); + }, o: function(e21) { + xa(d10, e21), xa(i10.$$.fragment, e21), xa(v10), xa(p10), l10 = false; + }, d: function(e21) { + e21 && wi(t10), d10 && d10.d(e21), h10 && h10.d(), Ra(i10), v10 && v10.d(), p10 && p10.d(), m10 && m10.d(); + } }; + } + function Tq(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10 = !e20[8].readOnly && e20[16] && e20[7] && (pE(e20[7]) || mE(e20[7])) && !zE(e20[7]) && Ow(JE(e20[7]), e20[1]), k10 = [Bq, zq], w10 = []; + function x10(e21, t11) { + return e21[12] ? 0 : 1; + } + o10 = x10(e20), i10 = w10[o10] = k10[o10](e20); + var j10 = e20[33].identifier, S10 = ei(j10, e20, e20[34], _q), C10 = !e20[17] && Lq(); + function $10(e21, t11) { + return e21[12] ? Vq : Fq; + } + var _10 = $10(e20), O10 = _10(e20), M10 = b10 && Hq(e20), E10 = e20[15] && (!e20[12] || !e20[15].isChildError) && Wq(e20); + function A10(e21, t11) { + return e21[12] ? Jq : e21[17] ? void 0 : Uq; + } + var P10 = A10(e20), T8 = P10 && P10(e20), R8 = e20[12] && Kq(e20); + return { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = ji("button"), i10.c(), a10 = $i(), S10 && S10.c(), s10 = $i(), C10 && C10.c(), c10 = $i(), l10 = ji("div"), u10 = ji("div"), O10.c(), f10 = $i(), M10 && M10.c(), d10 = $i(), E10 && E10.c(), h10 = $i(), T8 && T8.c(), v10 = $i(), R8 && R8.c(), p10 = _i(), Ai(r10, "type", "button"), Ai(r10, "class", "jse-expand svelte-1koa14y"), Ai(r10, "title", "Expand or collapse this object (Ctrl+Click to expand/collapse recursively)"), Ai(u10, "class", "jse-meta-inner svelte-1koa14y"), Ai(l10, "class", "jse-meta svelte-1koa14y"), Ai(l10, "data-type", "selectable-value"), Ai(n10, "class", "jse-header svelte-1koa14y"), Ai(t10, "class", "jse-header-outer svelte-1koa14y"); + }, m: function(i11, b11) { + ki(i11, t10, b11), pi(t10, n10), pi(n10, r10), w10[o10].m(r10, null), pi(n10, a10), S10 && S10.m(n10, null), pi(n10, s10), C10 && C10.m(n10, null), pi(n10, c10), pi(n10, l10), pi(l10, u10), O10.m(u10, null), pi(n10, f10), M10 && M10.m(n10, null), pi(t10, d10), E10 && E10.m(t10, null), pi(t10, h10), T8 && T8.m(t10, null), ki(i11, v10, b11), R8 && R8.m(i11, b11), ki(i11, p10, b11), m10 = true, g10 || (y10 = Oi(r10, "click", e20[20]), g10 = true); + }, p: function(e21, a11) { + var s11 = o10; + (o10 = x10(e21)) !== s11 && (ba(), xa(w10[s11], 1, 1, function() { + w10[s11] = null; + }), ka(), (i10 = w10[o10]) || (i10 = w10[o10] = k10[o10](e21)).c(), wa(i10, 1), i10.m(r10, null)), S10 && S10.p && (!m10 || 8 & a11[1]) && ri(S10, j10, e21, e21[34], m10 ? ni(j10, e21[34], a11, $q) : oi(e21[34]), _q), e21[17] ? C10 && (C10.d(1), C10 = null) : C10 || ((C10 = Lq()).c(), C10.m(n10, c10)), _10 === (_10 = $10(e21)) && O10 ? O10.p(e21, a11) : (O10.d(1), (O10 = _10(e21)) && (O10.c(), O10.m(u10, null))), 65922 & a11[0] && (b10 = !e21[8].readOnly && e21[16] && e21[7] && (pE(e21[7]) || mE(e21[7])) && !zE(e21[7]) && Ow(JE(e21[7]), e21[1])), b10 ? M10 ? (M10.p(e21, a11), 65922 & a11[0] && wa(M10, 1)) : ((M10 = Hq(e21)).c(), wa(M10, 1), M10.m(n10, null)) : M10 && (ba(), xa(M10, 1, 1, function() { + M10 = null; + }), ka()), !e21[15] || e21[12] && e21[15].isChildError ? E10 && (ba(), xa(E10, 1, 1, function() { + E10 = null; + }), ka()) : E10 ? (E10.p(e21, a11), 36864 & a11[0] && wa(E10, 1)) : ((E10 = Wq(e21)).c(), wa(E10, 1), E10.m(t10, h10)), P10 === (P10 = A10(e21)) && T8 ? T8.p(e21, a11) : (T8 && T8.d(1), (T8 = P10 && P10(e21)) && (T8.c(), T8.m(t10, null))), e21[12] ? R8 ? (R8.p(e21, a11), 4096 & a11[0] && wa(R8, 1)) : ((R8 = Kq(e21)).c(), wa(R8, 1), R8.m(p10.parentNode, p10)) : R8 && (ba(), xa(R8, 1, 1, function() { + R8 = null; + }), ka()); + }, i: function(e21) { + m10 || (wa(i10), wa(S10, e21), wa(M10), wa(E10), wa(R8), m10 = true); + }, o: function(e21) { + xa(i10), xa(S10, e21), xa(M10), xa(E10), xa(R8), m10 = false; + }, d: function(e21) { + e21 && (wi(t10), wi(v10), wi(p10)), w10[o10].d(), S10 && S10.d(e21), C10 && C10.d(), O10.d(), M10 && M10.d(), E10 && E10.d(), T8 && T8.d(), R8 && R8.d(e21), g10 = false, y10(); + } }; + } + function Rq(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10 = !e20[8].readOnly && e20[16] && e20[7] && (pE(e20[7]) || mE(e20[7])) && !zE(e20[7]) && Ow(JE(e20[7]), e20[1]), k10 = [ez, Zq], w10 = []; + function x10(e21, t11) { + return e21[12] ? 0 : 1; + } + o10 = x10(e20), i10 = w10[o10] = k10[o10](e20); + var j10 = e20[33].identifier, S10 = ei(j10, e20, e20[34], Aq), C10 = !e20[17] && tz(); + function $10(e21, t11) { + return e21[12] ? rz : nz; + } + var _10 = $10(e20), O10 = _10(e20), M10 = b10 && oz(e20), E10 = e20[15] && (!e20[12] || !e20[15].isChildError) && iz(e20); + function A10(e21, t11) { + return e21[12] ? sz : az; + } + var P10 = A10(e20), T8 = P10(e20), R8 = e20[12] && cz(e20); + return { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = ji("button"), i10.c(), a10 = $i(), S10 && S10.c(), s10 = $i(), C10 && C10.c(), c10 = $i(), l10 = ji("div"), u10 = ji("div"), O10.c(), f10 = $i(), M10 && M10.c(), d10 = $i(), E10 && E10.c(), h10 = $i(), T8.c(), v10 = $i(), R8 && R8.c(), p10 = _i(), Ai(r10, "type", "button"), Ai(r10, "class", "jse-expand svelte-1koa14y"), Ai(r10, "title", "Expand or collapse this array (Ctrl+Click to expand/collapse recursively)"), Ai(u10, "class", "jse-meta-inner svelte-1koa14y"), Ai(u10, "data-type", "selectable-value"), Ai(l10, "class", "jse-meta svelte-1koa14y"), Ai(n10, "class", "jse-header svelte-1koa14y"), Ai(t10, "class", "jse-header-outer svelte-1koa14y"); + }, m: function(i11, b11) { + ki(i11, t10, b11), pi(t10, n10), pi(n10, r10), w10[o10].m(r10, null), pi(n10, a10), S10 && S10.m(n10, null), pi(n10, s10), C10 && C10.m(n10, null), pi(n10, c10), pi(n10, l10), pi(l10, u10), O10.m(u10, null), pi(n10, f10), M10 && M10.m(n10, null), pi(t10, d10), E10 && E10.m(t10, null), pi(t10, h10), T8.m(t10, null), ki(i11, v10, b11), R8 && R8.m(i11, b11), ki(i11, p10, b11), m10 = true, g10 || (y10 = Oi(r10, "click", e20[20]), g10 = true); + }, p: function(e21, a11) { + var s11 = o10; + (o10 = x10(e21)) !== s11 && (ba(), xa(w10[s11], 1, 1, function() { + w10[s11] = null; + }), ka(), (i10 = w10[o10]) || (i10 = w10[o10] = k10[o10](e21)).c(), wa(i10, 1), i10.m(r10, null)), S10 && S10.p && (!m10 || 8 & a11[1]) && ri(S10, j10, e21, e21[34], m10 ? ni(j10, e21[34], a11, Eq) : oi(e21[34]), Aq), e21[17] ? C10 && (C10.d(1), C10 = null) : C10 || ((C10 = tz()).c(), C10.m(n10, c10)), _10 === (_10 = $10(e21)) && O10 ? O10.p(e21, a11) : (O10.d(1), (O10 = _10(e21)) && (O10.c(), O10.m(u10, null))), 65922 & a11[0] && (b10 = !e21[8].readOnly && e21[16] && e21[7] && (pE(e21[7]) || mE(e21[7])) && !zE(e21[7]) && Ow(JE(e21[7]), e21[1])), b10 ? M10 ? (M10.p(e21, a11), 65922 & a11[0] && wa(M10, 1)) : ((M10 = oz(e21)).c(), wa(M10, 1), M10.m(n10, null)) : M10 && (ba(), xa(M10, 1, 1, function() { + M10 = null; + }), ka()), !e21[15] || e21[12] && e21[15].isChildError ? E10 && (ba(), xa(E10, 1, 1, function() { + E10 = null; + }), ka()) : E10 ? (E10.p(e21, a11), 36864 & a11[0] && wa(E10, 1)) : ((E10 = iz(e21)).c(), wa(E10, 1), E10.m(t10, h10)), P10 === (P10 = A10(e21)) && T8 ? T8.p(e21, a11) : (T8.d(1), (T8 = P10(e21)) && (T8.c(), T8.m(t10, null))), e21[12] ? R8 ? (R8.p(e21, a11), 4096 & a11[0] && wa(R8, 1)) : ((R8 = cz(e21)).c(), wa(R8, 1), R8.m(p10.parentNode, p10)) : R8 && (ba(), xa(R8, 1, 1, function() { + R8 = null; + }), ka()); + }, i: function(e21) { + m10 || (wa(i10), wa(S10, e21), wa(M10), wa(E10), wa(R8), m10 = true); + }, o: function(e21) { + xa(i10), xa(S10, e21), xa(M10), xa(E10), xa(R8), m10 = false; + }, d: function(e21) { + e21 && (wi(t10), wi(v10), wi(p10)), w10[o10].d(), S10 && S10.d(e21), C10 && C10.d(), O10.d(), M10 && M10.d(), E10 && E10.d(), T8.d(), R8 && R8.d(e21), g10 = false, y10(); + } }; + } + function Nq(e20) { + var t10; + return { c: function() { + (t10 = ji("div")).textContent = ":", Ai(t10, "class", "jse-separator svelte-1koa14y"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function Iq(e20) { + var t10, n10, r10; + return n10 = new XD({ props: { selected: true, onContextMenu: e20[8].onContextMenu } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-context-menu-pointer-anchor svelte-1koa14y"); + }, m: function(e21, o10) { + ki(e21, t10, o10), Ta(n10, t10, null), r10 = true; + }, p: function(e21, t11) { + var r11 = {}; + 256 & t11[0] && (r11.onContextMenu = e21[8].onContextMenu), n10.$set(r11); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function Dq(e20) { + var t10, n10; + return t10 = new wq({ props: { validationError: e20[15], onExpand: e20[21] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 32768 & n11[0] && (r10.validationError = e21[15]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function qq(e20) { + var t10, n10, r10; + return { c: function() { + Ai(t10 = ji("div"), "role", "none"), Ai(t10, "class", "jse-insert-selection-area jse-after svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-after"); + }, m: function(o10, i10) { + ki(o10, t10, i10), n10 || (r10 = Oi(t10, "click", e20[29]), n10 = true); + }, p: Wo, d: function(e21) { + e21 && wi(t10), n10 = false, r10(); + } }; + } + function zq(e20) { + var t10, n10; + return t10 = new jM({ props: { data: YA } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function Bq(e20) { + var t10, n10; + return t10 = new jM({ props: { data: gP } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function Lq(e20) { + var t10; + return { c: function() { + (t10 = ji("div")).textContent = ":", Ai(t10, "class", "jse-separator svelte-1koa14y"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function Fq(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10 = Object.keys(e20[0]).length + "", d10 = 1 === Object.keys(e20[0]).length ? "prop" : "props"; + return { c: function() { + (t10 = ji("div")).textContent = "{", n10 = $i(), r10 = ji("button"), o10 = Ci(f10), i10 = $i(), a10 = Ci(d10), s10 = $i(), (c10 = ji("div")).textContent = "}", Ai(t10, "class", "jse-bracket svelte-1koa14y"), Ai(r10, "type", "button"), Ai(r10, "class", "jse-tag svelte-1koa14y"), Ai(c10, "class", "jse-bracket svelte-1koa14y"); + }, m: function(f11, d11) { + ki(f11, t10, d11), ki(f11, n10, d11), ki(f11, r10, d11), pi(r10, o10), pi(r10, i10), pi(r10, a10), ki(f11, s10, d11), ki(f11, c10, d11), l10 || (u10 = Oi(r10, "click", e20[21]), l10 = true); + }, p: function(e21, t11) { + 1 & t11[0] && f10 !== (f10 = Object.keys(e21[0]).length + "") && Ni(o10, f10), 1 & t11[0] && d10 !== (d10 = 1 === Object.keys(e21[0]).length ? "prop" : "props") && Ni(a10, d10); + }, d: function(e21) { + e21 && (wi(t10), wi(n10), wi(r10), wi(s10), wi(c10)), l10 = false, u10(); + } }; + } + function Vq(e20) { + var t10; + return { c: function() { + (t10 = ji("div")).textContent = "{", Ai(t10, "class", "jse-bracket jse-expanded svelte-1koa14y"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function Hq(e20) { + var t10, n10, r10; + return n10 = new XD({ props: { selected: true, onContextMenu: e20[8].onContextMenu } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-context-menu-pointer-anchor svelte-1koa14y"); + }, m: function(e21, o10) { + ki(e21, t10, o10), Ta(n10, t10, null), r10 = true; + }, p: function(e21, t11) { + var r11 = {}; + 256 & t11[0] && (r11.onContextMenu = e21[8].onContextMenu), n10.$set(r11); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function Wq(e20) { + var t10, n10; + return t10 = new wq({ props: { validationError: e20[15], onExpand: e20[21] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 32768 & n11[0] && (r10.validationError = e21[15]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function Uq(e20) { + var t10, n10, r10; + return { c: function() { + Ai(t10 = ji("div"), "role", "none"), Ai(t10, "class", "jse-insert-selection-area jse-after svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-after"); + }, m: function(o10, i10) { + ki(o10, t10, i10), n10 || (r10 = Oi(t10, "click", e20[29]), n10 = true); + }, p: Wo, d: function(e21) { + e21 && wi(t10), n10 = false, r10(); + } }; + } + function Jq(e20) { + var t10, n10, r10; + return { c: function() { + Ai(t10 = ji("div"), "role", "none"), Ai(t10, "class", "jse-insert-selection-area jse-inside svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-inside"); + }, m: function(o10, i10) { + ki(o10, t10, i10), n10 || (r10 = Oi(t10, "click", e20[28]), n10 = true); + }, p: Wo, d: function(e21) { + e21 && wi(t10), n10 = false, r10(); + } }; + } + function Kq(e20) { + for (var t10, n10, r10, o10, i10, a10, s10, c10 = !e20[8].readOnly && (e20[10] === js || e20[16] && hE(e20[7])), l10 = c10 && Gq(e20), u10 = Ca(e20[18](e20[1], e20[0], e20[2], e20[3], e20[4], e20[5], e20[6], e20[7], e20[11])), f10 = [], d10 = 0; d10 < u10.length; d10 += 1) + f10[d10] = Yq(Cq(e20, u10, d10)); + var h10 = function(e21) { + return xa(f10[e21], 1, 1, function() { + f10[e21] = null; + }); + }, v10 = !e20[17] && Xq(e20); + return { c: function() { + t10 = ji("div"), l10 && l10.c(), n10 = $i(); + for (var e21 = 0; e21 < f10.length; e21 += 1) + f10[e21].c(); + r10 = $i(), o10 = ji("div"), (i10 = ji("div")).innerHTML = '
}
', a10 = $i(), v10 && v10.c(), Ai(t10, "class", "jse-props svelte-1koa14y"), Ai(i10, "data-type", "selectable-value"), Ai(i10, "class", "jse-footer svelte-1koa14y"), Ai(o10, "class", "jse-footer-outer svelte-1koa14y"); + }, m: function(e21, c11) { + ki(e21, t10, c11), l10 && l10.m(t10, null), pi(t10, n10); + for (var u11 = 0; u11 < f10.length; u11 += 1) + f10[u11] && f10[u11].m(t10, null); + ki(e21, r10, c11), ki(e21, o10, c11), pi(o10, i10), pi(o10, a10), v10 && v10.m(o10, null), s10 = true; + }, p: function(e21, r11) { + if (66944 & r11[0] && (c10 = !e21[8].readOnly && (e21[10] === js || e21[16] && hE(e21[7]))), c10 ? l10 ? (l10.p(e21, r11), 66944 & r11[0] && wa(l10, 1)) : ((l10 = Gq(e21)).c(), wa(l10, 1), l10.m(t10, n10)) : l10 && (ba(), xa(l10, 1, 1, function() { + l10 = null; + }), ka()), 38013439 & r11[0]) { + var i11; + for (u10 = Ca(e21[18](e21[1], e21[0], e21[2], e21[3], e21[4], e21[5], e21[6], e21[7], e21[11])), i11 = 0; i11 < u10.length; i11 += 1) { + var a11 = Cq(e21, u10, i11); + f10[i11] ? (f10[i11].p(a11, r11), wa(f10[i11], 1)) : (f10[i11] = Yq(a11), f10[i11].c(), wa(f10[i11], 1), f10[i11].m(t10, null)); + } + for (ba(), i11 = u10.length; i11 < f10.length; i11 += 1) + h10(i11); + ka(); + } + e21[17] ? v10 && (v10.d(1), v10 = null) : v10 ? v10.p(e21, r11) : ((v10 = Xq(e21)).c(), v10.m(o10, null)); + }, i: function(e21) { + if (!s10) { + wa(l10); + for (var t11 = 0; t11 < u10.length; t11 += 1) + wa(f10[t11]); + s10 = true; + } + }, o: function(e21) { + xa(l10), f10 = f10.filter(Boolean); + for (var t11 = 0; t11 < f10.length; t11 += 1) + xa(f10[t11]); + s10 = false; + }, d: function(e21) { + e21 && (wi(t10), wi(r10), wi(o10)), l10 && l10.d(), xi(f10, e21), v10 && v10.d(); + } }; + } + function Gq(e20) { + var t10, n10, r10; + return n10 = new XD({ props: { selected: e20[16] && hE(e20[7]), onContextMenu: e20[30] } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-insert-area jse-inside svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-inside"), Ai(t10, "title", ws), zi(t10, "jse-hovered", e20[10] === js), zi(t10, "jse-selected", e20[16] && hE(e20[7])), Di(t10, "--level", e20[1].length + 1); + }, m: function(e21, o10) { + ki(e21, t10, o10), Ta(n10, t10, null), r10 = true; + }, p: function(e21, o10) { + var i10 = {}; + 65664 & o10[0] && (i10.selected = e21[16] && hE(e21[7])), n10.$set(i10), (!r10 || 1024 & o10[0]) && zi(t10, "jse-hovered", e21[10] === js), (!r10 || 65664 & o10[0]) && zi(t10, "jse-selected", e21[16] && hE(e21[7])), 2 & o10[0] && Di(t10, "--level", e21[1].length + 1); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function Qq(e20) { + var t10, n10, r10, o10; + return n10 = new sq({ props: { path: e20[52].path, key: e20[52].key, selection: e20[52].selection, searchResultItems: e20[52].keySearchResultItemsMap, context: e20[8], onUpdateKey: e20[22] } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), r10 = $i(), Ai(t10, "slot", "identifier"), Ai(t10, "class", "jse-identifier svelte-1koa14y"); + }, m: function(e21, i10) { + ki(e21, t10, i10), Ta(n10, t10, null), pi(t10, r10), o10 = true; + }, p: function(e21, t11) { + var r11 = {}; + 2303 & t11[0] && (r11.path = e21[52].path), 2303 & t11[0] && (r11.key = e21[52].key), 2303 & t11[0] && (r11.selection = e21[52].selection), 2303 & t11[0] && (r11.searchResultItems = e21[52].keySearchResultItemsMap), 256 & t11[0] && (r11.context = e21[8]), n10.$set(r11); + }, i: function(e21) { + o10 || (wa(n10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function Yq(e20) { + var t10, n10; + return t10 = new yz({ props: { value: e20[52].value, path: e20[52].path, expandedMap: e20[52].expandedMap, enforceStringMap: e20[52].enforceStringMap, visibleSectionsMap: e20[52].visibleSectionsMap, validationErrorsMap: e20[52].validationErrorsMap, searchResultItemsMap: e20[52].valueSearchResultItemsMap, selection: e20[52].selection, context: e20[8], onDragSelectionStart: e20[25], $$slots: { identifier: [Qq] }, $$scope: { ctx: e20 } } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 2303 & n11[0] && (r10.value = e21[52].value), 2303 & n11[0] && (r10.path = e21[52].path), 2303 & n11[0] && (r10.expandedMap = e21[52].expandedMap), 2303 & n11[0] && (r10.enforceStringMap = e21[52].enforceStringMap), 2303 & n11[0] && (r10.visibleSectionsMap = e21[52].visibleSectionsMap), 2303 & n11[0] && (r10.validationErrorsMap = e21[52].validationErrorsMap), 2303 & n11[0] && (r10.searchResultItemsMap = e21[52].valueSearchResultItemsMap), 2303 & n11[0] && (r10.selection = e21[52].selection), 256 & n11[0] && (r10.context = e21[8]), 2559 & n11[0] | 8 & n11[1] && (r10.$$scope = { dirty: n11, ctx: e21 }), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function Xq(e20) { + var t10, n10, r10; + return { c: function() { + Ai(t10 = ji("div"), "role", "none"), Ai(t10, "class", "jse-insert-selection-area jse-after svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-after"); + }, m: function(o10, i10) { + ki(o10, t10, i10), n10 || (r10 = Oi(t10, "click", e20[29]), n10 = true); + }, p: Wo, d: function(e21) { + e21 && wi(t10), n10 = false, r10(); + } }; + } + function Zq(e20) { + var t10, n10; + return t10 = new jM({ props: { data: YA } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function ez(e20) { + var t10, n10; + return t10 = new jM({ props: { data: gP } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function tz(e20) { + var t10; + return { c: function() { + (t10 = ji("div")).textContent = ":", Ai(t10, "class", "jse-separator svelte-1koa14y"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function nz(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10 = e20[0].length + "", d10 = 1 === e20[0].length ? "item" : "items"; + return { c: function() { + (t10 = ji("div")).textContent = "[", n10 = $i(), r10 = ji("button"), o10 = Ci(f10), i10 = $i(), a10 = Ci(d10), s10 = $i(), (c10 = ji("div")).textContent = "]", Ai(t10, "class", "jse-bracket svelte-1koa14y"), Ai(r10, "type", "button"), Ai(r10, "class", "jse-tag svelte-1koa14y"), Ai(c10, "class", "jse-bracket svelte-1koa14y"); + }, m: function(f11, d11) { + ki(f11, t10, d11), ki(f11, n10, d11), ki(f11, r10, d11), pi(r10, o10), pi(r10, i10), pi(r10, a10), ki(f11, s10, d11), ki(f11, c10, d11), l10 || (u10 = Oi(r10, "click", e20[21]), l10 = true); + }, p: function(e21, t11) { + 1 & t11[0] && f10 !== (f10 = e21[0].length + "") && Ni(o10, f10), 1 & t11[0] && d10 !== (d10 = 1 === e21[0].length ? "item" : "items") && Ni(a10, d10); + }, d: function(e21) { + e21 && (wi(t10), wi(n10), wi(r10), wi(s10), wi(c10)), l10 = false, u10(); + } }; + } + function rz(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10 = e20[0].length + "", l10 = 1 === e20[0].length ? "item" : "items"; + return { c: function() { + (t10 = ji("div")).textContent = "[", n10 = $i(), r10 = ji("span"), o10 = Ci(c10), i10 = $i(), a10 = Ci(l10), s10 = Ci("\n \xA0"), Ai(t10, "class", "jse-bracket svelte-1koa14y"), Ai(r10, "class", "jse-tag jse-expanded svelte-1koa14y"); + }, m: function(e21, c11) { + ki(e21, t10, c11), ki(e21, n10, c11), ki(e21, r10, c11), pi(r10, o10), pi(r10, i10), pi(r10, a10), ki(e21, s10, c11); + }, p: function(e21, t11) { + 1 & t11[0] && c10 !== (c10 = e21[0].length + "") && Ni(o10, c10), 1 & t11[0] && l10 !== (l10 = 1 === e21[0].length ? "item" : "items") && Ni(a10, l10); + }, d: function(e21) { + e21 && (wi(t10), wi(n10), wi(r10), wi(s10)); + } }; + } + function oz(e20) { + var t10, n10, r10; + return n10 = new XD({ props: { selected: true, onContextMenu: e20[8].onContextMenu } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-context-menu-pointer-anchor svelte-1koa14y"); + }, m: function(e21, o10) { + ki(e21, t10, o10), Ta(n10, t10, null), r10 = true; + }, p: function(e21, t11) { + var r11 = {}; + 256 & t11[0] && (r11.onContextMenu = e21[8].onContextMenu), n10.$set(r11); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function iz(e20) { + var t10, n10; + return t10 = new wq({ props: { validationError: e20[15], onExpand: e20[21] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 32768 & n11[0] && (r10.validationError = e21[15]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function az(e20) { + var t10, n10, r10; + return { c: function() { + Ai(t10 = ji("div"), "role", "none"), Ai(t10, "class", "jse-insert-selection-area jse-after svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-after"); + }, m: function(o10, i10) { + ki(o10, t10, i10), n10 || (r10 = Oi(t10, "click", e20[29]), n10 = true); + }, p: Wo, d: function(e21) { + e21 && wi(t10), n10 = false, r10(); + } }; + } + function sz(e20) { + var t10, n10, r10; + return { c: function() { + Ai(t10 = ji("div"), "role", "none"), Ai(t10, "class", "jse-insert-selection-area jse-inside svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-inside"); + }, m: function(o10, i10) { + ki(o10, t10, i10), n10 || (r10 = Oi(t10, "click", e20[28]), n10 = true); + }, p: Wo, d: function(e21) { + e21 && wi(t10), n10 = false, r10(); + } }; + } + function cz(e20) { + for (var t10, n10, r10, o10, i10, a10, s10, c10 = !e20[8].readOnly && (e20[10] === js || e20[16] && hE(e20[7])), l10 = [], u10 = /* @__PURE__ */ new Map(), f10 = c10 && lz(e20), d10 = Ca(e20[14] || ds), h10 = function(e21) { + return e21[48]; + }, v10 = 0; v10 < d10.length; v10 += 1) { + var p10 = Oq(e20, d10, v10), m10 = h10(p10); + u10.set(m10, l10[v10] = hz(m10, p10)); + } + var g10 = !e20[17] && vz(e20); + return { c: function() { + t10 = ji("div"), f10 && f10.c(), n10 = $i(); + for (var e21 = 0; e21 < l10.length; e21 += 1) + l10[e21].c(); + r10 = $i(), o10 = ji("div"), (i10 = ji("div")).innerHTML = ']', a10 = $i(), g10 && g10.c(), Ai(t10, "class", "jse-items svelte-1koa14y"), Ai(i10, "data-type", "selectable-value"), Ai(i10, "class", "jse-footer svelte-1koa14y"), Ai(o10, "class", "jse-footer-outer svelte-1koa14y"); + }, m: function(e21, c11) { + ki(e21, t10, c11), f10 && f10.m(t10, null), pi(t10, n10); + for (var u11 = 0; u11 < l10.length; u11 += 1) + l10[u11] && l10[u11].m(t10, null); + ki(e21, r10, c11), ki(e21, o10, c11), pi(o10, i10), pi(o10, a10), g10 && g10.m(o10, null), s10 = true; + }, p: function(e21, r11) { + 66944 & r11[0] && (c10 = !e21[8].readOnly && (e21[10] === js || e21[16] && hE(e21[7]))), c10 ? f10 ? (f10.p(e21, r11), 66944 & r11[0] && wa(f10, 1)) : ((f10 = lz(e21)).c(), wa(f10, 1), f10.m(t10, n10)) : f10 && (ba(), xa(f10, 1, 1, function() { + f10 = null; + }), ka()), 34097663 & r11[0] && (d10 = Ca(e21[14] || ds), ba(), l10 = Oa(l10, r11, h10, 1, e21, d10, u10, t10, _a, hz, null, Oq), ka()), e21[17] ? g10 && (g10.d(1), g10 = null) : g10 ? g10.p(e21, r11) : ((g10 = vz(e21)).c(), g10.m(o10, null)); + }, i: function(e21) { + if (!s10) { + wa(f10); + for (var t11 = 0; t11 < d10.length; t11 += 1) + wa(l10[t11]); + s10 = true; + } + }, o: function(e21) { + xa(f10); + for (var t11 = 0; t11 < l10.length; t11 += 1) + xa(l10[t11]); + s10 = false; + }, d: function(e21) { + e21 && (wi(t10), wi(r10), wi(o10)), f10 && f10.d(); + for (var n11 = 0; n11 < l10.length; n11 += 1) + l10[n11].d(); + g10 && g10.d(); + } }; + } + function lz(e20) { + var t10, n10, r10; + return n10 = new XD({ props: { selected: e20[16] && hE(e20[7]), onContextMenu: e20[30] } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-insert-area jse-inside svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-inside"), Ai(t10, "title", ws), zi(t10, "jse-hovered", e20[10] === js), zi(t10, "jse-selected", e20[16] && hE(e20[7])), Di(t10, "--level", e20[1].length + 1); + }, m: function(e21, o10) { + ki(e21, t10, o10), Ta(n10, t10, null), r10 = true; + }, p: function(e21, o10) { + var i10 = {}; + 65664 & o10[0] && (i10.selected = e21[16] && hE(e21[7])), n10.$set(i10), (!r10 || 1024 & o10[0]) && zi(t10, "jse-hovered", e21[10] === js), (!r10 || 65664 & o10[0]) && zi(t10, "jse-selected", e21[16] && hE(e21[7])), 2 & o10[0] && Di(t10, "--level", e21[1].length + 1); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function uz(e20) { + var t10, n10, r10, o10 = e20[49].index + ""; + return { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = Ci(o10), Ai(n10, "class", "jse-index svelte-1koa14y"), Ai(t10, "slot", "identifier"), Ai(t10, "class", "jse-identifier svelte-1koa14y"); + }, m: function(e21, o11) { + ki(e21, t10, o11), pi(t10, n10), pi(n10, r10); + }, p: function(e21, t11) { + 18687 & t11[0] && o10 !== (o10 = e21[49].index + "") && Ni(r10, o10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function fz(e20, t10) { + var n10, r10, o10; + return r10 = new yz({ props: { value: t10[49].value, path: t10[49].path, expandedMap: t10[49].expandedMap, enforceStringMap: t10[49].enforceStringMap, visibleSectionsMap: t10[49].visibleSectionsMap, validationErrorsMap: t10[49].validationErrorsMap, searchResultItemsMap: t10[49].searchResultItemsMap, selection: t10[49].selection, context: t10[8], onDragSelectionStart: t10[25], $$slots: { identifier: [uz] }, $$scope: { ctx: t10 } } }), { key: e20, first: null, c: function() { + n10 = _i(), Pa(r10.$$.fragment), this.first = n10; + }, m: function(e21, t11) { + ki(e21, n10, t11), Ta(r10, e21, t11), o10 = true; + }, p: function(e21, n11) { + t10 = e21; + var o11 = {}; + 18687 & n11[0] && (o11.value = t10[49].value), 18687 & n11[0] && (o11.path = t10[49].path), 18687 & n11[0] && (o11.expandedMap = t10[49].expandedMap), 18687 & n11[0] && (o11.enforceStringMap = t10[49].enforceStringMap), 18687 & n11[0] && (o11.visibleSectionsMap = t10[49].visibleSectionsMap), 18687 & n11[0] && (o11.validationErrorsMap = t10[49].validationErrorsMap), 18687 & n11[0] && (o11.searchResultItemsMap = t10[49].searchResultItemsMap), 18687 & n11[0] && (o11.selection = t10[49].selection), 256 & n11[0] && (o11.context = t10[8]), 18687 & n11[0] | 8 & n11[1] && (o11.$$scope = { dirty: n11, ctx: t10 }), r10.$set(o11); + }, i: function(e21) { + o10 || (wa(r10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(r10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(n10), Ra(r10, e21); + } }; + } + function dz(e20) { + var t10, n10; + return t10 = new KD({ props: { visibleSections: e20[14] || ds, sectionIndex: e20[48], total: e20[0].length, path: e20[1], onExpandSection: e20[8].onExpandSection, selection: e20[7], context: e20[8] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 16384 & n11[0] && (r10.visibleSections = e21[14] || ds), 16384 & n11[0] && (r10.sectionIndex = e21[48]), 1 & n11[0] && (r10.total = e21[0].length), 2 & n11[0] && (r10.path = e21[1]), 256 & n11[0] && (r10.onExpandSection = e21[8].onExpandSection), 128 & n11[0] && (r10.selection = e21[7]), 256 & n11[0] && (r10.context = e21[8]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function hz(e20, t10) { + for (var n10, r10, o10, i10, a10 = [], s10 = /* @__PURE__ */ new Map(), c10 = Ca(t10[19](t10[1], t10[0], t10[46], t10[2], t10[3], t10[4], t10[5], t10[6], t10[7], t10[11])), l10 = function(e21) { + return e21[49].index; + }, u10 = 0; u10 < c10.length; u10 += 1) { + var f10 = Mq(t10, c10, u10), d10 = l10(f10); + s10.set(d10, a10[u10] = fz(d10, f10)); + } + var h10 = t10[46].end < t10[0].length && dz(t10); + return { key: e20, first: null, c: function() { + n10 = _i(); + for (var e21 = 0; e21 < a10.length; e21 += 1) + a10[e21].c(); + r10 = $i(), h10 && h10.c(), o10 = _i(), this.first = n10; + }, m: function(e21, t11) { + ki(e21, n10, t11); + for (var s11 = 0; s11 < a10.length; s11 += 1) + a10[s11] && a10[s11].m(e21, t11); + ki(e21, r10, t11), h10 && h10.m(e21, t11), ki(e21, o10, t11), i10 = true; + }, p: function(e21, n11) { + t10 = e21, 34097663 & n11[0] && (c10 = Ca(t10[19](t10[1], t10[0], t10[46], t10[2], t10[3], t10[4], t10[5], t10[6], t10[7], t10[11])), ba(), a10 = Oa(a10, n11, l10, 1, t10, c10, s10, r10.parentNode, _a, fz, r10, Mq), ka()), t10[46].end < t10[0].length ? h10 ? (h10.p(t10, n11), 16385 & n11[0] && wa(h10, 1)) : ((h10 = dz(t10)).c(), wa(h10, 1), h10.m(o10.parentNode, o10)) : h10 && (ba(), xa(h10, 1, 1, function() { + h10 = null; + }), ka()); + }, i: function(e21) { + if (!i10) { + for (var t11 = 0; t11 < c10.length; t11 += 1) + wa(a10[t11]); + wa(h10), i10 = true; + } + }, o: function(e21) { + for (var t11 = 0; t11 < a10.length; t11 += 1) + xa(a10[t11]); + xa(h10), i10 = false; + }, d: function(e21) { + e21 && (wi(n10), wi(r10), wi(o10)); + for (var t11 = 0; t11 < a10.length; t11 += 1) + a10[t11].d(e21); + h10 && h10.d(e21); + } }; + } + function vz(e20) { + var t10, n10, r10; + return { c: function() { + Ai(t10 = ji("div"), "role", "none"), Ai(t10, "class", "jse-insert-selection-area jse-after svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-after"); + }, m: function(o10, i10) { + ki(o10, t10, i10), n10 || (r10 = Oi(t10, "click", e20[29]), n10 = true); + }, p: Wo, d: function(e21) { + e21 && wi(t10), n10 = false, r10(); + } }; + } + function pz(e20) { + var t10, n10, r10; + return n10 = new XD({ props: { selected: e20[16] && dE(e20[7]), onContextMenu: e20[31] } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-insert-area jse-after svelte-1koa14y"), Ai(t10, "data-type", "insert-selection-area-after"), Ai(t10, "title", ws), zi(t10, "jse-hovered", e20[10] === Ss), zi(t10, "jse-selected", e20[16] && dE(e20[7])); + }, m: function(e21, o10) { + ki(e21, t10, o10), Ta(n10, t10, null), r10 = true; + }, p: function(e21, o10) { + var i10 = {}; + 65664 & o10[0] && (i10.selected = e21[16] && dE(e21[7])), n10.$set(i10), (!r10 || 1024 & o10[0]) && zi(t10, "jse-hovered", e21[10] === Ss), (!r10 || 65664 & o10[0]) && zi(t10, "jse-selected", e21[16] && dE(e21[7])); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function mz(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10 = !e20[8].readOnly && (e20[10] === Ss || e20[16] && dE(e20[7])), h10 = [Rq, Tq, Pq], v10 = []; + function p10(e21, t11) { + return 1 & t11[0] && (n10 = null), 1 & t11[0] && (r10 = null), null == n10 && (n10 = !!Array.isArray(e21[0])), n10 ? 0 : (null == r10 && (r10 = !!Gl(e21[0])), r10 ? 1 : 2); + } + o10 = p10(e20, [-1, -1]), i10 = v10[o10] = h10[o10](e20); + var m10 = d10 && pz(e20); + return { c: function() { + t10 = ji("div"), i10.c(), a10 = $i(), m10 && m10.c(), Ai(t10, "role", "treeitem"), Ai(t10, "tabindex", "-1"), Ai(t10, "class", s10 = si(GE("jse-json-node", { "jse-expanded": e20[12] }, e20[8].onClassName(e20[1], e20[0]))) + " svelte-1koa14y"), Ai(t10, "data-path", c10 = OO(e20[1])), Ai(t10, "aria-selected", e20[16]), zi(t10, "jse-root", e20[17]), zi(t10, "jse-selected", e20[16] && mE(e20[7])), zi(t10, "jse-selected-key", e20[16] && vE(e20[7])), zi(t10, "jse-selected-value", e20[16] && pE(e20[7])), zi(t10, "jse-readonly", e20[8].readOnly), zi(t10, "jse-hovered", e20[10] === Cs), Di(t10, "--level", e20[1].length); + }, m: function(n11, r11) { + ki(n11, t10, r11), v10[o10].m(t10, null), pi(t10, a10), m10 && m10.m(t10, null), l10 = true, u10 || (f10 = [Oi(t10, "mousedown", e20[23]), Oi(t10, "mousemove", e20[24]), Oi(t10, "mouseover", e20[26]), Oi(t10, "mouseout", e20[27]), Oi(t10, "focus", void 0), Oi(t10, "blur", void 0)], u10 = true); + }, p: function(e21, n11) { + var r11 = o10; + (o10 = p10(e21, n11)) === r11 ? v10[o10].p(e21, n11) : (ba(), xa(v10[r11], 1, 1, function() { + v10[r11] = null; + }), ka(), (i10 = v10[o10]) ? i10.p(e21, n11) : (i10 = v10[o10] = h10[o10](e21)).c(), wa(i10, 1), i10.m(t10, a10)), 66944 & n11[0] && (d10 = !e21[8].readOnly && (e21[10] === Ss || e21[16] && dE(e21[7]))), d10 ? m10 ? (m10.p(e21, n11), 66944 & n11[0] && wa(m10, 1)) : ((m10 = pz(e21)).c(), wa(m10, 1), m10.m(t10, null)) : m10 && (ba(), xa(m10, 1, 1, function() { + m10 = null; + }), ka()), (!l10 || 4355 & n11[0] && s10 !== (s10 = si(GE("jse-json-node", { "jse-expanded": e21[12] }, e21[8].onClassName(e21[1], e21[0]))) + " svelte-1koa14y")) && Ai(t10, "class", s10), (!l10 || 2 & n11[0] && c10 !== (c10 = OO(e21[1]))) && Ai(t10, "data-path", c10), (!l10 || 65536 & n11[0]) && Ai(t10, "aria-selected", e21[16]), (!l10 || 135427 & n11[0]) && zi(t10, "jse-root", e21[17]), (!l10 || 70019 & n11[0]) && zi(t10, "jse-selected", e21[16] && mE(e21[7])), (!l10 || 70019 & n11[0]) && zi(t10, "jse-selected-key", e21[16] && vE(e21[7])), (!l10 || 70019 & n11[0]) && zi(t10, "jse-selected-value", e21[16] && pE(e21[7])), (!l10 || 4355 & n11[0]) && zi(t10, "jse-readonly", e21[8].readOnly), (!l10 || 5379 & n11[0]) && zi(t10, "jse-hovered", e21[10] === Cs), 2 & n11[0] && Di(t10, "--level", e21[1].length); + }, i: function(e21) { + l10 || (wa(i10), wa(m10), l10 = true); + }, o: function(e21) { + xa(i10), xa(m10), l10 = false; + }, d: function(e21) { + e21 && wi(t10), v10[o10].d(), m10 && m10.d(), u10 = false, Qo(f10); + } }; + } + function gz(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10 = t10.$$slots, f10 = void 0 === u10 ? {} : u10, d10 = t10.$$scope, h10 = t10.value, v10 = t10.path, p10 = t10.expandedMap, m10 = t10.enforceStringMap, g10 = t10.visibleSectionsMap, y10 = t10.validationErrorsMap, b10 = t10.searchResultItemsMap, k10 = t10.selection, w10 = t10.context, x10 = t10.onDragSelectionStart, j10 = Da("jsoneditor:JSONNode"), S10 = void 0, C10 = void 0, $10 = void 0, _10 = rv(function(e21) { + return e21; + }, JO); + function O10(e21) { + w10.onDrag(e21); + } + function M10(e21) { + pq.selecting && (pq.selecting = false, e21.stopPropagation()), w10.onDragEnd(), document.removeEventListener("mousemove", O10, true), document.removeEventListener("mouseup", M10); + } + function E10() { + var e21; + return (null === (e21 = w10.findElement([])) || void 0 === e21 || null === (e21 = e21.getBoundingClientRect()) || void 0 === e21 ? void 0 : e21.top) || 0; + } + function A10(e21, t11) { + var n11 = E10() - e21.initialContentTop; + return t11.clientY - e21.initialClientY - n11; + } + function P10(e21) { + if ($10) { + var t11 = w10.getJson(); + if (void 0 === t11) + return; + var r11 = w10.getDocumentState(), o11 = A10($10, e21), i11 = mq({ json: t11, documentState: r11, deltaY: o11, items: $10.items }).offset; + i11 !== $10.offset && (j10("drag selection", i11, o11), n10(11, $10 = Ro(Ro({}, $10), {}, { offset: i11, didMoveItems: true }))); + } + } + function T8(e21) { + if ($10) { + var t11 = w10.getJson(); + if (void 0 === t11) + return; + var r11 = mq({ json: t11, documentState: w10.getDocumentState(), deltaY: A10($10, e21), items: $10.items }), o11 = r11.operations, i11 = r11.updatedSelection; + if (o11) + w10.onPatch(o11, function(e23, t12) { + return { state: Ro(Ro({}, t12), {}, { selection: i11 || k10 }) }; + }); + else if (e21.target === $10.initialTarget && !$10.didMoveItems) { + var a11 = _O(e21.target), s11 = MO(e21.target); + s11 && w10.onSelect(VE(0, a11, s11)); + } + n10(11, $10 = void 0), pq.dragging = false, document.removeEventListener("mousemove", P10, true), document.removeEventListener("mouseup", T8); + } + } + return e20.$$set = function(e21) { + "value" in e21 && n10(0, h10 = e21.value), "path" in e21 && n10(1, v10 = e21.path), "expandedMap" in e21 && n10(2, p10 = e21.expandedMap), "enforceStringMap" in e21 && n10(3, m10 = e21.enforceStringMap), "visibleSectionsMap" in e21 && n10(4, g10 = e21.visibleSectionsMap), "validationErrorsMap" in e21 && n10(5, y10 = e21.validationErrorsMap), "searchResultItemsMap" in e21 && n10(6, b10 = e21.searchResultItemsMap), "selection" in e21 && n10(7, k10 = e21.selection), "context" in e21 && n10(8, w10 = e21.context), "onDragSelectionStart" in e21 && n10(32, x10 = e21.onDragSelectionStart), "$$scope" in e21 && n10(34, d10 = e21.$$scope); + }, e20.$$.update = function() { + 2 & e20.$$.dirty[0] && n10(9, o10 = Zs(v10)), 516 & e20.$$.dirty[0] && n10(12, i10 = !!p10 && true === p10[o10]), 777 & e20.$$.dirty[0] && n10(13, a10 = oE(h10, m10, o10, w10.parser)), 528 & e20.$$.dirty[0] && n10(14, s10 = g10 ? g10[o10] : void 0), 544 & e20.$$.dirty[0] && n10(15, c10 = y10 ? y10[o10] : void 0), 386 & e20.$$.dirty[0] && n10(16, l10 = WE(w10.getJson(), k10, v10)), 2 & e20.$$.dirty[0] && n10(17, r10 = 0 === v10.length); + }, [h10, v10, p10, m10, g10, y10, b10, k10, w10, o10, S10, $10, i10, a10, s10, c10, l10, r10, function(e21, t11, n11, r11, i11, a11, s11, c11, l11) { + var u11 = Object.keys(t11).map(function(l12) { + var u12 = _10(e21.concat(l12)), f11 = tc(o10, l12); + return { key: l12, value: t11[l12], path: u12, expandedMap: gq(n11, f11), enforceStringMap: gq(r11, f11), visibleSectionsMap: gq(i11, f11), validationErrorsMap: gq(a11, f11), keySearchResultItemsMap: SA(s11, f11), valueSearchResultItemsMap: gq(s11, f11), selection: HE(w10.getJson(), c11, u12) }; + }); + return l11 && 0 !== l11.offset && (u11 = q_(u11, l11.selectionStartIndex, l11.selectionItemsCount, l11.offset)), u11; + }, function(e21, t11, n11, r11, i11, a11, s11, c11, l11, u11) { + for (var f11 = n11.start, d11 = Math.min(n11.end, t11.length), h11 = [], v11 = f11; v11 < d11; v11++) { + var p11 = _10(e21.concat(String(v11))), m11 = tc(o10, v11); + h11.push({ index: v11, value: t11[v11], path: p11, expandedMap: gq(r11, m11), enforceStringMap: gq(i11, m11), visibleSectionsMap: gq(a11, m11), validationErrorsMap: gq(s11, m11), searchResultItemsMap: gq(c11, m11), selection: HE(w10.getJson(), l11, p11) }); + } + if (u11 && 0 !== u11.offset) { + var g11 = h11.map(function(e23) { + return e23.index; + }); + h11 = q_(h11, u11.selectionStartIndex, u11.selectionItemsCount, u11.offset); + for (var y11 = 0; y11 < h11.length; y11++) + h11[y11].index = g11[y11]; + } + return h11; + }, function(e21) { + e21.stopPropagation(); + var t11 = e21.ctrlKey; + w10.onExpand(v10, !i10, t11); + }, function(e21) { + e21.stopPropagation(), w10.onExpand(v10, true); + }, function(e21, t11) { + var n11 = aA(v10, Object.keys(h10), e21, t11); + return w10.onPatch(n11), vb(Xs(n11[0].path)); + }, function(e21) { + if (!(function(e23) { + return "DIV" === e23.nodeName && "true" === e23.contentEditable; + }(e21.target) || 1 === e21.which && yO(e21.target, "BUTTON"))) { + e21.stopPropagation(), e21.preventDefault(), w10.focus(), document.addEventListener("mousemove", O10, true), document.addEventListener("mouseup", M10); + var t11 = _O(e21.target), n11 = w10.getJson(), o11 = w10.getDocumentState(); + if (!k10 || t11 === Ya.after || t11 === Ya.inside || k10.type !== t11 && k10.type !== Ya.multi || !WE(n11, k10, v10)) + if (pq.selecting = true, pq.selectionAnchor = v10, pq.selectionAnchorType = t11, pq.selectionFocus = v10, e21.shiftKey) { + var i11 = w10.getDocumentState().selection; + i11 && w10.onSelect(DE(KE(i11), v10)); + } else if (t11 === Ya.multi) + if (r10 && e21.target.hasAttribute("data-path")) { + var a11 = vb(sE(h10, o11)); + w10.onSelect(FE(a11)); + } else + w10.onSelect(DE(v10, v10)); + else + void 0 !== n11 && w10.onSelect(VE(0, t11, v10)); + else + 0 === e21.button && x10(e21); + } + }, function(e21) { + if (pq.selecting) { + e21.preventDefault(), e21.stopPropagation(), null == pq.selectionFocus && window.getSelection && window.getSelection().empty(); + var t11 = _O(e21.target); + Ow(v10, pq.selectionFocus) && t11 === pq.selectionAnchorType || (pq.selectionFocus = v10, pq.selectionAnchorType = t11, w10.onSelect(DE(pq.selectionAnchor || pq.selectionFocus, pq.selectionFocus))); + } + }, function(e21) { + if (!w10.readOnly && k10) { + var t11 = Qk(JE(k10)); + if (Ow(v10, t11)) { + var r11 = function(e23, t12) { + var n11 = []; + function r12(e24) { + var t13 = v10.concat(e24), r13 = w10.findElement(t13); + null != r13 && n11.push({ path: t13, height: r13.clientHeight }); + } + if (Array.isArray(h10)) { + var o12 = w10.getJson(); + if (void 0 === o12) + return null; + var i12 = xE(o12, e23), a12 = jE(o12, e23), s11 = parseInt(vb(i12), 10), c12 = parseInt(vb(a12), 10), l11 = t12.find(function(e24) { + return s11 >= e24.start && c12 <= e24.end; + }); + if (!l11) + return null; + var u11 = l11.start, f11 = l11.end; + R_(u11, Math.min(h10.length, f11), function(e24) { + return r12(String(e24)); + }); + } else + Object.keys(h10).forEach(r12); + return n11; + }(k10, s10 || ds); + if (j10("dragSelectionStart", { selection: k10, items: r11 }), r11) { + var o11 = w10.getJson(); + if (void 0 !== o11) { + var i11 = xE(o11, k10), a11 = r11.findIndex(function(e23) { + return Ow(e23.path, i11); + }), c11 = mq({ json: o11, documentState: w10.getDocumentState(), deltaY: 0, items: r11 }).offset; + n10(11, $10 = { initialTarget: e21.target, initialClientY: e21.clientY, initialContentTop: E10(), selectionStartIndex: a11, selectionItemsCount: kE(o11, k10).length, items: r11, offset: c11, didMoveItems: false }), pq.dragging = true, document.addEventListener("mousemove", P10, true), document.addEventListener("mouseup", T8); + } + } else + j10("Cannot drag the current selection (probably spread over multiple sections)"); + } else + x10(e21); + } + }, function(e21) { + pq.selecting || pq.dragging || (e21.stopPropagation(), bO(e21.target, "data-type", "selectable-value") ? n10(10, S10 = Cs) : bO(e21.target, "data-type", "insert-selection-area-inside") ? n10(10, S10 = js) : bO(e21.target, "data-type", "insert-selection-area-after") && n10(10, S10 = Ss), clearTimeout(C10)); + }, function(e21) { + e21.stopPropagation(), C10 = window.setTimeout(function() { + return n10(10, S10 = void 0); + }); + }, function(e21) { + e21.shiftKey || (e21.stopPropagation(), e21.preventDefault(), w10.onSelect(NE(v10))); + }, function(e21) { + e21.shiftKey || (e21.stopPropagation(), e21.preventDefault(), w10.onSelect(IE(v10))); + }, function(e21) { + w10.onSelect(NE(v10)), w10.onContextMenu(e21); + }, function(e21) { + w10.onSelect(IE(v10)), w10.onContextMenu(e21); + }, x10, f10, d10]; + } + var yz = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, gz, mz, Zo, { value: 0, path: 1, expandedMap: 2, enforceStringMap: 3, visibleSectionsMap: 4, validationErrorsMap: 5, searchResultItemsMap: 6, selection: 7, context: 8, onDragSelectionStart: 32 }, xq, [-1, -1]), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var bz = yz; + var kz = { prefix: "fas", iconName: "jsoneditor-expand", icon: [512, 512, [], "", "M 0,448 V 512 h 512 v -64 z M 0,0 V 64 H 512 V 0 Z M 256,96 128,224 h 256 z M 256,416 384,288 H 128 Z"] }; + var wz = { prefix: "fas", iconName: "jsoneditor-collapse", icon: [512, 512, [], "", "m 0,224 v 64 h 512 v -64 z M 256,192 384,64 H 128 Z M 256,320 128,448 h 256 z"] }; + var xz = { prefix: "fas", iconName: "jsoneditor-format", icon: [512, 512, [], "", "M 0,32 v 64 h 416 v -64 z M 160,160 v 64 h 352 v -64 z M 160,288 v 64 h 288 v -64 z M 0,416 v 64 h 320 v -64 z"] }; + var jz = { prefix: "fas", iconName: "jsoneditor-compact", icon: [512, 512, [], "", "M 0,32 v 64 h 512 v -64 z M 0,160 v 64 h 512 v -64 z M 0,288 v 64 h 352 v -64 z"] }; + function Sz(e20) { + var t10, n10; + return t10 = new EI({ props: { items: e20[0] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & jo(n11, 1)[0] && (r10.items = e21[0]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function Cz(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10 = t10.json, f10 = t10.selection, d10 = t10.readOnly, h10 = t10.showSearch, v10 = void 0 !== h10 && h10, p10 = t10.historyState, m10 = t10.onExpandAll, g10 = t10.onCollapseAll, y10 = t10.onUndo, b10 = t10.onRedo, k10 = t10.onSort, w10 = t10.onTransform, x10 = t10.onContextMenu, j10 = t10.onCopy, S10 = t10.onRenderMenu; + function C10() { + n10(1, v10 = !v10); + } + return e20.$$set = function(e21) { + "json" in e21 && n10(2, u10 = e21.json), "selection" in e21 && n10(3, f10 = e21.selection), "readOnly" in e21 && n10(4, d10 = e21.readOnly), "showSearch" in e21 && n10(1, v10 = e21.showSearch), "historyState" in e21 && n10(5, p10 = e21.historyState), "onExpandAll" in e21 && n10(6, m10 = e21.onExpandAll), "onCollapseAll" in e21 && n10(7, g10 = e21.onCollapseAll), "onUndo" in e21 && n10(8, y10 = e21.onUndo), "onRedo" in e21 && n10(9, b10 = e21.onRedo), "onSort" in e21 && n10(10, k10 = e21.onSort), "onTransform" in e21 && n10(11, w10 = e21.onTransform), "onContextMenu" in e21 && n10(12, x10 = e21.onContextMenu), "onCopy" in e21 && n10(13, j10 = e21.onCopy), "onRenderMenu" in e21 && n10(14, S10 = e21.onRenderMenu); + }, e20.$$.update = function() { + 4 & e20.$$.dirty && n10(20, r10 = void 0 !== u10), 1048584 & e20.$$.dirty && n10(19, o10 = r10 && (mE(f10) || vE(f10) || pE(f10))), 68 & e20.$$.dirty && n10(15, a10 = { type: "button", icon: kz, title: "Expand all", className: "jse-expand-all", onClick: m10, disabled: !Ql(u10) }), 132 & e20.$$.dirty && n10(16, s10 = { type: "button", icon: wz, title: "Collapse all", className: "jse-collapse-all", onClick: g10, disabled: !Ql(u10) }), 4 & e20.$$.dirty && n10(17, c10 = { type: "button", icon: jP, title: "Search (Ctrl+F)", className: "jse-search", onClick: C10, disabled: void 0 === u10 }), 769844 & e20.$$.dirty && n10(18, l10 = d10 ? [a10, s10, { type: "separator" }, { type: "button", icon: CP, title: "Copy (Ctrl+C)", className: "jse-copy", onClick: j10, disabled: !o10 }, { type: "separator" }, c10, { type: "space" }] : [a10, s10, { type: "separator" }, { type: "button", icon: kP, title: "Sort", className: "jse-sort", onClick: k10, disabled: d10 || void 0 === u10 }, { type: "button", icon: cP, title: "Transform contents (filter, sort, project)", className: "jse-transform", onClick: w10, disabled: d10 || void 0 === u10 }, c10, { type: "button", icon: yP, title: xs, className: "jse-contextmenu", onClick: x10 }, { type: "separator" }, { type: "button", icon: vP, title: "Undo (Ctrl+Z)", className: "jse-undo", onClick: y10, disabled: !p10.canUndo }, { type: "button", icon: hP, title: "Redo (Ctrl+Shift+Z)", className: "jse-redo", onClick: b10, disabled: !p10.canRedo }, { type: "space" }]), 278528 & e20.$$.dirty && n10(0, i10 = S10(l10)); + }, [i10, v10, u10, f10, d10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, a10, s10, c10, l10, o10, r10]; + } + var $z = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, Cz, Sz, Zo, { json: 2, selection: 3, readOnly: 4, showSearch: 1, historyState: 5, onExpandAll: 6, onCollapseAll: 7, onUndo: 8, onRedo: 9, onSort: 10, onTransform: 11, onContextMenu: 12, onCopy: 13, onRenderMenu: 14 }), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function _z(e20) { + mi(e20, "svelte-s2toti", '.jse-welcome.svelte-s2toti.svelte-s2toti{flex:1;overflow:auto;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);display:flex;flex-direction:column;align-items:center;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7)}.jse-welcome.svelte-s2toti.svelte-s2toti:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-welcome.svelte-s2toti .jse-space.jse-before.svelte-s2toti{flex:1}.jse-welcome.svelte-s2toti .jse-space.jse-after.svelte-s2toti{flex:2}.jse-welcome.svelte-s2toti .jse-contents.svelte-s2toti{display:flex;flex-direction:column;max-width:300px;margin:2em var(--jse-padding, 10px);gap:var(--jse-padding, 10px)}.jse-welcome.svelte-s2toti .jse-contents .jse-welcome-info.svelte-s2toti{color:var(--jse-panel-color-readonly, #b2b2b2)}.jse-welcome.svelte-s2toti .jse-contents button.svelte-s2toti{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-welcome.svelte-s2toti .jse-contents button.svelte-s2toti:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-welcome.svelte-s2toti .jse-contents button.svelte-s2toti:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}'); + } + function Oz(e20) { + var t10, n10, r10, o10, i10, a10, s10; + return { c: function() { + (t10 = ji("div")).innerHTML = "You can paste clipboard data using Ctrl+V, or use the following options:", n10 = $i(), (r10 = ji("button")).textContent = "Create object", o10 = $i(), (i10 = ji("button")).textContent = "Create array", Ai(t10, "class", "jse-welcome-info svelte-s2toti"), Ai(r10, "title", "Create an empty JSON object (press '{')"), Ai(r10, "class", "svelte-s2toti"), Ai(i10, "title", "Create an empty JSON array (press '[')"), Ai(i10, "class", "svelte-s2toti"); + }, m: function(c10, l10) { + ki(c10, t10, l10), ki(c10, n10, l10), ki(c10, r10, l10), ki(c10, o10, l10), ki(c10, i10, l10), a10 || (s10 = [Oi(r10, "click", Ei(e20[4])), Oi(i10, "click", Ei(e20[5]))], a10 = true); + }, p: Wo, d: function(e21) { + e21 && (wi(t10), wi(n10), wi(r10), wi(o10), wi(i10)), a10 = false, Qo(s10); + } }; + } + function Mz(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10 = !e20[0] && Oz(e20); + return { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = $i(), o10 = ji("div"), (i10 = ji("div")).textContent = "Empty document", a10 = $i(), f10 && f10.c(), s10 = $i(), c10 = ji("div"), Ai(n10, "class", "jse-space jse-before svelte-s2toti"), Ai(i10, "class", "jse-welcome-title"), Ai(o10, "class", "jse-contents svelte-s2toti"), Ai(c10, "class", "jse-space jse-after svelte-s2toti"), Ai(t10, "class", "jse-welcome svelte-s2toti"), Ai(t10, "role", "none"); + }, m: function(d10, h10) { + ki(d10, t10, h10), pi(t10, n10), pi(t10, r10), pi(t10, o10), pi(o10, i10), pi(o10, a10), f10 && f10.m(o10, null), pi(t10, s10), pi(t10, c10), l10 || (u10 = Oi(t10, "click", e20[6]), l10 = true); + }, p: function(e21, t11) { + var n11 = jo(t11, 1)[0]; + e21[0] ? f10 && (f10.d(1), f10 = null) : f10 ? f10.p(e21, n11) : ((f10 = Oz(e21)).c(), f10.m(o10, null)); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10), f10 && f10.d(), l10 = false, u10(); + } }; + } + function Ez(e20, t10, n10) { + var r10 = t10.readOnly, o10 = t10.onCreateArray, i10 = t10.onCreateObject, a10 = t10.onClick; + return e20.$$set = function(e21) { + "readOnly" in e21 && n10(0, r10 = e21.readOnly), "onCreateArray" in e21 && n10(1, o10 = e21.onCreateArray), "onCreateObject" in e21 && n10(2, i10 = e21.onCreateObject), "onClick" in e21 && n10(3, a10 = e21.onClick); + }, [r10, o10, i10, a10, function() { + return i10(); + }, function() { + return o10(); + }, function() { + return a10(); + }]; + } + var Az = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, Ez, Mz, Zo, { readOnly: 0, onCreateArray: 1, onCreateObject: 2, onClick: 3 }, _z), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var Pz = { exports: {} }; + var Tz = function(e20, t10) { + var n10, r10, o10 = 1, i10 = 0, a10 = 0, s10 = String.alphabet; + function c10(e21, t11, r11) { + if (r11) { + for (n10 = t11; (r11 = c10(e21, n10)) < 76 && r11 > 65; ) + ++n10; + return +e21.slice(t11 - 1, n10); + } + return (r11 = s10 && s10.indexOf(e21.charAt(t11))) > -1 ? r11 + 76 : (r11 = e21.charCodeAt(t11) || 0) < 45 || r11 > 127 ? r11 : r11 < 46 ? 65 : r11 < 48 ? r11 - 1 : r11 < 58 ? r11 + 18 : r11 < 65 ? r11 - 11 : r11 < 91 ? r11 + 11 : r11 < 97 ? r11 - 37 : r11 < 123 ? r11 + 5 : r11 - 63; + } + if ((e20 += "") != (t10 += "")) { + for (; o10; ) + if (r10 = c10(e20, i10++), o10 = c10(t10, a10++), r10 < 76 && o10 < 76 && r10 > 66 && o10 > 66 && (r10 = c10(e20, i10, i10), o10 = c10(t10, a10, i10 = n10), a10 = n10), r10 != o10) + return r10 < o10 ? -1 : 1; + } + return 0; + }; + try { + Pz.exports = Tz; + } catch (e20) { + String.naturalCompare = Tz; + } + var Rz = yc(Pz.exports); + function Nz(e20, t10) { + var n10 = "string" == typeof e20 ? e20.toLowerCase() : e20, r10 = "string" == typeof t10 ? t10.toLowerCase() : t10; + return Rz(n10, r10); + } + function Iz(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], r10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1; + if (Ts(Ws(e20, t10))) { + if (void 0 === n10) + throw new Error("Cannot sort: no property selected by which to sort the array"); + return function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], n11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], r11 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1, o10 = /* @__PURE__ */ function(e23, t12) { + return function(n12, r12) { + var o11 = Ws(n12, e23), i11 = Ws(r12, e23); + return void 0 === o11 ? t12 : void 0 === i11 ? -t12 : "string" != typeof o11 && "string" != typeof i11 ? o11 > i11 ? t12 : o11 < i11 ? -t12 : 0 : t12 * Nz(o11, i11); + }; + }(n11, r11), i10 = Ws(e21, t11); + return [{ op: "replace", path: Zs(t11), value: i10.slice(0).sort(o10) }]; + }(e20, t10, n10, r10); + } + if (Gl(e20)) + return function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], n11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, r11 = Ws(e21, t11), o10 = Object.keys(r11), i10 = o10.slice(); + i10.sort(function(e23, t12) { + return n11 * Nz(e23, t12); + }); + for (var a10 = [], s10 = 0; s10 < i10.length; s10++) { + var c10 = i10[s10], l10 = Zs(t11.concat(c10)); + a10.push({ op: "move", from: l10, path: l10 }); + } + return a10; + }(e20, t10, r10); + throw new Error("Cannot sort: no array or object"); + } + function Dz(e20) { + mi(e20, "svelte-12glmu0", '.jse-navigation-bar-dropdown.svelte-12glmu0.svelte-12glmu0{position:absolute;top:100%;left:0;z-index:3;background:var(--jse-navigation-bar-background, var(--jse-background-color, #fff));color:var(--jse-navigation-bar-dropdown-color, #656565);box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24));display:flex;flex-direction:column;max-height:300px;overflow:auto;min-width:80px}.jse-navigation-bar-dropdown.svelte-12glmu0 button.jse-navigation-bar-dropdown-item.svelte-12glmu0{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);border:none;background:transparent;color:inherit;cursor:pointer;outline:none;text-align:left;white-space:nowrap;box-sizing:border-box;padding:calc(0.5 * var(--jse-padding, 10px)) 36px}.jse-navigation-bar-dropdown.svelte-12glmu0 button.jse-navigation-bar-dropdown-item.svelte-12glmu0:focus,.jse-navigation-bar-dropdown.svelte-12glmu0 button.jse-navigation-bar-dropdown-item.svelte-12glmu0:hover{background:var(--jse-navigation-bar-background-highlight, #e5e5e5)}.jse-navigation-bar-dropdown.svelte-12glmu0 button.jse-navigation-bar-dropdown-item.jse-selected.svelte-12glmu0{background:var(--jse-navigation-bar-dropdown-color, #656565);color:var(--jse-navigation-bar-background, var(--jse-background-color, #fff))}'); + } + function qz(e20, t10, n10) { + var r10 = e20.slice(); + return r10[4] = t10[n10], r10; + } + function zz(e20, t10) { + var n10, r10, o10, i10, a10, s10 = tM(t10[4].toString(), Vz) + ""; + function c10() { + return t10[3](t10[4]); + } + return { key: e20, first: null, c: function() { + n10 = ji("button"), r10 = Ci(s10), Ai(n10, "type", "button"), Ai(n10, "class", "jse-navigation-bar-dropdown-item svelte-12glmu0"), Ai(n10, "title", o10 = t10[4].toString()), zi(n10, "jse-selected", t10[4] === t10[1]), this.first = n10; + }, m: function(e21, t11) { + ki(e21, n10, t11), pi(n10, r10), i10 || (a10 = Oi(n10, "click", Ei(c10)), i10 = true); + }, p: function(e21, i11) { + t10 = e21, 1 & i11 && s10 !== (s10 = tM(t10[4].toString(), Vz) + "") && Ni(r10, s10), 1 & i11 && o10 !== (o10 = t10[4].toString()) && Ai(n10, "title", o10), 3 & i11 && zi(n10, "jse-selected", t10[4] === t10[1]); + }, d: function(e21) { + e21 && wi(n10), i10 = false, a10(); + } }; + } + function Bz(e20) { + var t10, n10; + return { c: function() { + t10 = ji("button"), n10 = Ci("..."), Ai(t10, "type", "button"), Ai(t10, "class", "jse-navigation-bar-dropdown-item svelte-12glmu0"), Ai(t10, "title", "Limited to " + Fz + " items"); + }, m: function(e21, r10) { + ki(e21, t10, r10), pi(t10, n10); + }, p: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function Lz(e20) { + for (var t10, n10, r10 = [], o10 = /* @__PURE__ */ new Map(), i10 = Ca(N_(e20[0], Fz)), a10 = function(e21) { + return e21[4]; + }, s10 = 0; s10 < i10.length; s10 += 1) { + var c10 = qz(e20, i10, s10), l10 = a10(c10); + o10.set(l10, r10[s10] = zz(l10, c10)); + } + var u10 = e20[0].length > Fz && Bz(); + return { c: function() { + t10 = ji("div"); + for (var e21 = 0; e21 < r10.length; e21 += 1) + r10[e21].c(); + n10 = $i(), u10 && u10.c(), Ai(t10, "class", "jse-navigation-bar-dropdown svelte-12glmu0"); + }, m: function(e21, o11) { + ki(e21, t10, o11); + for (var i11 = 0; i11 < r10.length; i11 += 1) + r10[i11] && r10[i11].m(t10, null); + pi(t10, n10), u10 && u10.m(t10, null); + }, p: function(e21, s11) { + var c11 = jo(s11, 1)[0]; + 7 & c11 && (i10 = Ca(N_(e21[0], Fz)), r10 = Oa(r10, c11, a10, 1, e21, i10, o10, t10, $a, zz, n10, qz)), e21[0].length > Fz ? u10 ? u10.p(e21, c11) : ((u10 = Bz()).c(), u10.m(t10, null)) : u10 && (u10.d(1), u10 = null); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + for (var n11 = 0; n11 < r10.length; n11 += 1) + r10[n11].d(); + u10 && u10.d(); + } }; + } + var Fz = 100; + var Vz = 30; + function Hz(e20, t10, n10) { + var r10 = t10.items, o10 = t10.selectedItem, i10 = t10.onSelect; + return e20.$$set = function(e21) { + "items" in e21 && n10(0, r10 = e21.items), "selectedItem" in e21 && n10(1, o10 = e21.selectedItem), "onSelect" in e21 && n10(2, i10 = e21.onSelect); + }, [r10, o10, i10, function(e21) { + return i10(e21); + }]; + } + var Wz = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, Hz, Lz, Zo, { items: 0, selectedItem: 1, onSelect: 2 }, Dz), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function Uz(e20) { + mi(e20, "svelte-x08607", ".jse-navigation-bar-item.svelte-x08607.svelte-x08607{position:relative;display:flex}.jse-navigation-bar-item.svelte-x08607 button.jse-navigation-bar-button.svelte-x08607{font-family:inherit;font-size:inherit;padding:calc(0.5 * var(--jse-padding, 10px)) 2px;border:none;background:transparent;color:inherit;cursor:pointer;outline:none;min-width:2em;white-space:nowrap}.jse-navigation-bar-item.svelte-x08607 button.jse-navigation-bar-button.svelte-x08607:focus,.jse-navigation-bar-item.svelte-x08607 button.jse-navigation-bar-button.svelte-x08607:hover{background:var(--jse-panel-button-background-highlight, #e0e0e0);color:var(--panel-button-color-highlight, var(--jse-text-color, #4d4d4d))}.jse-navigation-bar-item.svelte-x08607 button.jse-navigation-bar-button.jse-navigation-bar-arrow.svelte-x08607{padding:2px var(--jse-padding, 10px) 0}.jse-navigation-bar-item.svelte-x08607 button.jse-navigation-bar-button.jse-navigation-bar-arrow.jse-open.svelte-x08607{background:var(--jse-navigation-bar-background, var(--jse-background-color, #fff));color:var(--jse-navigation-bar-dropdown-color, #656565)}.jse-navigation-bar-item.svelte-x08607.svelte-x08607:last-child{padding-right:var(--jse-padding, 10px)}"); + } + function Jz(e20) { + var t10, n10, r10, o10; + return { c: function() { + t10 = ji("button"), n10 = Ci(e20[2]), Ai(t10, "type", "button"), Ai(t10, "class", "jse-navigation-bar-button svelte-x08607"); + }, m: function(i10, a10) { + ki(i10, t10, a10), pi(t10, n10), r10 || (o10 = Oi(t10, "click", e20[9]), r10 = true); + }, p: function(e21, t11) { + 4 & t11 && Ni(n10, e21[2]); + }, d: function(e21) { + e21 && wi(t10), r10 = false, o10(); + } }; + } + function Kz(e20) { + var t10, n10, r10, o10, i10, a10, s10; + r10 = new jM({ props: { data: iP } }); + var c10 = void 0 !== e20[2] && Jz(e20); + return { c: function() { + t10 = ji("div"), n10 = ji("button"), Pa(r10.$$.fragment), o10 = $i(), c10 && c10.c(), Ai(n10, "type", "button"), Ai(n10, "class", "jse-navigation-bar-button jse-navigation-bar-arrow svelte-x08607"), zi(n10, "jse-open", e20[1]), Ai(t10, "class", "jse-navigation-bar-item svelte-x08607"); + }, m: function(l10, u10) { + ki(l10, t10, u10), pi(t10, n10), Ta(r10, n10, null), pi(t10, o10), c10 && c10.m(t10, null), e20[10](t10), i10 = true, a10 || (s10 = Oi(n10, "click", e20[4]), a10 = true); + }, p: function(e21, r11) { + var o11 = jo(r11, 1)[0]; + (!i10 || 2 & o11) && zi(n10, "jse-open", e21[1]), void 0 !== e21[2] ? c10 ? c10.p(e21, o11) : ((c10 = Jz(e21)).c(), c10.m(t10, null)) : c10 && (c10.d(1), c10 = null); + }, i: function(e21) { + i10 || (wa(r10.$$.fragment, e21), i10 = true); + }, o: function(e21) { + xa(r10.$$.fragment, e21), i10 = false; + }, d: function(n11) { + n11 && wi(t10), Ra(r10), c10 && c10.d(), e20[10](null), a10 = false, s10(); + } }; + } + function Gz(e20, t10, n10) { + var r10, o10, i10, a10, s10 = Zi("absolute-popup"), c10 = s10.openAbsolutePopup, l10 = s10.closeAbsolutePopup, u10 = t10.path, f10 = t10.index, d10 = t10.onSelect, h10 = t10.getItems, v10 = false; + function p10(e21) { + l10(a10), d10(r10.concat(e21)); + } + return e20.$$set = function(e21) { + "path" in e21 && n10(5, u10 = e21.path), "index" in e21 && n10(6, f10 = e21.index), "onSelect" in e21 && n10(7, d10 = e21.onSelect), "getItems" in e21 && n10(8, h10 = e21.getItems); + }, e20.$$.update = function() { + 96 & e20.$$.dirty && (r10 = u10.slice(0, f10)), 96 & e20.$$.dirty && n10(2, o10 = u10[f10]); + }, [i10, v10, o10, p10, function() { + if (i10) { + n10(1, v10 = true); + var e21 = { items: h10(r10), selectedItem: o10, onSelect: p10 }; + a10 = c10(Wz, e21, { anchor: i10, closeOnOuterClick: true, onClose: function() { + n10(1, v10 = false); + } }); + } + }, u10, f10, d10, h10, function() { + return p10(o10); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(0, i10 = e21); + }); + }]; + } + var Qz = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, Gz, Kz, Zo, { path: 5, index: 6, onSelect: 7, getItems: 8 }, Uz), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function Yz(e20) { + var t10, n10; + if (navigator.clipboard) + return navigator.clipboard.writeText(e20); + if (null !== (t10 = (n10 = document).queryCommandSupported) && void 0 !== t10 && t10.call(n10, "copy")) { + var r10 = document.createElement("textarea"); + r10.value = e20, r10.style.position = "fixed", r10.style.opacity = "0", document.body.appendChild(r10), r10.select(); + try { + document.execCommand("copy"); + } catch (e21) { + console.error(e21); + } finally { + document.body.removeChild(r10); + } + } else + console.error("Copy failed."); + } + function Xz(e20) { + mi(e20, "svelte-1844qyt", ".jse-navigation-bar-path-editor.svelte-1844qyt.svelte-1844qyt{flex:1;display:flex;border:var(--jse-edit-outline, 2px solid #656565);background:var(--jse-background-color, #fff)}.jse-navigation-bar-path-editor.svelte-1844qyt input.jse-navigation-bar-text.svelte-1844qyt{flex:1;font-family:inherit;font-size:inherit;padding:0 5px 1px;background:var(--jse-background-color, #fff);color:var(--jse-text-color, #4d4d4d);border:none;outline:none}.jse-navigation-bar-path-editor.svelte-1844qyt button.svelte-1844qyt{border:none;background:var(--jse-background-color, #fff);cursor:pointer;font-family:inherit;font-size:80%;color:inherit}.jse-navigation-bar-path-editor.svelte-1844qyt button.jse-navigation-bar-copy.copied.svelte-1844qyt{color:var(--message-success-background, #9ac45d)}.jse-navigation-bar-path-editor.svelte-1844qyt button.jse-navigation-bar-validation-error.svelte-1844qyt{color:var(--jse-error-color, #ee5341)}.jse-navigation-bar-path-editor.error.svelte-1844qyt.svelte-1844qyt{border-color:var(--jse-error-color, #ee5341)}.jse-navigation-bar-path-editor.error.svelte-1844qyt input.jse-navigation-bar-text.svelte-1844qyt{color:var(--jse-error-color, #ee5341)}.jse-navigation-bar-path-editor.svelte-1844qyt .jse-copied-text.svelte-1844qyt{background:var(--message-success-background, #9ac45d);color:var(--jse-message-success-color, #fff);position:relative;margin:2px;padding:0 5px;border-radius:3px}"); + } + function Zz(e20) { + var t10, n10, r10, o10, i10, a10; + return n10 = new jM({ props: { data: TP } }), { c: function() { + t10 = ji("button"), Pa(n10.$$.fragment), Ai(t10, "type", "button"), Ai(t10, "class", "jse-navigation-bar-validation-error svelte-1844qyt"); + }, m: function(s10, c10) { + ki(s10, t10, c10), Ta(n10, t10, null), o10 = true, i10 || (a10 = ci(r10 = HA.call(null, t10, Ro({ text: String(e20[3] || "") }, e20[4]))), i10 = true); + }, p: function(e21, t11) { + r10 && Yo(r10.update) && 8 & t11 && r10.update.call(null, Ro({ text: String(e21[3] || "") }, e21[4])); + }, i: function(e21) { + o10 || (wa(n10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), i10 = false, a10(); + } }; + } + function eB(e20) { + var t10; + return { c: function() { + (t10 = ji("div")).textContent = "Copied!", Ai(t10, "class", "jse-copied-text svelte-1844qyt"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function tB(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10 = e20[3] && Zz(e20), d10 = e20[2] && eB(); + return s10 = new jM({ props: { data: CP } }), { c: function() { + t10 = ji("div"), n10 = ji("input"), r10 = $i(), f10 && f10.c(), o10 = $i(), d10 && d10.c(), i10 = $i(), a10 = ji("button"), Pa(s10.$$.fragment), Ai(n10, "type", "text"), Ai(n10, "class", "jse-navigation-bar-text svelte-1844qyt"), n10.value = e20[0], Ai(a10, "type", "button"), Ai(a10, "class", "jse-navigation-bar-copy svelte-1844qyt"), Ai(a10, "title", "Copy selected path to the clipboard"), zi(a10, "copied", e20[2]), Ai(t10, "class", "jse-navigation-bar-path-editor svelte-1844qyt"), zi(t10, "error", e20[3]); + }, m: function(h10, v10) { + ki(h10, t10, v10), pi(t10, n10), e20[15](n10), pi(t10, r10), f10 && f10.m(t10, null), pi(t10, o10), d10 && d10.m(t10, null), pi(t10, i10), pi(t10, a10), Ta(s10, a10, null), c10 = true, l10 || (u10 = [Oi(n10, "keydown", Ei(e20[6])), Oi(n10, "input", e20[5]), Oi(a10, "click", e20[7])], l10 = true); + }, p: function(e21, r11) { + var s11 = jo(r11, 1)[0]; + (!c10 || 1 & s11 && n10.value !== e21[0]) && (n10.value = e21[0]), e21[3] ? f10 ? (f10.p(e21, s11), 8 & s11 && wa(f10, 1)) : ((f10 = Zz(e21)).c(), wa(f10, 1), f10.m(t10, o10)) : f10 && (ba(), xa(f10, 1, 1, function() { + f10 = null; + }), ka()), e21[2] ? d10 || ((d10 = eB()).c(), d10.m(t10, i10)) : d10 && (d10.d(1), d10 = null), (!c10 || 4 & s11) && zi(a10, "copied", e21[2]), (!c10 || 8 & s11) && zi(t10, "error", e21[3]); + }, i: function(e21) { + c10 || (wa(f10), wa(s10.$$.fragment, e21), c10 = true); + }, o: function(e21) { + xa(f10), xa(s10.$$.fragment, e21), c10 = false; + }, d: function(n11) { + n11 && wi(t10), e20[15](null), f10 && f10.d(), d10 && d10.d(), Ra(s10), l10 = false, Qo(u10); + } }; + } + function nB(e20, t10, n10) { + var r10, o10, i10, a10 = Zi("absolute-popup"), s10 = t10.path, c10 = t10.pathParser, l10 = t10.onChange, u10 = t10.onClose, f10 = t10.onError, d10 = t10.pathExists, h10 = false, v10 = void 0, p10 = false; + function m10() { + o10.focus(); + } + function g10(e21) { + try { + var t11 = c10.parse(e21); + return function(e23) { + if (!d10(e23)) + throw new Error("Path does not exist in current document"); + }(t11), { path: t11, error: void 0 }; + } catch (e23) { + return { path: void 0, error: e23 }; + } + } + return Gi(function() { + m10(); + }), Qi(function() { + clearTimeout(v10); + }), e20.$$set = function(e21) { + "path" in e21 && n10(8, s10 = e21.path), "pathParser" in e21 && n10(9, c10 = e21.pathParser), "onChange" in e21 && n10(10, l10 = e21.onChange), "onClose" in e21 && n10(11, u10 = e21.onClose), "onError" in e21 && n10(12, f10 = e21.onError), "pathExists" in e21 && n10(13, d10 = e21.pathExists); + }, e20.$$.update = function() { + 768 & e20.$$.dirty && n10(0, i10 = c10.stringify(s10)), 16385 & e20.$$.dirty && n10(3, r10 = h10 ? g10(i10).error : void 0); + }, [i10, o10, p10, r10, a10, function(e21) { + n10(0, i10 = e21.currentTarget.value); + }, function(e21) { + var t11 = PO(e21); + if ("Escape" === t11 && u10(), "Enter" === t11) { + n10(14, h10 = true); + var r11 = g10(i10); + void 0 !== r11.path ? l10(r11.path) : f10(r11.error); + } + }, function() { + Yz(i10), n10(2, p10 = true), v10 = window.setTimeout(function() { + return n10(2, p10 = false); + }, 1e3), m10(); + }, s10, c10, l10, u10, f10, d10, h10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(1, o10 = e21); + }); + }]; + } + var rB = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, nB, tB, Xo, { path: 8, pathParser: 9, onChange: 10, onClose: 11, onError: 12, pathExists: 13 }, Xz), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function oB(e20) { + mi(e20, "svelte-1aycet9", '.jse-navigation-bar.svelte-1aycet9.svelte-1aycet9{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);background:var(--jse-panel-background, #ebebeb);color:var(--jse-panel-button-color, inherit);padding:0;margin:0;display:flex;overflow:auto;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7)}.jse-navigation-bar.svelte-1aycet9 .jse-navigation-bar-edit.svelte-1aycet9{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px);color:var(--jse-panel-color-readonly, #b2b2b2);background:transparent;border:none;display:flex;cursor:pointer;outline:none;align-items:center}.jse-navigation-bar.svelte-1aycet9 .jse-navigation-bar-edit.flex.svelte-1aycet9{flex:1}.jse-navigation-bar.svelte-1aycet9 .jse-navigation-bar-edit.svelte-1aycet9:focus,.jse-navigation-bar.svelte-1aycet9 .jse-navigation-bar-edit.svelte-1aycet9:hover,.jse-navigation-bar.svelte-1aycet9 .jse-navigation-bar-edit.editing.svelte-1aycet9{background:var(--jse-panel-button-background-highlight, #e0e0e0);color:var(--panel-button-color-highlight, var(--jse-text-color, #4d4d4d));transition:color 0.2s ease-in, background 0.2s ease-in}.jse-navigation-bar.svelte-1aycet9 .jse-navigation-bar-edit .jse-navigation-bar-space.svelte-1aycet9{flex:1;text-align:left}'); + } + function iB(e20, t10, n10) { + var r10 = e20.slice(); + return r10[18] = t10[n10], r10[20] = n10, r10; + } + function aB(e20) { + var t10, n10; + return t10 = new rB({ props: { path: e20[3], onClose: e20[11], onChange: e20[12], onError: e20[1], pathExists: e20[8], pathParser: e20[2] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 8 & n11 && (r10.path = e21[3]), 2 & n11 && (r10.onError = e21[1]), 4 & n11 && (r10.pathParser = e21[2]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function sB(e20) { + for (var t10, n10, r10, o10 = [], i10 = /* @__PURE__ */ new Map(), a10 = Ca(e20[3]), s10 = function(e21) { + return e21[20]; + }, c10 = 0; c10 < a10.length; c10 += 1) { + var l10 = iB(e20, a10, c10), u10 = s10(l10); + i10.set(u10, o10[c10] = cB(u10, l10)); + } + var f10 = e20[6] && lB(e20); + return { c: function() { + for (var e21 = 0; e21 < o10.length; e21 += 1) + o10[e21].c(); + t10 = $i(), f10 && f10.c(), n10 = _i(); + }, m: function(e21, i11) { + for (var a11 = 0; a11 < o10.length; a11 += 1) + o10[a11] && o10[a11].m(e21, i11); + ki(e21, t10, i11), f10 && f10.m(e21, i11), ki(e21, n10, i11), r10 = true; + }, p: function(e21, r11) { + 648 & r11 && (a10 = Ca(e21[3]), ba(), o10 = Oa(o10, r11, s10, 1, e21, a10, i10, t10.parentNode, _a, cB, t10, iB), ka()), e21[6] ? f10 ? (f10.p(e21, r11), 64 & r11 && wa(f10, 1)) : ((f10 = lB(e21)).c(), wa(f10, 1), f10.m(n10.parentNode, n10)) : f10 && (ba(), xa(f10, 1, 1, function() { + f10 = null; + }), ka()); + }, i: function(e21) { + if (!r10) { + for (var t11 = 0; t11 < a10.length; t11 += 1) + wa(o10[t11]); + wa(f10), r10 = true; + } + }, o: function(e21) { + for (var t11 = 0; t11 < o10.length; t11 += 1) + xa(o10[t11]); + xa(f10), r10 = false; + }, d: function(e21) { + e21 && (wi(t10), wi(n10)); + for (var r11 = 0; r11 < o10.length; r11 += 1) + o10[r11].d(e21); + f10 && f10.d(e21); + } }; + } + function cB(e20, t10) { + var n10, r10, o10; + return r10 = new Qz({ props: { getItems: t10[7], path: t10[3], index: t10[20], onSelect: t10[9] } }), { key: e20, first: null, c: function() { + n10 = _i(), Pa(r10.$$.fragment), this.first = n10; + }, m: function(e21, t11) { + ki(e21, n10, t11), Ta(r10, e21, t11), o10 = true; + }, p: function(e21, n11) { + t10 = e21; + var o11 = {}; + 8 & n11 && (o11.path = t10[3]), 8 & n11 && (o11.index = t10[20]), r10.$set(o11); + }, i: function(e21) { + o10 || (wa(r10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(r10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(n10), Ra(r10, e21); + } }; + } + function lB(e20) { + var t10, n10; + return t10 = new Qz({ props: { getItems: e20[7], path: e20[3], index: e20[3].length, onSelect: e20[9] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 8 & n11 && (r10.path = e21[3]), 8 & n11 && (r10.index = e21[3].length), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function uB(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10 = Ql(e20[0]) || e20[5] ? "\xA0" : "Navigation bar", p10 = [sB, aB], m10 = []; + function g10(e21, t11) { + return e21[5] ? 1 : 0; + } + return n10 = g10(e20), r10 = m10[n10] = p10[n10](e20), l10 = new jM({ props: { data: e20[5] ? OP : rP } }), { c: function() { + t10 = ji("div"), r10.c(), o10 = $i(), i10 = ji("button"), a10 = ji("span"), s10 = Ci(v10), c10 = $i(), Pa(l10.$$.fragment), Ai(a10, "class", "jse-navigation-bar-space svelte-1aycet9"), Ai(i10, "type", "button"), Ai(i10, "class", "jse-navigation-bar-edit svelte-1aycet9"), Ai(i10, "title", u10 = e20[5] ? "Cancel editing the selected path" : "Edit the selected path"), zi(i10, "flex", !e20[5]), zi(i10, "editing", e20[5]), Ai(t10, "class", "jse-navigation-bar svelte-1aycet9"); + }, m: function(r11, u11) { + ki(r11, t10, u11), m10[n10].m(t10, null), pi(t10, o10), pi(t10, i10), pi(i10, a10), pi(a10, s10), pi(i10, c10), Ta(l10, i10, null), e20[15](t10), f10 = true, d10 || (h10 = Oi(i10, "click", e20[10]), d10 = true); + }, p: function(e21, a11) { + var c11 = jo(a11, 1)[0], d11 = n10; + (n10 = g10(e21)) === d11 ? m10[n10].p(e21, c11) : (ba(), xa(m10[d11], 1, 1, function() { + m10[d11] = null; + }), ka(), (r10 = m10[n10]) ? r10.p(e21, c11) : (r10 = m10[n10] = p10[n10](e21)).c(), wa(r10, 1), r10.m(t10, o10)), (!f10 || 33 & c11) && v10 !== (v10 = Ql(e21[0]) || e21[5] ? "\xA0" : "Navigation bar") && Ni(s10, v10); + var h11 = {}; + 32 & c11 && (h11.data = e21[5] ? OP : rP), l10.$set(h11), (!f10 || 32 & c11 && u10 !== (u10 = e21[5] ? "Cancel editing the selected path" : "Edit the selected path")) && Ai(i10, "title", u10), (!f10 || 32 & c11) && zi(i10, "flex", !e21[5]), (!f10 || 32 & c11) && zi(i10, "editing", e21[5]); + }, i: function(e21) { + f10 || (wa(r10), wa(l10.$$.fragment, e21), f10 = true); + }, o: function(e21) { + xa(r10), xa(l10.$$.fragment, e21), f10 = false; + }, d: function(r11) { + r11 && wi(t10), m10[n10].d(), Ra(l10), e20[15](null), d10 = false, h10(); + } }; + } + function fB(e20, t10, n10) { + var r10, o10, i10, a10 = Da("jsoneditor:NavigationBar"), s10 = t10.json, c10 = t10.selection, l10 = t10.onSelect, u10 = t10.onError, f10 = t10.pathParser, d10 = false; + function h10(e21) { + a10("select path", JSON.stringify(e21)), l10(DE(e21, e21)); + } + function v10() { + n10(5, d10 = false); + } + return e20.$$set = function(e21) { + "json" in e21 && n10(0, s10 = e21.json), "selection" in e21 && n10(13, c10 = e21.selection), "onSelect" in e21 && n10(14, l10 = e21.onSelect), "onError" in e21 && n10(1, u10 = e21.onError), "pathParser" in e21 && n10(2, f10 = e21.pathParser); + }, e20.$$.update = function() { + 8192 & e20.$$.dirty && n10(3, r10 = c10 ? JE(c10) : []), 9 & e20.$$.dirty && n10(6, o10 = Ql(Ws(s10, r10))), 8 & e20.$$.dirty && setTimeout(function() { + if (i10 && i10.scrollTo) { + var e21 = i10.scrollWidth - i10.clientWidth; + e21 > 0 && (a10("scrollTo ", e21), i10.scrollTo({ left: e21, behavior: "smooth" })); + } + }); + }, [s10, u10, f10, r10, i10, d10, o10, function(e21) { + a10("get items for path", e21); + var t11 = Ws(s10, e21); + if (Array.isArray(t11)) + return hS(0, t11.length).map(String); + if (Gl(t11)) { + var n11 = Object.keys(t11).slice(0); + return n11.sort(Nz), n11; + } + return []; + }, function(e21) { + return Ys(s10, e21); + }, h10, function() { + n10(5, d10 = !d10); + }, v10, function(e21) { + v10(), h10(e21); + }, c10, l10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(4, i10 = e21); + }); + }]; + } + var dB = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, fB, uB, Zo, { json: 0, selection: 13, onSelect: 14, onError: 1, pathParser: 2 }, oB), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function hB(e20) { + mi(e20, "svelte-1vkjt6l", '.jse-search-box.svelte-1vkjt6l.svelte-1vkjt6l{border:var(--jse-panel-border, var(--jse-main-border, 1px solid #d7d7d7));border-radius:3px;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);background:var(--jse-panel-background, #ebebeb);color:var(--jse-panel-color-readonly, #b2b2b2);box-shadow:var(--jse-controls-box-shadow, 0 2px 6px 0 rgba(0, 0, 0, 0.24));display:inline-block;width:400px;max-width:100%;overflow:auto}.jse-search-box.svelte-1vkjt6l .jse-search-form.svelte-1vkjt6l{display:flex;align-items:stretch}.jse-search-box.svelte-1vkjt6l .jse-search-form button.svelte-1vkjt6l,.jse-search-box.svelte-1vkjt6l .jse-search-form input.svelte-1vkjt6l{font-family:inherit;font-size:inherit}.jse-search-box.svelte-1vkjt6l .jse-search-form button.svelte-1vkjt6l{display:block;text-align:center;border:none;padding:0 5px;margin:0;cursor:pointer;color:var(--jse-panel-button-color, inherit);background:var(--jse-panel-button-background, transparent)}.jse-search-box.svelte-1vkjt6l .jse-search-form button.svelte-1vkjt6l:hover{color:var(--panel-button-color-highlight, var(--jse-text-color, #4d4d4d));background:var(--jse-panel-button-background-highlight, #e0e0e0)}.jse-search-box.svelte-1vkjt6l .jse-search-form input.svelte-1vkjt6l{color:var(--jse-panel-color, var(--jse-text-color, #4d4d4d));border:var(--jse-input-border, 1px solid #d8dbdf);border-radius:3px;background:var(--jse-input-background, var(--jse-background-color, #fff));height:28px;padding:0 5px;margin:0;flex:1;width:0;min-width:50px;outline:none}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-replace-toggle.svelte-1vkjt6l{padding:var(--jse-padding, 10px) calc(0.5 * var(--jse-padding, 10px));min-width:20px;background:var(--jse-panel-button-background-highlight, #e0e0e0)}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents.svelte-1vkjt6l{flex:1;display:flex;flex-direction:column;padding:calc(0.5 * var(--jse-padding, 10px));gap:calc(0.5 * var(--jse-padding, 10px))}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section.svelte-1vkjt6l{flex:1;display:flex;align-items:center;position:relative;padding-left:32px}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section .jse-search-icon.svelte-1vkjt6l{color:inherit;cursor:inherit;background:inherit;position:absolute;top:calc(0.5 * var(--jse-padding, 10px));left:calc(0.5 * var(--jse-padding, 10px))}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section label.jse-search-input-label.svelte-1vkjt6l{flex:1;display:flex}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section .jse-search-count.svelte-1vkjt6l{color:inherit;font-size:80%;visibility:hidden;padding:0 5px;min-width:36px;text-align:center}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-search-section .jse-search-count.jse-visible.svelte-1vkjt6l{visibility:visible}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-replace-section.svelte-1vkjt6l{padding-left:32px;flex:1;display:flex}.jse-search-box.svelte-1vkjt6l .jse-search-form .jse-search-contents .jse-replace-section button.svelte-1vkjt6l{width:auto}'); + } + function vB(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, _10, O10, M10 = (-1 !== e20[3] ? "".concat(e20[3] + 1, "/") : "") + "", E10 = !e20[4] && pB(e20), A10 = [gB, mB], P10 = []; + function T8(e21, t11) { + return e21[2] ? 0 : 1; + } + s10 = T8(e20), c10 = P10[s10] = A10[s10](e20), y10 = new jM({ props: { data: SP } }), w10 = new jM({ props: { data: oP } }), S10 = new jM({ props: { data: MP } }); + var R8 = e20[0] && !e20[4] && yB(e20); + return { c: function() { + t10 = ji("div"), n10 = ji("form"), E10 && E10.c(), r10 = $i(), o10 = ji("div"), i10 = ji("div"), a10 = ji("div"), c10.c(), l10 = $i(), u10 = ji("label"), f10 = ji("input"), d10 = $i(), h10 = ji("div"), v10 = Ci(M10), p10 = Ci(e20[10]), m10 = $i(), g10 = ji("button"), Pa(y10.$$.fragment), b10 = $i(), k10 = ji("button"), Pa(w10.$$.fragment), x10 = $i(), j10 = ji("button"), Pa(S10.$$.fragment), C10 = $i(), R8 && R8.c(), Ai(a10, "class", "jse-search-icon svelte-1vkjt6l"), Ai(f10, "class", "jse-search-input svelte-1vkjt6l"), Ai(f10, "title", "Enter text to search"), Ai(f10, "type", "text"), Ai(f10, "placeholder", "Find"), Ai(u10, "class", "jse-search-input-label svelte-1vkjt6l"), Ai(u10, "about", "jse-search input"), Ai(h10, "class", "jse-search-count svelte-1vkjt6l"), zi(h10, "jse-visible", "" !== e20[8]), Ai(g10, "type", "button"), Ai(g10, "class", "jse-search-next svelte-1vkjt6l"), Ai(g10, "title", "Go to next search result (Enter)"), Ai(k10, "type", "button"), Ai(k10, "class", "jse-search-previous svelte-1vkjt6l"), Ai(k10, "title", "Go to previous search result (Shift+Enter)"), Ai(j10, "type", "button"), Ai(j10, "class", "jse-search-clear svelte-1vkjt6l"), Ai(j10, "title", "Close search box (Esc)"), Ai(i10, "class", "jse-search-section svelte-1vkjt6l"), Ai(o10, "class", "jse-search-contents svelte-1vkjt6l"), Ai(n10, "class", "jse-search-form svelte-1vkjt6l"), Ai(t10, "class", "jse-search-box svelte-1vkjt6l"); + }, m: function(c11, M11) { + ki(c11, t10, M11), pi(t10, n10), E10 && E10.m(n10, null), pi(n10, r10), pi(n10, o10), pi(o10, i10), pi(i10, a10), P10[s10].m(a10, null), pi(i10, l10), pi(i10, u10), pi(u10, f10), Ii(f10, e20[8]), pi(i10, d10), pi(i10, h10), pi(h10, v10), pi(h10, p10), pi(i10, m10), pi(i10, g10), Ta(y10, g10, null), pi(i10, b10), pi(i10, k10), Ta(w10, k10, null), pi(i10, x10), pi(i10, j10), Ta(S10, j10, null), pi(o10, C10), R8 && R8.m(o10, null), $10 = true, _10 || (O10 = [Oi(f10, "input", e20[21]), ci(kB.call(null, f10)), Oi(g10, "click", e20[22]), Oi(k10, "click", e20[23]), Oi(j10, "click", e20[24]), Oi(n10, "submit", e20[12]), Oi(n10, "keydown", e20[13])], _10 = true); + }, p: function(e21, t11) { + e21[4] ? E10 && (ba(), xa(E10, 1, 1, function() { + E10 = null; + }), ka()) : E10 ? (E10.p(e21, t11), 16 & t11 && wa(E10, 1)) : ((E10 = pB(e21)).c(), wa(E10, 1), E10.m(n10, r10)); + var i11 = s10; + (s10 = T8(e21)) !== i11 && (ba(), xa(P10[i11], 1, 1, function() { + P10[i11] = null; + }), ka(), (c10 = P10[s10]) || (c10 = P10[s10] = A10[s10](e21)).c(), wa(c10, 1), c10.m(a10, null)), 256 & t11 && f10.value !== e21[8] && Ii(f10, e21[8]), (!$10 || 8 & t11) && M10 !== (M10 = (-1 !== e21[3] ? "".concat(e21[3] + 1, "/") : "") + "") && Ni(v10, M10), (!$10 || 1024 & t11) && Ni(p10, e21[10]), (!$10 || 256 & t11) && zi(h10, "jse-visible", "" !== e21[8]), e21[0] && !e21[4] ? R8 ? R8.p(e21, t11) : ((R8 = yB(e21)).c(), R8.m(o10, null)) : R8 && (R8.d(1), R8 = null); + }, i: function(e21) { + $10 || (wa(E10), wa(c10), wa(y10.$$.fragment, e21), wa(w10.$$.fragment, e21), wa(S10.$$.fragment, e21), $10 = true); + }, o: function(e21) { + xa(E10), xa(c10), xa(y10.$$.fragment, e21), xa(w10.$$.fragment, e21), xa(S10.$$.fragment, e21), $10 = false; + }, d: function(e21) { + e21 && wi(t10), E10 && E10.d(), P10[s10].d(), Ra(y10), Ra(w10), Ra(S10), R8 && R8.d(), _10 = false, Qo(O10); + } }; + } + function pB(e20) { + var t10, n10, r10, o10, i10; + return n10 = new jM({ props: { data: e20[0] ? gP : YA } }), { c: function() { + t10 = ji("button"), Pa(n10.$$.fragment), Ai(t10, "type", "button"), Ai(t10, "class", "jse-replace-toggle svelte-1vkjt6l"), Ai(t10, "title", "Toggle visibility of replace options (Ctrl+H)"); + }, m: function(a10, s10) { + ki(a10, t10, s10), Ta(n10, t10, null), r10 = true, o10 || (i10 = Oi(t10, "click", e20[11]), o10 = true); + }, p: function(e21, t11) { + var r11 = {}; + 1 & t11 && (r11.data = e21[0] ? gP : YA), n10.$set(r11); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), o10 = false, i10(); + } }; + } + function mB(e20) { + var t10, n10; + return t10 = new jM({ props: { data: jP } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function gB(e20) { + var t10, n10; + return t10 = new jM({ props: { data: ZA, spin: true } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function yB(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10; + return { c: function() { + t10 = ji("div"), n10 = ji("input"), r10 = $i(), (o10 = ji("button")).textContent = "Replace", i10 = $i(), (a10 = ji("button")).textContent = "All", Ai(n10, "class", "jse-replace-input svelte-1vkjt6l"), Ai(n10, "title", "Enter replacement text"), Ai(n10, "type", "text"), Ai(n10, "placeholder", "Replace"), Ai(o10, "type", "button"), Ai(o10, "title", "Replace current occurrence (Ctrl+Enter)"), Ai(o10, "class", "svelte-1vkjt6l"), Ai(a10, "type", "button"), Ai(a10, "title", "Replace all occurrences"), Ai(a10, "class", "svelte-1vkjt6l"), Ai(t10, "class", "jse-replace-section svelte-1vkjt6l"); + }, m: function(l10, u10) { + ki(l10, t10, u10), pi(t10, n10), Ii(n10, e20[9]), pi(t10, r10), pi(t10, o10), pi(t10, i10), pi(t10, a10), s10 || (c10 = [Oi(n10, "input", e20[25]), Oi(o10, "click", e20[14]), Oi(a10, "click", e20[15])], s10 = true); + }, p: function(e21, t11) { + 512 & t11 && n10.value !== e21[9] && Ii(n10, e21[9]); + }, d: function(e21) { + e21 && wi(t10), s10 = false, Qo(c10); + } }; + } + function bB(e20) { + var t10, n10, r10 = e20[1] && vB(e20); + return { c: function() { + r10 && r10.c(), t10 = _i(); + }, m: function(e21, o10) { + r10 && r10.m(e21, o10), ki(e21, t10, o10), n10 = true; + }, p: function(e21, n11) { + var o10 = jo(n11, 1)[0]; + e21[1] ? r10 ? (r10.p(e21, o10), 2 & o10 && wa(r10, 1)) : ((r10 = vB(e21)).c(), wa(r10, 1), r10.m(t10.parentNode, t10)) : r10 && (ba(), xa(r10, 1, 1, function() { + r10 = null; + }), ka()); + }, i: function(e21) { + n10 || (wa(r10), n10 = true); + }, o: function(e21) { + xa(r10), n10 = false; + }, d: function(e21) { + e21 && wi(t10), r10 && r10.d(e21); + } }; + } + function kB(e20) { + e20.select(); + } + function wB(e20, t10, n10) { + var r10, o10, i10 = t10.show, a10 = void 0 !== i10 && i10, s10 = t10.searching, c10 = t10.resultCount, l10 = void 0 === c10 ? 0 : c10, u10 = t10.activeIndex, f10 = void 0 === u10 ? 0 : u10, d10 = t10.showReplace, h10 = void 0 !== d10 && d10, v10 = t10.readOnly, p10 = void 0 !== v10 && v10, m10 = t10.onChange, g10 = void 0 === m10 ? Mf : m10, y10 = t10.onPrevious, b10 = void 0 === y10 ? Mf : y10, k10 = t10.onNext, w10 = void 0 === k10 ? Mf : k10, x10 = t10.onReplace, j10 = void 0 === x10 ? Mf : x10, S10 = t10.onReplaceAll, C10 = void 0 === S10 ? Mf : S10, $10 = t10.onClose, _10 = void 0 === $10 ? Mf : $10, O10 = "", M10 = "", E10 = ""; + function A10() { + n10(0, h10 = !h10 && !p10); + } + function P10() { + p10 || j10(O10, E10); + } + return e20.$$set = function(e21) { + "show" in e21 && n10(1, a10 = e21.show), "searching" in e21 && n10(2, s10 = e21.searching), "resultCount" in e21 && n10(16, l10 = e21.resultCount), "activeIndex" in e21 && n10(3, f10 = e21.activeIndex), "showReplace" in e21 && n10(0, h10 = e21.showReplace), "readOnly" in e21 && n10(4, p10 = e21.readOnly), "onChange" in e21 && n10(17, g10 = e21.onChange), "onPrevious" in e21 && n10(5, b10 = e21.onPrevious), "onNext" in e21 && n10(6, w10 = e21.onNext), "onReplace" in e21 && n10(18, j10 = e21.onReplace), "onReplaceAll" in e21 && n10(19, C10 = e21.onReplaceAll), "onClose" in e21 && n10(7, _10 = e21.onClose); + }, e20.$$.update = function() { + 65536 & e20.$$.dirty && n10(10, r10 = l10 >= cs ? "".concat(999, "+") : String(l10)), 131072 & e20.$$.dirty && n10(20, o10 = Vy(g10, 300)), 1048832 & e20.$$.dirty && o10(O10), 2 & e20.$$.dirty && a10 && "" !== O10 && g10(O10); + }, [h10, a10, s10, f10, p10, b10, w10, _10, O10, E10, r10, A10, function(e21) { + e21.preventDefault(), O10 !== M10 ? (M10 = O10, o10.cancel(), g10(O10)) : w10(); + }, function(e21) { + e21.stopPropagation(); + var t11 = PO(e21); + "Enter" === t11 && (e21.preventDefault(), w10()), "Shift+Enter" === t11 && (e21.preventDefault(), b10()), "Ctrl+Enter" === t11 && (e21.preventDefault(), h10 ? P10() : w10()), "Ctrl+H" === t11 && (e21.preventDefault(), A10()), "Escape" === t11 && (e21.preventDefault(), _10()); + }, P10, function() { + p10 || C10(O10, E10); + }, l10, g10, j10, C10, o10, function() { + O10 = this.value, n10(8, O10); + }, function() { + return w10(); + }, function() { + return b10(); + }, function() { + return _10(); + }, function() { + E10 = this.value, n10(9, E10); + }]; + } + var xB = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, wB, bB, Zo, { show: 1, searching: 2, resultCount: 16, activeIndex: 3, showReplace: 0, readOnly: 4, onChange: 17, onPrevious: 5, onNext: 6, onReplace: 18, onReplaceAll: 19, onClose: 7 }, hB), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var jB = Number.isNaN || function(e20) { + return "number" == typeof e20 && e20 != e20; + }; + function SB(e20, t10) { + if (e20.length !== t10.length) + return false; + for (var n10 = 0; n10 < e20.length; n10++) + if (r10 = e20[n10], o10 = t10[n10], !(r10 === o10 || jB(r10) && jB(o10))) + return false; + var r10, o10; + return true; + } + function CB(e20, t10) { + void 0 === t10 && (t10 = SB); + var n10 = null; + function r10() { + for (var r11 = [], o10 = 0; o10 < arguments.length; o10++) + r11[o10] = arguments[o10]; + if (n10 && n10.lastThis === this && t10(r11, n10.lastArgs)) + return n10.lastResult; + var i10 = e20.apply(this, r11); + return n10 = { lastResult: i10, lastArgs: r11, lastThis: this }, i10; + } + return r10.clear = function() { + n10 = null; + }, r10; + } + var $B = Symbol("path"); + function _B(e20, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1 / 0, r10 = {}; + Array.isArray(e20) && function(e21, t11, n11) { + if (e21.length < t11) + e21.forEach(n11); + else + for (var r11 = t11 > 1 ? (e21.length - 1) / (t11 - 1) : e21.length, o11 = 0; o11 < t11; o11++) { + var i10 = Math.floor(o11 * r11); + n11(e21[i10], i10, e21); + } + }(e20, n10, function(e21) { + Gl(e21) ? OB(e21, r10, t10) : r10[$B] = true; + }); + var o10 = []; + return $B in r10 && o10.push([]), MB(r10, [], o10, t10), o10; + } + function OB(e20, t10, n10) { + for (var r10 in e20) { + var o10 = e20[r10], i10 = t10[r10] || (t10[r10] = {}); + Gl(o10) && n10 ? OB(o10, i10, n10) : void 0 === i10[$B] && (i10[$B] = true); + } + } + function MB(e20, t10, n10, r10) { + for (var o10 in e20) { + var i10 = t10.concat(o10), a10 = e20[o10]; + a10 && true === a10[$B] && n10.push(i10), Rs(a10) && r10 && MB(a10, i10, n10, r10); + } + } + function EB(e20, t10, n10, r10, o10) { + for (var i10 = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 80, a10 = Ts(n10) ? n10.length : 0, s10 = function(e21, t11) { + var n11 = Object.values(e21); + if (_w(n11)) + return t11; + var r11 = function(e23, t12) { + return e23 + t12; + }, o11 = n11.reduce(r11); + return o11 / n11.length; + }(r10, o10), c10 = e20 - i10, l10 = t10 + 2 * i10, u10 = function(e21) { + return r10[e21] || o10; + }, f10 = 0, d10 = 0; d10 < c10 && f10 < a10; ) + d10 += u10(f10), f10++; + f10 > 0 && (d10 -= u10(--f10)); + for (var h10 = f10, v10 = 0; v10 < l10 && h10 < a10; ) + v10 += u10(h10), h10++; + for (var p10 = 0, m10 = h10; m10 < a10; m10++) + p10 += u10(m10); + return { startIndex: f10, endIndex: h10, startHeight: d10, endHeight: p10, averageItemHeight: s10, visibleHeight: v10, visibleItems: Ts(n10) ? n10.slice(f10, h10) : [] }; + } + function AB(e20, t10, n10, r10) { + for (var o10 = PB(e20, t10).rowIndex, i10 = 0, a10 = 0; a10 < o10; a10++) + i10 += n10[a10] || r10; + return i10; + } + function PB(e20, t10) { + var n10, r10 = Co(n10 = e20) || Fo(n10) || Lo(n10) || So(), o10 = r10[0], i10 = r10.slice(1), a10 = parseInt(o10, 10); + return { rowIndex: isNaN(a10) ? -1 : a10, columnIndex: t10.findIndex(function(e21) { + return AE(i10, e21); + }) }; + } + function TB(e20, t10) { + var n10 = e20.rowIndex, r10 = e20.columnIndex; + return [String(n10)].concat(Bo(t10[r10])); + } + function RB(e20, t10) { + var n10 = jo(Lj(e20, function(e21) { + return Jl(e21.path[0]); + }), 2), r10 = n10[0], o10 = n10[1], i10 = dx(Ak(r10, IB), function(e21) { + var n11 = { row: [], columns: {} }; + return e21.forEach(function(e23) { + var r11 = function(e24, t11) { + var n12 = PB(e24.path, t11); + if (-1 !== n12.columnIndex) + return n12.columnIndex; + return -1; + }(e23, t10); + -1 !== r11 ? (void 0 === n11.columns[r11] && (n11.columns[r11] = []), n11.columns[r11].push(e23)) : n11.row.push(e23); + }), n11; + }); + return { root: o10, rows: i10 }; + } + function NB(e20, t10) { + if (t10 && 0 !== t10.length) + return 1 === t10.length ? t10[0] : { path: e20, message: "Multiple validation issues: " + t10.map(function(e21) { + return JO(e21.path) + " " + e21.message; + }).join(", "), severity: Za.warning }; + } + function IB(e20) { + return parseInt(e20.path[0], 10); + } + function DB(e20, t10, n10) { + return t10.some(function(t11) { + return function(e21, t12, n11) { + if (!e21) + return false; + if ("replace" === t12.op) { + var r10 = PB(Xs(t12.path), n11), o10 = r10.rowIndex, i10 = r10.columnIndex, a10 = n11.findIndex(function(t13) { + return Ow(t13, e21.path); + }); + if (-1 !== o10 && -1 !== i10 && i10 !== a10) + return false; + } + return true; + }(e20.sortedColumn, t11, n10); + }) ? Ro(Ro({}, e20), {}, { sortedColumn: null }) : e20; + } + var qB = Da("jsoneditor:actions"); + function zB(e20) { + return BB.apply(this, arguments); + } + function BB() { + return BB = xo(ko().mark(function e20(t10) { + var n10, r10, o10, i10, a10, s10, c10, l10, u10, f10; + return ko().wrap(function(e21) { + for (; ; ) + switch (e21.prev = e21.next) { + case 0: + if (n10 = t10.json, r10 = t10.documentState, o10 = t10.indentation, i10 = t10.readOnly, a10 = t10.parser, s10 = t10.onPatch, !i10 && void 0 !== n10 && r10.selection && BE(r10.selection)) { + e21.next = 3; + break; + } + return e21.abrupt("return"); + case 3: + if (null != (c10 = qE(n10, r10.selection, o10, a10))) { + e21.next = 6; + break; + } + return e21.abrupt("return"); + case 6: + return qB("cut", { selection: r10.selection, clipboard: c10, indentation: o10 }), e21.next = 9, Yz(c10); + case 9: + l10 = dA(n10, r10.selection), u10 = l10.operations, f10 = l10.newSelection, s10(u10, function(e23, t11) { + return { state: Ro(Ro({}, t11), {}, { selection: f10 }) }; + }); + case 11: + case "end": + return e21.stop(); + } + }, e20); + })), BB.apply(this, arguments); + } + function LB(e20) { + return FB.apply(this, arguments); + } + function FB() { + return FB = xo(ko().mark(function e20(t10) { + var n10, r10, o10, i10, a10; + return ko().wrap(function(e21) { + for (; ; ) + switch (e21.prev = e21.next) { + case 0: + if (n10 = t10.json, r10 = t10.documentState, o10 = t10.indentation, i10 = t10.parser, null != (a10 = qE(n10, r10.selection, o10, i10))) { + e21.next = 4; + break; + } + return e21.abrupt("return"); + case 4: + return qB("copy", { clipboard: a10, indentation: o10 }), e21.next = 7, Yz(a10); + case 7: + case "end": + return e21.stop(); + } + }, e20); + })), FB.apply(this, arguments); + } + function VB(e20) { + var t10 = e20.clipboardText, n10 = e20.json, r10 = e20.selection, o10 = e20.readOnly, i10 = e20.parser, a10 = e20.onPatch, s10 = e20.onChangeText, c10 = e20.openRepairModal; + if (!o10) + try { + l10(t10); + } catch (e21) { + c10(t10, function(e23) { + qB("repaired pasted text: ", e23), l10(e23); + }); + } + function l10(e21) { + if (void 0 !== n10) { + var o11 = r10 || RE([], false), c11 = cA(n10, o11, e21, i10); + qB("paste", { pastedText: e21, operations: c11, selectionNonNull: o11 }), a10(c11, function(e23, t11) { + var r11 = t11; + return c11.filter(function(e24) { + return (Ns(e24) || Ds(e24)) && Ql(e24.value); + }).forEach(function(t12) { + var o12 = dc(n10, t12.path); + r11 = lE(e23, r11, o12); + }), { state: r11 }; + }); + } else + qB("paste text", { pastedText: e21 }), s10(t10, function(e23, t11) { + if (e23) { + return { state: lE(e23, t11, []) }; + } + }); + } + } + function HB(e20) { + var t10 = e20.json, n10 = e20.text, r10 = e20.documentState, o10 = e20.keepSelection, i10 = e20.readOnly, a10 = e20.onChange, s10 = e20.onPatch; + if (!i10 && r10.selection) { + var c10 = void 0 !== t10 && (vE(r10.selection) || pE(r10.selection)) ? DE(r10.selection.path, r10.selection.path) : r10.selection; + if (_w(JE(r10.selection))) + qB("remove root", { selection: r10.selection }), a10 && a10({ text: "", json: void 0 }, void 0 !== t10 ? { text: void 0, json: t10 } : { text: n10 || "", json: t10 }, { contentErrors: null, patchResult: null }); + else if (void 0 !== t10) { + var l10 = dA(t10, c10), u10 = l10.operations, f10 = l10.newSelection; + qB("remove", { operations: u10, selection: r10.selection, newSelection: f10 }), s10(u10, function(e21, t11) { + return { state: Ro(Ro({}, t11), {}, { selection: o10 ? r10.selection : f10 }) }; + }); + } + } + } + function WB(e20) { + var t10 = e20.json, n10 = e20.documentState, r10 = e20.columns, o10 = e20.readOnly, i10 = e20.onPatch; + if (!o10 && void 0 !== t10 && n10.selection && BE(n10.selection)) { + var a10 = PB(JE(n10.selection), r10), s10 = a10.rowIndex, c10 = a10.columnIndex; + qB("duplicate row", { rowIndex: s10 }); + var l10 = [String(s10)]; + i10(sA(t10, [l10]), function(e21, n11) { + var o11 = RE(TB({ rowIndex: s10 < t10.length ? s10 + 1 : s10, columnIndex: c10 }, r10), false); + return { state: Ro(Ro({}, n11), {}, { selection: o11 }) }; + }); + } + } + function UB(e20) { + var t10 = e20.json, n10 = e20.documentState, r10 = e20.columns, o10 = e20.readOnly, i10 = e20.onPatch; + if (!o10 && void 0 !== t10 && n10.selection && BE(n10.selection)) { + var a10 = PB(JE(n10.selection), r10).rowIndex; + qB("insert before row", { rowIndex: a10 }), i10(oA(t10, [String(a10)], [{ key: "", value: Rs(t10[0]) ? {} : "" }])); + } + } + function JB(e20) { + var t10 = e20.json, n10 = e20.documentState, r10 = e20.columns, o10 = e20.readOnly, i10 = e20.onPatch; + if (!o10 && void 0 !== t10 && n10.selection && BE(n10.selection)) { + var a10 = PB(JE(n10.selection), r10), s10 = a10.rowIndex, c10 = a10.columnIndex; + qB("insert after row", { rowIndex: s10 }); + var l10 = s10 + 1, u10 = [String(l10)], f10 = [{ key: "", value: Rs(t10[0]) ? {} : "" }]; + i10(l10 < t10.length ? oA(t10, u10, f10) : iA(t10, [], f10), function(e21, t11) { + var n11 = RE(TB({ rowIndex: l10, columnIndex: c10 }, r10), false); + return { state: Ro(Ro({}, t11), {}, { selection: n11 }) }; + }); + } + } + function KB(e20) { + var t10 = e20.json, n10 = e20.documentState, r10 = e20.columns, o10 = e20.readOnly, i10 = e20.onPatch; + if (!o10 && void 0 !== t10 && n10.selection && BE(n10.selection)) { + var a10 = PB(JE(n10.selection), r10), s10 = a10.rowIndex, c10 = a10.columnIndex; + qB("remove row", { rowIndex: s10 }), i10(lA([[String(s10)]]), function(e21, t11) { + var n11 = s10 < e21.length ? s10 : s10 > 0 ? s10 - 1 : void 0, o11 = void 0 !== n11 ? RE(TB({ rowIndex: n11, columnIndex: c10 }, r10), false) : null; + return qB("remove row new selection", { rowIndex: s10, newRowIndex: n11, newSelection: o11 }), { state: Ro(Ro({}, t11), {}, { selection: o11 }) }; + }); + } + } + function GB(e20) { + var t10 = e20.insertType, n10 = e20.selectInside, r10 = e20.refJsonEditor, o10 = e20.json, i10 = e20.selection, a10 = e20.readOnly, s10 = e20.parser, c10 = e20.onPatch, l10 = e20.onReplaceJson; + if (!a10) { + var u10 = function(e21, t11, n11) { + if ("object" === n11) + return {}; + if ("array" === n11) + return []; + if ("structure" === n11 && void 0 !== e21) { + var r11 = Ws(e21, t11 ? wE(t11) : []); + if (Array.isArray(r11) && !_w(r11)) { + var o11 = ck(r11); + return Ql(o11) ? xg(o11, function(e23) { + return Array.isArray(e23) ? [] : Gl(e23) ? void 0 : ""; + }) : ""; + } + } + return ""; + }(o10, i10, t10); + if (void 0 !== o10) { + var f10 = s10.stringify(u10), d10 = cA(o10, i10, f10, s10); + qB("onInsert", { insertType: t10, operations: d10, newValue: u10, data: f10 }); + var h10 = vb(d10.filter(function(e21) { + return "add" === e21.op || "replace" === e21.op; + })); + c10(d10, function(e21, t11) { + if (h10) { + var r11 = dc(e21, h10.path); + if (Ql(u10)) + return { state: Ro(Ro({}, HM(e21, t11, r11, fE)), {}, { selection: n10 ? NE(r11) : t11.selection }) }; + if ("" === u10) { + var o11 = _w(r11) ? null : Ws(e21, Qk(r11)); + return { state: VM(e21, Ro(Ro({}, t11), {}, { selection: Gl(o11) ? TE(r11, true) : RE(r11, true) }), r11) }; + } + } else + ; + }), qB("after patch"), h10 && "" === u10 && eL(function() { + return jO(r10, "", true, tL); + }); + } else { + qB("onInsert", { insertType: t10, newValue: u10 }); + var v10 = []; + l10(u10, function(e21, t11) { + return { state: Ro(Ro({}, lE(e21, t11, v10)), {}, { selection: Ql(u10) ? NE(v10) : RE(v10, true) }) }; + }); + } + } + } + function QB(e20) { + return YB.apply(this, arguments); + } + function YB() { + return YB = xo(ko().mark(function e20(t10) { + var n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10; + return ko().wrap(function(e21) { + for (; ; ) + switch (e21.prev = e21.next) { + case 0: + if (n10 = t10.char, r10 = t10.selectInside, o10 = t10.refJsonEditor, i10 = t10.json, a10 = t10.selection, s10 = t10.readOnly, c10 = t10.parser, l10 = t10.onPatch, u10 = t10.onReplaceJson, f10 = t10.onSelect, !s10) { + e21.next = 3; + break; + } + return e21.abrupt("return"); + case 3: + if (!vE(a10)) { + e21.next = 8; + break; + } + return d10 = !a10.edit, f10(Ro(Ro({}, a10), {}, { edit: true })), eL(function() { + return jO(o10, n10, d10, tL); + }), e21.abrupt("return"); + case 8: + if ("{" !== n10) { + e21.next = 12; + break; + } + GB({ insertType: "object", selectInside: r10, refJsonEditor: o10, json: i10, selection: a10, readOnly: s10, parser: c10, onPatch: l10, onReplaceJson: u10 }), e21.next = 23; + break; + case 12: + if ("[" !== n10) { + e21.next = 16; + break; + } + GB({ insertType: "array", selectInside: r10, refJsonEditor: o10, json: i10, selection: a10, readOnly: s10, parser: c10, onPatch: l10, onReplaceJson: u10 }), e21.next = 23; + break; + case 16: + if (!pE(a10) || void 0 === i10) { + e21.next = 20; + break; + } + Ql(Ws(i10, a10.path)) || (h10 = !a10.edit, f10(Ro(Ro({}, a10), {}, { edit: true })), eL(function() { + return jO(o10, n10, h10, tL); + })), e21.next = 23; + break; + case 20: + return qB("onInsertValueWithCharacter", { char: n10 }), e21.next = 23, XB({ char: n10, refJsonEditor: o10, json: i10, selection: a10, readOnly: s10, parser: c10, onPatch: l10, onReplaceJson: u10 }); + case 23: + case "end": + return e21.stop(); + } + }, e20); + })), YB.apply(this, arguments); + } + function XB(e20) { + return ZB.apply(this, arguments); + } + function ZB() { + return ZB = xo(ko().mark(function e20(t10) { + var n10, r10, o10, i10, a10, s10, c10, l10, u10; + return ko().wrap(function(e21) { + for (; ; ) + switch (e21.prev = e21.next) { + case 0: + if (n10 = t10.char, r10 = t10.refJsonEditor, o10 = t10.json, i10 = t10.selection, a10 = t10.readOnly, s10 = t10.parser, c10 = t10.onPatch, l10 = t10.onReplaceJson, !a10) { + e21.next = 3; + break; + } + return e21.abrupt("return"); + case 3: + GB({ insertType: "value", selectInside: false, refJsonEditor: r10, json: o10, selection: i10, readOnly: a10, parser: s10, onPatch: c10, onReplaceJson: l10 }), u10 = !zE(i10), eL(function() { + return jO(r10, n10, u10, tL); + }); + case 6: + case "end": + return e21.stop(); + } + }, e20); + })), ZB.apply(this, arguments); + } + function eL(e20) { + setTimeout(function() { + return setTimeout(e20); + }); + } + function tL(e20) { + null == e20 || e20.refresh(); + } + function nL(e20) { + mi(e20, "svelte-l2z0i3", '.jse-json-preview.svelte-l2z0i3{flex:1;font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:var(--jse-panel-color-readonly, #b2b2b2);overflow:auto;white-space:pre-wrap;padding:2px;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7);border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}'); + } + function rL(e20) { + var t10, n10; + return { c: function() { + t10 = ji("div"), n10 = Ci(e20[0]), Ai(t10, "class", "jse-json-preview svelte-l2z0i3"); + }, m: function(e21, r10) { + ki(e21, t10, r10), pi(t10, n10); + }, p: function(e21, t11) { + 1 & jo(t11, 1)[0] && Ni(n10, e21[0]); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function oL(e20, t10, n10) { + var r10, o10, i10 = t10.text, a10 = t10.json, s10 = t10.indentation, c10 = t10.parser; + return e20.$$set = function(e21) { + "text" in e21 && n10(1, i10 = e21.text), "json" in e21 && n10(2, a10 = e21.json), "indentation" in e21 && n10(3, s10 = e21.indentation), "parser" in e21 && n10(4, c10 = e21.parser); + }, e20.$$.update = function() { + 6 & e20.$$.dirty && n10(5, r10 = void 0 !== a10 ? { json: a10 } : { text: i10 || "" }), 56 & e20.$$.dirty && n10(0, o10 = tM(Y_(r10, s10, c10), fs)); + }, [o10, i10, a10, s10, c10, r10]; + } + var iL = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, oL, rL, Xo, { text: 1, json: 2, indentation: 3, parser: 4 }, nL), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var aL = vi.window; + function sL(e20) { + mi(e20, "svelte-vx4hzc", '.jse-tree-mode.svelte-vx4hzc.svelte-vx4hzc{flex:1;display:flex;flex-direction:column;position:relative;background:var(--jse-background-color, #fff);min-width:0;min-height:0;font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:var(--jse-text-color, #4d4d4d);line-height:var(--jse-line-height, calc(1em + 4px))}.jse-tree-mode.svelte-vx4hzc .jse-hidden-input-label .jse-hidden-input.svelte-vx4hzc{position:fixed;top:-10px;left:-10px;width:1px;height:1px;padding:0;border:0;outline:none}.jse-tree-mode.svelte-vx4hzc .jse-search-box-container.svelte-vx4hzc{position:relative;height:0;top:var(--jse-padding, 10px);margin-right:calc(var(--jse-padding, 10px) + 20px);margin-left:var(--jse-padding, 10px);text-align:right;z-index:3}.jse-tree-mode.no-main-menu.svelte-vx4hzc.svelte-vx4hzc{border-top:var(--jse-main-border, 1px solid #d7d7d7)}.jse-tree-mode.svelte-vx4hzc .jse-contents.svelte-vx4hzc{border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7);flex:1;overflow:auto;position:relative;padding:2px;display:flex;flex-direction:column}.jse-tree-mode.svelte-vx4hzc .jse-contents.svelte-vx4hzc:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-tree-mode.svelte-vx4hzc .jse-contents .jse-loading-space.svelte-vx4hzc{flex:1}.jse-tree-mode.svelte-vx4hzc .jse-contents .jse-loading.svelte-vx4hzc{flex:2;text-align:center;color:var(--jse-panel-color-readonly, #b2b2b2);box-sizing:border-box;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}'); + } + function cL(e20) { + var t10, n10, r10; + function o10(t11) { + e20[79](t11); + } + var i10 = { json: e20[11], selection: e20[12].selection, readOnly: e20[0], historyState: e20[23], onExpandAll: e20[41], onCollapseAll: e20[42], onUndo: e20[37], onRedo: e20[38], onSort: e20[39], onTransform: e20[40], onContextMenu: e20[46], onCopy: e20[34], onRenderMenu: e20[7] }; + return void 0 !== e20[20] && (i10.showSearch = e20[20]), t10 = new $z({ props: i10 }), na.push(function() { + return Aa(t10, "showSearch", o10); + }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, n11) { + Ta(t10, e21, n11), r10 = true; + }, p: function(e21, r11) { + var o11 = {}; + 2048 & r11[0] && (o11.json = e21[11]), 4096 & r11[0] && (o11.selection = e21[12].selection), 1 & r11[0] && (o11.readOnly = e21[0]), 8388608 & r11[0] && (o11.historyState = e21[23]), 128 & r11[0] && (o11.onRenderMenu = e21[7]), !n10 && 1048576 & r11[0] && (n10 = true, o11.showSearch = e21[20], ua(function() { + return n10 = false; + })), t10.$set(o11); + }, i: function(e21) { + r10 || (wa(t10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function lL(e20) { + var t10, n10; + return t10 = new dB({ props: { json: e20[11], selection: e20[12].selection, onSelect: e20[50], onError: e20[6], pathParser: e20[4] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 2048 & n11[0] && (r10.json = e21[11]), 4096 & n11[0] && (r10.selection = e21[12].selection), 64 & n11[0] && (r10.onError = e21[6]), 16 & n11[0] && (r10.pathParser = e21[4]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function uL(e20) { + var t10; + return { c: function() { + (t10 = ji("div")).innerHTML = '
loading...
', Ai(t10, "class", "jse-contents svelte-vx4hzc"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function fL(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10 = [hL, dL], f10 = []; + function d10(e21, t11) { + return void 0 === e21[11] ? 0 : 1; + } + return o10 = d10(e20), i10 = f10[o10] = u10[o10](e20), { c: function() { + t10 = ji("label"), n10 = ji("input"), r10 = $i(), i10.c(), a10 = _i(), Ai(n10, "type", "text"), n10.readOnly = true, Ai(n10, "tabindex", "-1"), Ai(n10, "class", "jse-hidden-input svelte-vx4hzc"), Ai(t10, "class", "jse-hidden-input-label"); + }, m: function(i11, u11) { + ki(i11, t10, u11), pi(t10, n10), e20[80](n10), ki(i11, r10, u11), f10[o10].m(i11, u11), ki(i11, a10, u11), s10 = true, c10 || (l10 = Oi(n10, "paste", e20[35]), c10 = true); + }, p: function(e21, t11) { + var n11 = o10; + (o10 = d10(e21)) === n11 ? f10[o10].p(e21, t11) : (ba(), xa(f10[n11], 1, 1, function() { + f10[n11] = null; + }), ka(), (i10 = f10[o10]) ? i10.p(e21, t11) : (i10 = f10[o10] = u10[o10](e21)).c(), wa(i10, 1), i10.m(a10.parentNode, a10)); + }, i: function(e21) { + s10 || (wa(i10), s10 = true); + }, o: function(e21) { + xa(i10), s10 = false; + }, d: function(n11) { + n11 && (wi(t10), wi(r10), wi(a10)), e20[80](null), f10[o10].d(n11), c10 = false, l10(); + } }; + } + function dL(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10; + i10 = new xB({ props: { show: e20[20], resultCount: (null === (t10 = e20[18]) || void 0 === t10 || null === (t10 = t10.items) || void 0 === t10 ? void 0 : t10.length) || 0, activeIndex: (null === (n10 = e20[18]) || void 0 === n10 ? void 0 : n10.activeIndex) || 0, showReplace: e20[21], searching: e20[22], readOnly: e20[0], onChange: e20[27], onNext: e20[28], onPrevious: e20[29], onReplace: e20[30], onReplaceAll: e20[31], onClose: e20[32] } }), c10 = new bz({ props: { value: e20[11], path: [], expandedMap: e20[12].expandedMap, enforceStringMap: e20[12].enforceStringMap, visibleSectionsMap: e20[12].visibleSectionsMap, validationErrorsMap: e20[25], searchResultItemsMap: null === (r10 = e20[18]) || void 0 === r10 ? void 0 : r10.itemsMap, selection: e20[12].selection, context: e20[14], onDragSelectionStart: Mf } }); + var v10 = e20[19] && vL(e20), p10 = e20[24] && pL(e20); + return d10 = new JN({ props: { validationErrors: e20[13], selectError: e20[33] } }), { c: function() { + o10 = ji("div"), Pa(i10.$$.fragment), a10 = $i(), s10 = ji("div"), Pa(c10.$$.fragment), l10 = $i(), v10 && v10.c(), u10 = $i(), p10 && p10.c(), f10 = $i(), Pa(d10.$$.fragment), Ai(o10, "class", "jse-search-box-container svelte-vx4hzc"), Ai(s10, "class", "jse-contents svelte-vx4hzc"), Ai(s10, "data-jsoneditor-scrollable-contents", true); + }, m: function(t11, n11) { + ki(t11, o10, n11), Ta(i10, o10, null), ki(t11, a10, n11), ki(t11, s10, n11), Ta(c10, s10, null), e20[84](s10), ki(t11, l10, n11), v10 && v10.m(t11, n11), ki(t11, u10, n11), p10 && p10.m(t11, n11), ki(t11, f10, n11), Ta(d10, t11, n11), h10 = true; + }, p: function(e21, t11) { + var n11, r11, o11, a11 = {}; + 1048576 & t11[0] && (a11.show = e21[20]), 262144 & t11[0] && (a11.resultCount = (null === (n11 = e21[18]) || void 0 === n11 || null === (n11 = n11.items) || void 0 === n11 ? void 0 : n11.length) || 0), 262144 & t11[0] && (a11.activeIndex = (null === (r11 = e21[18]) || void 0 === r11 ? void 0 : r11.activeIndex) || 0), 2097152 & t11[0] && (a11.showReplace = e21[21]), 4194304 & t11[0] && (a11.searching = e21[22]), 1 & t11[0] && (a11.readOnly = e21[0]), i10.$set(a11); + var s11 = {}; + 2048 & t11[0] && (s11.value = e21[11]), 4096 & t11[0] && (s11.expandedMap = e21[12].expandedMap), 4096 & t11[0] && (s11.enforceStringMap = e21[12].enforceStringMap), 4096 & t11[0] && (s11.visibleSectionsMap = e21[12].visibleSectionsMap), 33554432 & t11[0] && (s11.validationErrorsMap = e21[25]), 262144 & t11[0] && (s11.searchResultItemsMap = null === (o11 = e21[18]) || void 0 === o11 ? void 0 : o11.itemsMap), 4096 & t11[0] && (s11.selection = e21[12].selection), 16384 & t11[0] && (s11.context = e21[14]), c10.$set(s11), e21[19] ? v10 ? (v10.p(e21, t11), 524288 & t11[0] && wa(v10, 1)) : ((v10 = vL(e21)).c(), wa(v10, 1), v10.m(u10.parentNode, u10)) : v10 && (ba(), xa(v10, 1, 1, function() { + v10 = null; + }), ka()), e21[24] ? p10 ? (p10.p(e21, t11), 16777216 & t11[0] && wa(p10, 1)) : ((p10 = pL(e21)).c(), wa(p10, 1), p10.m(f10.parentNode, f10)) : p10 && (ba(), xa(p10, 1, 1, function() { + p10 = null; + }), ka()); + var l11 = {}; + 8192 & t11[0] && (l11.validationErrors = e21[13]), d10.$set(l11); + }, i: function(e21) { + h10 || (wa(i10.$$.fragment, e21), wa(c10.$$.fragment, e21), wa(v10), wa(p10), wa(d10.$$.fragment, e21), h10 = true); + }, o: function(e21) { + xa(i10.$$.fragment, e21), xa(c10.$$.fragment, e21), xa(v10), xa(p10), xa(d10.$$.fragment, e21), h10 = false; + }, d: function(t11) { + t11 && (wi(o10), wi(a10), wi(s10), wi(l10), wi(u10), wi(f10)), Ra(i10), Ra(c10), e20[84](null), v10 && v10.d(t11), p10 && p10.d(t11), Ra(d10, t11); + } }; + } + function hL(e20) { + var t10, n10, r10, o10, i10 = [gL, mL], a10 = []; + function s10(e21, t11) { + return "" === e21[17] || void 0 === e21[17] ? 0 : 1; + } + return t10 = s10(e20), n10 = a10[t10] = i10[t10](e20), { c: function() { + n10.c(), r10 = _i(); + }, m: function(e21, n11) { + a10[t10].m(e21, n11), ki(e21, r10, n11), o10 = true; + }, p: function(e21, o11) { + var c10 = t10; + (t10 = s10(e21)) === c10 ? a10[t10].p(e21, o11) : (ba(), xa(a10[c10], 1, 1, function() { + a10[c10] = null; + }), ka(), (n10 = a10[t10]) ? n10.p(e21, o11) : (n10 = a10[t10] = i10[t10](e21)).c(), wa(n10, 1), n10.m(r10.parentNode, r10)); + }, i: function(e21) { + o10 || (wa(n10), o10 = true); + }, o: function(e21) { + xa(n10), o10 = false; + }, d: function(e21) { + e21 && wi(r10), a10[t10].d(e21); + } }; + } + function vL(e20) { + var t10, n10; + return t10 = new IN({ props: { type: "info", message: "You pasted a JSON ".concat(Array.isArray(e20[19].contents) ? "array" : "object", " as text"), actions: [{ icon: uP, text: "Paste as JSON instead", title: "Replace the value with the pasted JSON", onMouseDown: e20[47] }, { text: "Leave as is", title: "Keep the JSON embedded in the value", onClick: e20[48] }] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 524288 & n11[0] && (r10.message = "You pasted a JSON ".concat(Array.isArray(e21[19].contents) ? "array" : "object", " as text")), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function pL(e20) { + var t10, n10; + return t10 = new IN({ props: { type: "success", message: "The loaded JSON document was invalid but is successfully repaired.", actions: e20[0] ? [] : [{ icon: PP, text: "Ok", title: "Accept the repaired document", onClick: e20[8] }, { icon: lP, text: "Repair manually instead", title: "Leave the document unchanged and repair it manually instead", onClick: e20[49] }], onClose: e20[9] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11[0] && (r10.actions = e21[0] ? [] : [{ icon: PP, text: "Ok", title: "Accept the repaired document", onClick: e21[8] }, { icon: lP, text: "Repair manually instead", title: "Leave the document unchanged and repair it manually instead", onClick: e21[49] }]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function mL(e20) { + var t10, n10, r10, o10; + return t10 = new IN({ props: { type: "error", message: "The loaded JSON document is invalid and could not be repaired automatically.", actions: e20[0] ? [] : [{ icon: lP, text: "Repair manually", title: 'Open the document in "code" mode and repair it manually', onClick: e20[49] }] } }), r10 = new iL({ props: { text: e20[17], json: e20[11], indentation: e20[5], parser: e20[3] } }), { c: function() { + Pa(t10.$$.fragment), n10 = $i(), Pa(r10.$$.fragment); + }, m: function(e21, i10) { + Ta(t10, e21, i10), ki(e21, n10, i10), Ta(r10, e21, i10), o10 = true; + }, p: function(e21, n11) { + var o11 = {}; + 1 & n11[0] && (o11.actions = e21[0] ? [] : [{ icon: lP, text: "Repair manually", title: 'Open the document in "code" mode and repair it manually', onClick: e21[49] }]), t10.$set(o11); + var i10 = {}; + 131072 & n11[0] && (i10.text = e21[17]), 2048 & n11[0] && (i10.json = e21[11]), 32 & n11[0] && (i10.indentation = e21[5]), 8 & n11[0] && (i10.parser = e21[3]), r10.$set(i10); + }, i: function(e21) { + o10 || (wa(t10.$$.fragment, e21), wa(r10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), xa(r10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(n10), Ra(t10, e21), Ra(r10, e21); + } }; + } + function gL(e20) { + var t10, n10; + return t10 = new Az({ props: { readOnly: e20[0], onCreateObject: e20[81], onCreateArray: e20[82], onClick: e20[83] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11[0] && (r10.readOnly = e21[0]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function yL(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = e20[1] && cL(e20), u10 = e20[2] && lL(e20), f10 = [fL, uL], d10 = []; + return o10 = function(e21, t11) { + return e21[26] ? 1 : 0; + }(e20), i10 = d10[o10] = f10[o10](e20), { c: function() { + t10 = ji("div"), l10 && l10.c(), n10 = $i(), u10 && u10.c(), r10 = $i(), i10.c(), Ai(t10, "role", "tree"), Ai(t10, "tabindex", "-1"), Ai(t10, "class", "jse-tree-mode svelte-vx4hzc"), zi(t10, "no-main-menu", !e20[1]); + }, m: function(i11, f11) { + ki(i11, t10, f11), l10 && l10.m(t10, null), pi(t10, n10), u10 && u10.m(t10, null), pi(t10, r10), d10[o10].m(t10, null), e20[85](t10), a10 = true, s10 || (c10 = [Oi(aL, "mousedown", e20[51]), Oi(t10, "keydown", e20[43]), Oi(t10, "mousedown", e20[44]), Oi(t10, "contextmenu", e20[45])], s10 = true); + }, p: function(e21, o11) { + e21[1] ? l10 ? (l10.p(e21, o11), 2 & o11[0] && wa(l10, 1)) : ((l10 = cL(e21)).c(), wa(l10, 1), l10.m(t10, n10)) : l10 && (ba(), xa(l10, 1, 1, function() { + l10 = null; + }), ka()), e21[2] ? u10 ? (u10.p(e21, o11), 4 & o11[0] && wa(u10, 1)) : ((u10 = lL(e21)).c(), wa(u10, 1), u10.m(t10, r10)) : u10 && (ba(), xa(u10, 1, 1, function() { + u10 = null; + }), ka()), i10.p(e21, o11), (!a10 || 2 & o11[0]) && zi(t10, "no-main-menu", !e21[1]); + }, i: function(e21) { + a10 || (wa(l10), wa(u10), wa(i10), a10 = true); + }, o: function(e21) { + xa(l10), xa(u10), xa(i10), a10 = false; + }, d: function(n11) { + n11 && wi(t10), l10 && l10.d(), u10 && u10.d(), d10[o10].d(), e20[85](null), s10 = false, Qo(c10); + } }; + } + function bL(e20, t10, n10) { + var r10, o10 = Da("jsoneditor:TreeMode"), i10 = "undefined" == typeof window; + o10("isSSR:", i10); + var a10, s10, c10, l10, u10, f10 = Zi("simple-modal").open, d10 = A$(), h10 = A$(), v10 = Zi("absolute-popup"), p10 = v10.openAbsolutePopup, m10 = v10.closeAbsolutePopup, g10 = false, y10 = bN(), b10 = t10.readOnly, k10 = t10.externalContent, w10 = t10.externalSelection, x10 = t10.mainMenuBar, j10 = t10.navigationBar, S10 = t10.escapeControlCharacters, C10 = t10.escapeUnicodeCharacters, $10 = t10.parser, _10 = t10.parseMemoizeOne, O10 = t10.validator, M10 = t10.validationParser, E10 = t10.pathParser, A10 = t10.indentation, P10 = t10.onError, T8 = t10.onChange, R8 = t10.onChangeMode, N8 = t10.onSelect, I10 = t10.onRenderValue, D10 = t10.onRenderMenu, q10 = t10.onRenderContextMenu, z10 = t10.onClassName, B10 = t10.onFocus, L10 = t10.onBlur, F10 = t10.onSortModal, V10 = t10.onTransformModal, H10 = t10.onJSONEditorModal, W10 = false; + ON({ onMount: Gi, onDestroy: Qi, getWindow: function() { + return SO(c10); + }, hasFocus: function() { + return W10 && document.hasFocus() || CO(c10); + }, onFocus: function() { + g10 = true, B10 && B10(); + }, onBlur: function() { + g10 = false, L10 && L10(); + } }); + var U10 = void 0; + function J10(e21) { + o10("updateSelection", e21); + var t11 = "function" == typeof e21 ? e21(X10.selection) || null : e21; + Ow(t11, X10.selection) || (n10(12, X10 = Ro(Ro({}, X10), {}, { selection: t11 })), N8(t11)); + } + var K10, G10, Q10, Y10 = false, X10 = BM(), Z10 = false, ee2 = false, te2 = false, ne2 = ""; + function re2(e21) { + return oe2.apply(this, arguments); + } + function oe2() { + return oe2 = xo(ko().mark(function e21(t11) { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return o10("search text updated", t11), n10(78, ne2 = t11), e23.next = 4, ca(); + case 4: + return e23.next = 6, le2(); + case 6: + case "end": + return e23.stop(); + } + }, e21); + })), oe2.apply(this, arguments); + } + function ie2() { + return (ie2 = xo(ko().mark(function e21() { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return n10(18, K10 = K10 ? pA(K10) : void 0), e23.next = 3, le2(); + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function ae2() { + return (ae2 = xo(ko().mark(function e21() { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return n10(18, K10 = K10 ? mA(K10) : void 0), e23.next = 3, le2(); + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function se2() { + return (se2 = xo(ko().mark(function e21(t11, n11) { + var r11, i11, a11, s11, c11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (i11 = null === (r11 = K10) || void 0 === r11 ? void 0 : r11.activeItem, o10("handleReplace", { replacementText: n11, activeItem: i11 }), i11 && void 0 !== l10) { + e23.next = 4; + break; + } + return e23.abrupt("return"); + case 4: + return a11 = wA(l10, X10, n11, i11, $10), s11 = a11.operations, c11 = a11.newSelection, ot2(s11, function(e24, t12) { + return { state: Ro(Ro({}, t12), {}, { selection: c11 }) }; + }), e23.next = 8, ca(); + case 8: + return e23.next = 10, le2(); + case 10: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function ce2() { + return ce2 = xo(ko().mark(function e21(t11, n11) { + var r11, i11, a11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return o10("handleReplaceAll", { text: t11, replacementText: n11 }), r11 = xA(l10, X10, t11, n11, $10), i11 = r11.operations, a11 = r11.newSelection, ot2(i11, function(e24, t12) { + return { state: Ro(Ro({}, t12), {}, { selection: a11 }) }; + }), e23.next = 5, ca(); + case 5: + return e23.next = 7, le2(); + case 7: + case "end": + return e23.stop(); + } + }, e21); + })), ce2.apply(this, arguments); + } + function le2() { + return ue2.apply(this, arguments); + } + function ue2() { + return (ue2 = xo(ko().mark(function e21() { + var t11, r11, i11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (r11 = null === (t11 = K10) || void 0 === t11 ? void 0 : t11.activeItem, o10("focusActiveSearchResult", K10), !r11 || void 0 === l10) { + e23.next = 9; + break; + } + return i11 = r11.path, n10(12, X10 = Ro(Ro({}, VM(l10, X10, i11)), {}, { selection: null })), e23.next = 7, ca(); + case 7: + return e23.next = 9, Ze2(i11); + case 9: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + var fe2 = xN({ onChange: function(e21) { + n10(23, de2 = e21); + } }), de2 = fe2.getState(); + var he2, ve2, pe2 = UC(function(e21, t11) { + if ("" === e21) + return o10("clearing search result"), void (void 0 !== K10 && n10(18, K10 = void 0)); + n10(22, te2 = true), setTimeout(function() { + o10("searching...", e21); + var r11 = gA(e21, t11, cs); + n10(18, K10 = function(e23, t12, n11) { + var r12 = null != n11 && n11.activeItem ? jA(n11.activeItem) : void 0, o11 = t12.findIndex(function(e24) { + return Ow(r12, jA(e24)); + }), i11 = -1 !== o11 ? o11 : void 0 !== (null == n11 ? void 0 : n11.activeIndex) && (null == n11 ? void 0 : n11.activeIndex) < t12.length ? null == n11 ? void 0 : n11.activeIndex : t12.length > 0 ? 0 : -1, a11 = t12.map(function(e24, t13) { + return Ro(Ro({}, e24), {}, { active: t13 === i11 }); + }), s11 = a11[i11]; + return { items: a11, itemsMap: Ak(a11, function(e24) { + return Zs(e24.path); + }), activeItem: s11, activeIndex: i11 }; + }(0, r11, K10)), n10(22, te2 = false); + }); + }, 300), me2 = false, ge2 = [], ye2 = CB(CN); + function be2(e21, t11, r11, i11) { + jN(function() { + var a11; + try { + a11 = ye2(e21, t11, r11, i11); + } catch (e23) { + a11 = [{ path: [], message: "Failed to validate: " + e23.message, severity: Za.warning }]; + } + Ow(a11, ge2) || (o10("validationErrors changed:", a11), n10(13, ge2 = a11)); + }, function(e23) { + return o10("validationErrors updated in ".concat(e23, " ms")); + }); + } + function ke2() { + return o10("validate"), U10 ? { parseError: U10, isRepairable: false } : (be2(l10, O10, $10, M10), _w(ge2) ? null : { validationErrors: ge2 }); + } + function we2() { + return l10; + } + function xe2() { + return X10; + } + function je2(e21) { + K_(e21) ? function(e23) { + if (void 0 === e23) + return; + var t11 = !Ow(l10, e23); + if (o10("update external json", { isChanged: t11, currentlyText: void 0 === l10 }), !t11) + return; + var r11 = { json: l10, text: u10 }, i11 = X10, a11 = l10, s11 = u10, c11 = me2; + n10(11, l10 = e23), Se2(l10), n10(17, u10 = void 0), n10(24, me2 = false), U10 = void 0, Ce2(l10), $e2({ previousJson: a11, previousState: i11, previousText: s11, previousTextIsRepaired: c11 }), rt2(r11, null); + }(e21.json) : J_(e21) && function(e23) { + if (void 0 === e23 || K_(k10)) + return; + var t11 = e23 !== u10; + if (o10("update external text", { isChanged: t11 }), !t11) + return; + var r11 = { json: l10, text: u10 }, i11 = l10, a11 = X10, s11 = u10, c11 = me2; + try { + n10(11, l10 = _10(e23)), Se2(l10), n10(17, u10 = e23), n10(24, me2 = false), U10 = void 0; + } catch (t12) { + try { + n10(11, l10 = _10(Hl(e23))), Se2(l10), n10(17, u10 = e23), n10(24, me2 = true), U10 = void 0, Ce2(l10); + } catch (e24) { + n10(11, l10 = void 0), n10(17, u10 = k10.text), n10(24, me2 = false), U10 = void 0 !== u10 && "" !== u10 ? H_(u10, t12.message || String(t12)) : void 0; + } + } + Ce2(l10), $e2({ previousJson: i11, previousState: a11, previousText: s11, previousTextIsRepaired: c11 }), rt2(r11, null); + }(e21.text); + } + function Se2(e21) { + Y10 || (Y10 = true, n10(12, X10 = HM(e21, X10, [], function(e23) { + return X_({ json: e23 }, ms) ? uE : fE; + }(e21)))); + } + function Ce2(e21) { + X10.selection && (Ys(e21, KE(X10.selection)) && Ys(e21, JE(X10.selection)) || (o10("clearing selection: path does not exist anymore", X10.selection), n10(12, X10 = Ro(Ro({}, X10), {}, { selection: $E(e21, X10) })))); + } + function $e2(e21) { + var t11 = e21.previousJson, n11 = e21.previousState, r11 = e21.previousText, o11 = e21.previousTextIsRepaired; + void 0 === t11 && void 0 === r11 || (void 0 !== l10 ? void 0 !== t11 ? fe2.add({ undo: { patch: [{ op: "replace", path: "", value: t11 }], state: PE(n11), json: void 0, text: r11, textIsRepaired: o11 }, redo: { patch: [{ op: "replace", path: "", value: l10 }], state: PE(X10), json: void 0, text: u10, textIsRepaired: me2 } }) : fe2.add({ undo: { patch: void 0, json: void 0, text: r11, state: PE(n11), textIsRepaired: o11 }, redo: { patch: void 0, json: l10, state: PE(X10), text: u10, textIsRepaired: me2 } }) : void 0 !== t11 && fe2.add({ undo: { patch: void 0, json: t11, state: PE(n11), text: r11, textIsRepaired: o11 }, redo: { patch: void 0, json: void 0, text: u10, textIsRepaired: me2, state: PE(X10) } })); + } + function _e2(e21, t11) { + if (o10("patch", e21, t11), void 0 === l10) + throw new Error("Cannot apply patch: no JSON"); + var r11 = { json: l10, text: u10 }, i11 = l10, a11 = X10, s11 = u10, c11 = me2, f11 = hA(l10, e21), d11 = JM(l10, X10, e21), h11 = _E(l10, e21), v11 = function(e23, t12) { + return t12 || !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2] ? Ro(Ro({}, e23), {}, { selection: t12 }) : e23; + }(d11.documentState, h11, false); + o10("patch updatedSelection", h11); + var p11 = "function" == typeof t11 ? t11(d11.json, v11) : void 0; + n10(11, l10 = p11 && void 0 !== p11.json ? p11.json : d11.json); + var m11 = p11 && void 0 !== p11.state ? p11.state : v11; + n10(12, X10 = m11), n10(17, u10 = void 0), n10(24, me2 = false), n10(19, Q10 = void 0), U10 = void 0, Ce2(l10), fe2.add({ undo: { patch: f11, json: void 0, text: s11, state: PE(a11), textIsRepaired: c11 }, redo: { patch: e21, json: void 0, state: PE(m11), text: u10, textIsRepaired: me2 } }); + var g11 = { json: l10, previousJson: i11, undo: f11, redo: e21 }; + return rt2(r11, g11), g11; + } + function Oe2() { + !b10 && X10.selection && J10(TE(JE(X10.selection), true)); + } + function Me2() { + if (!b10 && X10.selection) { + var e21 = JE(X10.selection), t11 = Ws(l10, e21); + Ql(t11) ? function(e23, t12) { + o10("openJSONEditorModal", { path: e23, value: t12 }), W10 = true, H10({ content: { json: t12 }, path: e23, onPatch: ve2.onPatch, onClose: function() { + W10 = false, vt2(); + } }); + }(e21, t11) : J10(RE(e21, true)); + } + } + function Ee2() { + if (!b10 && pE(X10.selection)) { + var e21 = JE(X10.selection), t11 = Zs(e21), n11 = Ws(l10, e21), r11 = !oE(n11, X10.enforceStringMap, t11, $10), i11 = r11 ? String(n11) : ru(String(n11), $10); + o10("handleToggleEnforceString", { enforceString: r11, value: n11, updatedValue: i11 }), ot2([{ op: "replace", path: t11, value: i11 }], function(e23, n12) { + return { state: UM(n12, t11, r11) }; + }); + } + } + function Ae2() { + return Pe2.apply(this, arguments); + } + function Pe2() { + return Pe2 = xo(ko().mark(function e21() { + var t11, n11 = arguments; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return t11 = !(n11.length > 0 && void 0 !== n11[0]) || n11[0], e23.next = 3, zB({ json: l10, documentState: X10, indentation: t11 ? A10 : void 0, readOnly: b10, parser: $10, onPatch: ot2 }); + case 3: + case "end": + return e23.stop(); + } + }, e21); + })), Pe2.apply(this, arguments); + } + function Te2() { + return Re2.apply(this, arguments); + } + function Re2() { + return Re2 = xo(ko().mark(function e21() { + var t11, n11 = arguments; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (t11 = !(n11.length > 0 && void 0 !== n11[0]) || n11[0], void 0 !== l10) { + e23.next = 3; + break; + } + return e23.abrupt("return"); + case 3: + return e23.next = 5, LB({ json: l10, documentState: X10, indentation: t11 ? A10 : void 0, parser: $10 }); + case 5: + case "end": + return e23.stop(); + } + }, e21); + })), Re2.apply(this, arguments); + } + function Ne2() { + f10(nI, {}, Ro(Ro({}, gs), {}, { styleWindow: { width: "450px" } }), { onClose: function() { + return vt2(); + } }); + } + function Ie2(e21, t11) { + f10(HI, { text: e21, onParse: function(e23) { + return L_(e23, function(e24) { + return z_(e24, $10); + }); + }, onRepair: F_, onApply: t11 }, Ro(Ro({}, gs), {}, { styleWindow: { width: "600px", height: "500px" }, styleContent: { padding: 0, height: "100%" } }), { onClose: function() { + return vt2(); + } }); + } + function De2() { + HB({ json: l10, text: u10, documentState: X10, keepSelection: false, readOnly: b10, onChange: T8, onPatch: ot2 }); + } + function qe2() { + !b10 && void 0 !== l10 && X10.selection && BE(X10.selection) && !_w(JE(X10.selection)) && (o10("duplicate", { selection: X10.selection }), ot2(sA(l10, kE(l10, X10.selection)))); + } + function ze2() { + if (!b10 && X10.selection && (mE(X10.selection) || pE(X10.selection)) && !_w(JE(X10.selection))) { + o10("extract", { selection: X10.selection }); + var e21 = function(e23, t11) { + if (pE(t11)) + return [{ op: "move", from: Zs(t11.path), path: "" }]; + if (!mE(t11)) + throw new Error("Cannot create extract operations: parent must be an Object or Array"); + var n11 = Ws(e23, Qk(t11.focusPath)); + if (Ts(n11)) + return [{ op: "replace", path: "", value: kE(e23, t11).map(function(e24) { + var t12 = Ul(vb(e24)); + return n11[t12]; + }) }]; + if (Rs(n11)) { + var r11 = {}; + return kE(e23, t11).forEach(function(e24) { + var t12 = String(vb(e24)); + r11[t12] = n11[t12]; + }), [{ op: "replace", path: "", value: r11 }]; + } + throw new Error("Cannot extract: unsupported type of selection " + JSON.stringify(t11)); + }(l10, X10.selection); + ot2(e21, function(e23, t11) { + if (Ql(e23)) { + return { state: lE(e23, t11, []) }; + } + }); + } + } + function Be2(e21) { + void 0 !== l10 && GB({ insertType: e21, selectInside: true, refJsonEditor: c10, json: l10, selection: X10.selection, readOnly: b10, parser: $10, onPatch: ot2, onReplaceJson: it2 }); + } + function Le2(e21) { + vE(X10.selection) && J10(RE(X10.selection.path, false)), X10.selection || J10($E(l10, X10)), Be2(e21); + } + function Fe2(e21) { + if (!b10 && X10.selection) + if (LE(X10.selection)) + try { + var t11 = KE(X10.selection), n11 = Ws(l10, t11), r11 = function(e23, t12, n12) { + if ("array" === t12) { + if (Array.isArray(e23)) + return e23; + if (Gl(e23)) + return D_(e23); + if ("string" == typeof e23) + try { + var r12 = n12.parse(e23); + if (Array.isArray(r12)) + return r12; + if (Gl(r12)) + return D_(r12); + } catch (t13) { + return [e23]; + } + return [e23]; + } + if ("object" === t12) { + if (Array.isArray(e23)) + return I_(e23); + if (Gl(e23)) + return e23; + if ("string" == typeof e23) + try { + var o11 = n12.parse(e23); + if (Gl(o11)) + return o11; + if (Array.isArray(o11)) + return I_(o11); + } catch (t13) { + return { value: e23 }; + } + return { value: e23 }; + } + if ("value" === t12) + return Ql(e23) ? n12.stringify(e23) : e23; + throw new Error("Cannot convert ".concat(eu(e23, n12), " to ").concat(t12)); + }(n11, e21, $10); + if (r11 === n11) + return; + var i11 = [{ op: "replace", path: Zs(t11), value: r11 }]; + o10("handleConvert", { selection: X10.selection, path: t11, type: e21, operations: i11 }), ot2(i11, function(e23, t12) { + return { state: X10.selection ? lE(e23, t12, JE(X10.selection)) : X10 }; + }); + } catch (e23) { + P10(e23); + } + else + P10(new Error("Cannot convert current selection to ".concat(e21))); + } + function Ve2() { + if (X10.selection) { + var e21 = SE(l10, X10, false), t11 = Qk(JE(X10.selection)); + e21 && !_w(JE(e21)) && Ow(t11, Qk(JE(e21))) ? J10(IE(JE(e21))) : J10(NE(t11)), o10("insert before", { selection: X10.selection, selectionBefore: e21, parentPath: t11 }), ca().then(function() { + return dt2(); + }); + } + } + function He2() { + if (X10.selection) { + var e21 = jE(l10, X10.selection); + o10("insert after", e21), J10(IE(e21)), ca().then(function() { + return dt2(); + }); + } + } + function We2(e21) { + return Ue2.apply(this, arguments); + } + function Ue2() { + return (Ue2 = xo(ko().mark(function e21(t11) { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return e23.next = 2, QB({ char: t11, selectInside: true, refJsonEditor: c10, json: l10, selection: X10.selection, readOnly: b10, parser: $10, onPatch: ot2, onReplaceJson: it2, onSelect: J10 }); + case 2: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function Je2() { + if (!b10 && fe2.getState().canUndo) { + var e21 = fe2.undo(); + if (e21) { + var t11 = { json: l10, text: u10 }; + n10(11, l10 = e21.undo.patch ? rc(l10, e21.undo.patch) : e21.undo.json), n10(12, X10 = e21.undo.state), n10(17, u10 = e21.undo.text), n10(24, me2 = e21.undo.textIsRepaired), U10 = void 0, o10("undo", { item: e21, json: l10, documentState: X10 }), rt2(t11, e21.undo.patch && e21.redo.patch ? { json: l10, previousJson: t11.json, redo: e21.undo.patch, undo: e21.redo.patch } : null), vt2(), X10.selection && Ze2(JE(X10.selection), false); + } + } + } + function Ke2() { + if (!b10 && fe2.getState().canRedo) { + var e21 = fe2.redo(); + if (e21) { + var t11 = { json: l10, text: u10 }; + n10(11, l10 = e21.redo.patch ? rc(l10, e21.redo.patch) : e21.redo.json), n10(12, X10 = e21.redo.state), n10(17, u10 = e21.redo.text), n10(24, me2 = e21.redo.textIsRepaired), U10 = void 0, o10("redo", { item: e21, json: l10, documentState: X10 }), rt2(t11, e21.undo.patch && e21.redo.patch ? { json: l10, previousJson: t11.json, redo: e21.redo.patch, undo: e21.undo.patch } : null), vt2(), X10.selection && Ze2(JE(X10.selection), false); + } + } + } + function Ge2(e21) { + var t11; + b10 || void 0 === l10 || (W10 = true, F10({ id: d10, json: l10, rootPath: e21, onSort: (t11 = xo(ko().mark(function t12(n11) { + var r11; + return ko().wrap(function(t13) { + for (; ; ) + switch (t13.prev = t13.next) { + case 0: + r11 = n11.operations, o10("onSort", e21, r11), ot2(r11, function(t14, n12) { + return { state: Ro(Ro({}, lE(t14, n12, e21)), {}, { selection: RE(e21, false) }) }; + }); + case 3: + case "end": + return t13.stop(); + } + }, t12); + })), function(e23) { + return t11.apply(this, arguments); + }), onClose: function() { + W10 = false, vt2(); + } })); + } + function Qe2() { + X10.selection && Ge2(EE(l10, X10.selection)); + } + function Ye2(e21) { + if (void 0 !== l10) { + var t11 = e21.id, n11 = e21.onTransform, r11 = e21.onClose, i11 = e21.rootPath || []; + W10 = true, V10({ id: t11 || h10, json: l10, rootPath: i11, onTransform: function(e23) { + n11 ? n11({ operations: e23, json: l10, transformedJson: rc(l10, e23) }) : (o10("onTransform", i11, e23), ot2(e23, function(e24, t12) { + return { state: Ro(Ro({}, lE(e24, t12, i11)), {}, { selection: RE(i11, false) }) }; + })); + }, onClose: function() { + W10 = false, vt2(), r11 && r11(); + } }); + } + } + function Xe2() { + X10.selection && Ye2({ rootPath: EE(l10, X10.selection) }); + } + function Ze2(e21) { + return et2.apply(this, arguments); + } + function et2() { + return et2 = xo(ko().mark(function e21(t11) { + var r11, i11, s11, c11, u11, f11 = arguments; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return r11 = !(f11.length > 1 && void 0 !== f11[1]) || f11[1], n10(12, X10 = VM(l10, X10, t11)), e23.next = 4, ca(); + case 4: + if (i11 = tt2(t11), o10("scrollTo", { path: t11, elem: i11, refContents: a10 }), i11 && a10) { + e23.next = 8; + break; + } + return e23.abrupt("return", Promise.resolve()); + case 8: + if (s11 = a10.getBoundingClientRect(), c11 = i11.getBoundingClientRect(), r11) { + e23.next = 13; + break; + } + if (!(c11.bottom > s11.top && c11.top < s11.bottom)) { + e23.next = 13; + break; + } + return e23.abrupt("return", Promise.resolve()); + case 13: + return u11 = -s11.height / 4, e23.abrupt("return", new Promise(function(e24) { + y10(i11, { container: a10, offset: u11, duration: 300, callback: function() { + return e24(); + } }); + })); + case 15: + case "end": + return e23.stop(); + } + }, e21); + })), et2.apply(this, arguments); + } + function tt2(e21) { + return a10 ? a10.querySelector('div[data-path="'.concat(OO(e21), '"]')) : null; + } + function nt2(e21) { + var t11 = tt2(e21); + if (t11 && a10) { + var n11 = a10.getBoundingClientRect(), r11 = t11.getBoundingClientRect(), o11 = Ql(Ws(l10, e21)) ? 20 : r11.height; + r11.top < n11.top + 20 ? y10(t11, { container: a10, offset: -20, duration: 0 }) : r11.top + o11 > n11.bottom - 20 && y10(t11, { container: a10, offset: -(n11.height - o11 - 20), duration: 0 }); + } + } + function rt2(e21, t11) { + var n11; + if (void 0 !== e21.json || void 0 !== (null == e21 ? void 0 : e21.text)) { + if (void 0 !== u10) + null === (n11 = T8) || void 0 === n11 || n11({ text: u10, json: void 0 }, e21, { contentErrors: ke2(), patchResult: t11 }); + else if (void 0 !== l10) { + var r11; + null === (r11 = T8) || void 0 === r11 || r11({ text: void 0, json: l10 }, e21, { contentErrors: ke2(), patchResult: t11 }); + } + } + } + function ot2(e21, t11) { + return b10 ? { json: l10, previousJson: l10, undo: [], redo: [] } : (o10("handlePatch", e21, t11), _e2(e21, t11)); + } + function it2(e21, t11) { + var r11 = X10, o11 = l10, i11 = u10, a11 = { json: l10, text: u10 }, s11 = me2, c11 = HM(l10, X10, [], uE), f11 = "function" == typeof t11 ? t11(e21, c11) : void 0; + n10(11, l10 = f11 && void 0 !== f11.json ? f11.json : e21), n10(12, X10 = f11 && void 0 !== f11.state ? f11.state : c11), n10(17, u10 = void 0), n10(24, me2 = false), U10 = void 0, Ce2(l10), $e2({ previousJson: o11, previousState: r11, previousText: i11, previousTextIsRepaired: s11 }); + rt2(a11, null); + } + function at2(e21, t11) { + o10("handleChangeText"); + var r11 = X10, i11 = l10, a11 = u10, s11 = { json: l10, text: u10 }, c11 = me2; + try { + n10(11, l10 = _10(e21)), n10(12, X10 = HM(l10, X10, [], uE)), n10(17, u10 = void 0), n10(24, me2 = false), U10 = void 0; + } catch (t12) { + try { + n10(11, l10 = _10(Hl(e21))), n10(12, X10 = HM(l10, X10, [], uE)), n10(17, u10 = e21), n10(24, me2 = true), U10 = void 0; + } catch (r12) { + n10(11, l10 = void 0), n10(12, X10 = BM({ json: l10, expand: uE })), n10(17, u10 = e21), n10(24, me2 = false), U10 = "" !== u10 ? H_(u10, t12.message || String(t12)) : void 0; + } + } + if ("function" == typeof t11) { + var f11 = t11(l10, X10); + n10(11, l10 = f11 && f11.json ? f11.json : l10), n10(12, X10 = f11 && f11.state ? f11.state : X10); + } + Ce2(l10), $e2({ previousJson: i11, previousState: r11, previousText: a11, previousTextIsRepaired: c11 }); + rt2(s11, null); + } + function st2(e21, t11) { + var r11 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; + o10("expand", { path: e21, expanded: t11, recursive: r11 }), n10(12, X10 = t11 ? r11 ? HM(l10, X10, e21, fE) : function(e23, t12) { + return Ro(Ro({}, e23), {}, { expandedMap: Ro(Ro({}, e23.expandedMap), {}, qo({}, Zs(t12), true)) }); + }(X10, e21) : WM(X10, e21)), X10.selection && !t11 && function(e23, t12) { + return AE(JE(e23), t12) && (JE(e23).length > t12.length || hE(e23)); + }(X10.selection, e21) && J10(null), vt2(); + } + function ct2(e21) { + o10("openFind", { findAndReplace: e21 }), n10(20, Z10 = false), n10(21, ee2 = false), ca().then(function() { + n10(20, Z10 = true), n10(21, ee2 = e21); + }); + } + function lt2(e21, t11) { + o10("handleExpandSection", e21, t11); + var r11 = Zs(e21); + n10(12, X10 = function(e23, t12, n11, r12) { + return Ro(Ro({}, t12), {}, { visibleSectionsMap: Ro(Ro({}, t12.visibleSectionsMap), {}, qo({}, n11, IM(LM(t12, n11).concat(r12)))) }); + }(0, X10, r11, t11)); + } + function ut2(e21) { + o10("pasted json as text", e21), n10(19, Q10 = e21); + } + function ft2(e21) { + var t11 = e21.anchor, n11 = e21.left, r11 = e21.top, o11 = e21.width, i11 = e21.height, a11 = e21.offsetTop, s11 = e21.offsetLeft, c11 = e21.showTip; + W10 = true; + var u11 = p10(LD, { json: l10, documentState: X10, parser: $10, showTip: c11, onEditKey: Oe2, onEditValue: Me2, onToggleEnforceString: Ee2, onCut: Ae2, onCopy: Te2, onPaste: Ne2, onRemove: De2, onDuplicate: qe2, onExtract: ze2, onInsertBefore: Ve2, onInsert: Le2, onConvert: Fe2, onInsertAfter: He2, onSort: Qe2, onTransform: Xe2, onRenderContextMenu: q10, onCloseContextMenu: function() { + m10(u11), vt2(); + } }, { left: n11, top: r11, offsetTop: a11, offsetLeft: s11, width: o11, height: i11, anchor: t11, closeOnOuterClick: true, onClose: function() { + W10 = false, vt2(); + } }); + } + function dt2(e21) { + if (!b10 && !zE(X10.selection)) { + if (e21 && (e21.stopPropagation(), e21.preventDefault()), e21 && "contextmenu" === e21.type && e21.target !== s10) + ft2({ left: e21.clientX, top: e21.clientY, width: Ms, height: Os, showTip: false }); + else { + var t11, n11 = null === (t11 = a10) || void 0 === t11 ? void 0 : t11.querySelector(".jse-context-menu-pointer.jse-selected"); + if (n11) + ft2({ anchor: n11, offsetTop: 2, width: Ms, height: Os, showTip: false }); + else { + var r11, o11 = null === (r11 = a10) || void 0 === r11 ? void 0 : r11.getBoundingClientRect(); + o11 && ft2({ top: o11.top + 2, left: o11.left + 2, width: Ms, height: Os, showTip: false }); + } + } + return false; + } + } + function ht2() { + return (ht2 = xo(ko().mark(function e21() { + var t11, r11, i11, s11, c11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (o10("apply pasted json", Q10), Q10) { + e23.next = 3; + break; + } + return e23.abrupt("return"); + case 3: + i11 = (r11 = Q10).path, s11 = r11.contents, n10(19, Q10 = void 0), AO(c11 = (null === (t11 = a10) || void 0 === t11 ? void 0 : t11.querySelector(".jse-editable-div")) || null) && c11.cancel(), ot2([{ op: "replace", path: Zs(i11), value: s11 }], function(e24, t12) { + return { state: lE(e24, t12, i11) }; + }), setTimeout(vt2); + case 10: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function vt2() { + o10("focus"), s10 && (s10.focus(), s10.select()); + } + function pt2(e21) { + return function(e23, t11, n11) { + var r11 = Qk(n11), o11 = [vb(n11)], i11 = Ws(e23, r11), a11 = i11 ? cE(i11, t11, o11) : void 0; + return a11 ? RE(r11.concat(a11), false) : IE(n11); + }(l10, X10, e21); + } + function mt2(e21) { + r10 && r10.onDrag(e21); + } + function gt2() { + r10 && r10.onDragEnd(); + } + return e20.$$set = function(e21) { + "readOnly" in e21 && n10(0, b10 = e21.readOnly), "externalContent" in e21 && n10(52, k10 = e21.externalContent), "externalSelection" in e21 && n10(53, w10 = e21.externalSelection), "mainMenuBar" in e21 && n10(1, x10 = e21.mainMenuBar), "navigationBar" in e21 && n10(2, j10 = e21.navigationBar), "escapeControlCharacters" in e21 && n10(54, S10 = e21.escapeControlCharacters), "escapeUnicodeCharacters" in e21 && n10(55, C10 = e21.escapeUnicodeCharacters), "parser" in e21 && n10(3, $10 = e21.parser), "parseMemoizeOne" in e21 && n10(56, _10 = e21.parseMemoizeOne), "validator" in e21 && n10(57, O10 = e21.validator), "validationParser" in e21 && n10(58, M10 = e21.validationParser), "pathParser" in e21 && n10(4, E10 = e21.pathParser), "indentation" in e21 && n10(5, A10 = e21.indentation), "onError" in e21 && n10(6, P10 = e21.onError), "onChange" in e21 && n10(59, T8 = e21.onChange), "onChangeMode" in e21 && n10(60, R8 = e21.onChangeMode), "onSelect" in e21 && n10(61, N8 = e21.onSelect), "onRenderValue" in e21 && n10(62, I10 = e21.onRenderValue), "onRenderMenu" in e21 && n10(7, D10 = e21.onRenderMenu), "onRenderContextMenu" in e21 && n10(63, q10 = e21.onRenderContextMenu), "onClassName" in e21 && n10(64, z10 = e21.onClassName), "onFocus" in e21 && n10(65, B10 = e21.onFocus), "onBlur" in e21 && n10(66, L10 = e21.onBlur), "onSortModal" in e21 && n10(67, F10 = e21.onSortModal), "onTransformModal" in e21 && n10(68, V10 = e21.onTransformModal), "onJSONEditorModal" in e21 && n10(69, H10 = e21.onJSONEditorModal); + }, e20.$$.update = function() { + 25165824 & e20.$$.dirty[1] && n10(77, G10 = aO({ escapeControlCharacters: S10, escapeUnicodeCharacters: C10 })), 4096 & e20.$$.dirty[0] && o10("selection", X10.selection), 2097152 & e20.$$.dirty[1] && je2(k10), 4194304 & e20.$$.dirty[1] && function(e21) { + Ow(X10.selection, e21) || (o10("applyExternalSelection", e21), (yE(e21) || null === e21) && J10(e21)); + }(w10), 2048 & e20.$$.dirty[0] | 65536 & e20.$$.dirty[2] && pe2(ne2, l10), 2056 & e20.$$.dirty[0] | 201326592 & e20.$$.dirty[1] && be2(l10, O10, $10, M10), 8192 & e20.$$.dirty[0] && n10(25, he2 = function(e21) { + var t11 = {}; + return e21.forEach(function(e23) { + t11[Zs(e23.path)] = e23; + }), e21.forEach(function(e23) { + for (var n11 = e23.path; n11.length > 0; ) { + var r11 = Zs(n11 = Qk(n11)); + r11 in t11 || (t11[r11] = { isChildError: true, path: n11, message: "Contains invalid data", severity: Za.warning }); + } + }), t11; + }(ge2)), 1024 & e20.$$.dirty[0] && (r10 = a10 ? function(e21) { + var t11, n11; + function r11(e23) { + return e23 < 20 ? is : e23 < 50 ? as : ss; + } + function o11() { + if (e21) { + var n12 = (t11 || 0) * (os / 1e3); + e21.scrollTop += n12; + } + } + function i11(e23) { + n11 && e23 === t11 || (a11(), gN("startAutoScroll", e23), t11 = e23, n11 = setInterval(o11, os)); + } + function a11() { + n11 && (gN("stopAutoScroll"), clearInterval(n11), n11 = void 0, t11 = void 0); + } + return gN("createAutoScrollHandler", e21), { onDrag: function(t12) { + if (e21) { + var n12 = t12.clientY, o12 = e21.getBoundingClientRect(), s11 = o12.top, c11 = o12.bottom; + n12 < s11 ? i11(-r11(s11 - n12)) : n12 > c11 ? i11(r11(n12 - c11)) : a11(); + } + }, onDragEnd: function() { + a11(); + } }; + }(a10) : void 0), 9 & e20.$$.dirty[0] | 32773 & e20.$$.dirty[2] && n10(14, ve2 = { readOnly: b10, parser: $10, normalization: G10, getJson: we2, getDocumentState: xe2, findElement: tt2, findNextInside: pt2, focus: vt2, onPatch: ot2, onInsert: Be2, onExpand: st2, onSelect: J10, onFind: ct2, onExpandSection: lt2, onPasteJson: ut2, onRenderValue: I10, onContextMenu: ft2, onClassName: z10 || function() { + }, onDrag: mt2, onDragEnd: gt2 }), 16384 & e20.$$.dirty[0] && o10("context changed", ve2); + }, [b10, x10, j10, $10, E10, A10, P10, D10, function() { + return me2 && void 0 !== l10 && it2(l10), void 0 !== l10 ? { json: l10 } : { text: u10 || "" }; + }, vt2, a10, l10, X10, ge2, ve2, s10, c10, u10, K10, Q10, Z10, ee2, te2, de2, me2, he2, i10, re2, function() { + return ie2.apply(this, arguments); + }, function() { + return ae2.apply(this, arguments); + }, function(e21, t11) { + return se2.apply(this, arguments); + }, function(e21, t11) { + return ce2.apply(this, arguments); + }, function() { + n10(20, Z10 = false), n10(21, ee2 = false), re2(""), vt2(); + }, function(e21) { + o10("select validation error", e21), J10(RE(e21.path, false)), Ze2(e21.path); + }, Te2, function(e21) { + var t11; + e21.preventDefault(); + var n11 = null === (t11 = e21.clipboardData) || void 0 === t11 ? void 0 : t11.getData("text/plain"); + void 0 !== n11 && VB({ clipboardText: n11, json: l10, selection: X10.selection, readOnly: b10, parser: $10, onPatch: ot2, onChangeText: at2, openRepairModal: Ie2 }); + }, We2, Je2, Ke2, function() { + Ge2([]); + }, function() { + Ye2({ rootPath: [] }); + }, function() { + st2([], true, true); + }, function() { + st2([], false, true); + }, function(e21) { + var t11 = PO(e21), n11 = e21.shiftKey; + if (o10("keydown", { combo: t11, key: e21.key }), "Ctrl+X" === t11 && (e21.preventDefault(), Ae2(true)), "Ctrl+Shift+X" === t11 && (e21.preventDefault(), Ae2(false)), "Ctrl+C" === t11 && (e21.preventDefault(), Te2(true)), "Ctrl+Shift+C" === t11 && (e21.preventDefault(), Te2(false)), "Ctrl+D" === t11 && (e21.preventDefault(), qe2()), "Delete" !== t11 && "Backspace" !== t11 || (e21.preventDefault(), De2()), "Insert" === t11 && (e21.preventDefault(), Be2("structure")), "Ctrl+A" === t11 && (e21.preventDefault(), J10(RE([], false))), "Ctrl+Q" === t11 && dt2(e21), "ArrowUp" === t11 || "Shift+ArrowUp" === t11) { + e21.preventDefault(); + var r11 = X10.selection ? SE(l10, X10, n11) || X10.selection : $E(l10, X10); + J10(r11), nt2(JE(r11)); + } + if ("ArrowDown" === t11 || "Shift+ArrowDown" === t11) { + e21.preventDefault(); + var i11 = X10.selection ? function(e23, t12) { + var n12 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], r12 = t12.selection; + if (!r12) + return null; + var o11 = n12 ? JE(r12) : jE(e23, r12), i12 = Ql(Ws(e23, o11)) ? WM(t12, o11) : t12, a12 = cE(e23, t12, o11), s12 = cE(e23, i12, o11); + if (n12) + return hE(r12) ? null !== a12 ? DE(a12, a12) : null : dE(r12) ? null !== s12 ? DE(s12, s12) : null : null !== s12 ? DE(KE(r12), s12) : null; + if (dE(r12)) + return null !== s12 ? RE(s12, false) : null; + if (hE(r12)) + return null !== a12 ? RE(a12, false) : null; + if (pE(r12)) + return null !== a12 ? RE(a12, false) : null; + if (vE(r12)) { + if (null === a12 || 0 === a12.length) + return null; + var c12 = Ws(e23, Qk(a12)); + return Array.isArray(c12) ? RE(a12, false) : TE(a12, false); + } + return mE(r12) ? null !== s12 ? RE(s12, false) : null !== a12 ? RE(a12, false) : null : null; + }(l10, X10, n11) || X10.selection : $E(l10, X10); + J10(i11), nt2(JE(i11)); + } + if ("ArrowLeft" === t11 || "Shift+ArrowLeft" === t11) { + e21.preventDefault(); + var a11 = X10.selection ? function(e23, t12) { + var n12 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], r12 = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3], o11 = t12.selection; + if (!o11) + return null; + var i12 = CE(e23, t12, r12), a12 = i12.caret, s12 = i12.previous; + if (n12) + return mE(o11) ? null : DE(o11.path, o11.path); + if (a12 && s12) + return FE(s12); + var c12 = Ws(e23, Qk(JE(o11))); + return pE(o11) && Array.isArray(c12) ? DE(o11.path, o11.path) : mE(o11) && !Array.isArray(c12) ? TE(o11.focusPath, false) : null; + }(l10, X10, n11, !b10) || X10.selection : $E(l10, X10); + J10(a11), nt2(JE(a11)); + } + if ("ArrowRight" === t11 || "Shift+ArrowRight" === t11) { + e21.preventDefault(); + var s11 = X10.selection && void 0 !== l10 ? function(e23, t12) { + var n12 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], r12 = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3], o11 = t12.selection; + if (!o11) + return null; + var i12 = CE(e23, t12, r12), a12 = i12.caret, s12 = i12.next; + return n12 ? mE(o11) ? null : DE(o11.path, o11.path) : a12 && s12 ? FE(s12) : mE(o11) ? RE(o11.focusPath, false) : null; + }(l10, X10, n11, !b10) || X10.selection : $E(l10, X10); + J10(s11), nt2(JE(s11)); + } + if ("Enter" === t11 && X10.selection) { + if (gE(X10.selection)) { + var c11 = X10.selection.focusPath, u11 = Ws(l10, Qk(c11)); + Array.isArray(u11) && J10(RE(c11, false)); + } + if (vE(X10.selection) && (e21.preventDefault(), J10(Ro(Ro({}, X10.selection), {}, { edit: true }))), pE(X10.selection)) + e21.preventDefault(), Ql(Ws(l10, X10.selection.path)) ? st2(X10.selection.path, true) : J10(Ro(Ro({}, X10.selection), {}, { edit: true })); + } + if (1 === t11.replace(/^Shift\+/, "").length && X10.selection) + return e21.preventDefault(), void We2(e21.key); + if ("Enter" === t11 && (dE(X10.selection) || hE(X10.selection))) + return e21.preventDefault(), void We2(""); + if ("Ctrl+Enter" === t11 && pE(X10.selection)) { + var f11 = Ws(l10, X10.selection.path); + nu(f11) && window.open(String(f11), "_blank"); + } + "Escape" === t11 && X10.selection && (e21.preventDefault(), J10(null)), "Ctrl+F" === t11 && (e21.preventDefault(), ct2(false)), "Ctrl+H" === t11 && (e21.preventDefault(), ct2(true)), "Ctrl+Z" === t11 && (e21.preventDefault(), Je2()), "Ctrl+Shift+Z" === t11 && (e21.preventDefault(), Ke2()); + }, function(e21) { + o10("handleMouseDown", e21); + var t11 = e21.target; + yO(t11, "BUTTON") || t11.isContentEditable || (vt2(), X10.selection || void 0 !== l10 || "" !== u10 && void 0 !== u10 || (o10("createDefaultSelection"), n10(12, X10 = Ro(Ro({}, X10), {}, { selection: RE([], false) })))); + }, dt2, function(e21) { + b10 || ft2({ anchor: $O(e21.target, "BUTTON"), offsetTop: 0, width: Ms, height: Os, showTip: true }); + }, function() { + return ht2.apply(this, arguments); + }, function() { + o10("clear pasted json"), n10(19, Q10 = void 0), vt2(); + }, function() { + R8(Qa.text); + }, function(e21) { + J10(e21), vt2(), Ze2(JE(e21)); + }, function(e21) { + var t11 = !kO(e21.target, function(e23) { + return e23 === c10; + }); + t11 && zE(X10.selection) && (o10("click outside the editor, stop edit mode"), J10(function(e23) { + return vE(e23) || pE(e23) ? Ro(Ro({}, e23), {}, { edit: false }) : e23; + }), g10 && s10 && (s10.focus(), s10.blur()), o10("blur (outside editor)"), s10 && s10.blur()); + }, k10, w10, S10, C10, _10, O10, M10, T8, R8, N8, I10, q10, z10, B10, L10, F10, V10, H10, function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : fE; + o10("expand"); + var t11 = Ro(Ro({}, X10), {}, { expandedMap: {}, visibleSectionsMap: {} }); + n10(12, X10 = HM(l10, t11, [], e21)); + }, ke2, we2, _e2, Ye2, Ze2, tt2, G10, ne2, function(e21) { + n10(20, Z10 = e21); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(15, s10 = e21); + }); + }, function() { + vt2(), We2("{"); + }, function() { + vt2(), We2("["); + }, function() { + vt2(); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(10, a10 = e21); + }); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(16, c10 = e21); + }); + }]; + } + var kL = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, bL, yL, Zo, { readOnly: 0, externalContent: 52, externalSelection: 53, mainMenuBar: 1, navigationBar: 2, escapeControlCharacters: 54, escapeUnicodeCharacters: 55, parser: 3, parseMemoizeOne: 56, validator: 57, validationParser: 58, pathParser: 4, indentation: 5, onError: 6, onChange: 59, onChangeMode: 60, onSelect: 61, onRenderValue: 62, onRenderMenu: 7, onRenderContextMenu: 63, onClassName: 64, onFocus: 65, onBlur: 66, onSortModal: 67, onTransformModal: 68, onJSONEditorModal: 69, expand: 70, validate: 71, getJson: 72, patch: 73, acceptAutoRepair: 8, openTransformModal: 74, scrollTo: 75, findElement: 76, focus: 9 }, sL, [-1, -1, -1, -1, -1]), n10; + } + return Ao(t10, Ia), Do(t10, [{ key: "expand", get: function() { + return this.$$.ctx[70]; + } }, { key: "validate", get: function() { + return this.$$.ctx[71]; + } }, { key: "getJson", get: function() { + return this.$$.ctx[72]; + } }, { key: "patch", get: function() { + return this.$$.ctx[73]; + } }, { key: "acceptAutoRepair", get: function() { + return this.$$.ctx[8]; + } }, { key: "openTransformModal", get: function() { + return this.$$.ctx[74]; + } }, { key: "scrollTo", get: function() { + return this.$$.ctx[75]; + } }, { key: "findElement", get: function() { + return this.$$.ctx[76]; + } }, { key: "focus", get: function() { + return this.$$.ctx[9]; + } }]), t10; + }(); + function wL(e20) { + mi(e20, "svelte-l4qqoi", '.jse-modal.svelte-l4qqoi.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;background:var(--jse-modal-background, #f5f5f5);color:var(--jse-text-color, #4d4d4d)}.jse-modal.svelte-l4qqoi .svelte-select{--border:var(--jse-svelte-select-border, 1px solid #d8dbdf);--item-is-active-bg:var(--jse-item-is-active-bg, #3883fa);--border-radius:var(--jse-svelte-select-border-radius, 3px);--background:var(--jse-svelte-select-background, #fff);--padding:var(--jse-svelte-select-padding, 0 10px);--multi-select-padding:var(--jse-svelte-select-multi-select-padding, 0 10px);--font-size:var(--jse-svelte-select-font-size, var(--jse-font-size, 16px));--height:36px;--multi-item-height:28px;--multi-item-margin:2px;--multi-item-padding:2px 8px;--multi-item-border-radius:6px;--indicator-top:8px}.jse-modal.svelte-l4qqoi .jse-modal-contents.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;padding:20px;overflow:auto;min-width:0;min-height:0}.jse-modal.svelte-l4qqoi .jse-modal-contents .jse-actions.svelte-l4qqoi{display:flex;flex-direction:row;justify-content:flex-end;padding-top:var(--jse-padding, 10px)}.jse-modal.svelte-l4qqoi .jse-modal-contents .jse-actions button.jse-primary.svelte-l4qqoi{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-modal.svelte-l4qqoi .jse-modal-contents .jse-actions button.jse-primary.svelte-l4qqoi:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-modal.svelte-l4qqoi .jse-modal-contents .jse-actions button.jse-primary.svelte-l4qqoi:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}.bg.jse-modal-bg{width:100%;height:100%;top:0;left:0;background:var(--jse-overlay-background, rgba(0, 0, 0, 0.3))}.bg.jse-modal-bg .jse-modal-window-wrap{margin:0}.bg.jse-modal-bg .jse-modal-window{max-width:90%;margin:4rem auto 2rem auto;border-radius:2px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-sort{width:400px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-transform{width:1200px;height:1200px;max-height:80%;display:flex}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-jsoneditor{width:800px;height:auto;min-height:500px;max-height:calc(100vh - 6rem);display:flex}.bg.jse-modal-bg .jse-modal-container{flex:1;display:flex;flex-direction:column;padding:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents.svelte-l4qqoi{color:inherit;min-height:0;padding:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents.svelte-l4qqoi{flex:1;display:flex;gap:calc(2 * var(--jse-padding, 10px));min-height:0;box-sizing:border-box;padding:0 calc(2 * var(--jse-padding, 10px)) var(--jse-padding, 10px)}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents.svelte-l4qqoi{flex:1;display:flex;flex-direction:column}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents .jse-description.svelte-l4qqoi p{margin:var(--jse-padding, 10px) 0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents .jse-description.svelte-l4qqoi p:first-child{margin-top:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents .jse-description.svelte-l4qqoi p:last-child{margin-bottom:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents .jse-description.svelte-l4qqoi code{background:var(--jse-modal-code-background, rgba(0, 0, 0, 0.05));font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px)}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents textarea.jse-query.svelte-l4qqoi{flex:1;outline:none;resize:vertical}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;gap:calc(2 * var(--jse-padding, 10px))}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents .jse-original-data.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;min-height:0;box-sizing:border-box}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents .jse-original-data.jse-hide.svelte-l4qqoi{flex:none}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents .jse-preview-data.svelte-l4qqoi{flex:1;display:flex;flex-direction:column;min-height:0;box-sizing:border-box}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents.jse-hide-original-data.svelte-l4qqoi{flex-direction:column;gap:0;margin-bottom:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-actions.svelte-l4qqoi{padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px)) calc(2 * var(--jse-padding, 10px))}@media screen and (max-width: 1200px){.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents.svelte-l4qqoi{flex-direction:column;overflow:auto}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-query-contents textarea.jse-query.svelte-l4qqoi{min-height:150px;flex:none}.jse-modal.jse-transform.svelte-l4qqoi .jse-modal-contents .jse-main-contents .jse-data-contents.svelte-l4qqoi .jse-tree-mode{height:300px;flex:none}}.jse-modal.jse-transform.svelte-l4qqoi .jse-label.svelte-l4qqoi{font-weight:bold;display:block;box-sizing:border-box}.jse-modal.jse-transform.svelte-l4qqoi .jse-label .jse-label-inner.svelte-l4qqoi{margin-top:calc(2 * var(--jse-padding, 10px));margin-bottom:calc(0.5 * var(--jse-padding, 10px));box-sizing:border-box}.jse-modal.jse-transform.svelte-l4qqoi .jse-label .jse-label-inner button.svelte-l4qqoi{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;font-weight:bold;padding:0}.jse-modal.jse-transform.svelte-l4qqoi .jse-tree-mode{flex:1;background:var(--jse-input-background-readonly, transparent);box-shadow:none;box-sizing:border-box;--jse-main-border:var(--jse-input-border, 1px solid #d8dbdf)}.jse-modal.jse-transform.svelte-l4qqoi input.svelte-l4qqoi,.jse-modal.jse-transform.svelte-l4qqoi textarea.svelte-l4qqoi{border:var(--jse-input-border, 1px solid #d8dbdf);outline:none;box-sizing:border-box;padding:calc(0.5 * var(--jse-padding, 10px));font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:inherit;background:var(--jse-input-background, var(--jse-background-color, #fff))}.jse-modal.jse-transform.svelte-l4qqoi input.svelte-l4qqoi:focus,.jse-modal.jse-transform.svelte-l4qqoi textarea.svelte-l4qqoi:focus{border:var(--jse-input-border-focus, 1px solid var(--jse-input-border-focus, var(--jse-theme-color, #3883fa)))}.jse-modal.jse-transform.svelte-l4qqoi input.svelte-l4qqoi:read-only,.jse-modal.jse-transform.svelte-l4qqoi textarea.svelte-l4qqoi:read-only{background:var(--jse-input-background-readonly, transparent)}.jse-modal.jse-transform.svelte-l4qqoi .jse-preview.jse-error.svelte-l4qqoi{flex:1;background:var(--jse-input-background-readonly, transparent);border:var(--jse-input-border, 1px solid #d8dbdf);color:var(--jse-error-color, #ee5341);padding:calc(0.5 * var(--jse-padding, 10px))}.jse-modal.jse-transform.svelte-l4qqoi a{color:var(--jse-a-color, #156fc5)}.jse-modal.jse-transform.svelte-l4qqoi a:hover{color:var(--jse-a-color-highlight, #0f508d)}'); + } + function xL(e20) { + var t10, n10, r10, o10, i10, a10 = [SL, jL], s10 = []; + function c10(e21, n11) { + return 16384 & n11[0] && (t10 = null), null == t10 && (t10 = !!Array.isArray(e21[14])), t10 ? 0 : 1; + } + return n10 = c10(e20, [-1, -1]), r10 = s10[n10] = a10[n10](e20), { c: function() { + r10.c(), o10 = _i(); + }, m: function(e21, t11) { + s10[n10].m(e21, t11), ki(e21, o10, t11), i10 = true; + }, p: function(e21, t11) { + var i11 = n10; + (n10 = c10(e21, t11)) === i11 ? s10[n10].p(e21, t11) : (ba(), xa(s10[i11], 1, 1, function() { + s10[i11] = null; + }), ka(), (r10 = s10[n10]) ? r10.p(e21, t11) : (r10 = s10[n10] = a10[n10](e21)).c(), wa(r10, 1), r10.m(o10.parentNode, o10)); + }, i: function(e21) { + i10 || (wa(r10), i10 = true); + }, o: function(e21) { + xa(r10), i10 = false; + }, d: function(e21) { + e21 && wi(o10), s10[n10].d(e21); + } }; + } + function jL(e20) { + var t10; + return { c: function() { + t10 = Ci("(Only available for arrays, not for objects)"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function SL(e20) { + var t10, n10; + return t10 = new rN({ props: { queryOptions: e20[15], json: e20[14], onChange: e20[24] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 32768 & n11[0] && (r10.queryOptions = e21[15]), 16384 & n11[0] && (r10.json = e21[14]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function CL(e20) { + var t10, n10; + return t10 = new kL({ props: { externalContent: e20[17], externalSelection: null, readOnly: true, mainMenuBar: false, navigationBar: false, indentation: e20[2], escapeControlCharacters: e20[3], escapeUnicodeCharacters: e20[4], parser: e20[5], parseMemoizeOne: e20[6], onRenderValue: e20[10], onRenderMenu: e20[11], onRenderContextMenu: e20[12], onError: console.error, onChange: Mf, onChangeMode: Mf, onSelect: Mf, onFocus: Mf, onBlur: Mf, onSortModal: Mf, onTransformModal: Mf, onJSONEditorModal: Mf, onClassName: e20[13], validator: null, validationParser: e20[7], pathParser: e20[8] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 131072 & n11[0] && (r10.externalContent = e21[17]), 4 & n11[0] && (r10.indentation = e21[2]), 8 & n11[0] && (r10.escapeControlCharacters = e21[3]), 16 & n11[0] && (r10.escapeUnicodeCharacters = e21[4]), 32 & n11[0] && (r10.parser = e21[5]), 64 & n11[0] && (r10.parseMemoizeOne = e21[6]), 1024 & n11[0] && (r10.onRenderValue = e21[10]), 2048 & n11[0] && (r10.onRenderMenu = e21[11]), 4096 & n11[0] && (r10.onRenderContextMenu = e21[12]), 8192 & n11[0] && (r10.onClassName = e21[13]), 128 & n11[0] && (r10.validationParser = e21[7]), 256 & n11[0] && (r10.pathParser = e21[8]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function $L(e20) { + var t10, n10; + return { c: function() { + t10 = ji("div"), n10 = Ci(e20[20]), Ai(t10, "class", "jse-preview jse-error svelte-l4qqoi"); + }, m: function(e21, r10) { + ki(e21, t10, r10), pi(t10, n10); + }, p: function(e21, t11) { + 1048576 & t11[0] && Ni(n10, e21[20]); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function _L(e20) { + var t10, n10; + return t10 = new kL({ props: { externalContent: e20[21], externalSelection: null, readOnly: true, mainMenuBar: false, navigationBar: false, indentation: e20[2], escapeControlCharacters: e20[3], escapeUnicodeCharacters: e20[4], parser: e20[5], parseMemoizeOne: e20[6], onRenderValue: e20[10], onRenderMenu: e20[11], onRenderContextMenu: e20[12], onError: console.error, onChange: Mf, onChangeMode: Mf, onSelect: Mf, onFocus: Mf, onBlur: Mf, onSortModal: Mf, onTransformModal: Mf, onJSONEditorModal: Mf, onClassName: e20[13], validator: null, validationParser: e20[7], pathParser: e20[8] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 2097152 & n11[0] && (r10.externalContent = e21[21]), 4 & n11[0] && (r10.indentation = e21[2]), 8 & n11[0] && (r10.escapeControlCharacters = e21[3]), 16 & n11[0] && (r10.escapeUnicodeCharacters = e21[4]), 32 & n11[0] && (r10.parser = e21[5]), 64 & n11[0] && (r10.parseMemoizeOne = e21[6]), 1024 & n11[0] && (r10.onRenderValue = e21[10]), 2048 & n11[0] && (r10.onRenderMenu = e21[11]), 4096 & n11[0] && (r10.onRenderContextMenu = e21[12]), 8192 & n11[0] && (r10.onClassName = e21[13]), 128 & n11[0] && (r10.validationParser = e21[7]), 256 & n11[0] && (r10.pathParser = e21[8]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function OL(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, _10, O10, M10, E10, A10, P10, T8, R8, N8, I10, D10, q10, z10, B10, L10, F10, V10, H10, W10, U10, J10, K10 = e20[23](e20[0]).description + ""; + t10 = new mN({ props: { queryLanguages: e20[9], queryLanguageId: e20[0], onChangeQueryLanguage: e20[29] } }), y10 = new jM({ props: { data: e20[18] ? gP : YA } }); + var G10 = e20[18] && xL(e20); + A10 = new jM({ props: { data: e20[19] ? gP : YA } }); + var Q10 = e20[19] && CL(e20), Y10 = [_L, $L], X10 = []; + function Z10(e21, t11) { + return e21[20] ? 1 : 0; + } + return q10 = Z10(e20), z10 = X10[q10] = Y10[q10](e20), { c: function() { + Pa(t10.$$.fragment), n10 = $i(), r10 = ji("div"), o10 = ji("div"), i10 = ji("div"), (a10 = ji("div")).innerHTML = '
Language
', s10 = $i(), c10 = ji("div"), l10 = $i(), (u10 = ji("div")).innerHTML = '
Path
', f10 = $i(), d10 = ji("input"), v10 = $i(), p10 = ji("div"), m10 = ji("div"), g10 = ji("button"), Pa(y10.$$.fragment), b10 = Ci("\n Wizard"), k10 = $i(), G10 && G10.c(), w10 = $i(), (x10 = ji("div")).innerHTML = '
Query
', j10 = $i(), S10 = ji("textarea"), C10 = $i(), $10 = ji("div"), _10 = ji("div"), O10 = ji("div"), M10 = ji("div"), E10 = ji("button"), Pa(A10.$$.fragment), P10 = Ci("\n Original"), T8 = $i(), Q10 && Q10.c(), R8 = $i(), N8 = ji("div"), (I10 = ji("div")).innerHTML = '
Preview
', D10 = $i(), z10.c(), B10 = $i(), L10 = ji("div"), F10 = ji("button"), V10 = Ci("Transform"), Ai(a10, "class", "jse-label svelte-l4qqoi"), Ai(c10, "class", "jse-description svelte-l4qqoi"), Ai(u10, "class", "jse-label svelte-l4qqoi"), Ai(d10, "class", "jse-path svelte-l4qqoi"), Ai(d10, "type", "text"), d10.readOnly = true, Ai(d10, "title", "Selected path"), d10.value = h10 = _w(e20[1]) ? "(document root)" : JO(e20[1]), Ai(g10, "type", "button"), Ai(g10, "class", "svelte-l4qqoi"), Ai(m10, "class", "jse-label-inner svelte-l4qqoi"), Ai(p10, "class", "jse-label svelte-l4qqoi"), Ai(x10, "class", "jse-label svelte-l4qqoi"), Ai(S10, "class", "jse-query svelte-l4qqoi"), Ai(S10, "spellcheck", "false"), S10.value = e20[16], Ai(i10, "class", "jse-query-contents svelte-l4qqoi"), Ai(E10, "type", "button"), Ai(E10, "class", "svelte-l4qqoi"), Ai(M10, "class", "jse-label-inner svelte-l4qqoi"), Ai(O10, "class", "jse-label svelte-l4qqoi"), Ai(_10, "class", "jse-original-data svelte-l4qqoi"), zi(_10, "jse-hide", !e20[19]), Ai(I10, "class", "jse-label svelte-l4qqoi"), Ai(N8, "class", "jse-preview-data svelte-l4qqoi"), Ai($10, "class", "jse-data-contents svelte-l4qqoi"), zi($10, "jse-hide-original-data", !e20[19]), Ai(o10, "class", "jse-main-contents svelte-l4qqoi"), Ai(F10, "type", "button"), Ai(F10, "class", "jse-primary svelte-l4qqoi"), F10.disabled = H10 = !!e20[20], Ai(L10, "class", "jse-actions svelte-l4qqoi"), Ai(r10, "class", "jse-modal-contents svelte-l4qqoi"); + }, m: function(h11, z11) { + Ta(t10, h11, z11), ki(h11, n10, z11), ki(h11, r10, z11), pi(r10, o10), pi(o10, i10), pi(i10, a10), pi(i10, s10), pi(i10, c10), c10.innerHTML = K10, pi(i10, l10), pi(i10, u10), pi(i10, f10), pi(i10, d10), pi(i10, v10), pi(i10, p10), pi(p10, m10), pi(m10, g10), Ta(y10, g10, null), pi(g10, b10), pi(i10, k10), G10 && G10.m(i10, null), pi(i10, w10), pi(i10, x10), pi(i10, j10), pi(i10, S10), pi(o10, C10), pi(o10, $10), pi($10, _10), pi(_10, O10), pi(O10, M10), pi(M10, E10), Ta(A10, E10, null), pi(E10, P10), pi(_10, T8), Q10 && Q10.m(_10, null), pi($10, R8), pi($10, N8), pi(N8, I10), pi(N8, D10), X10[q10].m(N8, null), pi(r10, B10), pi(r10, L10), pi(L10, F10), pi(F10, V10), W10 = true, U10 || (J10 = [Oi(g10, "click", e20[27]), Oi(S10, "input", e20[25]), Oi(E10, "click", e20[28]), Oi(F10, "click", e20[26]), ci(EL.call(null, F10))], U10 = true); + }, p: function(e21, n11) { + var r11 = {}; + 512 & n11[0] && (r11.queryLanguages = e21[9]), 1 & n11[0] && (r11.queryLanguageId = e21[0]), t10.$set(r11), (!W10 || 1 & n11[0]) && K10 !== (K10 = e21[23](e21[0]).description + "") && (c10.innerHTML = K10), (!W10 || 2 & n11[0] && h10 !== (h10 = _w(e21[1]) ? "(document root)" : JO(e21[1])) && d10.value !== h10) && (d10.value = h10); + var o11 = {}; + 262144 & n11[0] && (o11.data = e21[18] ? gP : YA), y10.$set(o11), e21[18] ? G10 ? (G10.p(e21, n11), 262144 & n11[0] && wa(G10, 1)) : ((G10 = xL(e21)).c(), wa(G10, 1), G10.m(i10, w10)) : G10 && (ba(), xa(G10, 1, 1, function() { + G10 = null; + }), ka()), (!W10 || 65536 & n11[0]) && (S10.value = e21[16]); + var a11 = {}; + 524288 & n11[0] && (a11.data = e21[19] ? gP : YA), A10.$set(a11), e21[19] ? Q10 ? (Q10.p(e21, n11), 524288 & n11[0] && wa(Q10, 1)) : ((Q10 = CL(e21)).c(), wa(Q10, 1), Q10.m(_10, null)) : Q10 && (ba(), xa(Q10, 1, 1, function() { + Q10 = null; + }), ka()), (!W10 || 524288 & n11[0]) && zi(_10, "jse-hide", !e21[19]); + var s11 = q10; + (q10 = Z10(e21)) === s11 ? X10[q10].p(e21, n11) : (ba(), xa(X10[s11], 1, 1, function() { + X10[s11] = null; + }), ka(), (z10 = X10[q10]) ? z10.p(e21, n11) : (z10 = X10[q10] = Y10[q10](e21)).c(), wa(z10, 1), z10.m(N8, null)), (!W10 || 524288 & n11[0]) && zi($10, "jse-hide-original-data", !e21[19]), (!W10 || 1048576 & n11[0] && H10 !== (H10 = !!e21[20])) && (F10.disabled = H10); + }, i: function(e21) { + W10 || (wa(t10.$$.fragment, e21), wa(y10.$$.fragment, e21), wa(G10), wa(A10.$$.fragment, e21), wa(Q10), wa(z10), W10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), xa(y10.$$.fragment, e21), xa(G10), xa(A10.$$.fragment, e21), xa(Q10), xa(z10), W10 = false; + }, d: function(e21) { + e21 && (wi(n10), wi(r10)), Ra(t10, e21), Ra(y10), G10 && G10.d(), Ra(A10), Q10 && Q10.d(), X10[q10].d(), U10 = false, Qo(J10); + } }; + } + function ML(e20) { + var t10, n10, r10, o10, i10; + return n10 = new UO({ props: { $$slots: { default: [OL] }, $$scope: { ctx: e20 } } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-modal jse-transform svelte-l4qqoi"); + }, m: function(a10, s10) { + ki(a10, t10, s10), Ta(n10, t10, null), r10 = true, o10 || (i10 = ci(BI.call(null, t10, e20[22])), o10 = true); + }, p: function(e21, t11) { + var r11 = {}; + 4194303 & t11[0] | 2048 & t11[1] && (r11.$$scope = { dirty: t11, ctx: e21 }), n10.$set(r11); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), o10 = false, i10(); + } }; + } + function EL(e20) { + e20.focus(); + } + function AL(e20, t10, n10) { + var r10, o10, i10 = Da("jsoneditor:TransformModal"), a10 = t10.id, s10 = void 0 === a10 ? "transform-modal-" + Ps() : a10, c10 = t10.json, l10 = t10.rootPath, u10 = void 0 === l10 ? [] : l10, f10 = t10.indentation, d10 = t10.escapeControlCharacters, h10 = t10.escapeUnicodeCharacters, v10 = t10.parser, p10 = t10.parseMemoizeOne, m10 = t10.validationParser, g10 = t10.pathParser, y10 = t10.queryLanguages, b10 = t10.queryLanguageId, k10 = t10.onChangeQueryLanguage, w10 = t10.onRenderValue, x10 = t10.onRenderMenu, j10 = t10.onRenderContextMenu, S10 = t10.onClassName, C10 = t10.onTransform, $10 = Zi("simple-modal").close, _10 = "".concat(s10, ":").concat(Zs(u10)), O10 = RP[_10] || {}, M10 = false !== NP.showWizard, E10 = false !== NP.showOriginal, A10 = O10.queryOptions || {}, P10 = b10 === O10.queryLanguageId && O10.query ? O10.query : I10(b10).createQuery(c10, O10.queryOptions || {}), T8 = O10.isManual || false, R8 = void 0, N8 = { text: "" }; + function I10(e21) { + return y10.find(function(t11) { + return t11.id === e21; + }) || y10[0]; + } + var D10 = Vy(function(e21, t11) { + if (void 0 === e21) + return n10(21, N8 = { text: "" }), void n10(20, R8 = "Error: No JSON"); + try { + i10("previewTransform", { query: t11 }); + var r11 = I10(b10).executeQuery(e21, t11, v10); + n10(21, N8 = { json: r11 }), n10(20, R8 = void 0); + } catch (e23) { + n10(21, N8 = { text: "" }), n10(20, R8 = String(e23)); + } + }, 300); + return e20.$$set = function(e21) { + "id" in e21 && n10(30, s10 = e21.id), "json" in e21 && n10(31, c10 = e21.json), "rootPath" in e21 && n10(1, u10 = e21.rootPath), "indentation" in e21 && n10(2, f10 = e21.indentation), "escapeControlCharacters" in e21 && n10(3, d10 = e21.escapeControlCharacters), "escapeUnicodeCharacters" in e21 && n10(4, h10 = e21.escapeUnicodeCharacters), "parser" in e21 && n10(5, v10 = e21.parser), "parseMemoizeOne" in e21 && n10(6, p10 = e21.parseMemoizeOne), "validationParser" in e21 && n10(7, m10 = e21.validationParser), "pathParser" in e21 && n10(8, g10 = e21.pathParser), "queryLanguages" in e21 && n10(9, y10 = e21.queryLanguages), "queryLanguageId" in e21 && n10(0, b10 = e21.queryLanguageId), "onChangeQueryLanguage" in e21 && n10(32, k10 = e21.onChangeQueryLanguage), "onRenderValue" in e21 && n10(10, w10 = e21.onRenderValue), "onRenderMenu" in e21 && n10(11, x10 = e21.onRenderMenu), "onRenderContextMenu" in e21 && n10(12, j10 = e21.onRenderContextMenu), "onClassName" in e21 && n10(13, S10 = e21.onClassName), "onTransform" in e21 && n10(33, C10 = e21.onTransform); + }, e20.$$.update = function() { + 2 & e20.$$.dirty[0] | 1 & e20.$$.dirty[1] && n10(14, r10 = Ws(c10, u10)), 16384 & e20.$$.dirty[0] && n10(17, o10 = r10 ? { json: r10 } : { text: "" }), 81920 & e20.$$.dirty[0] && D10(r10, P10), 98305 & e20.$$.dirty[0] | 24 & e20.$$.dirty[1] && (n10(34, RP[_10] = { queryOptions: A10, query: P10, queryLanguageId: b10, isManual: T8 }, RP), i10("store state in memory", _10, RP[_10])); + }, [b10, u10, f10, d10, h10, v10, p10, m10, g10, y10, w10, x10, j10, S10, r10, A10, P10, o10, M10, E10, R8, N8, $10, I10, function(e21) { + n10(15, A10 = e21), n10(16, P10 = I10(b10).createQuery(c10, e21)), n10(35, T8 = false), i10("updateQueryByWizard", { queryOptions: A10, query: P10, isManual: T8 }); + }, function(e21) { + n10(16, P10 = e21.target.value), n10(35, T8 = true), i10("handleChangeQuery", { query: P10, isManual: T8 }); + }, function() { + if (void 0 === r10) + return n10(21, N8 = { text: "" }), void n10(20, R8 = "Error: No JSON"); + try { + i10("handleTransform", { query: P10 }); + var e21 = I10(b10).executeQuery(r10, P10, v10); + C10([{ op: "replace", path: Zs(u10), value: e21 }]), $10(); + } catch (e23) { + console.error(e23), n10(21, N8 = { text: "" }), n10(20, R8 = String(e23)); + } + }, function() { + n10(18, M10 = !M10), NP.showWizard = M10; + }, function() { + n10(19, E10 = !E10), NP.showOriginal = E10; + }, function(e21) { + i10("handleChangeQueryLanguage", e21), n10(0, b10 = e21), k10(e21); + var t11 = I10(b10); + n10(16, P10 = t11.createQuery(c10, A10)), n10(35, T8 = false); + }, s10, c10, k10, C10, RP, T8]; + } + var PL = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, AL, ML, Zo, { id: 30, json: 31, rootPath: 1, indentation: 2, escapeControlCharacters: 3, escapeUnicodeCharacters: 4, parser: 5, parseMemoizeOne: 6, validationParser: 7, pathParser: 8, queryLanguages: 9, queryLanguageId: 0, onChangeQueryLanguage: 32, onRenderValue: 10, onRenderMenu: 11, onRenderContextMenu: 12, onClassName: 13, onTransform: 33 }, wL, [-1, -1]), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var TL = {}; + function RL(e20) { + mi(e20, "svelte-qjdk97", '.jse-modal.svelte-qjdk97.svelte-qjdk97{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;background:var(--jse-modal-background, #f5f5f5);color:var(--jse-text-color, #4d4d4d)}.jse-modal.svelte-qjdk97 .svelte-select{--border:var(--jse-svelte-select-border, 1px solid #d8dbdf);--item-is-active-bg:var(--jse-item-is-active-bg, #3883fa);--border-radius:var(--jse-svelte-select-border-radius, 3px);--background:var(--jse-svelte-select-background, #fff);--padding:var(--jse-svelte-select-padding, 0 10px);--multi-select-padding:var(--jse-svelte-select-multi-select-padding, 0 10px);--font-size:var(--jse-svelte-select-font-size, var(--jse-font-size, 16px));--height:36px;--multi-item-height:28px;--multi-item-margin:2px;--multi-item-padding:2px 8px;--multi-item-border-radius:6px;--indicator-top:8px}.jse-modal.svelte-qjdk97 .jse-modal-contents.svelte-qjdk97{flex:1;display:flex;flex-direction:column;padding:20px;overflow:auto;min-width:0;min-height:0}.jse-modal.svelte-qjdk97 .jse-modal-contents .jse-actions.svelte-qjdk97{display:flex;flex-direction:row;justify-content:flex-end;padding-top:var(--jse-padding, 10px)}.jse-modal.svelte-qjdk97 .jse-modal-contents .jse-actions button.jse-primary.svelte-qjdk97{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-modal.svelte-qjdk97 .jse-modal-contents .jse-actions button.jse-primary.svelte-qjdk97:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-modal.svelte-qjdk97 .jse-modal-contents .jse-actions button.jse-primary.svelte-qjdk97:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}.bg.jse-modal-bg{width:100%;height:100%;top:0;left:0;background:var(--jse-overlay-background, rgba(0, 0, 0, 0.3))}.bg.jse-modal-bg .jse-modal-window-wrap{margin:0}.bg.jse-modal-bg .jse-modal-window{max-width:90%;margin:4rem auto 2rem auto;border-radius:2px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-sort{width:400px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-transform{width:1200px;height:1200px;max-height:80%;display:flex}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-jsoneditor{width:800px;height:auto;min-height:500px;max-height:calc(100vh - 6rem);display:flex}.bg.jse-modal-bg .jse-modal-container{flex:1;display:flex;flex-direction:column;padding:0}.jse-modal.jse-sort.svelte-qjdk97 table.svelte-qjdk97{width:100%;border-collapse:collapse;border-spacing:0}.jse-modal.jse-sort.svelte-qjdk97 table th.svelte-qjdk97,.jse-modal.jse-sort.svelte-qjdk97 table td.svelte-qjdk97{text-align:left;vertical-align:middle;font-weight:normal;padding-bottom:var(--jse-padding, 10px)}.jse-modal.jse-sort.svelte-qjdk97 table th input.jse-path.svelte-qjdk97,.jse-modal.jse-sort.svelte-qjdk97 table td input.jse-path.svelte-qjdk97{width:100%;box-sizing:border-box;padding:6px 16px;border:var(--jse-input-border, 1px solid #d8dbdf);border-radius:var(--jse-input-radius, 3px);font-family:inherit;font-size:inherit;background:inherit;color:inherit;outline:none}.jse-modal.jse-sort.svelte-qjdk97 table th input.jse-path.svelte-qjdk97:read-only,.jse-modal.jse-sort.svelte-qjdk97 table td input.jse-path.svelte-qjdk97:read-only{background:var(--jse-input-background-readonly, transparent)}.jse-modal.jse-sort.svelte-qjdk97 table th.svelte-qjdk97 .svelte-select input,.jse-modal.jse-sort.svelte-qjdk97 table td.svelte-qjdk97 .svelte-select input{box-sizing:border-box}.jse-modal.jse-sort.svelte-qjdk97 .jse-space.svelte-qjdk97{height:200px}.jse-modal.jse-sort.svelte-qjdk97 .jse-space .jse-error.svelte-qjdk97{color:var(--jse-error-color, #ee5341)}'); + } + function NL(e20) { + var t10, n10, r10, o10, i10, a10, s10; + function c10(t11) { + e20[14](t11); + } + var l10 = { showChevron: true, items: e20[5] }; + return void 0 !== e20[1] && (l10.value = e20[1]), i10 = new ZR({ props: l10 }), na.push(function() { + return Aa(i10, "value", c10); + }), { c: function() { + t10 = ji("tr"), (n10 = ji("th")).textContent = "Property", r10 = $i(), o10 = ji("td"), Pa(i10.$$.fragment), Ai(n10, "class", "svelte-qjdk97"), Ai(o10, "class", "svelte-qjdk97"); + }, m: function(e21, a11) { + ki(e21, t10, a11), pi(t10, n10), pi(t10, r10), pi(t10, o10), Ta(i10, o10, null), s10 = true; + }, p: function(e21, t11) { + var n11 = {}; + 32 & t11 && (n11.items = e21[5]), !a10 && 2 & t11 && (a10 = true, n11.value = e21[1], ua(function() { + return a10 = false; + })), i10.$set(n11); + }, i: function(e21) { + s10 || (wa(i10.$$.fragment, e21), s10 = true); + }, o: function(e21) { + xa(i10.$$.fragment, e21), s10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(i10); + } }; + } + function IL(e20) { + var t10, n10; + return { c: function() { + t10 = ji("div"), n10 = Ci(e20[4]), Ai(t10, "class", "jse-error svelte-qjdk97"); + }, m: function(e21, r10) { + ki(e21, t10, r10), pi(t10, n10); + }, p: function(e21, t11) { + 16 & t11 && Ni(n10, e21[4]); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function DL(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, _10, O10, M10, E10, A10, P10, T8; + r10 = new XN({ props: { title: e20[3] ? "Sort array items" : "Sort object keys" } }); + var R8 = e20[3] && (e20[5] && (null === (t10 = e20[5]) || void 0 === t10 ? void 0 : t10.length) > 1 || void 0 === e20[1]) && NL(e20); + function N8(t11) { + e20[15](t11); + } + var I10 = { showChevron: true, clearable: false, items: e20[7] }; + void 0 !== e20[2] && (I10.value = e20[2]), x10 = new ZR({ props: I10 }), na.push(function() { + return Aa(x10, "value", N8); + }); + var D10 = e20[4] && IL(e20); + return { c: function() { + var t11; + n10 = ji("div"), Pa(r10.$$.fragment), o10 = $i(), i10 = ji("div"), a10 = ji("table"), (s10 = ji("colgroup")).innerHTML = ' ', c10 = $i(), l10 = ji("tbody"), u10 = ji("tr"), (f10 = ji("th")).textContent = "Path", d10 = $i(), h10 = ji("td"), v10 = ji("input"), m10 = $i(), R8 && R8.c(), g10 = $i(), y10 = ji("tr"), (b10 = ji("th")).textContent = "Direction", k10 = $i(), w10 = ji("td"), Pa(x10.$$.fragment), S10 = $i(), C10 = ji("div"), D10 && D10.c(), $10 = $i(), _10 = ji("div"), O10 = ji("button"), M10 = Ci("Sort"), Ai(f10, "class", "svelte-qjdk97"), Ai(v10, "class", "jse-path svelte-qjdk97"), Ai(v10, "type", "text"), v10.readOnly = true, Ai(v10, "title", "Selected path"), v10.value = p10 = _w(e20[0]) ? "(document root)" : JO(e20[0]), Ai(h10, "class", "svelte-qjdk97"), Ai(b10, "class", "svelte-qjdk97"), Ai(w10, "class", "svelte-qjdk97"), Ai(a10, "class", "svelte-qjdk97"), Ai(C10, "class", "jse-space svelte-qjdk97"), Ai(O10, "type", "button"), Ai(O10, "class", "jse-primary svelte-qjdk97"), O10.disabled = E10 = !!(e20[3] && e20[5] && (null === (t11 = e20[5]) || void 0 === t11 ? void 0 : t11.length) > 1) && !e20[1], Ai(_10, "class", "jse-actions svelte-qjdk97"), Ai(i10, "class", "jse-modal-contents svelte-qjdk97"), Ai(n10, "class", "jse-modal jse-sort svelte-qjdk97"); + }, m: function(t11, p11) { + ki(t11, n10, p11), Ta(r10, n10, null), pi(n10, o10), pi(n10, i10), pi(i10, a10), pi(a10, s10), pi(a10, c10), pi(a10, l10), pi(l10, u10), pi(u10, f10), pi(u10, d10), pi(u10, h10), pi(h10, v10), pi(l10, m10), R8 && R8.m(l10, null), pi(l10, g10), pi(l10, y10), pi(y10, b10), pi(y10, k10), pi(y10, w10), Ta(x10, w10, null), pi(i10, S10), pi(i10, C10), D10 && D10.m(C10, null), pi(i10, $10), pi(i10, _10), pi(_10, O10), pi(O10, M10), A10 = true, P10 || (T8 = [Oi(O10, "click", e20[8]), ci(qL.call(null, O10)), ci(BI.call(null, n10, e20[6]))], P10 = true); + }, p: function(e21, t11) { + var n11, o11, i11 = jo(t11, 1)[0], a11 = {}; + 8 & i11 && (a11.title = e21[3] ? "Sort array items" : "Sort object keys"), r10.$set(a11), (!A10 || 1 & i11 && p10 !== (p10 = _w(e21[0]) ? "(document root)" : JO(e21[0])) && v10.value !== p10) && (v10.value = p10), e21[3] && (e21[5] && (null === (n11 = e21[5]) || void 0 === n11 ? void 0 : n11.length) > 1 || void 0 === e21[1]) ? R8 ? (R8.p(e21, i11), 42 & i11 && wa(R8, 1)) : ((R8 = NL(e21)).c(), wa(R8, 1), R8.m(l10, g10)) : R8 && (ba(), xa(R8, 1, 1, function() { + R8 = null; + }), ka()); + var s11 = {}; + !j10 && 4 & i11 && (j10 = true, s11.value = e21[2], ua(function() { + return j10 = false; + })), x10.$set(s11), e21[4] ? D10 ? D10.p(e21, i11) : ((D10 = IL(e21)).c(), D10.m(C10, null)) : D10 && (D10.d(1), D10 = null), (!A10 || 42 & i11 && E10 !== (E10 = !!(e21[3] && e21[5] && (null === (o11 = e21[5]) || void 0 === o11 ? void 0 : o11.length) > 1) && !e21[1])) && (O10.disabled = E10); + }, i: function(e21) { + A10 || (wa(r10.$$.fragment, e21), wa(R8), wa(x10.$$.fragment, e21), A10 = true); + }, o: function(e21) { + xa(r10.$$.fragment, e21), xa(R8), xa(x10.$$.fragment, e21), A10 = false; + }, d: function(e21) { + e21 && wi(n10), Ra(r10), R8 && R8.d(), Ra(x10), D10 && D10.d(), P10 = false, Qo(T8); + } }; + } + function qL(e20) { + e20.focus(); + } + function zL(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10 = Da("jsoneditor:SortModal"), l10 = t10.id, u10 = t10.json, f10 = t10.rootPath, d10 = t10.onSort, h10 = Zi("simple-modal").close, v10 = "".concat(l10, ":").concat(Zs(f10)), p10 = Ws(u10, f10), m10 = { value: 1, label: "ascending" }, g10 = [m10, { value: -1, label: "descending" }], y10 = null === (r10 = TL[v10]) || void 0 === r10 ? void 0 : r10.selectedProperty, b10 = (null === (o10 = TL[v10]) || void 0 === o10 ? void 0 : o10.selectedDirection) || m10, k10 = void 0; + return e20.$$set = function(e21) { + "id" in e21 && n10(9, l10 = e21.id), "json" in e21 && n10(10, u10 = e21.json), "rootPath" in e21 && n10(0, f10 = e21.rootPath), "onSort" in e21 && n10(11, d10 = e21.onSort); + }, e20.$$.update = function() { + 8 & e20.$$.dirty && n10(13, a10 = i10 && void 0 !== p10 ? T_(p10) : void 0), 8192 & e20.$$.dirty && n10(5, s10 = a10 ? a10.map(GO) : void 0), 4102 & e20.$$.dirty && (n10(12, TL[v10] = { selectedProperty: y10, selectedDirection: b10 }, TL), c10("store state in memory", v10, TL[v10])); + }, n10(3, i10 = Array.isArray(p10)), [f10, y10, b10, i10, k10, s10, h10, g10, function() { + try { + var e21, t11, r11; + n10(4, k10 = void 0); + var o11 = (null === (e21 = y10) || void 0 === e21 ? void 0 : e21.value) || (null === (t11 = s10) || void 0 === t11 || null === (t11 = t11[0]) || void 0 === t11 ? void 0 : t11.value) || [], i11 = null === (r11 = b10) || void 0 === r11 ? void 0 : r11.value, a11 = Iz(u10, f10, o11, i11); + d10({ operations: a11, rootPath: f10, itemPath: o11, direction: i11 }), h10(); + } catch (e23) { + n10(4, k10 = String(e23)); + } + }, l10, u10, d10, TL, a10, function(e21) { + n10(1, y10 = e21); + }, function(e21) { + n10(2, b10 = e21); + }]; + } + var BL = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, zL, DL, Zo, { id: 9, json: 10, rootPath: 0, onSort: 11 }, RL), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function LL() { + } + function FL(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1e3; + if (e20 < 0.9 * t10) + return e20.toFixed() + " B"; + var n10 = e20 / t10; + if (n10 < 0.9 * t10) + return n10.toFixed(1) + " KB"; + var r10 = n10 / t10; + if (r10 < 0.9 * t10) + return r10.toFixed(1) + " MB"; + var o10 = r10 / t10; + return o10 < 0.9 * t10 ? o10.toFixed(1) + " GB" : (o10 / t10).toFixed(1) + " TB"; + } + function VL(e20) { + var t10, n10; + return t10 = new EI({ props: { items: e20[0] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & jo(n11, 1)[0] && (r10.items = e21[0]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function HL(e20, t10, n10) { + var r10, o10, i10 = t10.readOnly, a10 = void 0 !== i10 && i10, s10 = t10.onFormat, c10 = t10.onCompact, l10 = t10.onSort, u10 = t10.onTransform, f10 = t10.onToggleSearch, d10 = t10.onUndo, h10 = t10.onRedo, v10 = t10.canUndo, p10 = t10.canRedo, m10 = t10.canFormat, g10 = t10.canCompact, y10 = t10.canSort, b10 = t10.canTransform, k10 = t10.onRenderMenu, w10 = { type: "button", icon: jP, title: "Search (Ctrl+F)", className: "jse-search", onClick: f10 }; + return e20.$$set = function(e21) { + "readOnly" in e21 && n10(1, a10 = e21.readOnly), "onFormat" in e21 && n10(2, s10 = e21.onFormat), "onCompact" in e21 && n10(3, c10 = e21.onCompact), "onSort" in e21 && n10(4, l10 = e21.onSort), "onTransform" in e21 && n10(5, u10 = e21.onTransform), "onToggleSearch" in e21 && n10(6, f10 = e21.onToggleSearch), "onUndo" in e21 && n10(7, d10 = e21.onUndo), "onRedo" in e21 && n10(8, h10 = e21.onRedo), "canUndo" in e21 && n10(9, v10 = e21.canUndo), "canRedo" in e21 && n10(10, p10 = e21.canRedo), "canFormat" in e21 && n10(11, m10 = e21.canFormat), "canCompact" in e21 && n10(12, g10 = e21.canCompact), "canSort" in e21 && n10(13, y10 = e21.canSort), "canTransform" in e21 && n10(14, b10 = e21.canTransform), "onRenderMenu" in e21 && n10(15, k10 = e21.onRenderMenu); + }, e20.$$.update = function() { + 32702 & e20.$$.dirty && n10(16, o10 = a10 ? [w10, { type: "space" }] : [{ type: "button", icon: xz, title: "Format JSON: add proper indentation and new lines (Ctrl+I)", className: "jse-format", onClick: s10, disabled: a10 || !m10 }, { type: "button", icon: jz, title: "Compact JSON: remove all white spacing and new lines (Ctrl+Shift+I)", className: "jse-compact", onClick: c10, disabled: a10 || !g10 }, { type: "separator" }, { type: "button", icon: kP, title: "Sort", className: "jse-sort", onClick: l10, disabled: a10 || !y10 }, { type: "button", icon: cP, title: "Transform contents (filter, sort, project)", className: "jse-transform", onClick: u10, disabled: a10 || !b10 }, w10, { type: "separator" }, { type: "button", icon: vP, title: "Undo (Ctrl+Z)", className: "jse-undo", onClick: d10, disabled: !v10 }, { type: "button", icon: hP, title: "Redo (Ctrl+Shift+Z)", className: "jse-redo", onClick: h10, disabled: !p10 }, { type: "space" }]), 98304 & e20.$$.dirty && n10(0, r10 = k10(o10) || o10); + }, [r10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, o10]; + } + var WL = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, HL, VL, Zo, { readOnly: 1, onFormat: 2, onCompact: 3, onSort: 4, onTransform: 5, onToggleSearch: 6, onUndo: 7, onRedo: 8, canUndo: 9, canRedo: 10, canFormat: 11, canCompact: 12, canSort: 13, canTransform: 14, onRenderMenu: 15 }), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var UL = function() { + function e20() { + No(this, e20); + } + return Do(e20, [{ key: "lineAt", value: function(e21) { + if (e21 < 0 || e21 > this.length) + throw new RangeError("Invalid position ".concat(e21, " in document of length ").concat(this.length)); + return this.lineInner(e21, false, 1, 0); + } }, { key: "line", value: function(e21) { + if (e21 < 1 || e21 > this.lines) + throw new RangeError("Invalid line number ".concat(e21, " in ").concat(this.lines, "-line document")); + return this.lineInner(e21, true, 1, 0); + } }, { key: "replace", value: function(e21, t10, n10) { + var r10 = jo(tF(this, e21, t10), 2); + e21 = r10[0], t10 = r10[1]; + var o10 = []; + return this.decompose(0, e21, o10, 2), n10.length && n10.decompose(0, n10.length, o10, 3), this.decompose(t10, this.length, o10, 1), KL.from(o10, this.length - (t10 - e21) + n10.length); + } }, { key: "append", value: function(e21) { + return this.replace(this.length, this.length, e21); + } }, { key: "slice", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.length, n10 = jo(tF(this, e21, t10), 2); + e21 = n10[0], t10 = n10[1]; + var r10 = []; + return this.decompose(e21, t10, r10, 0), KL.from(r10, t10 - e21); + } }, { key: "eq", value: function(e21) { + if (e21 == this) + return true; + if (e21.length != this.length || e21.lines != this.lines) + return false; + for (var t10 = this.scanIdentical(e21, 1), n10 = this.length - this.scanIdentical(e21, -1), r10 = new YL(this), o10 = new YL(e21), i10 = t10, a10 = t10; ; ) { + if (r10.next(i10), o10.next(i10), i10 = 0, r10.lineBreak != o10.lineBreak || r10.done != o10.done || r10.value != o10.value) + return false; + if (a10 += r10.value.length, r10.done || a10 >= n10) + return true; + } + } }, { key: "iter", value: function() { + return new YL(this, arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1); + } }, { key: "iterRange", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.length; + return new XL(this, e21, t10); + } }, { key: "iterLines", value: function(e21, t10) { + var n10; + if (null == e21) + n10 = this.iter(); + else { + null == t10 && (t10 = this.lines + 1); + var r10 = this.line(e21).from; + n10 = this.iterRange(r10, Math.max(r10, t10 == this.lines + 1 ? this.length : t10 <= 1 ? 0 : this.line(t10 - 1).to)); + } + return new ZL(n10); + } }, { key: "toString", value: function() { + return this.sliceString(0); + } }, { key: "toJSON", value: function() { + var e21 = []; + return this.flatten(e21), e21; + } }], [{ key: "of", value: function(t10) { + if (0 == t10.length) + throw new RangeError("A document must have at least one line"); + return 1 != t10.length || t10[0] ? t10.length <= 32 ? new JL(t10) : KL.from(JL.split(t10, [])) : e20.empty; + } }]), e20; + }(); + var JL = function(e20) { + function t10(e21) { + var n10, r10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function(e23) { + var t11, n11 = -1, r11 = bo(e23); + try { + for (r11.s(); !(t11 = r11.n()).done; ) { + n11 += t11.value.length + 1; + } + } catch (e24) { + r11.e(e24); + } finally { + r11.f(); + } + return n11; + }(e21); + return No(this, t10), (n10 = _o(this, t10)).text = e21, n10.length = r10, n10; + } + return Ao(t10, UL), Do(t10, [{ key: "lines", get: function() { + return this.text.length; + } }, { key: "children", get: function() { + return null; + } }, { key: "lineInner", value: function(e21, t11, n10, r10) { + for (var o10 = 0; ; o10++) { + var i10 = this.text[o10], a10 = r10 + i10.length; + if ((t11 ? n10 : a10) >= e21) + return new eF(r10, a10, n10, i10); + r10 = a10 + 1, n10++; + } + } }, { key: "decompose", value: function(e21, n10, r10, o10) { + var i10 = e21 <= 0 && n10 >= this.length ? this : new t10(QL(this.text, e21, n10), Math.min(n10, this.length) - Math.max(0, e21)); + if (1 & o10) { + var a10 = r10.pop(), s10 = GL(i10.text, a10.text.slice(), 0, i10.length); + if (s10.length <= 32) + r10.push(new t10(s10, a10.length + i10.length)); + else { + var c10 = s10.length >> 1; + r10.push(new t10(s10.slice(0, c10)), new t10(s10.slice(c10))); + } + } else + r10.push(i10); + } }, { key: "replace", value: function(e21, n10, r10) { + if (!(r10 instanceof t10)) + return go(Mo(t10.prototype), "replace", this).call(this, e21, n10, r10); + var o10 = jo(tF(this, e21, n10), 2); + e21 = o10[0], n10 = o10[1]; + var i10 = GL(this.text, GL(r10.text, QL(this.text, 0, e21)), n10), a10 = this.length + r10.length - (n10 - e21); + return i10.length <= 32 ? new t10(i10, a10) : KL.from(t10.split(i10, []), a10); + } }, { key: "sliceString", value: function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.length, n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "\n", r10 = jo(tF(this, e21, t11), 2); + e21 = r10[0], t11 = r10[1]; + for (var o10 = "", i10 = 0, a10 = 0; i10 <= t11 && a10 < this.text.length; a10++) { + var s10 = this.text[a10], c10 = i10 + s10.length; + i10 > e21 && a10 && (o10 += n10), e21 < c10 && t11 > i10 && (o10 += s10.slice(Math.max(0, e21 - i10), t11 - i10)), i10 = c10 + 1; + } + return o10; + } }, { key: "flatten", value: function(e21) { + var t11, n10 = bo(this.text); + try { + for (n10.s(); !(t11 = n10.n()).done; ) { + var r10 = t11.value; + e21.push(r10); + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + } }, { key: "scanIdentical", value: function() { + return 0; + } }], [{ key: "split", value: function(e21, n10) { + var r10, o10 = [], i10 = -1, a10 = bo(e21); + try { + for (a10.s(); !(r10 = a10.n()).done; ) { + var s10 = r10.value; + o10.push(s10), i10 += s10.length + 1, 32 == o10.length && (n10.push(new t10(o10, i10)), o10 = [], i10 = -1); + } + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + return i10 > -1 && n10.push(new t10(o10, i10)), n10; + } }]), t10; + }(); + var KL = function(e20) { + function t10(e21, n10) { + var r10; + No(this, t10), (r10 = _o(this, t10)).children = e21, r10.length = n10, r10.lines = 0; + var o10, i10 = bo(e21); + try { + for (i10.s(); !(o10 = i10.n()).done; ) { + var a10 = o10.value; + r10.lines += a10.lines; + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + return r10; + } + return Ao(t10, UL), Do(t10, [{ key: "lineInner", value: function(e21, t11, n10, r10) { + for (var o10 = 0; ; o10++) { + var i10 = this.children[o10], a10 = r10 + i10.length, s10 = n10 + i10.lines - 1; + if ((t11 ? s10 : a10) >= e21) + return i10.lineInner(e21, t11, n10, r10); + r10 = a10 + 1, n10 = s10 + 1; + } + } }, { key: "decompose", value: function(e21, t11, n10, r10) { + for (var o10 = 0, i10 = 0; i10 <= t11 && o10 < this.children.length; o10++) { + var a10 = this.children[o10], s10 = i10 + a10.length; + if (e21 <= s10 && t11 >= i10) { + var c10 = r10 & ((i10 <= e21 ? 1 : 0) | (s10 >= t11 ? 2 : 0)); + i10 >= e21 && s10 <= t11 && !c10 ? n10.push(a10) : a10.decompose(e21 - i10, t11 - i10, n10, c10); + } + i10 = s10 + 1; + } + } }, { key: "replace", value: function(e21, n10, r10) { + var o10 = jo(tF(this, e21, n10), 2); + if (e21 = o10[0], n10 = o10[1], r10.lines < this.lines) + for (var i10 = 0, a10 = 0; i10 < this.children.length; i10++) { + var s10 = this.children[i10], c10 = a10 + s10.length; + if (e21 >= a10 && n10 <= c10) { + var l10 = s10.replace(e21 - a10, n10 - a10, r10), u10 = this.lines - s10.lines + l10.lines; + if (l10.lines < u10 >> 4 && l10.lines > u10 >> 6) { + var f10 = this.children.slice(); + return f10[i10] = l10, new t10(f10, this.length - (n10 - e21) + r10.length); + } + return go(Mo(t10.prototype), "replace", this).call(this, a10, c10, l10); + } + a10 = c10 + 1; + } + return go(Mo(t10.prototype), "replace", this).call(this, e21, n10, r10); + } }, { key: "sliceString", value: function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.length, n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "\n", r10 = jo(tF(this, e21, t11), 2); + e21 = r10[0], t11 = r10[1]; + for (var o10 = "", i10 = 0, a10 = 0; i10 < this.children.length && a10 <= t11; i10++) { + var s10 = this.children[i10], c10 = a10 + s10.length; + a10 > e21 && i10 && (o10 += n10), e21 < c10 && t11 > a10 && (o10 += s10.sliceString(e21 - a10, t11 - a10, n10)), a10 = c10 + 1; + } + return o10; + } }, { key: "flatten", value: function(e21) { + var t11, n10 = bo(this.children); + try { + for (n10.s(); !(t11 = n10.n()).done; ) { + t11.value.flatten(e21); + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + } }, { key: "scanIdentical", value: function(e21, n10) { + if (!(e21 instanceof t10)) + return 0; + for (var r10 = 0, o10 = jo(n10 > 0 ? [0, 0, this.children.length, e21.children.length] : [this.children.length - 1, e21.children.length - 1, -1, -1], 4), i10 = o10[0], a10 = o10[1], s10 = o10[2], c10 = o10[3]; ; i10 += n10, a10 += n10) { + if (i10 == s10 || a10 == c10) + return r10; + var l10 = this.children[i10], u10 = e21.children[a10]; + if (l10 != u10) + return r10 + l10.scanIdentical(u10, n10); + r10 += l10.length + 1; + } + } }], [{ key: "from", value: function(e21) { + var n10, r10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21.reduce(function(e23, t11) { + return e23 + t11.length + 1; + }, -1), o10 = 0, i10 = bo(e21); + try { + for (i10.s(); !(n10 = i10.n()).done; ) { + o10 += n10.value.lines; + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + if (o10 < 32) { + var a10, s10 = [], c10 = bo(e21); + try { + for (c10.s(); !(a10 = c10.n()).done; ) { + a10.value.flatten(s10); + } + } catch (e23) { + c10.e(e23); + } finally { + c10.f(); + } + return new JL(s10, r10); + } + var l10 = Math.max(32, o10 >> 5), u10 = l10 << 1, f10 = l10 >> 1, d10 = [], h10 = 0, v10 = -1, p10 = []; + function m10(e23) { + var n11; + if (e23.lines > u10 && e23 instanceof t10) { + var r11, o11 = bo(e23.children); + try { + for (o11.s(); !(r11 = o11.n()).done; ) { + m10(r11.value); + } + } catch (e24) { + o11.e(e24); + } finally { + o11.f(); + } + } else + e23.lines > f10 && (h10 > f10 || !h10) ? (g10(), d10.push(e23)) : e23 instanceof JL && h10 && (n11 = p10[p10.length - 1]) instanceof JL && e23.lines + n11.lines <= 32 ? (h10 += e23.lines, v10 += e23.length + 1, p10[p10.length - 1] = new JL(n11.text.concat(e23.text), n11.length + 1 + e23.length)) : (h10 + e23.lines > l10 && g10(), h10 += e23.lines, v10 += e23.length + 1, p10.push(e23)); + } + function g10() { + 0 != h10 && (d10.push(1 == p10.length ? p10[0] : t10.from(p10, v10)), v10 = -1, h10 = p10.length = 0); + } + var y10, b10 = bo(e21); + try { + for (b10.s(); !(y10 = b10.n()).done; ) { + m10(y10.value); + } + } catch (e23) { + b10.e(e23); + } finally { + b10.f(); + } + return g10(), 1 == d10.length ? d10[0] : new t10(d10, r10); + } }]), t10; + }(); + function GL(e20, t10) { + for (var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, r10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1e9, o10 = 0, i10 = 0, a10 = true; i10 < e20.length && o10 <= r10; i10++) { + var s10 = e20[i10], c10 = o10 + s10.length; + c10 >= n10 && (c10 > r10 && (s10 = s10.slice(0, r10 - o10)), o10 < n10 && (s10 = s10.slice(n10 - o10)), a10 ? (t10[t10.length - 1] += s10, a10 = false) : t10.push(s10)), o10 = c10 + 1; + } + return t10; + } + function QL(e20, t10, n10) { + return GL(e20, [""], t10, n10); + } + UL.empty = new JL([""], 0); + var YL = function() { + function e20(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; + No(this, e20), this.dir = n10, this.done = false, this.lineBreak = false, this.value = "", this.nodes = [t10], this.offsets = [n10 > 0 ? 1 : (t10 instanceof JL ? t10.text.length : t10.children.length) << 1]; + } + return Do(e20, [{ key: "nextInner", value: function(e21, t10) { + for (this.done = this.lineBreak = false; ; ) { + var n10 = this.nodes.length - 1, r10 = this.nodes[n10], o10 = this.offsets[n10], i10 = o10 >> 1, a10 = r10 instanceof JL ? r10.text.length : r10.children.length; + if (i10 == (t10 > 0 ? a10 : 0)) { + if (0 == n10) + return this.done = true, this.value = "", this; + t10 > 0 && this.offsets[n10 - 1]++, this.nodes.pop(), this.offsets.pop(); + } else if ((1 & o10) == (t10 > 0 ? 0 : 1)) { + if (this.offsets[n10] += t10, 0 == e21) + return this.lineBreak = true, this.value = "\n", this; + e21--; + } else if (r10 instanceof JL) { + var s10 = r10.text[i10 + (t10 < 0 ? -1 : 0)]; + if (this.offsets[n10] += t10, s10.length > Math.max(0, e21)) + return this.value = 0 == e21 ? s10 : t10 > 0 ? s10.slice(e21) : s10.slice(0, s10.length - e21), this; + e21 -= s10.length; + } else { + var c10 = r10.children[i10 + (t10 < 0 ? -1 : 0)]; + e21 > c10.length ? (e21 -= c10.length, this.offsets[n10] += t10) : (t10 < 0 && this.offsets[n10]--, this.nodes.push(c10), this.offsets.push(t10 > 0 ? 1 : (c10 instanceof JL ? c10.text.length : c10.children.length) << 1)); + } + } + } }, { key: "next", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0; + return e21 < 0 && (this.nextInner(-e21, -this.dir), e21 = this.value.length), this.nextInner(e21, this.dir); + } }]), e20; + }(); + var XL = function() { + function e20(t10, n10, r10) { + No(this, e20), this.value = "", this.done = false, this.cursor = new YL(t10, n10 > r10 ? -1 : 1), this.pos = n10 > r10 ? t10.length : 0, this.from = Math.min(n10, r10), this.to = Math.max(n10, r10); + } + return Do(e20, [{ key: "nextInner", value: function(e21, t10) { + if (t10 < 0 ? this.pos <= this.from : this.pos >= this.to) + return this.value = "", this.done = true, this; + e21 += Math.max(0, t10 < 0 ? this.pos - this.to : this.from - this.pos); + var n10 = t10 < 0 ? this.pos - this.from : this.to - this.pos; + e21 > n10 && (e21 = n10), n10 -= e21; + var r10 = this.cursor.next(e21).value; + return this.pos += (r10.length + e21) * t10, this.value = r10.length <= n10 ? r10 : t10 < 0 ? r10.slice(r10.length - n10) : r10.slice(0, n10), this.done = !this.value, this; + } }, { key: "next", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0; + return e21 < 0 ? e21 = Math.max(e21, this.from - this.pos) : e21 > 0 && (e21 = Math.min(e21, this.to - this.pos)), this.nextInner(e21, this.cursor.dir); + } }, { key: "lineBreak", get: function() { + return this.cursor.lineBreak && "" != this.value; + } }]), e20; + }(); + var ZL = function() { + function e20(t10) { + No(this, e20), this.inner = t10, this.afterBreak = true, this.value = "", this.done = false; + } + return Do(e20, [{ key: "next", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, t10 = this.inner.next(e21), n10 = t10.done, r10 = t10.lineBreak, o10 = t10.value; + return n10 && this.afterBreak ? (this.value = "", this.afterBreak = false) : n10 ? (this.done = true, this.value = "") : r10 ? this.afterBreak ? this.value = "" : (this.afterBreak = true, this.next()) : (this.value = o10, this.afterBreak = false), this; + } }, { key: "lineBreak", get: function() { + return false; + } }]), e20; + }(); + "undefined" != typeof Symbol && (UL.prototype[Symbol.iterator] = function() { + return this.iter(); + }, YL.prototype[Symbol.iterator] = XL.prototype[Symbol.iterator] = ZL.prototype[Symbol.iterator] = function() { + return this; + }); + var eF = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.from = t10, this.to = n10, this.number = r10, this.text = o10; + } + return Do(e20, [{ key: "length", get: function() { + return this.to - this.from; + } }]), e20; + }(); + function tF(e20, t10, n10) { + return [t10 = Math.max(0, Math.min(e20.length, t10)), Math.max(t10, Math.min(e20.length, n10))]; + } + for (nF = "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(e20) { + return e20 ? parseInt(e20, 36) : 1; + }), rF = 1; rF < nF.length; rF++) + nF[rF] += nF[rF - 1]; + var nF; + var rF; + function oF(e20) { + for (var t10 = 1; t10 < nF.length; t10 += 2) + if (nF[t10] > e20) + return nF[t10 - 1] <= e20; + return false; + } + function iF(e20) { + return e20 >= 127462 && e20 <= 127487; + } + var aF = 8205; + function sF(e20, t10) { + return (!(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2] ? cF : lF)(e20, t10, !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3]); + } + function cF(e20, t10, n10) { + if (t10 == e20.length) + return t10; + t10 && uF(e20.charCodeAt(t10)) && fF(e20.charCodeAt(t10 - 1)) && t10--; + var r10 = dF(e20, t10); + for (t10 += vF(r10); t10 < e20.length; ) { + var o10 = dF(e20, t10); + if (r10 == aF || o10 == aF || n10 && oF(o10)) + t10 += vF(o10), r10 = o10; + else { + if (!iF(o10)) + break; + for (var i10 = 0, a10 = t10 - 2; a10 >= 0 && iF(dF(e20, a10)); ) + i10++, a10 -= 2; + if (i10 % 2 == 0) + break; + t10 += 2; + } + } + return t10; + } + function lF(e20, t10, n10) { + for (; t10 > 0; ) { + var r10 = cF(e20, t10 - 2, n10); + if (r10 < t10) + return r10; + t10--; + } + return 0; + } + function uF(e20) { + return e20 >= 56320 && e20 < 57344; + } + function fF(e20) { + return e20 >= 55296 && e20 < 56320; + } + function dF(e20, t10) { + var n10 = e20.charCodeAt(t10); + if (!fF(n10) || t10 + 1 == e20.length) + return n10; + var r10 = e20.charCodeAt(t10 + 1); + return uF(r10) ? r10 - 56320 + (n10 - 55296 << 10) + 65536 : n10; + } + function hF(e20) { + return e20 <= 65535 ? String.fromCharCode(e20) : (e20 -= 65536, String.fromCharCode(55296 + (e20 >> 10), 56320 + (1023 & e20))); + } + function vF(e20) { + return e20 < 65536 ? 1 : 2; + } + var pF = /\r\n?|\n/; + var mF = function(e20) { + return e20[e20.Simple = 0] = "Simple", e20[e20.TrackDel = 1] = "TrackDel", e20[e20.TrackBefore = 2] = "TrackBefore", e20[e20.TrackAfter = 3] = "TrackAfter", e20; + }(mF || (mF = {})); + var gF = function() { + function e20(t10) { + No(this, e20), this.sections = t10; + } + return Do(e20, [{ key: "length", get: function() { + for (var e21 = 0, t10 = 0; t10 < this.sections.length; t10 += 2) + e21 += this.sections[t10]; + return e21; + } }, { key: "newLength", get: function() { + for (var e21 = 0, t10 = 0; t10 < this.sections.length; t10 += 2) { + var n10 = this.sections[t10 + 1]; + e21 += n10 < 0 ? this.sections[t10] : n10; + } + return e21; + } }, { key: "empty", get: function() { + return 0 == this.sections.length || 2 == this.sections.length && this.sections[1] < 0; + } }, { key: "iterGaps", value: function(e21) { + for (var t10 = 0, n10 = 0, r10 = 0; t10 < this.sections.length; ) { + var o10 = this.sections[t10++], i10 = this.sections[t10++]; + i10 < 0 ? (e21(n10, r10, o10), r10 += o10) : r10 += i10, n10 += o10; + } + } }, { key: "iterChangedRanges", value: function(e21) { + wF(this, e21, arguments.length > 1 && void 0 !== arguments[1] && arguments[1]); + } }, { key: "invertedDesc", get: function() { + for (var t10 = [], n10 = 0; n10 < this.sections.length; ) { + var r10 = this.sections[n10++], o10 = this.sections[n10++]; + o10 < 0 ? t10.push(r10, o10) : t10.push(o10, r10); + } + return new e20(t10); + } }, { key: "composeDesc", value: function(e21) { + return this.empty ? e21 : e21.empty ? this : jF(this, e21); + } }, { key: "mapDesc", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + return e21.empty ? this : xF(this, e21, t10); + } }, { key: "mapPos", value: function(e21) { + for (var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1, n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : mF.Simple, r10 = 0, o10 = 0, i10 = 0; i10 < this.sections.length; ) { + var a10 = this.sections[i10++], s10 = this.sections[i10++], c10 = r10 + a10; + if (s10 < 0) { + if (c10 > e21) + return o10 + (e21 - r10); + o10 += a10; + } else { + if (n10 != mF.Simple && c10 >= e21 && (n10 == mF.TrackDel && r10 < e21 && c10 > e21 || n10 == mF.TrackBefore && r10 < e21 || n10 == mF.TrackAfter && c10 > e21)) + return null; + if (c10 > e21 || c10 == e21 && t10 < 0 && !a10) + return e21 == r10 || t10 < 0 ? o10 : o10 + s10; + o10 += s10; + } + r10 = c10; + } + if (e21 > r10) + throw new RangeError("Position ".concat(e21, " is out of range for changeset of length ").concat(r10)); + return o10; + } }, { key: "touchesRange", value: function(e21) { + for (var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21, n10 = 0, r10 = 0; n10 < this.sections.length && r10 <= t10; ) { + var o10 = r10 + this.sections[n10++]; + if (this.sections[n10++] >= 0 && r10 <= t10 && o10 >= e21) + return !(r10 < e21 && o10 > t10) || "cover"; + r10 = o10; + } + return false; + } }, { key: "toString", value: function() { + for (var e21 = "", t10 = 0; t10 < this.sections.length; ) { + var n10 = this.sections[t10++], r10 = this.sections[t10++]; + e21 += (e21 ? " " : "") + n10 + (r10 >= 0 ? ":" + r10 : ""); + } + return e21; + } }, { key: "toJSON", value: function() { + return this.sections; + } }], [{ key: "fromJSON", value: function(t10) { + if (!Array.isArray(t10) || t10.length % 2 || t10.some(function(e21) { + return "number" != typeof e21; + })) + throw new RangeError("Invalid JSON representation of ChangeDesc"); + return new e20(t10); + } }, { key: "create", value: function(t10) { + return new e20(t10); + } }]), e20; + }(); + var yF = function(e20) { + function t10(e21, n10) { + var r10; + return No(this, t10), (r10 = _o(this, t10, [e21])).inserted = n10, r10; + } + return Ao(t10, gF), Do(t10, [{ key: "apply", value: function(e21) { + if (this.length != e21.length) + throw new RangeError("Applying change set to a document with the wrong length"); + return wF(this, function(t11, n10, r10, o10, i10) { + return e21 = e21.replace(r10, r10 + (n10 - t11), i10); + }, false), e21; + } }, { key: "mapDesc", value: function(e21) { + return xF(this, e21, arguments.length > 1 && void 0 !== arguments[1] && arguments[1], true); + } }, { key: "invert", value: function(e21) { + for (var n10 = this.sections.slice(), r10 = [], o10 = 0, i10 = 0; o10 < n10.length; o10 += 2) { + var a10 = n10[o10], s10 = n10[o10 + 1]; + if (s10 >= 0) { + n10[o10] = s10, n10[o10 + 1] = a10; + for (var c10 = o10 >> 1; r10.length < c10; ) + r10.push(UL.empty); + r10.push(a10 ? e21.slice(i10, i10 + a10) : UL.empty); + } + i10 += a10; + } + return new t10(n10, r10); + } }, { key: "compose", value: function(e21) { + return this.empty ? e21 : e21.empty ? this : jF(this, e21, true); + } }, { key: "map", value: function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + return e21.empty ? this : xF(this, e21, t11, true); + } }, { key: "iterChanges", value: function(e21) { + wF(this, e21, arguments.length > 1 && void 0 !== arguments[1] && arguments[1]); + } }, { key: "desc", get: function() { + return gF.create(this.sections); + } }, { key: "filter", value: function(e21) { + var n10 = [], r10 = [], o10 = [], i10 = new SF(this); + e: + for (var a10 = 0, s10 = 0; ; ) { + for (var c10 = a10 == e21.length ? 1e9 : e21[a10++]; s10 < c10 || s10 == c10 && 0 == i10.len; ) { + if (i10.done) + break e; + var l10 = Math.min(i10.len, c10 - s10); + bF(o10, l10, -1); + var u10 = -1 == i10.ins ? -1 : 0 == i10.off ? i10.ins : 0; + bF(n10, l10, u10), u10 > 0 && kF(r10, n10, i10.text), i10.forward(l10), s10 += l10; + } + for (var f10 = e21[a10++]; s10 < f10; ) { + if (i10.done) + break e; + var d10 = Math.min(i10.len, f10 - s10); + bF(n10, d10, -1), bF(o10, d10, -1 == i10.ins ? -1 : 0 == i10.off ? i10.ins : 0), i10.forward(d10), s10 += d10; + } + } + return { changes: new t10(n10, r10), filtered: gF.create(o10) }; + } }, { key: "toJSON", value: function() { + for (var e21 = [], t11 = 0; t11 < this.sections.length; t11 += 2) { + var n10 = this.sections[t11], r10 = this.sections[t11 + 1]; + r10 < 0 ? e21.push(n10) : 0 == r10 ? e21.push([n10]) : e21.push([n10].concat(this.inserted[t11 >> 1].toJSON())); + } + return e21; + } }], [{ key: "of", value: function(e21, n10, r10) { + var o10 = [], i10 = [], a10 = 0, s10 = null; + function c10() { + if (arguments.length > 0 && void 0 !== arguments[0] && arguments[0] || o10.length) { + a10 < n10 && bF(o10, n10 - a10, -1); + var e23 = new t10(o10, i10); + s10 = s10 ? s10.compose(e23.map(s10)) : e23, o10 = [], i10 = [], a10 = 0; + } + } + return function e23(l10) { + if (Array.isArray(l10)) { + var u10, f10 = bo(l10); + try { + for (f10.s(); !(u10 = f10.n()).done; ) { + e23(u10.value); + } + } catch (e24) { + f10.e(e24); + } finally { + f10.f(); + } + } else if (l10 instanceof t10) { + if (l10.length != n10) + throw new RangeError("Mismatched change set length (got ".concat(l10.length, ", expected ").concat(n10, ")")); + c10(), s10 = s10 ? s10.compose(l10.map(s10)) : l10; + } else { + var d10 = l10.from, h10 = l10.to, v10 = void 0 === h10 ? d10 : h10, p10 = l10.insert; + if (d10 > v10 || d10 < 0 || v10 > n10) + throw new RangeError("Invalid change range ".concat(d10, " to ").concat(v10, " (in doc of length ").concat(n10, ")")); + var m10 = p10 ? "string" == typeof p10 ? UL.of(p10.split(r10 || pF)) : p10 : UL.empty, g10 = m10.length; + if (d10 == v10 && 0 == g10) + return; + d10 < a10 && c10(), d10 > a10 && bF(o10, d10 - a10, -1), bF(o10, v10 - d10, g10), kF(i10, o10, m10), a10 = v10; + } + }(e21), c10(!s10), s10; + } }, { key: "empty", value: function(e21) { + return new t10(e21 ? [e21, -1] : [], []); + } }, { key: "fromJSON", value: function(e21) { + if (!Array.isArray(e21)) + throw new RangeError("Invalid JSON representation of ChangeSet"); + for (var n10 = [], r10 = [], o10 = 0; o10 < e21.length; o10++) { + var i10 = e21[o10]; + if ("number" == typeof i10) + n10.push(i10, -1); + else { + if (!Array.isArray(i10) || "number" != typeof i10[0] || i10.some(function(e23, t11) { + return t11 && "string" != typeof e23; + })) + throw new RangeError("Invalid JSON representation of ChangeSet"); + if (1 == i10.length) + n10.push(i10[0], 0); + else { + for (; r10.length < o10; ) + r10.push(UL.empty); + r10[o10] = UL.of(i10.slice(1)), n10.push(i10[0], r10[o10].length); + } + } + } + return new t10(n10, r10); + } }, { key: "createSet", value: function(e21, n10) { + return new t10(e21, n10); + } }]), t10; + }(); + function bF(e20, t10, n10) { + var r10 = arguments.length > 3 && void 0 !== arguments[3] && arguments[3]; + if (!(0 == t10 && n10 <= 0)) { + var o10 = e20.length - 2; + o10 >= 0 && n10 <= 0 && n10 == e20[o10 + 1] ? e20[o10] += t10 : 0 == t10 && 0 == e20[o10] ? e20[o10 + 1] += n10 : r10 ? (e20[o10] += t10, e20[o10 + 1] += n10) : e20.push(t10, n10); + } + } + function kF(e20, t10, n10) { + if (0 != n10.length) { + var r10 = t10.length - 2 >> 1; + if (r10 < e20.length) + e20[e20.length - 1] = e20[e20.length - 1].append(n10); + else { + for (; e20.length < r10; ) + e20.push(UL.empty); + e20.push(n10); + } + } + } + function wF(e20, t10, n10) { + for (var r10 = e20.inserted, o10 = 0, i10 = 0, a10 = 0; a10 < e20.sections.length; ) { + var s10 = e20.sections[a10++], c10 = e20.sections[a10++]; + if (c10 < 0) + o10 += s10, i10 += s10; + else { + for (var l10 = o10, u10 = i10, f10 = UL.empty; l10 += s10, u10 += c10, c10 && r10 && (f10 = f10.append(r10[a10 - 2 >> 1])), !(n10 || a10 == e20.sections.length || e20.sections[a10 + 1] < 0); ) + s10 = e20.sections[a10++], c10 = e20.sections[a10++]; + t10(o10, l10, i10, u10, f10), o10 = l10, i10 = u10; + } + } + } + function xF(e20, t10, n10) { + for (var r10 = [], o10 = arguments.length > 3 && void 0 !== arguments[3] && arguments[3] ? [] : null, i10 = new SF(e20), a10 = new SF(t10), s10 = -1; ; ) + if (-1 == i10.ins && -1 == a10.ins) { + var c10 = Math.min(i10.len, a10.len); + bF(r10, c10, -1), i10.forward(c10), a10.forward(c10); + } else if (a10.ins >= 0 && (i10.ins < 0 || s10 == i10.i || 0 == i10.off && (a10.len < i10.len || a10.len == i10.len && !n10))) { + var l10 = a10.len; + for (bF(r10, a10.ins, -1); l10; ) { + var u10 = Math.min(i10.len, l10); + i10.ins >= 0 && s10 < i10.i && i10.len <= u10 && (bF(r10, 0, i10.ins), o10 && kF(o10, r10, i10.text), s10 = i10.i), i10.forward(u10), l10 -= u10; + } + a10.next(); + } else { + if (!(i10.ins >= 0)) { + if (i10.done && a10.done) + return o10 ? yF.createSet(r10, o10) : gF.create(r10); + throw new Error("Mismatched change set lengths"); + } + for (var f10 = 0, d10 = i10.len; d10; ) + if (-1 == a10.ins) { + var h10 = Math.min(d10, a10.len); + f10 += h10, d10 -= h10, a10.forward(h10); + } else { + if (!(0 == a10.ins && a10.len < d10)) + break; + d10 -= a10.len, a10.next(); + } + bF(r10, f10, s10 < i10.i ? i10.ins : 0), o10 && s10 < i10.i && kF(o10, r10, i10.text), s10 = i10.i, i10.forward(i10.len - d10); + } + } + function jF(e20, t10) { + for (var n10 = [], r10 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2] ? [] : null, o10 = new SF(e20), i10 = new SF(t10), a10 = false; ; ) { + if (o10.done && i10.done) + return r10 ? yF.createSet(n10, r10) : gF.create(n10); + if (0 == o10.ins) + bF(n10, o10.len, 0, a10), o10.next(); + else if (0 != i10.len || i10.done) { + if (o10.done || i10.done) + throw new Error("Mismatched change set lengths"); + var s10 = Math.min(o10.len2, i10.len), c10 = n10.length; + if (-1 == o10.ins) { + var l10 = -1 == i10.ins ? -1 : i10.off ? 0 : i10.ins; + bF(n10, s10, l10, a10), r10 && l10 && kF(r10, n10, i10.text); + } else + -1 == i10.ins ? (bF(n10, o10.off ? 0 : o10.len, s10, a10), r10 && kF(r10, n10, o10.textBit(s10))) : (bF(n10, o10.off ? 0 : o10.len, i10.off ? 0 : i10.ins, a10), r10 && !i10.off && kF(r10, n10, i10.text)); + a10 = (o10.ins > s10 || i10.ins >= 0 && i10.len > s10) && (a10 || n10.length > c10), o10.forward2(s10), i10.forward(s10); + } else + bF(n10, 0, i10.ins, a10), r10 && kF(r10, n10, i10.text), i10.next(); + } + } + var SF = function() { + function e20(t10) { + No(this, e20), this.set = t10, this.i = 0, this.next(); + } + return Do(e20, [{ key: "next", value: function() { + var e21 = this.set.sections; + this.i < e21.length ? (this.len = e21[this.i++], this.ins = e21[this.i++]) : (this.len = 0, this.ins = -2), this.off = 0; + } }, { key: "done", get: function() { + return -2 == this.ins; + } }, { key: "len2", get: function() { + return this.ins < 0 ? this.len : this.ins; + } }, { key: "text", get: function() { + var e21 = this.set.inserted, t10 = this.i - 2 >> 1; + return t10 >= e21.length ? UL.empty : e21[t10]; + } }, { key: "textBit", value: function(e21) { + var t10 = this.set.inserted, n10 = this.i - 2 >> 1; + return n10 >= t10.length && !e21 ? UL.empty : t10[n10].slice(this.off, null == e21 ? void 0 : this.off + e21); + } }, { key: "forward", value: function(e21) { + e21 == this.len ? this.next() : (this.len -= e21, this.off += e21); + } }, { key: "forward2", value: function(e21) { + -1 == this.ins ? this.forward(e21) : e21 == this.ins ? this.next() : (this.ins -= e21, this.off += e21); + } }]), e20; + }(); + var CF = function() { + function e20(t10, n10, r10) { + No(this, e20), this.from = t10, this.to = n10, this.flags = r10; + } + return Do(e20, [{ key: "anchor", get: function() { + return 32 & this.flags ? this.to : this.from; + } }, { key: "head", get: function() { + return 32 & this.flags ? this.from : this.to; + } }, { key: "empty", get: function() { + return this.from == this.to; + } }, { key: "assoc", get: function() { + return 8 & this.flags ? -1 : 16 & this.flags ? 1 : 0; + } }, { key: "bidiLevel", get: function() { + var e21 = 7 & this.flags; + return 7 == e21 ? null : e21; + } }, { key: "goalColumn", get: function() { + var e21 = this.flags >> 6; + return 16777215 == e21 ? void 0 : e21; + } }, { key: "map", value: function(t10) { + var n10, r10, o10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1; + return this.empty ? n10 = r10 = t10.mapPos(this.from, o10) : (n10 = t10.mapPos(this.from, 1), r10 = t10.mapPos(this.to, -1)), n10 == this.from && r10 == this.to ? this : new e20(n10, r10, this.flags); + } }, { key: "extend", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21; + if (e21 <= this.anchor && t10 >= this.anchor) + return $F.range(e21, t10); + var n10 = Math.abs(e21 - this.anchor) > Math.abs(t10 - this.anchor) ? e21 : t10; + return $F.range(this.anchor, n10); + } }, { key: "eq", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + return !(this.anchor != e21.anchor || this.head != e21.head || t10 && this.empty && this.assoc != e21.assoc); + } }, { key: "toJSON", value: function() { + return { anchor: this.anchor, head: this.head }; + } }], [{ key: "fromJSON", value: function(e21) { + if (!e21 || "number" != typeof e21.anchor || "number" != typeof e21.head) + throw new RangeError("Invalid JSON representation for SelectionRange"); + return $F.range(e21.anchor, e21.head); + } }, { key: "create", value: function(t10, n10, r10) { + return new e20(t10, n10, r10); + } }]), e20; + }(); + var $F = function() { + function e20(t10, n10) { + No(this, e20), this.ranges = t10, this.mainIndex = n10; + } + return Do(e20, [{ key: "map", value: function(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1; + return t10.empty ? this : e20.create(this.ranges.map(function(e21) { + return e21.map(t10, n10); + }), this.mainIndex); + } }, { key: "eq", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + if (this.ranges.length != e21.ranges.length || this.mainIndex != e21.mainIndex) + return false; + for (var n10 = 0; n10 < this.ranges.length; n10++) + if (!this.ranges[n10].eq(e21.ranges[n10], t10)) + return false; + return true; + } }, { key: "main", get: function() { + return this.ranges[this.mainIndex]; + } }, { key: "asSingle", value: function() { + return 1 == this.ranges.length ? this : new e20([this.main], 0); + } }, { key: "addRange", value: function(t10) { + var n10 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]; + return e20.create([t10].concat(this.ranges), n10 ? 0 : this.mainIndex + 1); + } }, { key: "replaceRange", value: function(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.mainIndex, r10 = this.ranges.slice(); + return r10[n10] = t10, e20.create(r10, this.mainIndex); + } }, { key: "toJSON", value: function() { + return { ranges: this.ranges.map(function(e21) { + return e21.toJSON(); + }), main: this.mainIndex }; + } }], [{ key: "fromJSON", value: function(t10) { + if (!t10 || !Array.isArray(t10.ranges) || "number" != typeof t10.main || t10.main >= t10.ranges.length) + throw new RangeError("Invalid JSON representation for EditorSelection"); + return new e20(t10.ranges.map(function(e21) { + return CF.fromJSON(e21); + }), t10.main); + } }, { key: "single", value: function(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : t10; + return new e20([e20.range(t10, n10)], 0); + } }, { key: "create", value: function(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; + if (0 == t10.length) + throw new RangeError("A selection needs at least one range"); + for (var r10 = 0, o10 = 0; o10 < t10.length; o10++) { + var i10 = t10[o10]; + if (i10.empty ? i10.from <= r10 : i10.from < r10) + return e20.normalized(t10.slice(), n10); + r10 = i10.to; + } + return new e20(t10, n10); + } }, { key: "cursor", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n10 = arguments.length > 2 ? arguments[2] : void 0, r10 = arguments.length > 3 ? arguments[3] : void 0; + return CF.create(e21, e21, (0 == t10 ? 0 : t10 < 0 ? 8 : 16) | (null == n10 ? 7 : Math.min(6, n10)) | (null != r10 ? r10 : 16777215) << 6); + } }, { key: "range", value: function(e21, t10, n10, r10) { + var o10 = (null != n10 ? n10 : 16777215) << 6 | (null == r10 ? 7 : Math.min(6, r10)); + return t10 < e21 ? CF.create(t10, e21, 48 | o10) : CF.create(e21, t10, (t10 > e21 ? 8 : 0) | o10); + } }, { key: "normalized", value: function(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r10 = t10[n10]; + t10.sort(function(e21, t11) { + return e21.from - t11.from; + }), n10 = t10.indexOf(r10); + for (var o10 = 1; o10 < t10.length; o10++) { + var i10 = t10[o10], a10 = t10[o10 - 1]; + if (i10.empty ? i10.from <= a10.to : i10.from < a10.to) { + var s10 = a10.from, c10 = Math.max(i10.to, a10.to); + o10 <= n10 && n10--, t10.splice(--o10, 2, i10.anchor > i10.head ? e20.range(c10, s10) : e20.range(s10, c10)); + } + } + return new e20(t10, n10); + } }]), e20; + }(); + function _F(e20, t10) { + var n10, r10 = bo(e20.ranges); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + if (n10.value.to > t10) + throw new RangeError("Selection points outside of document"); + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + } + var OF = 0; + var MF = function() { + function e20(t10, n10, r10, o10, i10) { + No(this, e20), this.combine = t10, this.compareInput = n10, this.compare = r10, this.isStatic = o10, this.id = OF++, this.default = t10([]), this.extensions = "function" == typeof i10 ? i10(this) : i10; + } + return Do(e20, [{ key: "reader", get: function() { + return this; + } }, { key: "of", value: function(e21) { + return new AF([], this, 0, e21); + } }, { key: "compute", value: function(e21, t10) { + if (this.isStatic) + throw new Error("Can't compute a static facet"); + return new AF(e21, this, 1, t10); + } }, { key: "computeN", value: function(e21, t10) { + if (this.isStatic) + throw new Error("Can't compute a static facet"); + return new AF(e21, this, 2, t10); + } }, { key: "from", value: function(e21, t10) { + return t10 || (t10 = function(e23) { + return e23; + }), this.compute([e21], function(n10) { + return t10(n10.field(e21)); + }); + } }], [{ key: "define", value: function() { + var t10 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return new e20(t10.combine || function(e21) { + return e21; + }, t10.compareInput || function(e21, t11) { + return e21 === t11; + }, t10.compare || (t10.combine ? function(e21, t11) { + return e21 === t11; + } : EF), !!t10.static, t10.enables); + } }]), e20; + }(); + function EF(e20, t10) { + return e20 == t10 || e20.length == t10.length && e20.every(function(e21, n10) { + return e21 === t10[n10]; + }); + } + var AF = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.dependencies = t10, this.facet = n10, this.type = r10, this.value = o10, this.id = OF++; + } + return Do(e20, [{ key: "dynamicSlot", value: function(e21) { + var t10, n10, r10 = this, o10 = this.value, i10 = this.facet.compareInput, a10 = this.id, s10 = e21[a10] >> 1, c10 = 2 == this.type, l10 = false, u10 = false, f10 = [], d10 = bo(this.dependencies); + try { + for (d10.s(); !(n10 = d10.n()).done; ) { + var h10 = n10.value; + "doc" == h10 ? l10 = true : "selection" == h10 ? u10 = true : 0 == (1 & (null !== (t10 = e21[h10.id]) && void 0 !== t10 ? t10 : 1)) && f10.push(e21[h10.id]); + } + } catch (e23) { + d10.e(e23); + } finally { + d10.f(); + } + return { create: function(e23) { + return e23.values[s10] = o10(e23), 1; + }, update: function(e23, t11) { + if (l10 && t11.docChanged || u10 && (t11.docChanged || t11.selection) || TF(e23, f10)) { + var n11 = o10(e23); + if (c10 ? !PF(n11, e23.values[s10], i10) : !i10(n11, e23.values[s10])) + return e23.values[s10] = n11, 1; + } + return 0; + }, reconfigure: function(e23, t11) { + var n11, l11 = t11.config.address[a10]; + if (null != l11) { + var u11 = JF(t11, l11); + if (r10.dependencies.every(function(n12) { + return n12 instanceof MF ? t11.facet(n12) === e23.facet(n12) : !(n12 instanceof NF) || t11.field(n12, false) == e23.field(n12, false); + }) || (c10 ? PF(n11 = o10(e23), u11, i10) : i10(n11 = o10(e23), u11))) + return e23.values[s10] = u11, 0; + } else + n11 = o10(e23); + return e23.values[s10] = n11, 1; + } }; + } }]), e20; + }(); + function PF(e20, t10, n10) { + if (e20.length != t10.length) + return false; + for (var r10 = 0; r10 < e20.length; r10++) + if (!n10(e20[r10], t10[r10])) + return false; + return true; + } + function TF(e20, t10) { + var n10, r10 = false, o10 = bo(t10); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + 1 & UF(e20, n10.value) && (r10 = true); + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + return r10; + } + var RF = MF.define({ static: true }); + var NF = function() { + function e20(t10, n10, r10, o10, i10) { + No(this, e20), this.id = t10, this.createF = n10, this.updateF = r10, this.compareF = o10, this.spec = i10, this.provides = void 0; + } + return Do(e20, [{ key: "create", value: function(e21) { + var t10 = this, n10 = e21.facet(RF).find(function(e23) { + return e23.field == t10; + }); + return ((null == n10 ? void 0 : n10.create) || this.createF)(e21); + } }, { key: "slot", value: function(e21) { + var t10 = this, n10 = e21[this.id] >> 1; + return { create: function(e23) { + return e23.values[n10] = t10.create(e23), 1; + }, update: function(e23, r10) { + var o10 = e23.values[n10], i10 = t10.updateF(o10, r10); + return t10.compareF(o10, i10) ? 0 : (e23.values[n10] = i10, 1); + }, reconfigure: function(e23, r10) { + return null != r10.config.address[t10.id] ? (e23.values[n10] = r10.field(t10), 0) : (e23.values[n10] = t10.create(e23), 1); + } }; + } }, { key: "init", value: function(e21) { + return [this, RF.of({ field: this, create: e21 })]; + } }, { key: "extension", get: function() { + return this; + } }], [{ key: "define", value: function(t10) { + var n10 = new e20(OF++, t10.create, t10.update, t10.compare || function(e21, t11) { + return e21 === t11; + }, t10); + return t10.provide && (n10.provides = t10.provide(n10)), n10; + } }]), e20; + }(); + var IF = 4; + var DF = 3; + var qF = 2; + var zF = 1; + function BF(e20) { + return function(t10) { + return new FF(t10, e20); + }; + } + var LF = { highest: BF(0), high: BF(zF), default: BF(qF), low: BF(DF), lowest: BF(IF) }; + var FF = Do(function e2(t10, n10) { + No(this, e2), this.inner = t10, this.prec = n10; + }); + var VF = function() { + function e20() { + No(this, e20); + } + return Do(e20, [{ key: "of", value: function(e21) { + return new HF(this, e21); + } }, { key: "reconfigure", value: function(t10) { + return e20.reconfigure.of({ compartment: this, extension: t10 }); + } }, { key: "get", value: function(e21) { + return e21.config.compartments.get(this); + } }]), e20; + }(); + var HF = Do(function e3(t10, n10) { + No(this, e3), this.compartment = t10, this.inner = n10; + }); + var WF = function() { + function e20(t10, n10, r10, o10, i10, a10) { + for (No(this, e20), this.base = t10, this.compartments = n10, this.dynamicSlots = r10, this.address = o10, this.staticValues = i10, this.facets = a10, this.statusTemplate = []; this.statusTemplate.length < r10.length; ) + this.statusTemplate.push(0); + } + return Do(e20, [{ key: "staticFacet", value: function(e21) { + var t10 = this.address[e21.id]; + return null == t10 ? e21.default : this.staticValues[t10 >> 1]; + } }], [{ key: "resolve", value: function(t10, n10, r10) { + var o10, i10 = [], a10 = /* @__PURE__ */ Object.create(null), s10 = /* @__PURE__ */ new Map(), c10 = bo(function(e21, t11, n11) { + var r11 = [[], [], [], [], []], o11 = /* @__PURE__ */ new Map(); + function i11(e23, a11) { + var s11 = o11.get(e23); + if (null != s11) { + if (s11 <= a11) + return; + var c11 = r11[s11].indexOf(e23); + c11 > -1 && r11[s11].splice(c11, 1), e23 instanceof HF && n11.delete(e23.compartment); + } + if (o11.set(e23, a11), Array.isArray(e23)) { + var l11, u11 = bo(e23); + try { + for (u11.s(); !(l11 = u11.n()).done; ) { + i11(l11.value, a11); + } + } catch (e24) { + u11.e(e24); + } finally { + u11.f(); + } + } else if (e23 instanceof HF) { + if (n11.has(e23.compartment)) + throw new RangeError("Duplicate use of compartment in extensions"); + var f11 = t11.get(e23.compartment) || e23.inner; + n11.set(e23.compartment, f11), i11(f11, a11); + } else if (e23 instanceof FF) + i11(e23.inner, e23.prec); + else if (e23 instanceof NF) + r11[a11].push(e23), e23.provides && i11(e23.provides, a11); + else if (e23 instanceof AF) + r11[a11].push(e23), e23.facet.extensions && i11(e23.facet.extensions, qF); + else { + var d11 = e23.extension; + if (!d11) + throw new Error("Unrecognized extension value in extension set (".concat(e23, "). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.")); + i11(d11, a11); + } + } + return i11(e21, qF), r11.reduce(function(e23, t12) { + return e23.concat(t12); + }); + }(t10, n10, s10)); + try { + for (c10.s(); !(o10 = c10.n()).done; ) { + var l10 = o10.value; + l10 instanceof NF ? i10.push(l10) : (a10[l10.facet.id] || (a10[l10.facet.id] = [])).push(l10); + } + } catch (e21) { + c10.e(e21); + } finally { + c10.f(); + } + for (var u10 = /* @__PURE__ */ Object.create(null), f10 = [], d10 = [], h10 = function() { + var e21 = p10[v10]; + u10[e21.id] = d10.length << 1, d10.push(function(t11) { + return e21.slot(t11); + }); + }, v10 = 0, p10 = i10; v10 < p10.length; v10++) + h10(); + var m10 = null == r10 ? void 0 : r10.config.facets, g10 = function() { + var e21 = a10[y10], t11 = e21[0].facet, n11 = m10 && m10[y10] || []; + if (e21.every(function(e23) { + return 0 == e23.type; + })) + if (u10[t11.id] = f10.length << 1 | 1, EF(n11, e21)) + f10.push(r10.facet(t11)); + else { + var o11 = t11.combine(e21.map(function(e23) { + return e23.value; + })); + f10.push(r10 && t11.compare(o11, r10.facet(t11)) ? r10.facet(t11) : o11); + } + else { + var i11, s11 = bo(e21); + try { + var c11 = function() { + var e23 = i11.value; + 0 == e23.type ? (u10[e23.id] = f10.length << 1 | 1, f10.push(e23.value)) : (u10[e23.id] = d10.length << 1, d10.push(function(t12) { + return e23.dynamicSlot(t12); + })); + }; + for (s11.s(); !(i11 = s11.n()).done; ) + c11(); + } catch (e23) { + s11.e(e23); + } finally { + s11.f(); + } + u10[t11.id] = d10.length << 1, d10.push(function(n12) { + return function(e23, t12, n13) { + var r11 = n13.map(function(t13) { + return e23[t13.id]; + }), o12 = n13.map(function(e24) { + return e24.type; + }), i12 = r11.filter(function(e24) { + return !(1 & e24); + }), a11 = e23[t12.id] >> 1; + function s12(e24) { + for (var n14 = [], i13 = 0; i13 < r11.length; i13++) { + var a12 = JF(e24, r11[i13]); + if (2 == o12[i13]) { + var s13, c12 = bo(a12); + try { + for (c12.s(); !(s13 = c12.n()).done; ) { + var l11 = s13.value; + n14.push(l11); + } + } catch (e25) { + c12.e(e25); + } finally { + c12.f(); + } + } else + n14.push(a12); + } + return t12.combine(n14); + } + return { create: function(e24) { + var t13, n14 = bo(r11); + try { + for (n14.s(); !(t13 = n14.n()).done; ) + UF(e24, t13.value); + } catch (e25) { + n14.e(e25); + } finally { + n14.f(); + } + return e24.values[a11] = s12(e24), 1; + }, update: function(e24, n14) { + if (!TF(e24, i12)) + return 0; + var r12 = s12(e24); + return t12.compare(r12, e24.values[a11]) ? 0 : (e24.values[a11] = r12, 1); + }, reconfigure: function(e24, o13) { + var i13 = TF(e24, r11), c12 = o13.config.facets[t12.id], l11 = o13.facet(t12); + if (c12 && !i13 && EF(n13, c12)) + return e24.values[a11] = l11, 0; + var u11 = s12(e24); + return t12.compare(u11, l11) ? (e24.values[a11] = l11, 0) : (e24.values[a11] = u11, 1); + } }; + }(n12, t11, e21); + }); + } + }; + for (var y10 in a10) + g10(); + return new e20(t10, s10, d10.map(function(e21) { + return e21(u10); + }), u10, f10, a10); + } }]), e20; + }(); + function UF(e20, t10) { + if (1 & t10) + return 2; + var n10 = t10 >> 1, r10 = e20.status[n10]; + if (4 == r10) + throw new Error("Cyclic dependency between fields and/or facets"); + if (2 & r10) + return r10; + e20.status[n10] = 4; + var o10 = e20.computeSlot(e20, e20.config.dynamicSlots[n10]); + return e20.status[n10] = 2 | o10; + } + function JF(e20, t10) { + return 1 & t10 ? e20.config.staticValues[t10 >> 1] : e20.values[t10 >> 1]; + } + var KF = MF.define(); + var GF = MF.define({ combine: function(e20) { + return e20.some(function(e21) { + return e21; + }); + }, static: true }); + var QF = MF.define({ combine: function(e20) { + return e20.length ? e20[0] : void 0; + }, static: true }); + var YF = MF.define(); + var XF = MF.define(); + var ZF = MF.define(); + var eV = MF.define({ combine: function(e20) { + return !!e20.length && e20[0]; + } }); + var tV = function() { + function e20(t10, n10) { + No(this, e20), this.type = t10, this.value = n10; + } + return Do(e20, null, [{ key: "define", value: function() { + return new nV(); + } }]), e20; + }(); + var nV = function() { + function e20() { + No(this, e20); + } + return Do(e20, [{ key: "of", value: function(e21) { + return new tV(this, e21); + } }]), e20; + }(); + var rV = function() { + function e20(t10) { + No(this, e20), this.map = t10; + } + return Do(e20, [{ key: "of", value: function(e21) { + return new oV(this, e21); + } }]), e20; + }(); + var oV = function() { + function e20(t10, n10) { + No(this, e20), this.type = t10, this.value = n10; + } + return Do(e20, [{ key: "map", value: function(t10) { + var n10 = this.type.map(this.value, t10); + return void 0 === n10 ? void 0 : n10 == this.value ? this : new e20(this.type, n10); + } }, { key: "is", value: function(e21) { + return this.type == e21; + } }], [{ key: "define", value: function() { + return new rV((arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).map || function(e21) { + return e21; + }); + } }, { key: "mapEffects", value: function(e21, t10) { + if (!e21.length) + return e21; + var n10, r10 = [], o10 = bo(e21); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = n10.value.map(t10); + i10 && r10.push(i10); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + return r10; + } }]), e20; + }(); + oV.reconfigure = oV.define(), oV.appendConfig = oV.define(); + var iV = function() { + function e20(t10, n10, r10, o10, i10, a10) { + No(this, e20), this.startState = t10, this.changes = n10, this.selection = r10, this.effects = o10, this.annotations = i10, this.scrollIntoView = a10, this._doc = null, this._state = null, r10 && _F(r10, n10.newLength), i10.some(function(t11) { + return t11.type == e20.time; + }) || (this.annotations = i10.concat(e20.time.of(Date.now()))); + } + return Do(e20, [{ key: "newDoc", get: function() { + return this._doc || (this._doc = this.changes.apply(this.startState.doc)); + } }, { key: "newSelection", get: function() { + return this.selection || this.startState.selection.map(this.changes); + } }, { key: "state", get: function() { + return this._state || this.startState.applyTransaction(this), this._state; + } }, { key: "annotation", value: function(e21) { + var t10, n10 = bo(this.annotations); + try { + for (n10.s(); !(t10 = n10.n()).done; ) { + var r10 = t10.value; + if (r10.type == e21) + return r10.value; + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + } }, { key: "docChanged", get: function() { + return !this.changes.empty; + } }, { key: "reconfigured", get: function() { + return this.startState.config != this.state.config; + } }, { key: "isUserEvent", value: function(t10) { + var n10 = this.annotation(e20.userEvent); + return !(!n10 || !(n10 == t10 || n10.length > t10.length && n10.slice(0, t10.length) == t10 && "." == n10[t10.length])); + } }], [{ key: "create", value: function(t10, n10, r10, o10, i10, a10) { + return new e20(t10, n10, r10, o10, i10, a10); + } }]), e20; + }(); + function aV(e20, t10) { + for (var n10 = [], r10 = 0, o10 = 0; ; ) { + var i10 = void 0, a10 = void 0; + if (r10 < e20.length && (o10 == t10.length || t10[o10] >= e20[r10])) + i10 = e20[r10++], a10 = e20[r10++]; + else { + if (!(o10 < t10.length)) + return n10; + i10 = t10[o10++], a10 = t10[o10++]; + } + !n10.length || n10[n10.length - 1] < i10 ? n10.push(i10, a10) : n10[n10.length - 1] < a10 && (n10[n10.length - 1] = a10); + } + } + function sV(e20, t10, n10) { + var r10, o10, i10, a10; + return n10 ? (o10 = t10.changes, i10 = yF.empty(t10.changes.length), a10 = e20.changes.compose(t10.changes)) : (o10 = t10.changes.map(e20.changes), i10 = e20.changes.mapDesc(t10.changes, true), a10 = e20.changes.compose(o10)), { changes: a10, selection: t10.selection ? t10.selection.map(i10) : null === (r10 = e20.selection) || void 0 === r10 ? void 0 : r10.map(o10), effects: oV.mapEffects(e20.effects, o10).concat(oV.mapEffects(t10.effects, i10)), annotations: e20.annotations.length ? e20.annotations.concat(t10.annotations) : t10.annotations, scrollIntoView: e20.scrollIntoView || t10.scrollIntoView }; + } + function cV(e20, t10, n10) { + var r10 = t10.selection, o10 = fV(t10.annotations); + return t10.userEvent && (o10 = o10.concat(iV.userEvent.of(t10.userEvent))), { changes: t10.changes instanceof yF ? t10.changes : yF.of(t10.changes || [], n10, e20.facet(QF)), selection: r10 && (r10 instanceof $F ? r10 : $F.single(r10.anchor, r10.head)), effects: fV(t10.effects), annotations: o10, scrollIntoView: !!t10.scrollIntoView }; + } + function lV(e20, t10, n10) { + var r10 = cV(e20, t10.length ? t10[0] : {}, e20.doc.length); + t10.length && false === t10[0].filter && (n10 = false); + for (var o10 = 1; o10 < t10.length; o10++) { + false === t10[o10].filter && (n10 = false); + var i10 = !!t10[o10].sequential; + r10 = sV(r10, cV(e20, t10[o10], i10 ? r10.changes.newLength : e20.doc.length), i10); + } + var a10 = iV.create(e20, r10.changes, r10.selection, r10.effects, r10.annotations, r10.scrollIntoView); + return function(e21) { + for (var t11 = e21.startState, n11 = t11.facet(ZF), r11 = e21, o11 = n11.length - 1; o11 >= 0; o11--) { + var i11 = n11[o11](e21); + i11 && Object.keys(i11).length && (r11 = sV(r11, cV(t11, i11, e21.changes.newLength), true)); + } + return r11 == e21 ? e21 : iV.create(t11, e21.changes, e21.selection, r11.effects, r11.annotations, r11.scrollIntoView); + }(n10 ? function(e21) { + var t11, n11 = e21.startState, r11 = true, o11 = bo(n11.facet(YF)); + try { + for (o11.s(); !(t11 = o11.n()).done; ) { + var i11 = (0, t11.value)(e21); + if (false === i11) { + r11 = false; + break; + } + Array.isArray(i11) && (r11 = true === r11 ? i11 : aV(r11, i11)); + } + } catch (e23) { + o11.e(e23); + } finally { + o11.f(); + } + if (true !== r11) { + var a11, s10; + if (false === r11) + s10 = e21.changes.invertedDesc, a11 = yF.empty(n11.doc.length); + else { + var c10 = e21.changes.filter(r11); + a11 = c10.changes, s10 = c10.filtered.mapDesc(c10.changes).invertedDesc; + } + e21 = iV.create(n11, a11, e21.selection && e21.selection.map(s10), oV.mapEffects(e21.effects, s10), e21.annotations, e21.scrollIntoView); + } + for (var l10 = n11.facet(XF), u10 = l10.length - 1; u10 >= 0; u10--) { + var f10 = l10[u10](e21); + e21 = f10 instanceof iV ? f10 : Array.isArray(f10) && 1 == f10.length && f10[0] instanceof iV ? f10[0] : lV(n11, fV(f10), false); + } + return e21; + }(a10) : a10); + } + iV.time = tV.define(), iV.userEvent = tV.define(), iV.addToHistory = tV.define(), iV.remote = tV.define(); + var uV = []; + function fV(e20) { + return null == e20 ? uV : Array.isArray(e20) ? e20 : [e20]; + } + var dV; + var hV = function(e20) { + return e20[e20.Word = 0] = "Word", e20[e20.Space = 1] = "Space", e20[e20.Other = 2] = "Other", e20; + }(hV || (hV = {})); + var vV = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; + try { + dV = new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u"); + } catch (E_2) { + } + function pV(e20) { + return function(t10) { + if (!/\S/.test(t10)) + return hV.Space; + if (function(e21) { + if (dV) + return dV.test(e21); + for (var t11 = 0; t11 < e21.length; t11++) { + var n11 = e21[t11]; + if (/\w/.test(n11) || n11 > "\x80" && (n11.toUpperCase() != n11.toLowerCase() || vV.test(n11))) + return true; + } + return false; + }(t10)) + return hV.Word; + for (var n10 = 0; n10 < e20.length; n10++) + if (t10.indexOf(e20[n10]) > -1) + return hV.Word; + return hV.Other; + }; + } + var mV = function() { + function e20(t10, n10, r10, o10, i10, a10) { + No(this, e20), this.config = t10, this.doc = n10, this.selection = r10, this.values = o10, this.status = t10.statusTemplate.slice(), this.computeSlot = i10, a10 && (a10._state = this); + for (var s10 = 0; s10 < this.config.dynamicSlots.length; s10++) + UF(this, s10 << 1); + this.computeSlot = null; + } + return Do(e20, [{ key: "field", value: function(e21) { + var t10 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n10 = this.config.address[e21.id]; + if (null != n10) + return UF(this, n10), JF(this, n10); + if (t10) + throw new RangeError("Field is not present in this state"); + } }, { key: "update", value: function() { + for (var e21 = arguments.length, t10 = new Array(e21), n10 = 0; n10 < e21; n10++) + t10[n10] = arguments[n10]; + return lV(this, t10, true); + } }, { key: "applyTransaction", value: function(t10) { + var n10, r10, o10 = this, i10 = this.config, a10 = i10, s10 = a10.base, c10 = a10.compartments, l10 = bo(t10.effects); + try { + for (l10.s(); !(n10 = l10.n()).done; ) { + var u10 = n10.value; + u10.is(VF.reconfigure) ? (i10 && (c10 = /* @__PURE__ */ new Map(), i10.compartments.forEach(function(e21, t11) { + return c10.set(t11, e21); + }), i10 = null), c10.set(u10.value.compartment, u10.value.extension)) : u10.is(oV.reconfigure) ? (i10 = null, s10 = u10.value) : u10.is(oV.appendConfig) && (i10 = null, s10 = fV(s10).concat(u10.value)); + } + } catch (e21) { + l10.e(e21); + } finally { + l10.f(); + } + i10 ? r10 = t10.startState.values.slice() : r10 = new e20(i10 = WF.resolve(s10, c10, this), this.doc, this.selection, i10.dynamicSlots.map(function() { + return null; + }), function(e21, t11) { + return t11.reconfigure(e21, o10); + }, null).values; + var f10 = t10.startState.facet(GF) ? t10.newSelection : t10.newSelection.asSingle(); + new e20(i10, t10.newDoc, f10, r10, function(e21, n11) { + return n11.update(e21, t10); + }, t10); + } }, { key: "replaceSelection", value: function(e21) { + return "string" == typeof e21 && (e21 = this.toText(e21)), this.changeByRange(function(t10) { + return { changes: { from: t10.from, to: t10.to, insert: e21 }, range: $F.cursor(t10.from + e21.length) }; + }); + } }, { key: "changeByRange", value: function(e21) { + for (var t10 = this.selection, n10 = e21(t10.ranges[0]), r10 = this.changes(n10.changes), o10 = [n10.range], i10 = fV(n10.effects), a10 = 1; a10 < t10.ranges.length; a10++) { + for (var s10 = e21(t10.ranges[a10]), c10 = this.changes(s10.changes), l10 = c10.map(r10), u10 = 0; u10 < a10; u10++) + o10[u10] = o10[u10].map(l10); + var f10 = r10.mapDesc(c10, true); + o10.push(s10.range.map(f10)), r10 = r10.compose(l10), i10 = oV.mapEffects(i10, l10).concat(oV.mapEffects(fV(s10.effects), f10)); + } + return { changes: r10, selection: $F.create(o10, t10.mainIndex), effects: i10 }; + } }, { key: "changes", value: function() { + var t10 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return t10 instanceof yF ? t10 : yF.of(t10, this.doc.length, this.facet(e20.lineSeparator)); + } }, { key: "toText", value: function(t10) { + return UL.of(t10.split(this.facet(e20.lineSeparator) || pF)); + } }, { key: "sliceDoc", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.doc.length; + return this.doc.sliceString(e21, t10, this.lineBreak); + } }, { key: "facet", value: function(e21) { + var t10 = this.config.address[e21.id]; + return null == t10 ? e21.default : (UF(this, t10), JF(this, t10)); + } }, { key: "toJSON", value: function(e21) { + var t10 = { doc: this.sliceDoc(), selection: this.selection.toJSON() }; + if (e21) + for (var n10 in e21) { + var r10 = e21[n10]; + r10 instanceof NF && null != this.config.address[r10.id] && (t10[n10] = r10.spec.toJSON(this.field(e21[n10]), this)); + } + return t10; + } }, { key: "tabSize", get: function() { + return this.facet(e20.tabSize); + } }, { key: "lineBreak", get: function() { + return this.facet(e20.lineSeparator) || "\n"; + } }, { key: "readOnly", get: function() { + return this.facet(eV); + } }, { key: "phrase", value: function(t10) { + for (var n10 = arguments.length, r10 = new Array(n10 > 1 ? n10 - 1 : 0), o10 = 1; o10 < n10; o10++) + r10[o10 - 1] = arguments[o10]; + var i10, a10 = bo(this.facet(e20.phrases)); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = i10.value; + if (Object.prototype.hasOwnProperty.call(s10, t10)) { + t10 = s10[t10]; + break; + } + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + return r10.length && (t10 = t10.replace(/\$(\$|\d*)/g, function(e21, t11) { + if ("$" == t11) + return "$"; + var n11 = +(t11 || 1); + return !n11 || n11 > r10.length ? e21 : r10[n11 - 1]; + })), t10; + } }, { key: "languageDataAt", value: function(e21, t10) { + var n10, r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1, o10 = [], i10 = bo(this.facet(KF)); + try { + for (i10.s(); !(n10 = i10.n()).done; ) { + var a10, s10 = bo((0, n10.value)(this, t10, r10)); + try { + for (s10.s(); !(a10 = s10.n()).done; ) { + var c10 = a10.value; + Object.prototype.hasOwnProperty.call(c10, e21) && o10.push(c10[e21]); + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + return o10; + } }, { key: "charCategorizer", value: function(e21) { + return pV(this.languageDataAt("wordChars", e21).join("")); + } }, { key: "wordAt", value: function(e21) { + for (var t10 = this.doc.lineAt(e21), n10 = t10.text, r10 = t10.from, o10 = t10.length, i10 = this.charCategorizer(e21), a10 = e21 - r10, s10 = e21 - r10; a10 > 0; ) { + var c10 = sF(n10, a10, false); + if (i10(n10.slice(c10, a10)) != hV.Word) + break; + a10 = c10; + } + for (; s10 < o10; ) { + var l10 = sF(n10, s10); + if (i10(n10.slice(s10, l10)) != hV.Word) + break; + s10 = l10; + } + return a10 == s10 ? null : $F.range(a10 + r10, s10 + r10); + } }], [{ key: "fromJSON", value: function(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r10 = arguments.length > 2 ? arguments[2] : void 0; + if (!t10 || "string" != typeof t10.doc) + throw new RangeError("Invalid JSON representation for EditorState"); + var o10 = []; + if (r10) { + var i10 = function() { + if (Object.prototype.hasOwnProperty.call(t10, a10)) { + var e21 = r10[a10], n11 = t10[a10]; + o10.push(e21.init(function(t11) { + return e21.spec.fromJSON(n11, t11); + })); + } + }; + for (var a10 in r10) + i10(); + } + return e20.create({ doc: t10.doc, selection: $F.fromJSON(t10.selection), extensions: n10.extensions ? o10.concat([n10.extensions]) : o10 }); + } }, { key: "create", value: function() { + var t10 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n10 = WF.resolve(t10.extensions || [], /* @__PURE__ */ new Map()), r10 = t10.doc instanceof UL ? t10.doc : UL.of((t10.doc || "").split(n10.staticFacet(e20.lineSeparator) || pF)), o10 = t10.selection ? t10.selection instanceof $F ? t10.selection : $F.single(t10.selection.anchor, t10.selection.head) : $F.single(0); + return _F(o10, r10.length), n10.staticFacet(GF) || (o10 = o10.asSingle()), new e20(n10, r10, o10, n10.dynamicSlots.map(function() { + return null; + }), function(e21, t11) { + return t11.create(e21); + }, null); + } }]), e20; + }(); + function gV(e20, t10) { + var n10, r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, o10 = {}, i10 = bo(e20); + try { + for (i10.s(); !(n10 = i10.n()).done; ) + for (var a10 = n10.value, s10 = 0, c10 = Object.keys(a10); s10 < c10.length; s10++) { + var l10 = c10[s10], u10 = a10[l10], f10 = o10[l10]; + if (void 0 === f10) + o10[l10] = u10; + else if (f10 === u10 || void 0 === u10) + ; + else { + if (!Object.hasOwnProperty.call(r10, l10)) + throw new Error("Config merge conflict for field " + l10); + o10[l10] = r10[l10](f10, u10); + } + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + for (var d10 in t10) + void 0 === o10[d10] && (o10[d10] = t10[d10]); + return o10; + } + mV.allowMultipleSelections = GF, mV.tabSize = MF.define({ combine: function(e20) { + return e20.length ? e20[0] : 4; + } }), mV.lineSeparator = QF, mV.readOnly = eV, mV.phrases = MF.define({ compare: function(e20, t10) { + var n10 = Object.keys(e20), r10 = Object.keys(t10); + return n10.length == r10.length && n10.every(function(n11) { + return e20[n11] == t10[n11]; + }); + } }), mV.languageData = KF, mV.changeFilter = YF, mV.transactionFilter = XF, mV.transactionExtender = ZF, VF.reconfigure = oV.define(); + var yV = function() { + function e20() { + No(this, e20); + } + return Do(e20, [{ key: "eq", value: function(e21) { + return this == e21; + } }, { key: "range", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21; + return bV.create(e21, t10, this); + } }]), e20; + }(); + yV.prototype.startSide = yV.prototype.endSide = 0, yV.prototype.point = false, yV.prototype.mapMode = mF.TrackDel; + var bV = function() { + function e20(t10, n10, r10) { + No(this, e20), this.from = t10, this.to = n10, this.value = r10; + } + return Do(e20, null, [{ key: "create", value: function(t10, n10, r10) { + return new e20(t10, n10, r10); + } }]), e20; + }(); + function kV(e20, t10) { + return e20.from - t10.from || e20.value.startSide - t10.value.startSide; + } + var wV = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.from = t10, this.to = n10, this.value = r10, this.maxPoint = o10; + } + return Do(e20, [{ key: "length", get: function() { + return this.to[this.to.length - 1]; + } }, { key: "findIndex", value: function(e21, t10, n10) { + for (var r10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, o10 = n10 ? this.to : this.from, i10 = r10, a10 = o10.length; ; ) { + if (i10 == a10) + return i10; + var s10 = i10 + a10 >> 1, c10 = o10[s10] - e21 || (n10 ? this.value[s10].endSide : this.value[s10].startSide) - t10; + if (s10 == i10) + return c10 >= 0 ? i10 : a10; + c10 >= 0 ? a10 = s10 : i10 = s10 + 1; + } + } }, { key: "between", value: function(e21, t10, n10, r10) { + for (var o10 = this.findIndex(t10, -1e9, true), i10 = this.findIndex(n10, 1e9, false, o10); o10 < i10; o10++) + if (false === r10(this.from[o10] + e21, this.to[o10] + e21, this.value[o10])) + return false; + } }, { key: "map", value: function(t10, n10) { + for (var r10 = [], o10 = [], i10 = [], a10 = -1, s10 = -1, c10 = 0; c10 < this.value.length; c10++) { + var l10 = this.value[c10], u10 = this.from[c10] + t10, f10 = this.to[c10] + t10, d10 = void 0, h10 = void 0; + if (u10 == f10) { + var v10 = n10.mapPos(u10, l10.startSide, l10.mapMode); + if (null == v10) + continue; + if (d10 = h10 = v10, l10.startSide != l10.endSide && (h10 = n10.mapPos(u10, l10.endSide)) < d10) + continue; + } else if ((d10 = n10.mapPos(u10, l10.startSide)) > (h10 = n10.mapPos(f10, l10.endSide)) || d10 == h10 && l10.startSide > 0 && l10.endSide <= 0) + continue; + (h10 - d10 || l10.endSide - l10.startSide) < 0 || (a10 < 0 && (a10 = d10), l10.point && (s10 = Math.max(s10, h10 - d10)), r10.push(l10), o10.push(d10 - a10), i10.push(h10 - a10)); + } + return { mapped: r10.length ? new e20(o10, i10, r10, s10) : null, pos: a10 }; + } }]), e20; + }(); + var xV = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.chunkPos = t10, this.chunk = n10, this.nextLayer = r10, this.maxPoint = o10; + } + return Do(e20, [{ key: "length", get: function() { + var e21 = this.chunk.length - 1; + return e21 < 0 ? 0 : Math.max(this.chunkEnd(e21), this.nextLayer.length); + } }, { key: "size", get: function() { + if (this.isEmpty) + return 0; + var e21, t10 = this.nextLayer.size, n10 = bo(this.chunk); + try { + for (n10.s(); !(e21 = n10.n()).done; ) { + t10 += e21.value.value.length; + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + return t10; + } }, { key: "chunkEnd", value: function(e21) { + return this.chunkPos[e21] + this.chunk[e21].length; + } }, { key: "update", value: function(t10) { + var n10 = t10.add, r10 = void 0 === n10 ? [] : n10, o10 = t10.sort, i10 = void 0 !== o10 && o10, a10 = t10.filterFrom, s10 = void 0 === a10 ? 0 : a10, c10 = t10.filterTo, l10 = void 0 === c10 ? this.length : c10, u10 = t10.filter; + if (0 == r10.length && !u10) + return this; + if (i10 && (r10 = r10.slice().sort(kV)), this.isEmpty) + return r10.length ? e20.of(r10) : this; + for (var f10 = new CV(this, null, -1).goto(0), d10 = 0, h10 = [], v10 = new jV(); f10.value || d10 < r10.length; ) + if (d10 < r10.length && (f10.from - r10[d10].from || f10.startSide - r10[d10].value.startSide) >= 0) { + var p10 = r10[d10++]; + v10.addInner(p10.from, p10.to, p10.value) || h10.push(p10); + } else + 1 == f10.rangeIndex && f10.chunkIndex < this.chunk.length && (d10 == r10.length || this.chunkEnd(f10.chunkIndex) < r10[d10].from) && (!u10 || s10 > this.chunkEnd(f10.chunkIndex) || l10 < this.chunkPos[f10.chunkIndex]) && v10.addChunk(this.chunkPos[f10.chunkIndex], this.chunk[f10.chunkIndex]) ? f10.nextChunk() : ((!u10 || s10 > f10.to || l10 < f10.from || u10(f10.from, f10.to, f10.value)) && (v10.addInner(f10.from, f10.to, f10.value) || h10.push(bV.create(f10.from, f10.to, f10.value))), f10.next()); + return v10.finishInner(this.nextLayer.isEmpty && !h10.length ? e20.empty : this.nextLayer.update({ add: h10, filter: u10, filterFrom: s10, filterTo: l10 })); + } }, { key: "map", value: function(t10) { + if (t10.empty || this.isEmpty) + return this; + for (var n10 = [], r10 = [], o10 = -1, i10 = 0; i10 < this.chunk.length; i10++) { + var a10 = this.chunkPos[i10], s10 = this.chunk[i10], c10 = t10.touchesRange(a10, a10 + s10.length); + if (false === c10) + o10 = Math.max(o10, s10.maxPoint), n10.push(s10), r10.push(t10.mapPos(a10)); + else if (true === c10) { + var l10 = s10.map(a10, t10), u10 = l10.mapped, f10 = l10.pos; + u10 && (o10 = Math.max(o10, u10.maxPoint), n10.push(u10), r10.push(f10)); + } + } + var d10 = this.nextLayer.map(t10); + return 0 == n10.length ? d10 : new e20(r10, n10, d10 || e20.empty, o10); + } }, { key: "between", value: function(e21, t10, n10) { + if (!this.isEmpty) { + for (var r10 = 0; r10 < this.chunk.length; r10++) { + var o10 = this.chunkPos[r10], i10 = this.chunk[r10]; + if (t10 >= o10 && e21 <= o10 + i10.length && false === i10.between(o10, e21 - o10, t10 - o10, n10)) + return; + } + this.nextLayer.between(e21, t10, n10); + } + } }, { key: "iter", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0; + return $V.from([this]).goto(e21); + } }, { key: "isEmpty", get: function() { + return this.nextLayer == this; + } }], [{ key: "create", value: function(t10, n10, r10, o10) { + return new e20(t10, n10, r10, o10); + } }, { key: "iter", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; + return $V.from(e21).goto(t10); + } }, { key: "compare", value: function(e21, t10, n10, r10) { + var o10 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : -1, i10 = e21.filter(function(e23) { + return e23.maxPoint > 0 || !e23.isEmpty && e23.maxPoint >= o10; + }), a10 = t10.filter(function(e23) { + return e23.maxPoint > 0 || !e23.isEmpty && e23.maxPoint >= o10; + }), s10 = SV(i10, a10, n10), c10 = new OV(i10, s10, o10), l10 = new OV(a10, s10, o10); + n10.iterGaps(function(e23, t11, n11) { + return MV(c10, e23, l10, t11, n11, r10); + }), n10.empty && 0 == n10.length && MV(c10, 0, l10, 0, 0, r10); + } }, { key: "eq", value: function(e21, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, r10 = arguments.length > 3 ? arguments[3] : void 0; + null == r10 && (r10 = 999999999); + var o10 = e21.filter(function(e23) { + return !e23.isEmpty && t10.indexOf(e23) < 0; + }), i10 = t10.filter(function(t11) { + return !t11.isEmpty && e21.indexOf(t11) < 0; + }); + if (o10.length != i10.length) + return false; + if (!o10.length) + return true; + for (var a10 = SV(o10, i10), s10 = new OV(o10, a10, 0).goto(n10), c10 = new OV(i10, a10, 0).goto(n10); ; ) { + if (s10.to != c10.to || !EV(s10.active, c10.active) || s10.point && (!c10.point || !s10.point.eq(c10.point))) + return false; + if (s10.to > r10) + return true; + s10.next(), c10.next(); + } + } }, { key: "spans", value: function(e21, t10, n10, r10) { + for (var o10 = new OV(e21, null, arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : -1).goto(t10), i10 = t10, a10 = o10.openStart; ; ) { + var s10 = Math.min(o10.to, n10); + if (o10.point) { + var c10 = o10.activeForPoint(o10.to), l10 = o10.pointFrom < t10 ? c10.length + 1 : Math.min(c10.length, a10); + r10.point(i10, s10, o10.point, c10, l10, o10.pointRank), a10 = Math.min(o10.openEnd(s10), c10.length); + } else + s10 > i10 && (r10.span(i10, s10, o10.active, a10), a10 = o10.openEnd(s10)); + if (o10.to > n10) + return a10 + (o10.point && o10.to > n10 ? 1 : 0); + i10 = o10.to, o10.next(); + } + } }, { key: "of", value: function(e21) { + var t10, n10 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r10 = new jV(), o10 = bo(e21 instanceof bV ? [e21] : n10 ? function(e23) { + if (e23.length > 1) + for (var t11 = e23[0], n11 = 1; n11 < e23.length; n11++) { + var r11 = e23[n11]; + if (kV(t11, r11) > 0) + return e23.slice().sort(kV); + t11 = r11; + } + return e23; + }(e21) : e21); + try { + for (o10.s(); !(t10 = o10.n()).done; ) { + var i10 = t10.value; + r10.add(i10.from, i10.to, i10.value); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + return r10.finish(); + } }, { key: "join", value: function(t10) { + if (!t10.length) + return e20.empty; + for (var n10 = t10[t10.length - 1], r10 = t10.length - 2; r10 >= 0; r10--) + for (var o10 = t10[r10]; o10 != e20.empty; o10 = o10.nextLayer) + n10 = new e20(o10.chunkPos, o10.chunk, n10, Math.max(o10.maxPoint, n10.maxPoint)); + return n10; + } }]), e20; + }(); + xV.empty = new xV([], [], null, -1), xV.empty.nextLayer = xV.empty; + var jV = function() { + function e20() { + No(this, e20), this.chunks = [], this.chunkPos = [], this.chunkStart = -1, this.last = null, this.lastFrom = -1e9, this.lastTo = -1e9, this.from = [], this.to = [], this.value = [], this.maxPoint = -1, this.setMaxPoint = -1, this.nextLayer = null; + } + return Do(e20, [{ key: "finishChunk", value: function(e21) { + this.chunks.push(new wV(this.from, this.to, this.value, this.maxPoint)), this.chunkPos.push(this.chunkStart), this.chunkStart = -1, this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint), this.maxPoint = -1, e21 && (this.from = [], this.to = [], this.value = []); + } }, { key: "add", value: function(t10, n10, r10) { + this.addInner(t10, n10, r10) || (this.nextLayer || (this.nextLayer = new e20())).add(t10, n10, r10); + } }, { key: "addInner", value: function(e21, t10, n10) { + var r10 = e21 - this.lastTo || n10.startSide - this.last.endSide; + if (r10 <= 0 && (e21 - this.lastFrom || n10.startSide - this.last.startSide) < 0) + throw new Error("Ranges must be added sorted by `from` position and `startSide`"); + return !(r10 < 0) && (250 == this.from.length && this.finishChunk(true), this.chunkStart < 0 && (this.chunkStart = e21), this.from.push(e21 - this.chunkStart), this.to.push(t10 - this.chunkStart), this.last = n10, this.lastFrom = e21, this.lastTo = t10, this.value.push(n10), n10.point && (this.maxPoint = Math.max(this.maxPoint, t10 - e21)), true); + } }, { key: "addChunk", value: function(e21, t10) { + if ((e21 - this.lastTo || t10.value[0].startSide - this.last.endSide) < 0) + return false; + this.from.length && this.finishChunk(true), this.setMaxPoint = Math.max(this.setMaxPoint, t10.maxPoint), this.chunks.push(t10), this.chunkPos.push(e21); + var n10 = t10.value.length - 1; + return this.last = t10.value[n10], this.lastFrom = t10.from[n10] + e21, this.lastTo = t10.to[n10] + e21, true; + } }, { key: "finish", value: function() { + return this.finishInner(xV.empty); + } }, { key: "finishInner", value: function(e21) { + if (this.from.length && this.finishChunk(false), 0 == this.chunks.length) + return e21; + var t10 = xV.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(e21) : e21, this.setMaxPoint); + return this.from = null, t10; + } }]), e20; + }(); + function SV(e20, t10, n10) { + var r10, o10 = /* @__PURE__ */ new Map(), i10 = bo(e20); + try { + for (i10.s(); !(r10 = i10.n()).done; ) + for (var a10 = r10.value, s10 = 0; s10 < a10.chunk.length; s10++) + a10.chunk[s10].maxPoint <= 0 && o10.set(a10.chunk[s10], a10.chunkPos[s10]); + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + var c10, l10 = /* @__PURE__ */ new Set(), u10 = bo(t10); + try { + for (u10.s(); !(c10 = u10.n()).done; ) + for (var f10 = c10.value, d10 = 0; d10 < f10.chunk.length; d10++) { + var h10 = o10.get(f10.chunk[d10]); + null == h10 || (n10 ? n10.mapPos(h10) : h10) != f10.chunkPos[d10] || (null == n10 ? void 0 : n10.touchesRange(h10, h10 + f10.chunk[d10].length)) || l10.add(f10.chunk[d10]); + } + } catch (e21) { + u10.e(e21); + } finally { + u10.f(); + } + return l10; + } + var CV = function() { + function e20(t10, n10, r10) { + var o10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0; + No(this, e20), this.layer = t10, this.skip = n10, this.minPoint = r10, this.rank = o10; + } + return Do(e20, [{ key: "startSide", get: function() { + return this.value ? this.value.startSide : 0; + } }, { key: "endSide", get: function() { + return this.value ? this.value.endSide : 0; + } }, { key: "goto", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1e9; + return this.chunkIndex = this.rangeIndex = 0, this.gotoInner(e21, t10, false), this; + } }, { key: "gotoInner", value: function(e21, t10, n10) { + for (; this.chunkIndex < this.layer.chunk.length; ) { + var r10 = this.layer.chunk[this.chunkIndex]; + if (!(this.skip && this.skip.has(r10) || this.layer.chunkEnd(this.chunkIndex) < e21 || r10.maxPoint < this.minPoint)) + break; + this.chunkIndex++, n10 = false; + } + if (this.chunkIndex < this.layer.chunk.length) { + var o10 = this.layer.chunk[this.chunkIndex].findIndex(e21 - this.layer.chunkPos[this.chunkIndex], t10, true); + (!n10 || this.rangeIndex < o10) && this.setRangeIndex(o10); + } + this.next(); + } }, { key: "forward", value: function(e21, t10) { + (this.to - e21 || this.endSide - t10) < 0 && this.gotoInner(e21, t10, true); + } }, { key: "next", value: function() { + for (; ; ) { + if (this.chunkIndex == this.layer.chunk.length) { + this.from = this.to = 1e9, this.value = null; + break; + } + var e21 = this.layer.chunkPos[this.chunkIndex], t10 = this.layer.chunk[this.chunkIndex], n10 = e21 + t10.from[this.rangeIndex]; + if (this.from = n10, this.to = e21 + t10.to[this.rangeIndex], this.value = t10.value[this.rangeIndex], this.setRangeIndex(this.rangeIndex + 1), this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) + break; + } + } }, { key: "setRangeIndex", value: function(e21) { + if (e21 == this.layer.chunk[this.chunkIndex].value.length) { + if (this.chunkIndex++, this.skip) + for (; this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]); ) + this.chunkIndex++; + this.rangeIndex = 0; + } else + this.rangeIndex = e21; + } }, { key: "nextChunk", value: function() { + this.chunkIndex++, this.rangeIndex = 0, this.next(); + } }, { key: "compare", value: function(e21) { + return this.from - e21.from || this.startSide - e21.startSide || this.rank - e21.rank || this.to - e21.to || this.endSide - e21.endSide; + } }]), e20; + }(); + var $V = function() { + function e20(t10) { + No(this, e20), this.heap = t10; + } + return Do(e20, [{ key: "startSide", get: function() { + return this.value ? this.value.startSide : 0; + } }, { key: "goto", value: function(e21) { + var t10, n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1e9, r10 = bo(this.heap); + try { + for (r10.s(); !(t10 = r10.n()).done; ) { + t10.value.goto(e21, n10); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + for (var o10 = this.heap.length >> 1; o10 >= 0; o10--) + _V(this.heap, o10); + return this.next(), this; + } }, { key: "forward", value: function(e21, t10) { + var n10, r10 = bo(this.heap); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + n10.value.forward(e21, t10); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + for (var o10 = this.heap.length >> 1; o10 >= 0; o10--) + _V(this.heap, o10); + (this.to - e21 || this.value.endSide - t10) < 0 && this.next(); + } }, { key: "next", value: function() { + if (0 == this.heap.length) + this.from = this.to = 1e9, this.value = null, this.rank = -1; + else { + var e21 = this.heap[0]; + this.from = e21.from, this.to = e21.to, this.value = e21.value, this.rank = e21.rank, e21.value && e21.next(), _V(this.heap, 0); + } + } }], [{ key: "from", value: function(t10) { + for (var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1, o10 = [], i10 = 0; i10 < t10.length; i10++) + for (var a10 = t10[i10]; !a10.isEmpty; a10 = a10.nextLayer) + a10.maxPoint >= r10 && o10.push(new CV(a10, n10, r10, i10)); + return 1 == o10.length ? o10[0] : new e20(o10); + } }]), e20; + }(); + function _V(e20, t10) { + for (var n10 = e20[t10]; ; ) { + var r10 = 1 + (t10 << 1); + if (r10 >= e20.length) + break; + var o10 = e20[r10]; + if (r10 + 1 < e20.length && o10.compare(e20[r10 + 1]) >= 0 && (o10 = e20[r10 + 1], r10++), n10.compare(o10) < 0) + break; + e20[r10] = n10, e20[t10] = o10, t10 = r10; + } + } + var OV = function() { + function e20(t10, n10, r10) { + No(this, e20), this.minPoint = r10, this.active = [], this.activeTo = [], this.activeRank = [], this.minActive = -1, this.point = null, this.pointFrom = 0, this.pointRank = 0, this.to = -1e9, this.endSide = 0, this.openStart = -1, this.cursor = $V.from(t10, n10, r10); + } + return Do(e20, [{ key: "goto", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1e9; + return this.cursor.goto(e21, t10), this.active.length = this.activeTo.length = this.activeRank.length = 0, this.minActive = -1, this.to = e21, this.endSide = t10, this.openStart = -1, this.next(), this; + } }, { key: "forward", value: function(e21, t10) { + for (; this.minActive > -1 && (this.activeTo[this.minActive] - e21 || this.active[this.minActive].endSide - t10) < 0; ) + this.removeActive(this.minActive); + this.cursor.forward(e21, t10); + } }, { key: "removeActive", value: function(e21) { + AV(this.active, e21), AV(this.activeTo, e21), AV(this.activeRank, e21), this.minActive = TV(this.active, this.activeTo); + } }, { key: "addActive", value: function(e21) { + for (var t10 = 0, n10 = this.cursor, r10 = n10.value, o10 = n10.to, i10 = n10.rank; t10 < this.activeRank.length && (i10 - this.activeRank[t10] || o10 - this.activeTo[t10]) > 0; ) + t10++; + PV(this.active, t10, r10), PV(this.activeTo, t10, o10), PV(this.activeRank, t10, i10), e21 && PV(e21, t10, this.cursor.from), this.minActive = TV(this.active, this.activeTo); + } }, { key: "next", value: function() { + var e21 = this.to, t10 = this.point; + this.point = null; + for (var n10 = this.openStart < 0 ? [] : null; ; ) { + var r10 = this.minActive; + if (r10 > -1 && (this.activeTo[r10] - this.cursor.from || this.active[r10].endSide - this.cursor.startSide) < 0) { + if (this.activeTo[r10] > e21) { + this.to = this.activeTo[r10], this.endSide = this.active[r10].endSide; + break; + } + this.removeActive(r10), n10 && AV(n10, r10); + } else { + if (!this.cursor.value) { + this.to = this.endSide = 1e9; + break; + } + if (this.cursor.from > e21) { + this.to = this.cursor.from, this.endSide = this.cursor.startSide; + break; + } + var o10 = this.cursor.value; + if (o10.point) { + if (!(t10 && this.cursor.to == this.to && this.cursor.from < this.cursor.to)) { + this.point = o10, this.pointFrom = this.cursor.from, this.pointRank = this.cursor.rank, this.to = this.cursor.to, this.endSide = o10.endSide, this.cursor.next(), this.forward(this.to, this.endSide); + break; + } + this.cursor.next(); + } else + this.addActive(n10), this.cursor.next(); + } + } + if (n10) { + this.openStart = 0; + for (var i10 = n10.length - 1; i10 >= 0 && n10[i10] < e21; i10--) + this.openStart++; + } + } }, { key: "activeForPoint", value: function(e21) { + if (!this.active.length) + return this.active; + for (var t10 = [], n10 = this.active.length - 1; n10 >= 0 && !(this.activeRank[n10] < this.pointRank); n10--) + (this.activeTo[n10] > e21 || this.activeTo[n10] == e21 && this.active[n10].endSide >= this.point.endSide) && t10.push(this.active[n10]); + return t10.reverse(); + } }, { key: "openEnd", value: function(e21) { + for (var t10 = 0, n10 = this.activeTo.length - 1; n10 >= 0 && this.activeTo[n10] > e21; n10--) + t10++; + return t10; + } }]), e20; + }(); + function MV(e20, t10, n10, r10, o10, i10) { + e20.goto(t10), n10.goto(r10); + for (var a10 = r10 + o10, s10 = r10, c10 = r10 - t10; ; ) { + var l10 = e20.to + c10 - n10.to || e20.endSide - n10.endSide, u10 = l10 < 0 ? e20.to + c10 : n10.to, f10 = Math.min(u10, a10); + if (e20.point || n10.point ? e20.point && n10.point && (e20.point == n10.point || e20.point.eq(n10.point)) && EV(e20.activeForPoint(e20.to), n10.activeForPoint(n10.to)) || i10.comparePoint(s10, f10, e20.point, n10.point) : f10 > s10 && !EV(e20.active, n10.active) && i10.compareRange(s10, f10, e20.active, n10.active), u10 > a10) + break; + s10 = u10, l10 <= 0 && e20.next(), l10 >= 0 && n10.next(); + } + } + function EV(e20, t10) { + if (e20.length != t10.length) + return false; + for (var n10 = 0; n10 < e20.length; n10++) + if (e20[n10] != t10[n10] && !e20[n10].eq(t10[n10])) + return false; + return true; + } + function AV(e20, t10) { + for (var n10 = t10, r10 = e20.length - 1; n10 < r10; n10++) + e20[n10] = e20[n10 + 1]; + e20.pop(); + } + function PV(e20, t10, n10) { + for (var r10 = e20.length - 1; r10 >= t10; r10--) + e20[r10 + 1] = e20[r10]; + e20[t10] = n10; + } + function TV(e20, t10) { + for (var n10 = -1, r10 = 1e9, o10 = 0; o10 < t10.length; o10++) + (t10[o10] - r10 || e20[o10].endSide - e20[n10].endSide) < 0 && (n10 = o10, r10 = t10[o10]); + return n10; + } + function RV(e20, t10) { + for (var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : e20.length, r10 = 0, o10 = 0; o10 < n10; ) + 9 == e20.charCodeAt(o10) ? (r10 += t10 - r10 % t10, o10++) : (r10++, o10 = sF(e20, o10)); + return r10; + } + function NV(e20, t10, n10, r10) { + for (var o10 = 0, i10 = 0; ; ) { + if (i10 >= t10) + return o10; + if (o10 == e20.length) + break; + i10 += 9 == e20.charCodeAt(o10) ? n10 - i10 % n10 : 1, o10 = sF(e20, o10); + } + return true === r10 ? -1 : e20.length; + } + for (IV = "undefined" == typeof Symbol ? "__\u037C" : Symbol.for("\u037C"), DV = "undefined" == typeof Symbol ? "__styleSet" + Math.floor(1e8 * Math.random()) : Symbol("styleSet"), qV = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : {}, zV = function() { + function e20(t10, n10) { + No(this, e20), this.rules = []; + var r10 = (n10 || {}).finish; + function o10(e21) { + return /^@/.test(e21) ? [e21] : e21.split(/,\s*/); + } + function i10(e21, t11, n11, a11) { + var s10 = [], c10 = /^@(\w+)\b/.exec(e21[0]), l10 = c10 && "keyframes" == c10[1]; + if (c10 && null == t11) + return n11.push(e21[0] + ";"); + for (var u10 in t11) { + var f10 = t11[u10]; + if (/&/.test(u10)) + i10(u10.split(/,\s*/).map(function(t12) { + return e21.map(function(e23) { + return t12.replace(/&/, e23); + }); + }).reduce(function(e23, t12) { + return e23.concat(t12); + }), f10, n11); + else if (f10 && "object" == Ho(f10)) { + if (!c10) + throw new RangeError("The value of a property (" + u10 + ") should be a primitive value."); + i10(o10(u10), f10, s10, l10); + } else + null != f10 && s10.push(u10.replace(/_.*/, "").replace(/[A-Z]/g, function(e23) { + return "-" + e23.toLowerCase(); + }) + ": " + f10 + ";"); + } + (s10.length || l10) && n11.push((!r10 || c10 || a11 ? e21 : e21.map(r10)).join(", ") + " {" + s10.join(" ") + "}"); + } + for (var a10 in t10) + i10(o10(a10), t10[a10], this.rules); + } + return Do(e20, [{ key: "getRules", value: function() { + return this.rules.join("\n"); + } }], [{ key: "newName", value: function() { + var e21 = qV[IV] || 1; + return qV[IV] = e21 + 1, "\u037C" + e21.toString(36); + } }, { key: "mount", value: function(e21, t10, n10) { + var r10 = e21[DV], o10 = n10 && n10.nonce; + r10 ? o10 && r10.setNonce(o10) : r10 = new LV(e21, o10), r10.mount(Array.isArray(t10) ? t10 : [t10]); + } }]), e20; + }(), BV = /* @__PURE__ */ new Map(), LV = function() { + function e20(t10, n10) { + No(this, e20); + var r10 = t10.ownerDocument || t10, o10 = r10.defaultView; + if (!t10.head && t10.adoptedStyleSheets && o10.CSSStyleSheet) { + var i10 = BV.get(r10); + if (i10) + return t10.adoptedStyleSheets = [i10.sheet].concat(Bo(t10.adoptedStyleSheets)), t10[DV] = i10; + this.sheet = new o10.CSSStyleSheet(), t10.adoptedStyleSheets = [this.sheet].concat(Bo(t10.adoptedStyleSheets)), BV.set(r10, this); + } else { + this.styleTag = r10.createElement("style"), n10 && this.styleTag.setAttribute("nonce", n10); + var a10 = t10.head || t10; + a10.insertBefore(this.styleTag, a10.firstChild); + } + this.modules = [], t10[DV] = this; + } + return Do(e20, [{ key: "mount", value: function(e21) { + for (var t10 = this.sheet, n10 = 0, r10 = 0, o10 = 0; o10 < e21.length; o10++) { + var i10 = e21[o10], a10 = this.modules.indexOf(i10); + if (a10 < r10 && a10 > -1 && (this.modules.splice(a10, 1), r10--, a10 = -1), -1 == a10) { + if (this.modules.splice(r10++, 0, i10), t10) + for (var s10 = 0; s10 < i10.rules.length; s10++) + t10.insertRule(i10.rules[s10], n10++); + } else { + for (; r10 < a10; ) + n10 += this.modules[r10++].rules.length; + n10 += i10.rules.length, r10++; + } + } + if (!t10) { + for (var c10 = "", l10 = 0; l10 < this.modules.length; l10++) + c10 += this.modules[l10].getRules() + "\n"; + this.styleTag.textContent = c10; + } + } }, { key: "setNonce", value: function(e21) { + this.styleTag && this.styleTag.getAttribute("nonce") != e21 && this.styleTag.setAttribute("nonce", e21); + } }]), e20; + }(), FV = { 8: "Backspace", 9: "Tab", 10: "Enter", 12: "NumLock", 13: "Enter", 16: "Shift", 17: "Control", 18: "Alt", 20: "CapsLock", 27: "Escape", 32: " ", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "ArrowLeft", 38: "ArrowUp", 39: "ArrowRight", 40: "ArrowDown", 44: "PrintScreen", 45: "Insert", 46: "Delete", 59: ";", 61: "=", 91: "Meta", 92: "Meta", 106: "*", 107: "+", 108: ",", 109: "-", 110: ".", 111: "/", 144: "NumLock", 145: "ScrollLock", 160: "Shift", 161: "Shift", 162: "Control", 163: "Control", 164: "Alt", 165: "Alt", 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'" }, VV = { 48: ")", 49: "!", 50: "@", 51: "#", 52: "$", 53: "%", 54: "^", 55: "&", 56: "*", 57: "(", 59: ":", 61: "+", 173: "_", 186: ":", 187: "+", 188: "<", 189: "_", 190: ">", 191: "?", 192: "~", 219: "{", 220: "|", 221: "}", 222: '"' }, HV = "undefined" != typeof navigator && /Mac/.test(navigator.platform), WV = "undefined" != typeof navigator && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent), UV = 0; UV < 10; UV++) + FV[48 + UV] = FV[96 + UV] = String(UV); + var IV; + var DV; + var qV; + var zV; + var BV; + var LV; + var FV; + var VV; + var HV; + var WV; + var UV; + for (UV = 1; UV <= 24; UV++) + FV[UV + 111] = "F" + UV; + for (UV = 65; UV <= 90; UV++) + FV[UV] = String.fromCharCode(UV + 32), VV[UV] = String.fromCharCode(UV); + for (JV in FV) + VV.hasOwnProperty(JV) || (VV[JV] = FV[JV]); + var JV; + function KV(e20) { + return (11 == e20.nodeType ? e20.getSelection ? e20 : e20.ownerDocument : e20).getSelection(); + } + function GV(e20, t10) { + return !!t10 && (e20 == t10 || e20.contains(1 != t10.nodeType ? t10.parentNode : t10)); + } + function QV(e20, t10) { + if (!t10.anchorNode) + return false; + try { + return GV(e20, t10.anchorNode); + } catch (e21) { + return false; + } + } + function YV(e20) { + return 3 == e20.nodeType ? lH(e20, 0, e20.nodeValue.length).getClientRects() : 1 == e20.nodeType ? e20.getClientRects() : []; + } + function XV(e20, t10, n10, r10) { + return !!n10 && (eH(e20, t10, n10, r10, -1) || eH(e20, t10, n10, r10, 1)); + } + function ZV(e20) { + for (var t10 = 0; ; t10++) + if (!(e20 = e20.previousSibling)) + return t10; + } + function eH(e20, t10, n10, r10, o10) { + for (; ; ) { + if (e20 == n10 && t10 == r10) + return true; + if (t10 == (o10 < 0 ? 0 : tH(e20))) { + if ("DIV" == e20.nodeName) + return false; + var i10 = e20.parentNode; + if (!i10 || 1 != i10.nodeType) + return false; + t10 = ZV(e20) + (o10 < 0 ? 0 : 1), e20 = i10; + } else { + if (1 != e20.nodeType) + return false; + if (1 == (e20 = e20.childNodes[t10 + (o10 < 0 ? -1 : 0)]).nodeType && "false" == e20.contentEditable) + return false; + t10 = o10 < 0 ? tH(e20) : 0; + } + } + } + function tH(e20) { + return 3 == e20.nodeType ? e20.nodeValue.length : e20.childNodes.length; + } + function nH(e20, t10) { + var n10 = t10 ? e20.left : e20.right; + return { left: n10, right: n10, top: e20.top, bottom: e20.bottom }; + } + function rH(e20) { + return { left: 0, right: e20.innerWidth, top: 0, bottom: e20.innerHeight }; + } + function oH(e20, t10) { + var n10 = t10.width / e20.offsetWidth, r10 = t10.height / e20.offsetHeight; + return (n10 > 0.995 && n10 < 1.005 || !isFinite(n10) || Math.abs(t10.width - e20.offsetWidth) < 1) && (n10 = 1), (r10 > 0.995 && r10 < 1.005 || !isFinite(r10) || Math.abs(t10.height - e20.offsetHeight) < 1) && (r10 = 1), { scaleX: n10, scaleY: r10 }; + } + var iH; + var aH = function() { + function e20() { + No(this, e20), this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0; + } + return Do(e20, [{ key: "eq", value: function(e21) { + return this.anchorNode == e21.anchorNode && this.anchorOffset == e21.anchorOffset && this.focusNode == e21.focusNode && this.focusOffset == e21.focusOffset; + } }, { key: "setRange", value: function(e21) { + var t10 = e21.anchorNode, n10 = e21.focusNode; + this.set(t10, Math.min(e21.anchorOffset, t10 ? tH(t10) : 0), n10, Math.min(e21.focusOffset, n10 ? tH(n10) : 0)); + } }, { key: "set", value: function(e21, t10, n10, r10) { + this.anchorNode = e21, this.anchorOffset = t10, this.focusNode = n10, this.focusOffset = r10; + } }]), e20; + }(); + var sH = null; + function cH(e20) { + if (e20.setActive) + return e20.setActive(); + if (sH) + return e20.focus(sH); + for (var t10 = [], n10 = e20; n10 && (t10.push(n10, n10.scrollTop, n10.scrollLeft), n10 != n10.ownerDocument); n10 = n10.parentNode) + ; + if (e20.focus(null == sH ? { get preventScroll() { + return sH = { preventScroll: true }, true; + } } : void 0), !sH) { + sH = false; + for (var r10 = 0; r10 < t10.length; ) { + var o10 = t10[r10++], i10 = t10[r10++], a10 = t10[r10++]; + o10.scrollTop != i10 && (o10.scrollTop = i10), o10.scrollLeft != a10 && (o10.scrollLeft = a10); + } + } + } + function lH(e20, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : t10, r10 = iH || (iH = document.createRange()); + return r10.setEnd(e20, n10), r10.setStart(e20, t10), r10; + } + function uH(e20, t10, n10) { + var r10 = { key: t10, code: t10, keyCode: n10, which: n10, cancelable: true }, o10 = new KeyboardEvent("keydown", r10); + o10.synthetic = true, e20.dispatchEvent(o10); + var i10 = new KeyboardEvent("keyup", r10); + return i10.synthetic = true, e20.dispatchEvent(i10), o10.defaultPrevented || i10.defaultPrevented; + } + function fH(e20) { + for (; e20.attributes.length; ) + e20.removeAttributeNode(e20.attributes[0]); + } + function dH(e20) { + return e20.scrollTop > Math.max(1, e20.scrollHeight - e20.clientHeight - 4); + } + var hH = function() { + function e20(t10, n10) { + var r10 = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]; + No(this, e20), this.node = t10, this.offset = n10, this.precise = r10; + } + return Do(e20, null, [{ key: "before", value: function(t10, n10) { + return new e20(t10.parentNode, ZV(t10), n10); + } }, { key: "after", value: function(t10, n10) { + return new e20(t10.parentNode, ZV(t10) + 1, n10); + } }]), e20; + }(); + var vH = []; + var pH = function() { + function e20() { + No(this, e20), this.parent = null, this.dom = null, this.flags = 2; + } + return Do(e20, [{ key: "overrideDOMText", get: function() { + return null; + } }, { key: "posAtStart", get: function() { + return this.parent ? this.parent.posBefore(this) : 0; + } }, { key: "posAtEnd", get: function() { + return this.posAtStart + this.length; + } }, { key: "posBefore", value: function(e21) { + var t10, n10 = this.posAtStart, r10 = bo(this.children); + try { + for (r10.s(); !(t10 = r10.n()).done; ) { + var o10 = t10.value; + if (o10 == e21) + return n10; + n10 += o10.length + o10.breakAfter; + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + throw new RangeError("Invalid child in posBefore"); + } }, { key: "posAfter", value: function(e21) { + return this.posBefore(e21) + e21.length; + } }, { key: "sync", value: function(t10, n10) { + if (2 & this.flags) { + var r10, o10, i10 = this.dom, a10 = null, s10 = bo(this.children); + try { + for (s10.s(); !(o10 = s10.n()).done; ) { + var c10 = o10.value; + if (7 & c10.flags) { + if (!c10.dom && (r10 = a10 ? a10.nextSibling : i10.firstChild)) { + var l10 = e20.get(r10); + (!l10 || !l10.parent && l10.canReuseDOM(c10)) && c10.reuseDOM(r10); + } + c10.sync(t10, n10), c10.flags &= -8; + } + if (r10 = a10 ? a10.nextSibling : i10.firstChild, n10 && !n10.written && n10.node == i10 && r10 != c10.dom && (n10.written = true), c10.dom.parentNode == i10) + for (; r10 && r10 != c10.dom; ) + r10 = mH(r10); + else + i10.insertBefore(c10.dom, r10); + a10 = c10.dom; + } + } catch (e21) { + s10.e(e21); + } finally { + s10.f(); + } + for ((r10 = a10 ? a10.nextSibling : i10.firstChild) && n10 && n10.node == i10 && (n10.written = true); r10; ) + r10 = mH(r10); + } else if (1 & this.flags) { + var u10, f10 = bo(this.children); + try { + for (f10.s(); !(u10 = f10.n()).done; ) { + var d10 = u10.value; + 7 & d10.flags && (d10.sync(t10, n10), d10.flags &= -8); + } + } catch (e21) { + f10.e(e21); + } finally { + f10.f(); + } + } + } }, { key: "reuseDOM", value: function(e21) { + } }, { key: "localPosFromDOM", value: function(t10, n10) { + var r10; + if (t10 == this.dom) + r10 = this.dom.childNodes[n10]; + else { + for (var o10 = 0 == tH(t10) ? 0 : 0 == n10 ? -1 : 1; ; ) { + var i10 = t10.parentNode; + if (i10 == this.dom) + break; + 0 == o10 && i10.firstChild != i10.lastChild && (o10 = t10 == i10.firstChild ? -1 : 1), t10 = i10; + } + r10 = o10 < 0 ? t10 : t10.nextSibling; + } + if (r10 == this.dom.firstChild) + return 0; + for (; r10 && !e20.get(r10); ) + r10 = r10.nextSibling; + if (!r10) + return this.length; + for (var a10 = 0, s10 = 0; ; a10++) { + var c10 = this.children[a10]; + if (c10.dom == r10) + return s10; + s10 += c10.length + c10.breakAfter; + } + } }, { key: "domBoundsAround", value: function(e21, t10) { + for (var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, r10 = -1, o10 = -1, i10 = -1, a10 = -1, s10 = 0, c10 = n10, l10 = n10; s10 < this.children.length; s10++) { + var u10 = this.children[s10], f10 = c10 + u10.length; + if (c10 < e21 && f10 > t10) + return u10.domBoundsAround(e21, t10, c10); + if (f10 >= e21 && -1 == r10 && (r10 = s10, o10 = c10), c10 > t10 && u10.dom.parentNode == this.dom) { + i10 = s10, a10 = l10; + break; + } + l10 = f10, c10 = f10 + u10.breakAfter; + } + return { from: o10, to: a10 < 0 ? n10 + this.length : a10, startDOM: (r10 ? this.children[r10 - 1].dom.nextSibling : null) || this.dom.firstChild, endDOM: i10 < this.children.length && i10 >= 0 ? this.children[i10].dom : null }; + } }, { key: "markDirty", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; + this.flags |= 2, this.markParentsDirty(e21); + } }, { key: "markParentsDirty", value: function(e21) { + for (var t10 = this.parent; t10; t10 = t10.parent) { + if (e21 && (t10.flags |= 2), 1 & t10.flags) + return; + t10.flags |= 1, e21 = false; + } + } }, { key: "setParent", value: function(e21) { + this.parent != e21 && (this.parent = e21, 7 & this.flags && this.markParentsDirty(true)); + } }, { key: "setDOM", value: function(e21) { + this.dom != e21 && (this.dom && (this.dom.cmView = null), this.dom = e21, e21.cmView = this); + } }, { key: "rootView", get: function() { + for (var e21 = this; ; ) { + var t10 = e21.parent; + if (!t10) + return e21; + e21 = t10; + } + } }, { key: "replaceChildren", value: function(e21, t10) { + var n10, r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : vH; + this.markDirty(); + for (var o10 = e21; o10 < t10; o10++) { + var i10 = this.children[o10]; + i10.parent == this && r10.indexOf(i10) < 0 && i10.destroy(); + } + (n10 = this.children).splice.apply(n10, [e21, t10 - e21].concat(Bo(r10))); + for (var a10 = 0; a10 < r10.length; a10++) + r10[a10].setParent(this); + } }, { key: "ignoreMutation", value: function(e21) { + return false; + } }, { key: "ignoreEvent", value: function(e21) { + return false; + } }, { key: "childCursor", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.length; + return new gH(this.children, e21, this.children.length); + } }, { key: "childPos", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; + return this.childCursor().findPos(e21, t10); + } }, { key: "toString", value: function() { + var e21 = this.constructor.name.replace("View", ""); + return e21 + (this.children.length ? "(" + this.children.join() + ")" : this.length ? "[" + ("Text" == e21 ? this.text : this.length) + "]" : "") + (this.breakAfter ? "#" : ""); + } }, { key: "isEditable", get: function() { + return true; + } }, { key: "isWidget", get: function() { + return false; + } }, { key: "isHidden", get: function() { + return false; + } }, { key: "merge", value: function(e21, t10, n10, r10, o10, i10) { + return false; + } }, { key: "become", value: function(e21) { + return false; + } }, { key: "canReuseDOM", value: function(e21) { + return e21.constructor == this.constructor && !(8 & (this.flags | e21.flags)); + } }, { key: "getSide", value: function() { + return 0; + } }, { key: "destroy", value: function() { + var e21, t10 = bo(this.children); + try { + for (t10.s(); !(e21 = t10.n()).done; ) { + var n10 = e21.value; + n10.parent == this && n10.destroy(); + } + } catch (e23) { + t10.e(e23); + } finally { + t10.f(); + } + this.parent = null; + } }], [{ key: "get", value: function(e21) { + return e21.cmView; + } }]), e20; + }(); + function mH(e20) { + var t10 = e20.nextSibling; + return e20.parentNode.removeChild(e20), t10; + } + pH.prototype.breakAfter = 0; + var gH = function() { + function e20(t10, n10, r10) { + No(this, e20), this.children = t10, this.pos = n10, this.i = r10, this.off = 0; + } + return Do(e20, [{ key: "findPos", value: function(e21) { + for (var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; ; ) { + if (e21 > this.pos || e21 == this.pos && (t10 > 0 || 0 == this.i || this.children[this.i - 1].breakAfter)) + return this.off = e21 - this.pos, this; + var n10 = this.children[--this.i]; + this.pos -= n10.length + n10.breakAfter; + } + } }]), e20; + }(); + function yH(e20, t10, n10, r10, o10, i10, a10, s10, c10) { + var l10 = e20.children, u10 = l10.length ? l10[t10] : null, f10 = i10.length ? i10[i10.length - 1] : null, d10 = f10 ? f10.breakAfter : a10; + if (!(t10 == r10 && u10 && !a10 && !d10 && i10.length < 2 && u10.merge(n10, o10, i10.length ? f10 : null, 0 == n10, s10, c10))) { + if (r10 < l10.length) { + var h10 = l10[r10]; + h10 && (o10 < h10.length || h10.breakAfter && (null == f10 ? void 0 : f10.breakAfter)) ? (t10 == r10 && (h10 = h10.split(o10), o10 = 0), !d10 && f10 && h10.merge(0, o10, f10, true, 0, c10) ? i10[i10.length - 1] = h10 : ((o10 || h10.children.length && !h10.children[0].length) && h10.merge(0, o10, null, false, 0, c10), i10.push(h10))) : (null == h10 ? void 0 : h10.breakAfter) && (f10 ? f10.breakAfter = 1 : a10 = 1), r10++; + } + for (u10 && (u10.breakAfter = a10, n10 > 0 && (!a10 && i10.length && u10.merge(n10, u10.length, i10[0], false, s10, 0) ? u10.breakAfter = i10.shift().breakAfter : (n10 < u10.length || u10.children.length && 0 == u10.children[u10.children.length - 1].length) && u10.merge(n10, u10.length, null, false, s10, 0), t10++)); t10 < r10 && i10.length; ) + if (l10[r10 - 1].become(i10[i10.length - 1])) + r10--, i10.pop(), c10 = i10.length ? 0 : s10; + else { + if (!l10[t10].become(i10[0])) + break; + t10++, i10.shift(), s10 = i10.length ? 0 : c10; + } + !i10.length && t10 && r10 < l10.length && !l10[t10 - 1].breakAfter && l10[r10].merge(0, 0, l10[t10 - 1], false, s10, c10) && t10--, (t10 < r10 || i10.length) && e20.replaceChildren(t10, r10, i10); + } + } + function bH(e20, t10, n10, r10, o10, i10) { + var a10, s10 = e20.childCursor(), c10 = s10.findPos(n10, 1), l10 = c10.i, u10 = c10.off, f10 = s10.findPos(t10, -1), d10 = f10.i, h10 = f10.off, v10 = t10 - n10, p10 = bo(r10); + try { + for (p10.s(); !(a10 = p10.n()).done; ) { + v10 += a10.value.length; + } + } catch (e21) { + p10.e(e21); + } finally { + p10.f(); + } + e20.length += v10, yH(e20, d10, h10, l10, u10, r10, 0, o10, i10); + } + var kH = "undefined" != typeof navigator ? navigator : { userAgent: "", vendor: "", platform: "" }; + var wH = "undefined" != typeof document ? document : { documentElement: { style: {} } }; + var xH = /Edge\/(\d+)/.exec(kH.userAgent); + var jH = /MSIE \d/.test(kH.userAgent); + var SH = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(kH.userAgent); + var CH = !!(jH || SH || xH); + var $H = !CH && /gecko\/(\d+)/i.test(kH.userAgent); + var _H = !CH && /Chrome\/(\d+)/.exec(kH.userAgent); + var OH = "webkitFontSmoothing" in wH.documentElement.style; + var MH = !CH && /Apple Computer/.test(kH.vendor); + var EH = MH && (/Mobile\/\w+/.test(kH.userAgent) || kH.maxTouchPoints > 2); + var AH = { mac: EH || /Mac/.test(kH.platform), windows: /Win/.test(kH.platform), linux: /Linux|X11/.test(kH.platform), ie: CH, ie_version: jH ? wH.documentMode || 6 : SH ? +SH[1] : xH ? +xH[1] : 0, gecko: $H, gecko_version: $H ? +(/Firefox\/(\d+)/.exec(kH.userAgent) || [0, 0])[1] : 0, chrome: !!_H, chrome_version: _H ? +_H[1] : 0, ios: EH, android: /Android\b/.test(kH.userAgent), webkit: OH, safari: MH, webkit_version: OH ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0, tabSize: null != wH.documentElement.style.tabSize ? "tab-size" : "-moz-tab-size" }; + var PH = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).text = e21, n10; + } + return Ao(t10, pH), Do(t10, [{ key: "length", get: function() { + return this.text.length; + } }, { key: "createDOM", value: function(e21) { + this.setDOM(e21 || document.createTextNode(this.text)); + } }, { key: "sync", value: function(e21, t11) { + this.dom || this.createDOM(), this.dom.nodeValue != this.text && (t11 && t11.node == this.dom && (t11.written = true), this.dom.nodeValue = this.text); + } }, { key: "reuseDOM", value: function(e21) { + 3 == e21.nodeType && this.createDOM(e21); + } }, { key: "merge", value: function(e21, n10, r10) { + return !(8 & this.flags || r10 && (!(r10 instanceof t10) || this.length - (n10 - e21) + r10.length > 256 || 8 & r10.flags)) && (this.text = this.text.slice(0, e21) + (r10 ? r10.text : "") + this.text.slice(n10), this.markDirty(), true); + } }, { key: "split", value: function(e21) { + var n10 = new t10(this.text.slice(e21)); + return this.text = this.text.slice(0, e21), this.markDirty(), n10.flags |= 8 & this.flags, n10; + } }, { key: "localPosFromDOM", value: function(e21, t11) { + return e21 == this.dom ? t11 : t11 ? this.text.length : 0; + } }, { key: "domAtPos", value: function(e21) { + return new hH(this.dom, e21); + } }, { key: "domBoundsAround", value: function(e21, t11, n10) { + return { from: n10, to: n10 + this.length, startDOM: this.dom, endDOM: this.dom.nextSibling }; + } }, { key: "coordsAt", value: function(e21, t11) { + return function(e23, t12, n10) { + var r10 = e23.nodeValue.length; + t12 > r10 && (t12 = r10); + var o10 = t12, i10 = t12, a10 = 0; + 0 == t12 && n10 < 0 || t12 == r10 && n10 >= 0 ? AH.chrome || AH.gecko || (t12 ? (o10--, a10 = 1) : i10 < r10 && (i10++, a10 = -1)) : n10 < 0 ? o10-- : i10 < r10 && i10++; + var s10 = lH(e23, o10, i10).getClientRects(); + if (!s10.length) + return null; + var c10 = s10[(a10 ? a10 < 0 : n10 >= 0) ? 0 : s10.length - 1]; + AH.safari && !a10 && 0 == c10.width && (c10 = Array.prototype.find.call(s10, function(e24) { + return e24.width; + }) || c10); + return a10 ? nH(c10, a10 < 0) : c10 || null; + }(this.dom, e21, t11); + } }]), t10; + }(); + var TH = function(e20) { + function t10(e21) { + var n10, r10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], o10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0; + No(this, t10), (n10 = _o(this, t10)).mark = e21, n10.children = r10, n10.length = o10; + var i10, a10 = bo(r10); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + i10.value.setParent(Eo(n10)); + } + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + return n10; + } + return Ao(t10, pH), Do(t10, [{ key: "setAttrs", value: function(e21) { + if (fH(e21), this.mark.class && (e21.className = this.mark.class), this.mark.attrs) + for (var t11 in this.mark.attrs) + e21.setAttribute(t11, this.mark.attrs[t11]); + return e21; + } }, { key: "canReuseDOM", value: function(e21) { + return go(Mo(t10.prototype), "canReuseDOM", this).call(this, e21) && !(8 & (this.flags | e21.flags)); + } }, { key: "reuseDOM", value: function(e21) { + e21.nodeName == this.mark.tagName.toUpperCase() && (this.setDOM(e21), this.flags |= 6); + } }, { key: "sync", value: function(e21, n10) { + this.dom ? 4 & this.flags && this.setAttrs(this.dom) : this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))), go(Mo(t10.prototype), "sync", this).call(this, e21, n10); + } }, { key: "merge", value: function(e21, n10, r10, o10, i10, a10) { + return (!r10 || !(!(r10 instanceof t10 && r10.mark.eq(this.mark)) || e21 && i10 <= 0 || n10 < this.length && a10 <= 0)) && (bH(this, e21, n10, r10 ? r10.children.slice() : [], i10 - 1, a10 - 1), this.markDirty(), true); + } }, { key: "split", value: function(e21) { + var n10, r10 = [], o10 = 0, i10 = -1, a10 = 0, s10 = bo(this.children); + try { + for (s10.s(); !(n10 = s10.n()).done; ) { + var c10 = n10.value, l10 = o10 + c10.length; + l10 > e21 && r10.push(o10 < e21 ? c10.split(e21 - o10) : c10), i10 < 0 && o10 >= e21 && (i10 = a10), o10 = l10, a10++; + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + var u10 = this.length - e21; + return this.length = e21, i10 > -1 && (this.children.length = i10, this.markDirty()), new t10(this.mark, r10, u10); + } }, { key: "domAtPos", value: function(e21) { + return IH(this, e21); + } }, { key: "coordsAt", value: function(e21, t11) { + return qH(this, e21, t11); + } }]), t10; + }(); + var RH = function(e20) { + function t10(e21, n10, r10) { + var o10; + return No(this, t10), (o10 = _o(this, t10)).widget = e21, o10.length = n10, o10.side = r10, o10.prevWidget = null, o10; + } + return Ao(t10, pH), Do(t10, [{ key: "split", value: function(e21) { + var n10 = t10.create(this.widget, this.length - e21, this.side); + return this.length -= e21, n10; + } }, { key: "sync", value: function(e21) { + this.dom && this.widget.updateDOM(this.dom, e21) || (this.dom && this.prevWidget && this.prevWidget.destroy(this.dom), this.prevWidget = null, this.setDOM(this.widget.toDOM(e21)), this.widget.editable || (this.dom.contentEditable = "false")); + } }, { key: "getSide", value: function() { + return this.side; + } }, { key: "merge", value: function(e21, n10, r10, o10, i10, a10) { + return !(r10 && (!(r10 instanceof t10 && this.widget.compare(r10.widget)) || e21 > 0 && i10 <= 0 || n10 < this.length && a10 <= 0)) && (this.length = e21 + (r10 ? r10.length : 0) + (this.length - n10), true); + } }, { key: "become", value: function(e21) { + return e21 instanceof t10 && e21.side == this.side && this.widget.constructor == e21.widget.constructor && (this.widget.compare(e21.widget) || this.markDirty(true), this.dom && !this.prevWidget && (this.prevWidget = this.widget), this.widget = e21.widget, this.length = e21.length, true); + } }, { key: "ignoreMutation", value: function() { + return true; + } }, { key: "ignoreEvent", value: function(e21) { + return this.widget.ignoreEvent(e21); + } }, { key: "overrideDOMText", get: function() { + if (0 == this.length) + return UL.empty; + for (var e21 = this; e21.parent; ) + e21 = e21.parent; + var t11 = e21.view, n10 = t11 && t11.state.doc, r10 = this.posAtStart; + return n10 ? n10.slice(r10, r10 + this.length) : UL.empty; + } }, { key: "domAtPos", value: function(e21) { + return (this.length ? 0 == e21 : this.side > 0) ? hH.before(this.dom) : hH.after(this.dom, e21 == this.length); + } }, { key: "domBoundsAround", value: function() { + return null; + } }, { key: "coordsAt", value: function(e21, t11) { + var n10 = this.widget.coordsAt(this.dom, e21, t11); + if (n10) + return n10; + var r10 = this.dom.getClientRects(), o10 = null; + if (!r10.length) + return null; + for (var i10 = this.side ? this.side < 0 : e21 > 0, a10 = i10 ? r10.length - 1 : 0; o10 = r10[a10], !(e21 > 0 ? 0 == a10 : a10 == r10.length - 1 || o10.top < o10.bottom); a10 += i10 ? -1 : 1) + ; + return nH(o10, !i10); + } }, { key: "isEditable", get: function() { + return false; + } }, { key: "isWidget", get: function() { + return true; + } }, { key: "isHidden", get: function() { + return this.widget.isHidden; + } }, { key: "destroy", value: function() { + go(Mo(t10.prototype), "destroy", this).call(this), this.dom && this.widget.destroy(this.dom); + } }], [{ key: "create", value: function(e21, n10, r10) { + return new t10(e21, n10, r10); + } }]), t10; + }(); + var NH = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).side = e21, n10; + } + return Ao(t10, pH), Do(t10, [{ key: "length", get: function() { + return 0; + } }, { key: "merge", value: function() { + return false; + } }, { key: "become", value: function(e21) { + return e21 instanceof t10 && e21.side == this.side; + } }, { key: "split", value: function() { + return new t10(this.side); + } }, { key: "sync", value: function() { + if (!this.dom) { + var e21 = document.createElement("img"); + e21.className = "cm-widgetBuffer", e21.setAttribute("aria-hidden", "true"), this.setDOM(e21); + } + } }, { key: "getSide", value: function() { + return this.side; + } }, { key: "domAtPos", value: function(e21) { + return this.side > 0 ? hH.before(this.dom) : hH.after(this.dom); + } }, { key: "localPosFromDOM", value: function() { + return 0; + } }, { key: "domBoundsAround", value: function() { + return null; + } }, { key: "coordsAt", value: function(e21) { + return this.dom.getBoundingClientRect(); + } }, { key: "overrideDOMText", get: function() { + return UL.empty; + } }, { key: "isHidden", get: function() { + return true; + } }]), t10; + }(); + function IH(e20, t10) { + for (var n10 = e20.dom, r10 = e20.children, o10 = 0, i10 = 0; o10 < r10.length; o10++) { + var a10 = r10[o10], s10 = i10 + a10.length; + if (!(s10 == i10 && a10.getSide() <= 0)) { + if (t10 > i10 && t10 < s10 && a10.dom.parentNode == n10) + return a10.domAtPos(t10 - i10); + if (t10 <= i10) + break; + i10 = s10; + } + } + for (var c10 = o10; c10 > 0; c10--) { + var l10 = r10[c10 - 1]; + if (l10.dom.parentNode == n10) + return l10.domAtPos(l10.length); + } + for (var u10 = o10; u10 < r10.length; u10++) { + var f10 = r10[u10]; + if (f10.dom.parentNode == n10) + return f10.domAtPos(0); + } + return new hH(n10, 0); + } + function DH(e20, t10, n10) { + var r10, o10 = e20.children; + n10 > 0 && t10 instanceof TH && o10.length && (r10 = o10[o10.length - 1]) instanceof TH && r10.mark.eq(t10.mark) ? DH(r10, t10.children[0], n10 - 1) : (o10.push(t10), t10.setParent(e20)), e20.length += t10.length; + } + function qH(e20, t10, n10) { + var r10 = null, o10 = -1, i10 = null, a10 = -1; + !function e21(t11, s11) { + for (var c10 = 0, l10 = 0; c10 < t11.children.length && l10 <= s11; c10++) { + var u10 = t11.children[c10], f10 = l10 + u10.length; + f10 >= s11 && (u10.children.length ? e21(u10, s11 - l10) : (!i10 || i10.isHidden && n10 > 0) && (f10 > s11 || l10 == f10 && u10.getSide() > 0) ? (i10 = u10, a10 = s11 - l10) : (l10 < s11 || l10 == f10 && u10.getSide() < 0 && !u10.isHidden) && (r10 = u10, o10 = s11 - l10)), l10 = f10; + } + }(e20, t10); + var s10 = (n10 < 0 ? r10 : i10) || r10 || i10; + return s10 ? s10.coordsAt(Math.max(0, s10 == r10 ? o10 : a10), n10) : function(e21) { + var t11 = e21.dom.lastChild; + if (!t11) + return e21.dom.getBoundingClientRect(); + var n11 = YV(t11); + return n11[n11.length - 1] || null; + }(e20); + } + function zH(e20, t10) { + for (var n10 in e20) + "class" == n10 && t10.class ? t10.class += " " + e20.class : "style" == n10 && t10.style ? t10.style += ";" + e20.style : t10[n10] = e20[n10]; + return t10; + } + PH.prototype.children = RH.prototype.children = NH.prototype.children = vH; + var BH = /* @__PURE__ */ Object.create(null); + function LH(e20, t10, n10) { + if (e20 == t10) + return true; + e20 || (e20 = BH), t10 || (t10 = BH); + var r10 = Object.keys(e20), o10 = Object.keys(t10); + if (r10.length - (n10 && r10.indexOf(n10) > -1 ? 1 : 0) != o10.length - (n10 && o10.indexOf(n10) > -1 ? 1 : 0)) + return false; + for (var i10 = 0, a10 = r10; i10 < a10.length; i10++) { + var s10 = a10[i10]; + if (s10 != n10 && (-1 == o10.indexOf(s10) || e20[s10] !== t10[s10])) + return false; + } + return true; + } + function FH(e20, t10, n10) { + var r10 = false; + if (t10) + for (var o10 in t10) + n10 && o10 in n10 || (r10 = true, "style" == o10 ? e20.style.cssText = "" : e20.removeAttribute(o10)); + if (n10) + for (var i10 in n10) + t10 && t10[i10] == n10[i10] || (r10 = true, "style" == i10 ? e20.style.cssText = n10[i10] : e20.setAttribute(i10, n10[i10])); + return r10; + } + function VH(e20) { + for (var t10 = /* @__PURE__ */ Object.create(null), n10 = 0; n10 < e20.attributes.length; n10++) { + var r10 = e20.attributes[n10]; + t10[r10.name] = r10.value; + } + return t10; + } + var HH = function(e20) { + function t10() { + var e21; + return No(this, t10), (e21 = _o(this, t10, arguments)).children = [], e21.length = 0, e21.prevAttrs = void 0, e21.attrs = null, e21.breakAfter = 0, e21; + } + return Ao(t10, pH), Do(t10, [{ key: "merge", value: function(e21, n10, r10, o10, i10, a10) { + if (r10) { + if (!(r10 instanceof t10)) + return false; + this.dom || r10.transferDOM(this); + } + return o10 && this.setDeco(r10 ? r10.attrs : null), bH(this, e21, n10, r10 ? r10.children.slice() : [], i10, a10), true; + } }, { key: "split", value: function(e21) { + var n10 = new t10(); + if (n10.breakAfter = this.breakAfter, 0 == this.length) + return n10; + var r10 = this.childPos(e21), o10 = r10.i, i10 = r10.off; + i10 && (n10.append(this.children[o10].split(i10), 0), this.children[o10].merge(i10, this.children[o10].length, null, false, 0, 0), o10++); + for (var a10 = o10; a10 < this.children.length; a10++) + n10.append(this.children[a10], 0); + for (; o10 > 0 && 0 == this.children[o10 - 1].length; ) + this.children[--o10].destroy(); + return this.children.length = o10, this.markDirty(), this.length = e21, n10; + } }, { key: "transferDOM", value: function(e21) { + this.dom && (this.markDirty(), e21.setDOM(this.dom), e21.prevAttrs = void 0 === this.prevAttrs ? this.attrs : this.prevAttrs, this.prevAttrs = void 0, this.dom = null); + } }, { key: "setDeco", value: function(e21) { + LH(this.attrs, e21) || (this.dom && (this.prevAttrs = this.attrs, this.markDirty()), this.attrs = e21); + } }, { key: "append", value: function(e21, t11) { + DH(this, e21, t11); + } }, { key: "addLineDeco", value: function(e21) { + var t11 = e21.spec.attributes, n10 = e21.spec.class; + t11 && (this.attrs = zH(t11, this.attrs || {})), n10 && (this.attrs = zH({ class: n10 }, this.attrs || {})); + } }, { key: "domAtPos", value: function(e21) { + return IH(this, e21); + } }, { key: "reuseDOM", value: function(e21) { + "DIV" == e21.nodeName && (this.setDOM(e21), this.flags |= 6); + } }, { key: "sync", value: function(e21, n10) { + var r10; + this.dom ? 4 & this.flags && (fH(this.dom), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0) : (this.setDOM(document.createElement("div")), this.dom.className = "cm-line", this.prevAttrs = this.attrs ? null : void 0), void 0 !== this.prevAttrs && (FH(this.dom, this.prevAttrs, this.attrs), this.dom.classList.add("cm-line"), this.prevAttrs = void 0), go(Mo(t10.prototype), "sync", this).call(this, e21, n10); + for (var o10 = this.dom.lastChild; o10 && pH.get(o10) instanceof TH; ) + o10 = o10.lastChild; + if (!(o10 && this.length && ("BR" == o10.nodeName || 0 != (null === (r10 = pH.get(o10)) || void 0 === r10 ? void 0 : r10.isEditable) || AH.ios && this.children.some(function(e23) { + return e23 instanceof PH; + })))) { + var i10 = document.createElement("BR"); + i10.cmIgnore = true, this.dom.appendChild(i10); + } + } }, { key: "measureTextSize", value: function() { + if (0 == this.children.length || this.length > 20) + return null; + var e21, t11, n10 = 0, r10 = bo(this.children); + try { + for (r10.s(); !(t11 = r10.n()).done; ) { + var o10 = t11.value; + if (!(o10 instanceof PH) || /[^ -~]/.test(o10.text)) + return null; + var i10 = YV(o10.dom); + if (1 != i10.length) + return null; + n10 += i10[0].width, e21 = i10[0].height; + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + return n10 ? { lineHeight: this.dom.getBoundingClientRect().height, charWidth: n10 / this.length, textHeight: e21 } : null; + } }, { key: "coordsAt", value: function(e21, t11) { + var n10 = qH(this, e21, t11); + if (!this.children.length && n10 && this.parent) { + var r10 = this.parent.view.viewState.heightOracle, o10 = n10.bottom - n10.top; + if (Math.abs(o10 - r10.lineHeight) < 2 && r10.textHeight < o10) { + var i10 = (o10 - r10.textHeight) / 2; + return { top: n10.top + i10, bottom: n10.bottom - i10, left: n10.left, right: n10.left }; + } + } + return n10; + } }, { key: "become", value: function(e21) { + return false; + } }, { key: "covers", value: function() { + return true; + } }], [{ key: "find", value: function(e21, n10) { + for (var r10 = 0, o10 = 0; r10 < e21.children.length; r10++) { + var i10 = e21.children[r10], a10 = o10 + i10.length; + if (a10 >= n10) { + if (i10 instanceof t10) + return i10; + if (a10 > n10) + break; + } + o10 = a10 + i10.breakAfter; + } + return null; + } }]), t10; + }(); + var WH = function(e20) { + function t10(e21, n10, r10) { + var o10; + return No(this, t10), (o10 = _o(this, t10)).widget = e21, o10.length = n10, o10.deco = r10, o10.breakAfter = 0, o10.prevWidget = null, o10; + } + return Ao(t10, pH), Do(t10, [{ key: "merge", value: function(e21, n10, r10, o10, i10, a10) { + return !(r10 && (!(r10 instanceof t10 && this.widget.compare(r10.widget)) || e21 > 0 && i10 <= 0 || n10 < this.length && a10 <= 0)) && (this.length = e21 + (r10 ? r10.length : 0) + (this.length - n10), true); + } }, { key: "domAtPos", value: function(e21) { + return 0 == e21 ? hH.before(this.dom) : hH.after(this.dom, e21 == this.length); + } }, { key: "split", value: function(e21) { + var n10 = this.length - e21; + this.length = e21; + var r10 = new t10(this.widget, n10, this.deco); + return r10.breakAfter = this.breakAfter, r10; + } }, { key: "children", get: function() { + return vH; + } }, { key: "sync", value: function(e21) { + this.dom && this.widget.updateDOM(this.dom, e21) || (this.dom && this.prevWidget && this.prevWidget.destroy(this.dom), this.prevWidget = null, this.setDOM(this.widget.toDOM(e21)), this.widget.editable || (this.dom.contentEditable = "false")); + } }, { key: "overrideDOMText", get: function() { + return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : UL.empty; + } }, { key: "domBoundsAround", value: function() { + return null; + } }, { key: "become", value: function(e21) { + return e21 instanceof t10 && e21.widget.constructor == this.widget.constructor && (e21.widget.compare(this.widget) || this.markDirty(true), this.dom && !this.prevWidget && (this.prevWidget = this.widget), this.widget = e21.widget, this.length = e21.length, this.deco = e21.deco, this.breakAfter = e21.breakAfter, true); + } }, { key: "ignoreMutation", value: function() { + return true; + } }, { key: "ignoreEvent", value: function(e21) { + return this.widget.ignoreEvent(e21); + } }, { key: "isEditable", get: function() { + return false; + } }, { key: "isWidget", get: function() { + return true; + } }, { key: "coordsAt", value: function(e21, t11) { + return this.widget.coordsAt(this.dom, e21, t11); + } }, { key: "destroy", value: function() { + go(Mo(t10.prototype), "destroy", this).call(this), this.dom && this.widget.destroy(this.dom); + } }, { key: "covers", value: function(e21) { + var t11 = this.deco, n10 = t11.startSide, r10 = t11.endSide; + return n10 != r10 && (e21 < 0 ? n10 < 0 : r10 > 0); + } }]), t10; + }(); + var UH = function() { + function e20() { + No(this, e20); + } + return Do(e20, [{ key: "eq", value: function(e21) { + return false; + } }, { key: "updateDOM", value: function(e21, t10) { + return false; + } }, { key: "compare", value: function(e21) { + return this == e21 || this.constructor == e21.constructor && this.eq(e21); + } }, { key: "estimatedHeight", get: function() { + return -1; + } }, { key: "lineBreaks", get: function() { + return 0; + } }, { key: "ignoreEvent", value: function(e21) { + return true; + } }, { key: "coordsAt", value: function(e21, t10, n10) { + return null; + } }, { key: "isHidden", get: function() { + return false; + } }, { key: "editable", get: function() { + return false; + } }, { key: "destroy", value: function(e21) { + } }]), e20; + }(); + var JH = function(e20) { + return e20[e20.Text = 0] = "Text", e20[e20.WidgetBefore = 1] = "WidgetBefore", e20[e20.WidgetAfter = 2] = "WidgetAfter", e20[e20.WidgetRange = 3] = "WidgetRange", e20; + }(JH || (JH = {})); + var KH = function(e20) { + function t10(e21, n10, r10, o10) { + var i10; + return No(this, t10), (i10 = _o(this, t10)).startSide = e21, i10.endSide = n10, i10.widget = r10, i10.spec = o10, i10; + } + return Ao(t10, yV), Do(t10, [{ key: "heightRelevant", get: function() { + return false; + } }, { key: "hasHeight", value: function() { + return !!this.widget && this.widget.estimatedHeight > -1; + } }], [{ key: "mark", value: function(e21) { + return new GH(e21); + } }, { key: "widget", value: function(e21) { + var t11 = Math.max(-1e4, Math.min(1e4, e21.side || 0)), n10 = !!e21.block; + return t11 += n10 && !e21.inlineOrder ? t11 > 0 ? 3e8 : -4e8 : t11 > 0 ? 1e8 : -1e8, new YH(e21, t11, t11, n10, e21.widget || null, false); + } }, { key: "replace", value: function(e21) { + var t11, n10, r10 = !!e21.block; + if (e21.isBlockGap) + t11 = -5e8, n10 = 4e8; + else { + var o10 = XH(e21, r10); + t11 = (o10.start ? r10 ? -3e8 : -1 : 5e8) - 1, n10 = 1 + (o10.end ? r10 ? 2e8 : 1 : -6e8); + } + return new YH(e21, t11, n10, r10, e21.widget || null, true); + } }, { key: "line", value: function(e21) { + return new QH(e21); + } }, { key: "set", value: function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + return xV.of(e21, t11); + } }]), t10; + }(); + KH.none = xV.empty; + var GH = function(e20) { + function t10(e21) { + var n10; + No(this, t10); + var r10 = XH(e21); + return (n10 = _o(this, t10, [r10.start ? -1 : 5e8, r10.end ? 1 : -6e8, null, e21])).tagName = e21.tagName || "span", n10.class = e21.class || "", n10.attrs = e21.attributes || null, n10; + } + return Ao(t10, KH), Do(t10, [{ key: "eq", value: function(e21) { + var n10, r10; + return this == e21 || e21 instanceof t10 && this.tagName == e21.tagName && (this.class || (null === (n10 = this.attrs) || void 0 === n10 ? void 0 : n10.class)) == (e21.class || (null === (r10 = e21.attrs) || void 0 === r10 ? void 0 : r10.class)) && LH(this.attrs, e21.attrs, "class"); + } }, { key: "range", value: function(e21) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21; + if (e21 >= n10) + throw new RangeError("Mark decorations may not be empty"); + return go(Mo(t10.prototype), "range", this).call(this, e21, n10); + } }]), t10; + }(); + GH.prototype.point = false; + var QH = function(e20) { + function t10(e21) { + return No(this, t10), _o(this, t10, [-2e8, -2e8, null, e21]); + } + return Ao(t10, KH), Do(t10, [{ key: "eq", value: function(e21) { + return e21 instanceof t10 && this.spec.class == e21.spec.class && LH(this.spec.attributes, e21.spec.attributes); + } }, { key: "range", value: function(e21) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21; + if (n10 != e21) + throw new RangeError("Line decoration ranges must be zero-length"); + return go(Mo(t10.prototype), "range", this).call(this, e21, n10); + } }]), t10; + }(); + QH.prototype.mapMode = mF.TrackBefore, QH.prototype.point = true; + var YH = function(e20) { + function t10(e21, n10, r10, o10, i10, a10) { + var s10; + return No(this, t10), (s10 = _o(this, t10, [n10, r10, i10, e21])).block = o10, s10.isReplace = a10, s10.mapMode = o10 ? n10 <= 0 ? mF.TrackBefore : mF.TrackAfter : mF.TrackDel, s10; + } + return Ao(t10, KH), Do(t10, [{ key: "type", get: function() { + return this.startSide != this.endSide ? JH.WidgetRange : this.startSide <= 0 ? JH.WidgetBefore : JH.WidgetAfter; + } }, { key: "heightRelevant", get: function() { + return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0); + } }, { key: "eq", value: function(e21) { + return e21 instanceof t10 && (n10 = this.widget, r10 = e21.widget, n10 == r10 || !!(n10 && r10 && n10.compare(r10))) && this.block == e21.block && this.startSide == e21.startSide && this.endSide == e21.endSide; + var n10, r10; + } }, { key: "range", value: function(e21) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21; + if (this.isReplace && (e21 > n10 || e21 == n10 && this.startSide > 0 && this.endSide <= 0)) + throw new RangeError("Invalid range for replacement decoration"); + if (!this.isReplace && n10 != e21) + throw new RangeError("Widget decorations can only have zero-length ranges"); + return go(Mo(t10.prototype), "range", this).call(this, e21, n10); + } }]), t10; + }(); + function XH(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], n10 = e20.inclusiveStart, r10 = e20.inclusiveEnd; + return null == n10 && (n10 = e20.inclusive), null == r10 && (r10 = e20.inclusive), { start: null != n10 ? n10 : t10, end: null != r10 ? r10 : t10 }; + } + function ZH(e20, t10, n10) { + var r10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, o10 = n10.length - 1; + o10 >= 0 && n10[o10] + r10 >= e20 ? n10[o10] = Math.max(n10[o10], t10) : n10.push(e20, t10); + } + YH.prototype.point = true; + var eW = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.doc = t10, this.pos = n10, this.end = r10, this.disallowBlockEffectsFor = o10, this.content = [], this.curLine = null, this.breakAtStart = 0, this.pendingBuffer = 0, this.bufferMarks = [], this.atCursorPos = true, this.openStart = -1, this.openEnd = -1, this.text = "", this.textOff = 0, this.cursor = t10.iter(), this.skip = n10; + } + return Do(e20, [{ key: "posCovered", value: function() { + if (0 == this.content.length) + return !this.breakAtStart && this.doc.lineAt(this.pos).from != this.pos; + var e21 = this.content[this.content.length - 1]; + return !(e21.breakAfter || e21 instanceof WH && e21.deco.endSide < 0); + } }, { key: "getLine", value: function() { + return this.curLine || (this.content.push(this.curLine = new HH()), this.atCursorPos = true), this.curLine; + } }, { key: "flushBuffer", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.bufferMarks; + this.pendingBuffer && (this.curLine.append(tW(new NH(-1), e21), e21.length), this.pendingBuffer = 0); + } }, { key: "addBlockWidget", value: function(e21) { + this.flushBuffer(), this.curLine = null, this.content.push(e21); + } }, { key: "finish", value: function(e21) { + this.pendingBuffer && e21 <= this.bufferMarks.length ? this.flushBuffer() : this.pendingBuffer = 0, this.posCovered() || e21 && this.content.length && this.content[this.content.length - 1] instanceof WH || this.getLine(); + } }, { key: "buildText", value: function(e21, t10, n10) { + for (; e21 > 0; ) { + if (this.textOff == this.text.length) { + var r10 = this.cursor.next(this.skip), o10 = r10.value, i10 = r10.lineBreak, a10 = r10.done; + if (this.skip = 0, a10) + throw new Error("Ran out of text content when drawing inline views"); + if (i10) { + this.posCovered() || this.getLine(), this.content.length ? this.content[this.content.length - 1].breakAfter = 1 : this.breakAtStart = 1, this.flushBuffer(), this.curLine = null, this.atCursorPos = true, e21--; + continue; + } + this.text = o10, this.textOff = 0; + } + var s10 = Math.min(this.text.length - this.textOff, e21, 512); + this.flushBuffer(t10.slice(t10.length - n10)), this.getLine().append(tW(new PH(this.text.slice(this.textOff, this.textOff + s10)), t10), n10), this.atCursorPos = true, this.textOff += s10, e21 -= s10, n10 = 0; + } + } }, { key: "span", value: function(e21, t10, n10, r10) { + this.buildText(t10 - e21, n10, r10), this.pos = t10, this.openStart < 0 && (this.openStart = r10); + } }, { key: "point", value: function(e21, t10, n10, r10, o10, i10) { + if (this.disallowBlockEffectsFor[i10] && n10 instanceof YH) { + if (n10.block) + throw new RangeError("Block decorations may not be specified via plugins"); + if (t10 > this.doc.lineAt(this.pos).to) + throw new RangeError("Decorations that replace line breaks may not be specified via plugins"); + } + var a10 = t10 - e21; + if (n10 instanceof YH) + if (n10.block) + n10.startSide > 0 && !this.posCovered() && this.getLine(), this.addBlockWidget(new WH(n10.widget || new nW("div"), a10, n10)); + else { + var s10 = RH.create(n10.widget || new nW("span"), a10, a10 ? 0 : n10.startSide), c10 = this.atCursorPos && !s10.isEditable && o10 <= r10.length && (e21 < t10 || n10.startSide > 0), l10 = !s10.isEditable && (e21 < t10 || o10 > r10.length || n10.startSide <= 0), u10 = this.getLine(); + 2 != this.pendingBuffer || c10 || s10.isEditable || (this.pendingBuffer = 0), this.flushBuffer(r10), c10 && (u10.append(tW(new NH(1), r10), o10), o10 = r10.length + Math.max(0, o10 - r10.length)), u10.append(tW(s10, r10), o10), this.atCursorPos = l10, this.pendingBuffer = l10 ? e21 < t10 || o10 > r10.length ? 1 : 2 : 0, this.pendingBuffer && (this.bufferMarks = r10.slice()); + } + else + this.doc.lineAt(this.pos).from == this.pos && this.getLine().addLineDeco(n10); + a10 && (this.textOff + a10 <= this.text.length ? this.textOff += a10 : (this.skip += a10 - (this.text.length - this.textOff), this.text = "", this.textOff = 0), this.pos = t10), this.openStart < 0 && (this.openStart = o10); + } }], [{ key: "build", value: function(t10, n10, r10, o10, i10) { + var a10 = new e20(t10, n10, r10, i10); + return a10.openEnd = xV.spans(o10, n10, r10, a10), a10.openStart < 0 && (a10.openStart = a10.openEnd), a10.finish(a10.openEnd), a10; + } }]), e20; + }(); + function tW(e20, t10) { + var n10, r10 = bo(t10); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + e20 = new TH(o10, [e20], e20.length); + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + return e20; + } + var nW = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).tag = e21, n10; + } + return Ao(t10, UH), Do(t10, [{ key: "eq", value: function(e21) { + return e21.tag == this.tag; + } }, { key: "toDOM", value: function() { + return document.createElement(this.tag); + } }, { key: "updateDOM", value: function(e21) { + return e21.nodeName.toLowerCase() == this.tag; + } }, { key: "isHidden", get: function() { + return true; + } }]), t10; + }(); + var rW = function(e20) { + return e20[e20.LTR = 0] = "LTR", e20[e20.RTL = 1] = "RTL", e20; + }(rW || (rW = {})); + var oW = rW.LTR; + var iW = rW.RTL; + function aW(e20) { + for (var t10 = [], n10 = 0; n10 < e20.length; n10++) + t10.push(1 << +e20[n10]); + return t10; + } + for (sW = aW("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"), cW = aW("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"), lW = /* @__PURE__ */ Object.create(null), uW = [], fW = 0, dW = ["()", "[]", "{}"]; fW < dW.length; fW++) { + hW = dW[fW], vW = hW.charCodeAt(0), pW = hW.charCodeAt(1); + lW[vW] = pW, lW[pW] = -vW; + } + var hW; + var vW; + var pW; + var sW; + var cW; + var lW; + var uW; + var fW; + var dW; + function mW(e20) { + return e20 <= 247 ? sW[e20] : 1424 <= e20 && e20 <= 1524 ? 2 : 1536 <= e20 && e20 <= 1785 ? cW[e20 - 1536] : 1774 <= e20 && e20 <= 2220 ? 4 : 8192 <= e20 && e20 <= 8204 ? 256 : 64336 <= e20 && e20 <= 65023 ? 4 : 1; + } + var gW = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/; + var yW = function() { + function e20(t10, n10, r10) { + No(this, e20), this.from = t10, this.to = n10, this.level = r10; + } + return Do(e20, [{ key: "dir", get: function() { + return this.level % 2 ? iW : oW; + } }, { key: "side", value: function(e21, t10) { + return this.dir == t10 == e21 ? this.to : this.from; + } }, { key: "forward", value: function(e21, t10) { + return e21 == (this.dir == t10); + } }], [{ key: "find", value: function(e21, t10, n10, r10) { + for (var o10 = -1, i10 = 0; i10 < e21.length; i10++) { + var a10 = e21[i10]; + if (a10.from <= t10 && a10.to >= t10) { + if (a10.level == n10) + return i10; + (o10 < 0 || (0 != r10 ? r10 < 0 ? a10.from < t10 : a10.to > t10 : e21[o10].level > a10.level)) && (o10 = i10); + } + } + if (o10 < 0) + throw new RangeError("Index out of range"); + return o10; + } }]), e20; + }(); + function bW(e20, t10) { + if (e20.length != t10.length) + return false; + for (var n10 = 0; n10 < e20.length; n10++) { + var r10 = e20[n10], o10 = t10[n10]; + if (r10.from != o10.from || r10.to != o10.to || r10.direction != o10.direction || !bW(r10.inner, o10.inner)) + return false; + } + return true; + } + var kW = []; + function wW(e20, t10, n10, r10, o10, i10, a10) { + var s10 = r10 % 2 ? 2 : 1; + if (r10 % 2 == o10 % 2) + for (var c10 = t10, l10 = 0; c10 < n10; ) { + var u10 = true, f10 = false; + if (l10 == i10.length || c10 < i10[l10].from) { + var d10 = kW[c10]; + d10 != s10 && (u10 = false, f10 = 16 == d10); + } + var h10 = u10 || 1 != s10 ? null : [], v10 = u10 ? r10 : r10 + 1, p10 = c10; + e: + for (; ; ) + if (l10 < i10.length && p10 == i10[l10].from) { + if (f10) + break e; + var m10 = i10[l10]; + if (!u10) + for (var g10 = m10.to, y10 = l10 + 1; ; ) { + if (g10 == n10) + break e; + if (!(y10 < i10.length && i10[y10].from == g10)) { + if (kW[g10] == s10) + break e; + break; + } + g10 = i10[y10++].to; + } + if (l10++, h10) + h10.push(m10); + else + m10.from > c10 && a10.push(new yW(c10, m10.from, v10)), xW(e20, m10.direction == oW != !(v10 % 2) ? r10 + 1 : r10, o10, m10.inner, m10.from, m10.to, a10), c10 = m10.to; + p10 = m10.to; + } else { + if (p10 == n10 || (u10 ? kW[p10] != s10 : kW[p10] == s10)) + break; + p10++; + } + h10 ? wW(e20, c10, p10, r10 + 1, o10, h10, a10) : c10 < p10 && a10.push(new yW(c10, p10, v10)), c10 = p10; + } + else + for (var b10 = n10, k10 = i10.length; b10 > t10; ) { + var w10 = true, x10 = false; + if (!k10 || b10 > i10[k10 - 1].to) { + var j10 = kW[b10 - 1]; + j10 != s10 && (w10 = false, x10 = 16 == j10); + } + var S10 = w10 || 1 != s10 ? null : [], C10 = w10 ? r10 : r10 + 1, $10 = b10; + e: + for (; ; ) + if (k10 && $10 == i10[k10 - 1].to) { + if (x10) + break e; + var _10 = i10[--k10]; + if (!w10) + for (var O10 = _10.from, M10 = k10; ; ) { + if (O10 == t10) + break e; + if (!M10 || i10[M10 - 1].to != O10) { + if (kW[O10 - 1] == s10) + break e; + break; + } + O10 = i10[--M10].from; + } + if (S10) + S10.push(_10); + else + _10.to < b10 && a10.push(new yW(_10.to, b10, C10)), xW(e20, _10.direction == oW != !(C10 % 2) ? r10 + 1 : r10, o10, _10.inner, _10.from, _10.to, a10), b10 = _10.from; + $10 = _10.from; + } else { + if ($10 == t10 || (w10 ? kW[$10 - 1] != s10 : kW[$10 - 1] == s10)) + break; + $10--; + } + S10 ? wW(e20, $10, b10, r10 + 1, o10, S10, a10) : $10 < b10 && a10.push(new yW($10, b10, C10)), b10 = $10; + } + } + function xW(e20, t10, n10, r10, o10, i10, a10) { + var s10 = t10 % 2 ? 2 : 1; + !function(e21, t11, n11, r11, o11) { + for (var i11 = 0; i11 <= r11.length; i11++) { + for (var a11 = i11 ? r11[i11 - 1].to : t11, s11 = i11 < r11.length ? r11[i11].from : n11, c10 = i11 ? 256 : o11, l10 = a11, u10 = c10, f10 = c10; l10 < s11; l10++) { + var d10 = mW(e21.charCodeAt(l10)); + 512 == d10 ? d10 = u10 : 8 == d10 && 4 == f10 && (d10 = 16), kW[l10] = 4 == d10 ? 2 : d10, 7 & d10 && (f10 = d10), u10 = d10; + } + for (var h10 = a11, v10 = c10, p10 = c10; h10 < s11; h10++) { + var m10 = kW[h10]; + if (128 == m10) + h10 < s11 - 1 && v10 == kW[h10 + 1] && 24 & v10 ? m10 = kW[h10] = v10 : kW[h10] = 256; + else if (64 == m10) { + for (var g10 = h10 + 1; g10 < s11 && 64 == kW[g10]; ) + g10++; + for (var y10 = h10 && 8 == v10 || g10 < n11 && 8 == kW[g10] ? 1 == p10 ? 1 : 8 : 256, b10 = h10; b10 < g10; b10++) + kW[b10] = y10; + h10 = g10 - 1; + } else + 8 == m10 && 1 == p10 && (kW[h10] = 1); + v10 = m10, 7 & m10 && (p10 = m10); + } + } + }(e20, o10, i10, r10, s10), function(e21, t11, n11, r11, o11) { + for (var i11 = 1 == o11 ? 2 : 1, a11 = 0, s11 = 0, c10 = 0; a11 <= r11.length; a11++) + for (var l10, u10, f10, d10 = a11 ? r11[a11 - 1].to : t11, h10 = a11 < r11.length ? r11[a11].from : n11, v10 = d10; v10 < h10; v10++) + if (u10 = lW[l10 = e21.charCodeAt(v10)]) + if (u10 < 0) { + for (var p10 = s11 - 3; p10 >= 0; p10 -= 3) + if (uW[p10 + 1] == -u10) { + var m10 = uW[p10 + 2], g10 = 2 & m10 ? o11 : 4 & m10 ? 1 & m10 ? i11 : o11 : 0; + g10 && (kW[v10] = kW[uW[p10]] = g10), s11 = p10; + break; + } + } else { + if (189 == uW.length) + break; + uW[s11++] = v10, uW[s11++] = l10, uW[s11++] = c10; + } + else if (2 == (f10 = kW[v10]) || 1 == f10) { + var y10 = f10 == o11; + c10 = y10 ? 0 : 1; + for (var b10 = s11 - 3; b10 >= 0; b10 -= 3) { + var k10 = uW[b10 + 2]; + if (2 & k10) + break; + if (y10) + uW[b10 + 2] |= 2; + else { + if (4 & k10) + break; + uW[b10 + 2] |= 4; + } + } + } + }(e20, o10, i10, r10, s10), function(e21, t11, n11, r11) { + for (var o11 = 0, i11 = r11; o11 <= n11.length; o11++) + for (var a11 = o11 ? n11[o11 - 1].to : e21, s11 = o11 < n11.length ? n11[o11].from : t11, c10 = a11; c10 < s11; ) { + var l10 = kW[c10]; + if (256 == l10) { + for (var u10 = c10 + 1; ; ) + if (u10 == s11) { + if (o11 == n11.length) + break; + u10 = n11[o11++].to, s11 = o11 < n11.length ? n11[o11].from : t11; + } else { + if (256 != kW[u10]) + break; + u10++; + } + for (var f10 = 1 == i11, d10 = f10 == (1 == (u10 < t11 ? kW[u10] : r11)) ? f10 ? 1 : 2 : r11, h10 = u10, v10 = o11, p10 = v10 ? n11[v10 - 1].to : e21; h10 > c10; ) + h10 == p10 && (h10 = n11[--v10].from, p10 = v10 ? n11[v10 - 1].to : e21), kW[--h10] = d10; + c10 = u10; + } else + i11 = l10, c10++; + } + }(o10, i10, r10, s10), wW(e20, o10, i10, t10, n10, r10, a10); + } + function jW(e20) { + return [new yW(0, e20, 0)]; + } + var SW = ""; + function CW(e20, t10, n10, r10, o10) { + var i10, a10 = r10.head - e20.from, s10 = yW.find(t10, a10, null !== (i10 = r10.bidiLevel) && void 0 !== i10 ? i10 : -1, r10.assoc), c10 = t10[s10], l10 = c10.side(o10, n10); + if (a10 == l10) { + var u10 = s10 += o10 ? 1 : -1; + if (u10 < 0 || u10 >= t10.length) + return null; + a10 = (c10 = t10[s10 = u10]).side(!o10, n10), l10 = c10.side(o10, n10); + } + var f10 = sF(e20.text, a10, c10.forward(o10, n10)); + (f10 < c10.from || f10 > c10.to) && (f10 = l10), SW = e20.text.slice(Math.min(a10, f10), Math.max(a10, f10)); + var d10 = s10 == (o10 ? t10.length - 1 : 0) ? null : t10[s10 + (o10 ? 1 : -1)]; + return d10 && f10 == l10 && d10.level + (o10 ? 0 : 1) < c10.level ? $F.cursor(d10.side(!o10, n10) + e20.from, d10.forward(o10, n10) ? 1 : -1, d10.level) : $F.cursor(f10 + e20.from, c10.forward(o10, n10) ? -1 : 1, c10.level); + } + function $W(e20, t10, n10) { + for (var r10 = t10; r10 < n10; r10++) { + var o10 = mW(e20.charCodeAt(r10)); + if (1 == o10) + return oW; + if (2 == o10 || 4 == o10) + return iW; + } + return oW; + } + var _W = MF.define(); + var OW = MF.define(); + var MW = MF.define(); + var EW = MF.define(); + var AW = MF.define(); + var PW = MF.define(); + var TW = MF.define(); + var RW = MF.define({ combine: function(e20) { + return e20.some(function(e21) { + return e21; + }); + } }); + var NW = MF.define({ combine: function(e20) { + return e20.some(function(e21) { + return e21; + }); + } }); + var IW = function() { + function e20(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "nearest", r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "nearest", o10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 5, i10 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 5, a10 = arguments.length > 5 && void 0 !== arguments[5] && arguments[5]; + No(this, e20), this.range = t10, this.y = n10, this.x = r10, this.yMargin = o10, this.xMargin = i10, this.isSnapshot = a10; + } + return Do(e20, [{ key: "map", value: function(t10) { + return t10.empty ? this : new e20(this.range.map(t10), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot); + } }, { key: "clip", value: function(t10) { + return this.range.to <= t10.doc.length ? this : new e20($F.cursor(t10.doc.length), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot); + } }]), e20; + }(); + var DW = oV.define({ map: function(e20, t10) { + return e20.map(t10); + } }); + function qW(e20, t10, n10) { + var r10 = e20.facet(EW); + r10.length ? r10[0](t10) : window.onerror ? window.onerror(String(t10), n10, void 0, void 0, t10) : n10 ? console.error(n10 + ":", t10) : console.error(t10); + } + var zW = MF.define({ combine: function(e20) { + return !e20.length || e20[0]; + } }); + var BW = 0; + var LW = MF.define(); + var FW = function() { + function e20(t10, n10, r10, o10, i10) { + No(this, e20), this.id = t10, this.create = n10, this.domEventHandlers = r10, this.domEventObservers = o10, this.extension = i10(this); + } + return Do(e20, null, [{ key: "define", value: function(t10, n10) { + var r10 = n10 || {}, o10 = r10.eventHandlers, i10 = r10.eventObservers, a10 = r10.provide, s10 = r10.decorations; + return new e20(BW++, t10, o10, i10, function(e21) { + var t11 = [LW.of(e21)]; + return s10 && t11.push(UW.of(function(t12) { + var n11 = t12.plugin(e21); + return n11 ? s10(n11) : KH.none; + })), a10 && t11.push(a10(e21)), t11; + }); + } }, { key: "fromClass", value: function(t10, n10) { + return e20.define(function(e21) { + return new t10(e21); + }, n10); + } }]), e20; + }(); + var VW = function() { + function e20(t10) { + No(this, e20), this.spec = t10, this.mustUpdate = null, this.value = null; + } + return Do(e20, [{ key: "update", value: function(e21) { + if (this.value) { + if (this.mustUpdate) { + var t10 = this.mustUpdate; + if (this.mustUpdate = null, this.value.update) + try { + this.value.update(t10); + } catch (e23) { + if (qW(t10.state, e23, "CodeMirror plugin crashed"), this.value.destroy) + try { + this.value.destroy(); + } catch (e24) { + } + this.deactivate(); + } + } + } else if (this.spec) + try { + this.value = this.spec.create(e21); + } catch (t11) { + qW(e21.state, t11, "CodeMirror plugin crashed"), this.deactivate(); + } + return this; + } }, { key: "destroy", value: function(e21) { + var t10; + if (null === (t10 = this.value) || void 0 === t10 ? void 0 : t10.destroy) + try { + this.value.destroy(); + } catch (t11) { + qW(e21.state, t11, "CodeMirror plugin crashed"); + } + } }, { key: "deactivate", value: function() { + this.spec = this.value = null; + } }]), e20; + }(); + var HW = MF.define(); + var WW = MF.define(); + var UW = MF.define(); + var JW = MF.define(); + var KW = MF.define(); + var GW = MF.define(); + function QW(e20, t10) { + var n10 = e20.state.facet(GW); + if (!n10.length) + return n10; + var r10 = n10.map(function(t11) { + return t11 instanceof Function ? t11(e20) : t11; + }), o10 = []; + return xV.spans(r10, t10.from, t10.to, { point: function() { + }, span: function(e21, n11, r11, i10) { + for (var a10 = e21 - t10.from, s10 = n11 - t10.from, c10 = o10, l10 = r11.length - 1; l10 >= 0; l10--, i10--) { + var u10 = r11[l10].spec.bidiIsolate, f10 = void 0; + if (null == u10 && (u10 = $W(t10.text, a10, s10)), i10 > 0 && c10.length && (f10 = c10[c10.length - 1]).to == a10 && f10.direction == u10) + f10.to = s10, c10 = f10.inner; + else { + var d10 = { from: a10, to: s10, direction: u10, inner: [] }; + c10.push(d10), c10 = d10.inner; + } + } + } }), o10; + } + var YW = MF.define(); + function XW(e20) { + var t10, n10 = 0, r10 = 0, o10 = 0, i10 = 0, a10 = bo(e20.state.facet(YW)); + try { + for (a10.s(); !(t10 = a10.n()).done; ) { + var s10 = (0, t10.value)(e20); + s10 && (null != s10.left && (n10 = Math.max(n10, s10.left)), null != s10.right && (r10 = Math.max(r10, s10.right)), null != s10.top && (o10 = Math.max(o10, s10.top)), null != s10.bottom && (i10 = Math.max(i10, s10.bottom))); + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + return { left: n10, right: r10, top: o10, bottom: i10 }; + } + var ZW = MF.define(); + var eU = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.fromA = t10, this.toA = n10, this.fromB = r10, this.toB = o10; + } + return Do(e20, [{ key: "join", value: function(t10) { + return new e20(Math.min(this.fromA, t10.fromA), Math.max(this.toA, t10.toA), Math.min(this.fromB, t10.fromB), Math.max(this.toB, t10.toB)); + } }, { key: "addToSet", value: function(e21) { + for (var t10 = e21.length, n10 = this; t10 > 0; t10--) { + var r10 = e21[t10 - 1]; + if (!(r10.fromA > n10.toA)) { + if (r10.toA < n10.fromA) + break; + n10 = n10.join(r10), e21.splice(t10 - 1, 1); + } + } + return e21.splice(t10, 0, n10), e21; + } }], [{ key: "extendWithRanges", value: function(t10, n10) { + if (0 == n10.length) + return t10; + for (var r10 = [], o10 = 0, i10 = 0, a10 = 0, s10 = 0; ; o10++) { + for (var c10 = o10 == t10.length ? null : t10[o10], l10 = a10 - s10, u10 = c10 ? c10.fromB : 1e9; i10 < n10.length && n10[i10] < u10; ) { + var f10 = n10[i10], d10 = n10[i10 + 1], h10 = Math.max(s10, f10), v10 = Math.min(u10, d10); + if (h10 <= v10 && new e20(h10 + l10, v10 + l10, h10, v10).addToSet(r10), d10 > u10) + break; + i10 += 2; + } + if (!c10) + return r10; + new e20(c10.fromA, c10.toA, c10.fromB, c10.toB).addToSet(r10), a10 = c10.toA, s10 = c10.toB; + } + } }]), e20; + }(); + var tU = function() { + function e20(t10, n10, r10) { + No(this, e20), this.view = t10, this.state = n10, this.transactions = r10, this.flags = 0, this.startState = t10.state, this.changes = yF.empty(this.startState.doc.length); + var o10, i10 = bo(r10); + try { + for (i10.s(); !(o10 = i10.n()).done; ) { + var a10 = o10.value; + this.changes = this.changes.compose(a10.changes); + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + var s10 = []; + this.changes.iterChangedRanges(function(e21, t11, n11, r11) { + return s10.push(new eU(e21, t11, n11, r11)); + }), this.changedRanges = s10; + } + return Do(e20, [{ key: "viewportChanged", get: function() { + return (4 & this.flags) > 0; + } }, { key: "heightChanged", get: function() { + return (2 & this.flags) > 0; + } }, { key: "geometryChanged", get: function() { + return this.docChanged || (10 & this.flags) > 0; + } }, { key: "focusChanged", get: function() { + return (1 & this.flags) > 0; + } }, { key: "docChanged", get: function() { + return !this.changes.empty; + } }, { key: "selectionSet", get: function() { + return this.transactions.some(function(e21) { + return e21.selection; + }); + } }, { key: "empty", get: function() { + return 0 == this.flags && 0 == this.transactions.length; + } }], [{ key: "create", value: function(t10, n10, r10) { + return new e20(t10, n10, r10); + } }]), e20; + }(); + var nU = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).view = e21, n10.decorations = [], n10.dynamicDecorationMap = [], n10.domChanged = null, n10.hasComposition = null, n10.markedForComposition = /* @__PURE__ */ new Set(), n10.minWidth = 0, n10.minWidthFrom = 0, n10.minWidthTo = 0, n10.impreciseAnchor = null, n10.impreciseHead = null, n10.forceSelection = false, n10.lastUpdate = Date.now(), n10.setDOM(e21.contentDOM), n10.children = [new HH()], n10.children[0].setParent(Eo(n10)), n10.updateDeco(), n10.updateInner([new eU(0, 0, 0, e21.state.doc.length)], 0, null), n10; + } + return Ao(t10, pH), Do(t10, [{ key: "length", get: function() { + return this.view.state.doc.length; + } }, { key: "update", value: function(e21) { + var t11, n10 = this, r10 = e21.changedRanges; + this.minWidth > 0 && r10.length && (r10.every(function(e23) { + var t12 = e23.fromA; + return e23.toA < n10.minWidthFrom || t12 > n10.minWidthTo; + }) ? (this.minWidthFrom = e21.changes.mapPos(this.minWidthFrom, 1), this.minWidthTo = e21.changes.mapPos(this.minWidthTo, 1)) : this.minWidth = this.minWidthFrom = this.minWidthTo = 0); + var o10 = -1; + this.view.inputState.composing >= 0 && ((null === (t11 = this.domChanged) || void 0 === t11 ? void 0 : t11.newSel) ? o10 = this.domChanged.newSel.head : function(e23, t12) { + var n11 = false; + t12 && e23.iterChangedRanges(function(e24, r11) { + e24 < t12.to && r11 > t12.from && (n11 = true); + }); + return n11; + }(e21.changes, this.hasComposition) || e21.selectionSet || (o10 = e21.state.selection.main.head)); + var i10 = o10 > -1 ? function(e23, t12, n11) { + var r11 = oU(e23, n11); + if (!r11) + return null; + var o11 = r11.node, i11 = r11.from, a11 = r11.to, s11 = o11.nodeValue; + if (/[\n\r]/.test(s11)) + return null; + if (e23.state.doc.sliceString(r11.from, r11.to) != s11) + return null; + for (var c11 = t12.invertedDesc, l11 = new eU(c11.mapPos(i11), c11.mapPos(a11), i11, a11), u11 = [], f11 = o11.parentNode; ; f11 = f11.parentNode) { + var d11 = pH.get(f11); + if (d11 instanceof TH) + u11.push({ node: f11, deco: d11.mark }); + else { + if (d11 instanceof HH || "DIV" == f11.nodeName && f11.parentNode == e23.contentDOM) + return { range: l11, text: o11, marks: u11, line: f11 }; + if (f11 == e23.contentDOM) + return null; + u11.push({ node: f11, deco: new GH({ inclusive: true, attributes: VH(f11), tagName: f11.tagName.toLowerCase() }) }); + } + } + }(this.view, e21.changes, o10) : null; + if (this.domChanged = null, this.hasComposition) { + this.markedForComposition.clear(); + var a10 = this.hasComposition, s10 = a10.from, c10 = a10.to; + r10 = new eU(s10, c10, e21.changes.mapPos(s10, -1), e21.changes.mapPos(c10, 1)).addToSet(r10.slice()); + } + this.hasComposition = i10 ? { from: i10.range.fromB, to: i10.range.toB } : null, (AH.ie || AH.chrome) && !i10 && e21 && e21.state.doc.lines != e21.startState.doc.lines && (this.forceSelection = true); + var l10, u10, f10, d10, h10 = this.decorations, v10 = this.updateDeco(), p10 = (l10 = h10, u10 = v10, f10 = e21.changes, d10 = new aU(), xV.compare(l10, u10, f10, d10), d10.changes); + return r10 = eU.extendWithRanges(r10, p10), !!(7 & this.flags || 0 != r10.length) && (this.updateInner(r10, e21.startState.doc.length, i10), e21.transactions.length && (this.lastUpdate = Date.now()), true); + } }, { key: "updateInner", value: function(e21, t11, n10) { + var r10 = this; + this.view.viewState.mustMeasureContent = true, this.updateChildren(e21, t11, n10); + var o10 = this.view.observer; + o10.ignore(function() { + r10.dom.style.height = r10.view.viewState.contentHeight / r10.view.scaleY + "px", r10.dom.style.flexBasis = r10.minWidth ? r10.minWidth + "px" : ""; + var e23 = AH.chrome || AH.ios ? { node: o10.selectionRange.focusNode, written: false } : void 0; + r10.sync(r10.view, e23), r10.flags &= -8, e23 && (e23.written || o10.selectionRange.focusNode != e23.node) && (r10.forceSelection = true), r10.dom.style.height = ""; + }), this.markedForComposition.forEach(function(e23) { + return e23.flags &= -9; + }); + var i10 = []; + if (this.view.viewport.from || this.view.viewport.to < this.view.state.doc.length) { + var a10, s10 = bo(this.children); + try { + for (s10.s(); !(a10 = s10.n()).done; ) { + var c10 = a10.value; + c10 instanceof WH && c10.widget instanceof rU && i10.push(c10.dom); + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + } + o10.updateGaps(i10); + } }, { key: "updateChildren", value: function(e21, t11, n10) { + for (var r10 = n10 ? n10.range.addToSet(e21.slice()) : e21, o10 = this.childCursor(t11), i10 = r10.length - 1; ; i10--) { + var a10 = i10 >= 0 ? r10[i10] : null; + if (!a10) + break; + var s10 = a10.fromA, c10 = a10.toA, l10 = a10.fromB, u10 = a10.toB, f10 = void 0, d10 = void 0, h10 = void 0, v10 = void 0; + if (n10 && n10.range.fromB < u10 && n10.range.toB > l10) { + var p10 = eW.build(this.view.state.doc, l10, n10.range.fromB, this.decorations, this.dynamicDecorationMap), m10 = eW.build(this.view.state.doc, n10.range.toB, u10, this.decorations, this.dynamicDecorationMap); + d10 = p10.breakAtStart, h10 = p10.openStart, v10 = m10.openEnd; + var g10 = this.compositionView(n10); + m10.breakAtStart ? g10.breakAfter = 1 : m10.content.length && g10.merge(g10.length, g10.length, m10.content[0], false, m10.openStart, 0) && (g10.breakAfter = m10.content[0].breakAfter, m10.content.shift()), p10.content.length && g10.merge(0, 0, p10.content[p10.content.length - 1], true, 0, p10.openEnd) && p10.content.pop(), f10 = p10.content.concat(g10).concat(m10.content); + } else { + var y10 = eW.build(this.view.state.doc, l10, u10, this.decorations, this.dynamicDecorationMap); + f10 = y10.content, d10 = y10.breakAtStart, h10 = y10.openStart, v10 = y10.openEnd; + } + var b10 = o10.findPos(c10, 1), k10 = b10.i, w10 = b10.off, x10 = o10.findPos(s10, -1); + yH(this, x10.i, x10.off, k10, w10, f10, d10, h10, v10); + } + n10 && this.fixCompositionDOM(n10); + } }, { key: "compositionView", value: function(e21) { + var t11 = new PH(e21.text.nodeValue); + t11.flags |= 8; + var n10, r10 = bo(e21.marks); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value.deco; + t11 = new TH(o10, [t11], t11.length); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + var i10 = new HH(); + return i10.append(t11, 0), i10; + } }, { key: "fixCompositionDOM", value: function(e21) { + var t11 = this, n10 = function(e23, n11) { + n11.flags |= 8 | (n11.children.some(function(e24) { + return 7 & e24.flags; + }) ? 1 : 0), t11.markedForComposition.add(n11); + var r11 = pH.get(e23); + r11 && r11 != n11 && (r11.dom = null), n11.setDOM(e23); + }, r10 = this.childPos(e21.range.fromB, 1), o10 = this.children[r10.i]; + n10(e21.line, o10); + for (var i10 = e21.marks.length - 1; i10 >= -1; i10--) + r10 = o10.childPos(r10.off, 1), o10 = o10.children[r10.i], n10(i10 >= 0 ? e21.marks[i10].node : e21.text, o10); + } }, { key: "updateSelection", value: function() { + var e21 = this, t11 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + !(arguments.length > 0 && void 0 !== arguments[0] && arguments[0]) && this.view.observer.selectionRange.focusNode || this.view.observer.readSelectionRange(); + var n10 = this.view.root.activeElement, r10 = n10 == this.dom, o10 = !r10 && QV(this.dom, this.view.observer.selectionRange) && !(n10 && this.dom.contains(n10)); + if (r10 || t11 || o10) { + var i10 = this.forceSelection; + this.forceSelection = false; + var a10, s10 = this.view.state.selection.main, c10 = this.moveToLine(this.domAtPos(s10.anchor)), l10 = s10.empty ? c10 : this.moveToLine(this.domAtPos(s10.head)); + if (AH.gecko && s10.empty && !this.hasComposition && (1 == (a10 = c10).node.nodeType && a10.node.firstChild && (0 == a10.offset || "false" == a10.node.childNodes[a10.offset - 1].contentEditable) && (a10.offset == a10.node.childNodes.length || "false" == a10.node.childNodes[a10.offset].contentEditable))) { + var u10 = document.createTextNode(""); + this.view.observer.ignore(function() { + return c10.node.insertBefore(u10, c10.node.childNodes[c10.offset] || null); + }), c10 = l10 = new hH(u10, 0), i10 = true; + } + var f10 = this.view.observer.selectionRange; + !i10 && f10.focusNode && (XV(c10.node, c10.offset, f10.anchorNode, f10.anchorOffset) && XV(l10.node, l10.offset, f10.focusNode, f10.focusOffset) || this.suppressWidgetCursorChange(f10, s10)) || (this.view.observer.ignore(function() { + AH.android && AH.chrome && e21.dom.contains(f10.focusNode) && function(e23, t13) { + for (var n11 = e23; n11 && n11 != t13; n11 = n11.assignedSlot || n11.parentNode) + if (1 == n11.nodeType && "false" == n11.contentEditable) + return true; + return false; + }(f10.focusNode, e21.dom) && (e21.dom.blur(), e21.dom.focus({ preventScroll: true })); + var t12 = KV(e21.view.root); + if (t12) + if (s10.empty) { + if (AH.gecko) { + var r11 = function(e23, t13) { + return 1 != e23.nodeType ? 0 : (t13 && "false" == e23.childNodes[t13 - 1].contentEditable ? 1 : 0) | (t13 < e23.childNodes.length && "false" == e23.childNodes[t13].contentEditable ? 2 : 0); + }(c10.node, c10.offset); + if (r11 && 3 != r11) { + var i11 = iU(c10.node, c10.offset, 1 == r11 ? 1 : -1); + i11 && (c10 = new hH(i11.node, i11.offset)); + } + } + t12.collapse(c10.node, c10.offset), null != s10.bidiLevel && void 0 !== t12.caretBidiLevel && (t12.caretBidiLevel = s10.bidiLevel); + } else if (t12.extend) { + t12.collapse(c10.node, c10.offset); + try { + t12.extend(l10.node, l10.offset); + } catch (e23) { + } + } else { + var a11 = document.createRange(); + if (s10.anchor > s10.head) { + var u11 = [l10, c10]; + c10 = u11[0], l10 = u11[1]; + } + a11.setEnd(l10.node, l10.offset), a11.setStart(c10.node, c10.offset), t12.removeAllRanges(), t12.addRange(a11); + } + else + ; + o10 && e21.view.root.activeElement == e21.dom && (e21.dom.blur(), n10 && n10.focus()); + }), this.view.observer.setSelectionRange(c10, l10)), this.impreciseAnchor = c10.precise ? null : new hH(f10.anchorNode, f10.anchorOffset), this.impreciseHead = l10.precise ? null : new hH(f10.focusNode, f10.focusOffset); + } + } }, { key: "suppressWidgetCursorChange", value: function(e21, t11) { + return this.hasComposition && t11.empty && XV(e21.focusNode, e21.focusOffset, e21.anchorNode, e21.anchorOffset) && this.posFromDOM(e21.focusNode, e21.focusOffset) == t11.head; + } }, { key: "enforceCursorAssoc", value: function() { + if (!this.hasComposition) { + var e21 = this.view, t11 = e21.state.selection.main, n10 = KV(e21.root), r10 = e21.observer.selectionRange, o10 = r10.anchorNode, i10 = r10.anchorOffset; + if (n10 && t11.empty && t11.assoc && n10.modify) { + var a10 = HH.find(this, t11.head); + if (a10) { + var s10 = a10.posAtStart; + if (t11.head != s10 && t11.head != s10 + a10.length) { + var c10 = this.coordsAt(t11.head, -1), l10 = this.coordsAt(t11.head, 1); + if (c10 && l10 && !(c10.bottom > l10.top)) { + var u10 = this.domAtPos(t11.head + t11.assoc); + n10.collapse(u10.node, u10.offset), n10.modify("move", t11.assoc < 0 ? "forward" : "backward", "lineboundary"), e21.observer.readSelectionRange(); + var f10 = e21.observer.selectionRange; + e21.docView.posFromDOM(f10.anchorNode, f10.anchorOffset) != t11.from && n10.collapse(o10, i10); + } + } + } + } + } + } }, { key: "moveToLine", value: function(e21) { + var t11, n10 = this.dom; + if (e21.node != n10) + return e21; + for (var r10 = e21.offset; !t11 && r10 < n10.childNodes.length; r10++) { + var o10 = pH.get(n10.childNodes[r10]); + o10 instanceof HH && (t11 = o10.domAtPos(0)); + } + for (var i10 = e21.offset - 1; !t11 && i10 >= 0; i10--) { + var a10 = pH.get(n10.childNodes[i10]); + a10 instanceof HH && (t11 = a10.domAtPos(a10.length)); + } + return t11 ? new hH(t11.node, t11.offset, true) : e21; + } }, { key: "nearest", value: function(e21) { + for (var t11 = e21; t11; ) { + var n10 = pH.get(t11); + if (n10 && n10.rootView == this) + return n10; + t11 = t11.parentNode; + } + return null; + } }, { key: "posFromDOM", value: function(e21, t11) { + var n10 = this.nearest(e21); + if (!n10) + throw new RangeError("Trying to find position for a DOM position outside of the document"); + return n10.localPosFromDOM(e21, t11) + n10.posAtStart; + } }, { key: "domAtPos", value: function(e21) { + for (var t11 = this.childCursor().findPos(e21, -1), n10 = t11.i, r10 = t11.off; n10 < this.children.length - 1; ) { + var o10 = this.children[n10]; + if (r10 < o10.length || o10 instanceof HH) + break; + n10++, r10 = 0; + } + return this.children[n10].domAtPos(r10); + } }, { key: "coordsAt", value: function(e21, t11) { + for (var n10 = null, r10 = 0, o10 = this.length, i10 = this.children.length - 1; i10 >= 0; i10--) { + var a10 = this.children[i10], s10 = o10 - a10.breakAfter, c10 = s10 - a10.length; + if (s10 < e21) + break; + c10 <= e21 && (c10 < e21 || a10.covers(-1)) && (s10 > e21 || a10.covers(1)) && (!n10 || a10 instanceof HH && !(n10 instanceof HH && t11 >= 0)) && (n10 = a10, r10 = c10), o10 = c10; + } + return n10 ? n10.coordsAt(e21 - r10, t11) : null; + } }, { key: "coordsForChar", value: function(e21) { + var t11 = this.childPos(e21, 1), n10 = t11.i, r10 = t11.off, o10 = this.children[n10]; + if (!(o10 instanceof HH)) + return null; + for (; o10.children.length; ) { + for (var i10 = o10.childPos(r10, 1), a10 = i10.i, s10 = i10.off; ; a10++) { + if (a10 == o10.children.length) + return null; + if ((o10 = o10.children[a10]).length) + break; + } + r10 = s10; + } + if (!(o10 instanceof PH)) + return null; + var c10 = sF(o10.text, r10); + if (c10 == r10) + return null; + for (var l10 = lH(o10.dom, r10, c10).getClientRects(), u10 = 0; u10 < l10.length; u10++) { + var f10 = l10[u10]; + if (u10 == l10.length - 1 || f10.top < f10.bottom && f10.left < f10.right) + return f10; + } + return null; + } }, { key: "measureVisibleLineHeights", value: function(e21) { + for (var t11 = [], n10 = e21.from, r10 = e21.to, o10 = this.view.contentDOM.clientWidth, i10 = o10 > Math.max(this.view.scrollDOM.clientWidth, this.minWidth) + 1, a10 = -1, s10 = this.view.textDirection == rW.LTR, c10 = 0, l10 = 0; l10 < this.children.length; l10++) { + var u10 = this.children[l10], f10 = c10 + u10.length; + if (f10 > r10) + break; + if (c10 >= n10) { + var d10 = u10.dom.getBoundingClientRect(); + if (t11.push(d10.height), i10) { + var h10 = u10.dom.lastChild, v10 = h10 ? YV(h10) : []; + if (v10.length) { + var p10 = v10[v10.length - 1], m10 = s10 ? p10.right - d10.left : d10.right - p10.left; + m10 > a10 && (a10 = m10, this.minWidth = o10, this.minWidthFrom = c10, this.minWidthTo = f10); + } + } + } + c10 = f10 + u10.breakAfter; + } + return t11; + } }, { key: "textDirectionAt", value: function(e21) { + var t11 = this.childPos(e21, 1).i; + return "rtl" == getComputedStyle(this.children[t11].dom).direction ? rW.RTL : rW.LTR; + } }, { key: "measureTextSize", value: function() { + var e21, t11 = this, n10 = bo(this.children); + try { + for (n10.s(); !(e21 = n10.n()).done; ) { + var r10 = e21.value; + if (r10 instanceof HH) { + var o10 = r10.measureTextSize(); + if (o10) + return o10; + } + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + var i10, a10, s10, c10 = document.createElement("div"); + return c10.className = "cm-line", c10.style.width = "99999px", c10.style.position = "absolute", c10.textContent = "abc def ghi jkl mno pqr stu", this.view.observer.ignore(function() { + t11.dom.appendChild(c10); + var e23 = YV(c10.firstChild)[0]; + i10 = c10.getBoundingClientRect().height, a10 = e23 ? e23.width / 27 : 7, s10 = e23 ? e23.height : i10, c10.remove(); + }), { lineHeight: i10, charWidth: a10, textHeight: s10 }; + } }, { key: "childCursor", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.length, t11 = this.children.length; + return t11 && (e21 -= this.children[--t11].length), new gH(this.children, e21, t11); + } }, { key: "computeBlockGapDeco", value: function() { + for (var e21 = [], t11 = this.view.viewState, n10 = 0, r10 = 0; ; r10++) { + var o10 = r10 == t11.viewports.length ? null : t11.viewports[r10], i10 = o10 ? o10.from - 1 : this.length; + if (i10 > n10) { + var a10 = (t11.lineBlockAt(i10).bottom - t11.lineBlockAt(n10).top) / this.view.scaleY; + e21.push(KH.replace({ widget: new rU(a10), block: true, inclusive: true, isBlockGap: true }).range(n10, i10)); + } + if (!o10) + break; + n10 = o10.to + 1; + } + return KH.set(e21); + } }, { key: "updateDeco", value: function() { + var e21 = this, t11 = this.view.state.facet(UW).map(function(t12, n11) { + return (e21.dynamicDecorationMap[n11] = "function" == typeof t12) ? t12(e21.view) : t12; + }), n10 = false, r10 = this.view.state.facet(JW).map(function(t12, r11) { + var o11 = "function" == typeof t12; + return o11 && (n10 = true), o11 ? t12(e21.view) : t12; + }); + r10.length && (this.dynamicDecorationMap[t11.length] = n10, t11.push(xV.join(r10))); + for (var o10 = t11.length; o10 < t11.length + 3; o10++) + this.dynamicDecorationMap[o10] = false; + return this.decorations = [].concat(Bo(t11), [this.computeBlockGapDeco(), this.view.viewState.lineGapDeco]); + } }, { key: "scrollIntoView", value: function(e21) { + if (e21.isSnapshot) { + var t11 = this.view.viewState.lineBlockAt(e21.range.head); + return this.view.scrollDOM.scrollTop = t11.top - e21.yMargin, void (this.view.scrollDOM.scrollLeft = e21.xMargin); + } + var n10, r10 = e21.range, o10 = this.coordsAt(r10.head, r10.empty ? r10.assoc : r10.head > r10.anchor ? -1 : 1); + if (o10) { + !r10.empty && (n10 = this.coordsAt(r10.anchor, r10.anchor > r10.head ? -1 : 1)) && (o10 = { left: Math.min(o10.left, n10.left), top: Math.min(o10.top, n10.top), right: Math.max(o10.right, n10.right), bottom: Math.max(o10.bottom, n10.bottom) }); + var i10 = XW(this.view), a10 = { left: o10.left - i10.left, top: o10.top - i10.top, right: o10.right + i10.right, bottom: o10.bottom + i10.bottom }, s10 = this.view.scrollDOM, c10 = s10.offsetWidth, l10 = s10.offsetHeight; + !function(e23, t12, n11, r11, o11, i11, a11, s11) { + for (var c11 = e23.ownerDocument, l11 = c11.defaultView || window, u10 = e23, f10 = false; u10 && !f10; ) + if (1 == u10.nodeType) { + var d10 = void 0, h10 = u10 == c11.body, v10 = 1, p10 = 1; + if (h10) + d10 = rH(l11); + else { + if (/^(fixed|sticky)$/.test(getComputedStyle(u10).position) && (f10 = true), u10.scrollHeight <= u10.clientHeight && u10.scrollWidth <= u10.clientWidth) { + u10 = u10.assignedSlot || u10.parentNode; + continue; + } + var m10 = u10.getBoundingClientRect(), g10 = oH(u10, m10); + v10 = g10.scaleX, p10 = g10.scaleY, d10 = { left: m10.left, right: m10.left + u10.clientWidth * v10, top: m10.top, bottom: m10.top + u10.clientHeight * p10 }; + } + var y10 = 0, b10 = 0; + if ("nearest" == o11) + t12.top < d10.top ? (b10 = -(d10.top - t12.top + a11), n11 > 0 && t12.bottom > d10.bottom + b10 && (b10 = t12.bottom - d10.bottom + b10 + a11)) : t12.bottom > d10.bottom && (b10 = t12.bottom - d10.bottom + a11, n11 < 0 && t12.top - b10 < d10.top && (b10 = -(d10.top + b10 - t12.top + a11))); + else { + var k10 = t12.bottom - t12.top, w10 = d10.bottom - d10.top; + b10 = ("center" == o11 && k10 <= w10 ? t12.top + k10 / 2 - w10 / 2 : "start" == o11 || "center" == o11 && n11 < 0 ? t12.top - a11 : t12.bottom - w10 + a11) - d10.top; + } + if ("nearest" == r11 ? t12.left < d10.left ? (y10 = -(d10.left - t12.left + i11), n11 > 0 && t12.right > d10.right + y10 && (y10 = t12.right - d10.right + y10 + i11)) : t12.right > d10.right && (y10 = t12.right - d10.right + i11, n11 < 0 && t12.left < d10.left + y10 && (y10 = -(d10.left + y10 - t12.left + i11))) : y10 = ("center" == r11 ? t12.left + (t12.right - t12.left) / 2 - (d10.right - d10.left) / 2 : "start" == r11 == s11 ? t12.left - i11 : t12.right - (d10.right - d10.left) + i11) - d10.left, y10 || b10) + if (h10) + l11.scrollBy(y10, b10); + else { + var x10 = 0, j10 = 0; + if (b10) { + var S10 = u10.scrollTop; + u10.scrollTop += b10 / p10, j10 = (u10.scrollTop - S10) * p10; + } + if (y10) { + var C10 = u10.scrollLeft; + u10.scrollLeft += y10 / v10, x10 = (u10.scrollLeft - C10) * v10; + } + t12 = { left: t12.left - x10, top: t12.top - j10, right: t12.right - x10, bottom: t12.bottom - j10 }, x10 && Math.abs(x10 - y10) < 1 && (r11 = "nearest"), j10 && Math.abs(j10 - b10) < 1 && (o11 = "nearest"); + } + if (h10) + break; + u10 = u10.assignedSlot || u10.parentNode; + } else { + if (11 != u10.nodeType) + break; + u10 = u10.host; + } + }(this.view.scrollDOM, a10, r10.head < r10.anchor ? -1 : 1, e21.x, e21.y, Math.max(Math.min(e21.xMargin, c10), -c10), Math.max(Math.min(e21.yMargin, l10), -l10), this.view.textDirection == rW.LTR); + } + } }]), t10; + }(); + var rU = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).height = e21, n10; + } + return Ao(t10, UH), Do(t10, [{ key: "toDOM", value: function() { + var e21 = document.createElement("div"); + return e21.className = "cm-gap", this.updateDOM(e21), e21; + } }, { key: "eq", value: function(e21) { + return e21.height == this.height; + } }, { key: "updateDOM", value: function(e21) { + return e21.style.height = this.height + "px", true; + } }, { key: "editable", get: function() { + return true; + } }, { key: "estimatedHeight", get: function() { + return this.height; + } }]), t10; + }(); + function oU(e20, t10) { + var n10 = e20.observer.selectionRange, r10 = n10.focusNode && iU(n10.focusNode, n10.focusOffset, 0); + if (!r10) + return null; + var o10 = t10 - r10.offset; + return { from: o10, to: o10 + r10.node.nodeValue.length, node: r10.node }; + } + function iU(e20, t10, n10) { + if (n10 <= 0) + for (var r10 = e20, o10 = t10; ; ) { + if (3 == r10.nodeType) + return { node: r10, offset: o10 }; + if (!(1 == r10.nodeType && o10 > 0)) + break; + o10 = tH(r10 = r10.childNodes[o10 - 1]); + } + if (n10 >= 0) + for (var i10 = e20, a10 = t10; ; ) { + if (3 == i10.nodeType) + return { node: i10, offset: a10 }; + if (!(1 == i10.nodeType && a10 < i10.childNodes.length && n10 >= 0)) + break; + i10 = i10.childNodes[a10], a10 = 0; + } + return null; + } + var aU = function() { + function e20() { + No(this, e20), this.changes = []; + } + return Do(e20, [{ key: "compareRange", value: function(e21, t10) { + ZH(e21, t10, this.changes); + } }, { key: "comparePoint", value: function(e21, t10) { + ZH(e21, t10, this.changes); + } }]), e20; + }(); + function sU(e20, t10) { + return t10.left > e20 ? t10.left - e20 : Math.max(0, e20 - t10.right); + } + function cU(e20, t10) { + return t10.top > e20 ? t10.top - e20 : Math.max(0, e20 - t10.bottom); + } + function lU(e20, t10) { + return e20.top < t10.bottom - 1 && e20.bottom > t10.top + 1; + } + function uU(e20, t10) { + return t10 < e20.top ? { top: t10, left: e20.left, right: e20.right, bottom: e20.bottom } : e20; + } + function fU(e20, t10) { + return t10 > e20.bottom ? { top: e20.top, left: e20.left, right: e20.right, bottom: t10 } : e20; + } + function dU(e20, t10, n10) { + for (var r10, o10, i10, a10, s10, c10, l10, u10, f10 = false, d10 = e20.firstChild; d10; d10 = d10.nextSibling) + for (var h10 = YV(d10), v10 = 0; v10 < h10.length; v10++) { + var p10 = h10[v10]; + o10 && lU(o10, p10) && (p10 = uU(fU(p10, o10.bottom), o10.top)); + var m10 = sU(t10, p10), g10 = cU(n10, p10); + if (0 == m10 && 0 == g10) + return 3 == d10.nodeType ? hU(d10, t10, n10) : dU(d10, t10, n10); + if (!r10 || a10 > g10 || a10 == g10 && i10 > m10) { + r10 = d10, o10 = p10, i10 = m10, a10 = g10; + var y10 = g10 ? n10 < p10.top ? -1 : 1 : m10 ? t10 < p10.left ? -1 : 1 : 0; + f10 = !y10 || (y10 > 0 ? v10 < h10.length - 1 : v10 > 0); + } + 0 == m10 ? n10 > p10.bottom && (!l10 || l10.bottom < p10.bottom) ? (s10 = d10, l10 = p10) : n10 < p10.top && (!u10 || u10.top > p10.top) && (c10 = d10, u10 = p10) : l10 && lU(l10, p10) ? l10 = fU(l10, p10.bottom) : u10 && lU(u10, p10) && (u10 = uU(u10, p10.top)); + } + if (l10 && l10.bottom >= n10 ? (r10 = s10, o10 = l10) : u10 && u10.top <= n10 && (r10 = c10, o10 = u10), !r10) + return { node: e20, offset: 0 }; + var b10 = Math.max(o10.left, Math.min(o10.right, t10)); + return 3 == r10.nodeType ? hU(r10, b10, n10) : f10 && "false" != r10.contentEditable ? dU(r10, b10, n10) : { node: e20, offset: Array.prototype.indexOf.call(e20.childNodes, r10) + (t10 >= (o10.left + o10.right) / 2 ? 1 : 0) }; + } + function hU(e20, t10, n10) { + for (var r10 = e20.nodeValue.length, o10 = -1, i10 = 1e9, a10 = 0, s10 = 0; s10 < r10; s10++) + for (var c10 = lH(e20, s10, s10 + 1).getClientRects(), l10 = 0; l10 < c10.length; l10++) { + var u10 = c10[l10]; + if (u10.top != u10.bottom) { + a10 || (a10 = t10 - u10.left); + var f10 = (u10.top > n10 ? u10.top - n10 : n10 - u10.bottom) - 1; + if (u10.left - 1 <= t10 && u10.right + 1 >= t10 && f10 < i10) { + var d10 = t10 >= (u10.left + u10.right) / 2, h10 = d10; + if (AH.chrome || AH.gecko) + lH(e20, s10).getBoundingClientRect().left == u10.right && (h10 = !d10); + if (f10 <= 0) + return { node: e20, offset: s10 + (h10 ? 1 : 0) }; + o10 = s10 + (h10 ? 1 : 0), i10 = f10; + } + } + } + return { node: e20, offset: o10 > -1 ? o10 : a10 > 0 ? e20.nodeValue.length : 0 }; + } + function vU(e20, t10, n10) { + var r10, o10, i10, a10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : -1, s10 = e20.contentDOM.getBoundingClientRect(), c10 = s10.top + e20.viewState.paddingTop, l10 = e20.viewState.docHeight, u10 = t10.x, f10 = t10.y, d10 = f10 - c10; + if (d10 < 0) + return 0; + if (d10 > l10) + return e20.state.doc.length; + for (var h10 = e20.viewState.heightOracle.textHeight / 2, v10 = false; (i10 = e20.elementAtHeight(d10)).type != JH.Text; ) + for (; !((d10 = a10 > 0 ? i10.bottom + h10 : i10.top - h10) >= 0 && d10 <= l10); ) { + if (v10) + return n10 ? null : 0; + v10 = true, a10 = -a10; + } + f10 = c10 + d10; + var p10 = i10.from; + if (p10 < e20.viewport.from) + return 0 == e20.viewport.from ? 0 : n10 ? null : pU(e20, s10, i10, u10, f10); + if (p10 > e20.viewport.to) + return e20.viewport.to == e20.state.doc.length ? e20.state.doc.length : n10 ? null : pU(e20, s10, i10, u10, f10); + var m10 = e20.dom.ownerDocument, g10 = e20.root.elementFromPoint ? e20.root : m10, y10 = g10.elementFromPoint(u10, f10); + y10 && !e20.contentDOM.contains(y10) && (y10 = null), y10 || (u10 = Math.max(s10.left + 1, Math.min(s10.right - 1, u10)), (y10 = g10.elementFromPoint(u10, f10)) && !e20.contentDOM.contains(y10) && (y10 = null)); + var b10, k10 = -1; + if (y10 && 0 != (null === (r10 = e20.docView.nearest(y10)) || void 0 === r10 ? void 0 : r10.isEditable)) { + if (m10.caretPositionFromPoint) { + var w10 = m10.caretPositionFromPoint(u10, f10); + w10 && (b10 = w10.offsetNode, k10 = w10.offset); + } else if (m10.caretRangeFromPoint) { + var x10 = m10.caretRangeFromPoint(u10, f10); + x10 && (b10 = x10.startContainer, k10 = x10.startOffset, (!e20.contentDOM.contains(b10) || AH.safari && function(e21, t11, n11) { + var r11; + if (3 != e21.nodeType || t11 != (r11 = e21.nodeValue.length)) + return false; + for (var o11 = e21.nextSibling; o11; o11 = o11.nextSibling) + if (1 != o11.nodeType || "BR" != o11.nodeName) + return false; + return lH(e21, r11 - 1, r11).getBoundingClientRect().left > n11; + }(b10, k10, u10) || AH.chrome && function(e21, t11, n11) { + if (0 != t11) + return false; + for (var r11 = e21; ; ) { + var o11 = r11.parentNode; + if (!o11 || 1 != o11.nodeType || o11.firstChild != r11) + return false; + if (o11.classList.contains("cm-line")) + break; + r11 = o11; + } + var i11 = 1 == e21.nodeType ? e21.getBoundingClientRect() : lH(e21, 0, Math.max(e21.nodeValue.length, 1)).getBoundingClientRect(); + return n11 - i11.left > 5; + }(b10, k10, u10)) && (b10 = void 0)); + } + } + if (!b10 || !e20.docView.dom.contains(b10)) { + var j10 = HH.find(e20.docView, p10); + if (!j10) + return d10 > i10.top + i10.height / 2 ? i10.to : i10.from; + var S10 = dU(j10.dom, u10, f10); + b10 = S10.node, k10 = S10.offset; + } + var C10 = e20.docView.nearest(b10); + if (!C10) + return null; + if (C10.isWidget && 1 == (null === (o10 = C10.dom) || void 0 === o10 ? void 0 : o10.nodeType)) { + var $10 = C10.dom.getBoundingClientRect(); + return t10.y < $10.top || t10.y <= $10.bottom && t10.x <= ($10.left + $10.right) / 2 ? C10.posAtStart : C10.posAtEnd; + } + return C10.localPosFromDOM(b10, k10) + C10.posAtStart; + } + function pU(e20, t10, n10, r10, o10) { + var i10 = Math.round((r10 - t10.left) * e20.defaultCharacterWidth); + if (e20.lineWrapping && n10.height > 1.5 * e20.defaultLineHeight) { + var a10 = e20.viewState.heightOracle.textHeight; + i10 += Math.floor((o10 - n10.top - 0.5 * (e20.defaultLineHeight - a10)) / a10) * e20.viewState.heightOracle.lineLength; + } + var s10 = e20.state.sliceDoc(n10.from, n10.to); + return n10.from + NV(s10, i10, e20.state.tabSize); + } + function mU(e20, t10) { + var n10 = e20.lineBlockAt(t10); + if (Array.isArray(n10.type)) { + var r10, o10 = bo(n10.type); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + if (i10.to > t10 || i10.to == t10 && (i10.to == n10.to || i10.type == JH.Text)) + return i10; + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + } + return n10; + } + function gU(e20, t10, n10, r10) { + for (var o10 = e20.state.doc.lineAt(t10.head), i10 = e20.bidiSpans(o10), a10 = e20.textDirectionAt(o10.from), s10 = t10, c10 = null; ; ) { + var l10 = CW(o10, i10, a10, s10, n10), u10 = SW; + if (!l10) { + if (o10.number == (n10 ? e20.state.doc.lines : 1)) + return s10; + u10 = "\n", o10 = e20.state.doc.line(o10.number + (n10 ? 1 : -1)), i10 = e20.bidiSpans(o10), l10 = e20.visualLineSide(o10, !n10); + } + if (c10) { + if (!c10(u10)) + return s10; + } else { + if (!r10) + return l10; + c10 = r10(u10); + } + s10 = l10; + } + } + function yU(e20, t10, n10) { + for (var r10, o10 = function() { + var r11, o11 = 0, i10 = bo(e20); + try { + for (i10.s(); !(r11 = i10.n()).done; ) { + r11.value.between(t10 - 1, t10 + 1, function(e21, r12, i11) { + if (t10 > e21 && t10 < r12) { + var a10 = o11 || n10 || (t10 - e21 < r12 - t10 ? -1 : 1); + t10 = a10 < 0 ? e21 : r12, o11 = a10; + } + }); + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + if (!o11) + return { v: t10 }; + }; ; ) + if (r10 = o10()) + return r10.v; + } + function bU(e20, t10, n10) { + var r10 = yU(e20.state.facet(KW).map(function(t11) { + return t11(e20); + }), n10.from, t10.head > n10.from ? -1 : 1); + return r10 == n10.from ? n10 : $F.cursor(r10, r10 < n10.from ? 1 : -1); + } + var kU = function() { + function e20(t10) { + No(this, e20), this.view = t10, this.lastKeyCode = 0, this.lastKeyTime = 0, this.lastTouchTime = 0, this.lastFocusTime = 0, this.lastScrollTop = 0, this.lastScrollLeft = 0, this.pendingIOSKey = void 0, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastEscPress = 0, this.lastContextMenu = 0, this.scrollHandlers = [], this.handlers = /* @__PURE__ */ Object.create(null), this.composing = -1, this.compositionFirstChange = null, this.compositionEndedAt = 0, this.compositionPendingKey = false, this.compositionPendingChange = false, this.mouseSelection = null, this.draggedContent = null, this.handleEvent = this.handleEvent.bind(this), this.notifiedFocused = t10.hasFocus, AH.safari && t10.contentDOM.addEventListener("input", function() { + return null; + }), AH.gecko && function(e21) { + JU.has(e21) || (JU.add(e21), e21.addEventListener("copy", function() { + }), e21.addEventListener("cut", function() { + })); + }(t10.contentDOM.ownerDocument); + } + return Do(e20, [{ key: "setSelectionOrigin", value: function(e21) { + this.lastSelectionOrigin = e21, this.lastSelectionTime = Date.now(); + } }, { key: "handleEvent", value: function(e21) { + (function(e23, t10) { + if (!t10.bubbles) + return true; + if (t10.defaultPrevented) + return false; + for (var n10, r10 = t10.target; r10 != e23.contentDOM; r10 = r10.parentNode) + if (!r10 || 11 == r10.nodeType || (n10 = pH.get(r10)) && n10.ignoreEvent(t10)) + return false; + return true; + })(this.view, e21) && !this.ignoreDuringComposition(e21) && ("keydown" == e21.type && this.keydown(e21) || this.runHandlers(e21.type, e21)); + } }, { key: "runHandlers", value: function(e21, t10) { + var n10 = this.handlers[e21]; + if (n10) { + var r10, o10 = bo(n10.observers); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + (0, r10.value)(this.view, t10); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + var i10, a10 = bo(n10.handlers); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = i10.value; + if (t10.defaultPrevented) + break; + if (s10(this.view, t10)) { + t10.preventDefault(); + break; + } + } + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + } + } }, { key: "ensureHandlers", value: function(e21) { + var t10 = xU(e21), n10 = this.handlers, r10 = this.view.contentDOM; + for (var o10 in t10) + if ("scroll" != o10) { + var i10 = !t10[o10].handlers.length, a10 = n10[o10]; + a10 && i10 != !a10.handlers.length && (r10.removeEventListener(o10, this.handleEvent), a10 = null), a10 || r10.addEventListener(o10, this.handleEvent, { passive: i10 }); + } + for (var s10 in n10) + "scroll" == s10 || t10[s10] || r10.removeEventListener(s10, this.handleEvent); + this.handlers = t10; + } }, { key: "keydown", value: function(e21) { + var t10, n10 = this; + return this.lastKeyCode = e21.keyCode, this.lastKeyTime = Date.now(), 9 == e21.keyCode && Date.now() < this.lastEscPress + 2e3 || (27 != e21.keyCode && CU.indexOf(e21.keyCode) < 0 && (this.view.inputState.lastEscPress = 0), !AH.android || !AH.chrome || e21.synthetic || 13 != e21.keyCode && 8 != e21.keyCode ? !AH.ios || e21.synthetic || e21.altKey || e21.metaKey || !((t10 = jU.find(function(t11) { + return t11.keyCode == e21.keyCode; + })) && !e21.ctrlKey || SU.indexOf(e21.key) > -1 && e21.ctrlKey && !e21.shiftKey) ? (229 != e21.keyCode && this.view.observer.forceFlush(), false) : (this.pendingIOSKey = t10 || e21, setTimeout(function() { + return n10.flushIOSKey(); + }, 250), true) : (this.view.observer.delayAndroidKey(e21.key, e21.keyCode), true)); + } }, { key: "flushIOSKey", value: function() { + var e21 = this.pendingIOSKey; + return !!e21 && (this.pendingIOSKey = void 0, uH(this.view.contentDOM, e21.key, e21.keyCode)); + } }, { key: "ignoreDuringComposition", value: function(e21) { + return !!/^key/.test(e21.type) && (this.composing > 0 || !!(AH.safari && !AH.ios && this.compositionPendingKey && Date.now() - this.compositionEndedAt < 100) && (this.compositionPendingKey = false, true)); + } }, { key: "startMouseSelection", value: function(e21) { + this.mouseSelection && this.mouseSelection.destroy(), this.mouseSelection = e21; + } }, { key: "update", value: function(e21) { + this.mouseSelection && this.mouseSelection.update(e21), this.draggedContent && e21.docChanged && (this.draggedContent = this.draggedContent.map(e21.changes)), e21.transactions.length && (this.lastKeyCode = this.lastSelectionTime = 0); + } }, { key: "destroy", value: function() { + this.mouseSelection && this.mouseSelection.destroy(); + } }]), e20; + }(); + function wU(e20, t10) { + return function(n10, r10) { + try { + return t10.call(e20, r10, n10); + } catch (e21) { + qW(n10.state, e21); + } + }; + } + function xU(e20) { + var t10 = /* @__PURE__ */ Object.create(null); + function n10(e21) { + return t10[e21] || (t10[e21] = { observers: [], handlers: [] }); + } + var r10, o10 = bo(e20); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value, a10 = i10.spec; + if (a10 && a10.domEventHandlers) + for (var s10 in a10.domEventHandlers) { + var c10 = a10.domEventHandlers[s10]; + c10 && n10(s10).handlers.push(wU(i10.value, c10)); + } + if (a10 && a10.domEventObservers) + for (var l10 in a10.domEventObservers) { + var u10 = a10.domEventObservers[l10]; + u10 && n10(l10).observers.push(wU(i10.value, u10)); + } + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + for (var f10 in OU) + n10(f10).handlers.push(OU[f10]); + for (var d10 in MU) + n10(d10).observers.push(MU[d10]); + return t10; + } + var jU = [{ key: "Backspace", keyCode: 8, inputType: "deleteContentBackward" }, { key: "Enter", keyCode: 13, inputType: "insertParagraph" }, { key: "Enter", keyCode: 13, inputType: "insertLineBreak" }, { key: "Delete", keyCode: 46, inputType: "deleteContentForward" }]; + var SU = "dthko"; + var CU = [16, 17, 18, 20, 91, 92, 224, 225]; + function $U(e20) { + return 0.7 * Math.max(0, e20) + 8; + } + var _U = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.view = t10, this.startEvent = n10, this.style = r10, this.mustSelect = o10, this.scrollSpeed = { x: 0, y: 0 }, this.scrolling = -1, this.lastEvent = n10, this.scrollParent = function(e21) { + for (var t11 = e21.ownerDocument, n11 = e21.parentNode; n11 && n11 != t11.body; ) + if (1 == n11.nodeType) { + if (n11.scrollHeight > n11.clientHeight || n11.scrollWidth > n11.clientWidth) + return n11; + n11 = n11.assignedSlot || n11.parentNode; + } else { + if (11 != n11.nodeType) + break; + n11 = n11.host; + } + return null; + }(t10.contentDOM), this.atoms = t10.state.facet(KW).map(function(e21) { + return e21(t10); + }); + var i10 = t10.contentDOM.ownerDocument; + i10.addEventListener("mousemove", this.move = this.move.bind(this)), i10.addEventListener("mouseup", this.up = this.up.bind(this)), this.extend = n10.shiftKey, this.multiple = t10.state.facet(mV.allowMultipleSelections) && function(e21, t11) { + var n11 = e21.state.facet(_W); + return n11.length ? n11[0](t11) : AH.mac ? t11.metaKey : t11.ctrlKey; + }(t10, n10), this.dragging = !(!function(e21, t11) { + var n11 = e21.state.selection.main; + if (n11.empty) + return false; + var r11 = KV(e21.root); + if (!r11 || 0 == r11.rangeCount) + return true; + for (var o11 = r11.getRangeAt(0).getClientRects(), i11 = 0; i11 < o11.length; i11++) { + var a10 = o11[i11]; + if (a10.left <= t11.clientX && a10.right >= t11.clientX && a10.top <= t11.clientY && a10.bottom >= t11.clientY) + return true; + } + return false; + }(t10, n10) || 1 != LU(n10)) && null; + } + return Do(e20, [{ key: "start", value: function(e21) { + false === this.dragging && this.select(e21); + } }, { key: "move", value: function(e21) { + var t10; + if (0 == e21.buttons) + return this.destroy(); + if (!(this.dragging || null == this.dragging && (n10 = this.startEvent, r10 = e21, Math.max(Math.abs(n10.clientX - r10.clientX), Math.abs(n10.clientY - r10.clientY)) < 10))) { + var n10, r10; + this.select(this.lastEvent = e21); + var o10 = 0, i10 = 0, a10 = (null === (t10 = this.scrollParent) || void 0 === t10 ? void 0 : t10.getBoundingClientRect()) || { left: 0, top: 0, right: this.view.win.innerWidth, bottom: this.view.win.innerHeight }, s10 = XW(this.view); + e21.clientX - s10.left <= a10.left + 6 ? o10 = -$U(a10.left - e21.clientX) : e21.clientX + s10.right >= a10.right - 6 && (o10 = $U(e21.clientX - a10.right)), e21.clientY - s10.top <= a10.top + 6 ? i10 = -$U(a10.top - e21.clientY) : e21.clientY + s10.bottom >= a10.bottom - 6 && (i10 = $U(e21.clientY - a10.bottom)), this.setScrollSpeed(o10, i10); + } + } }, { key: "up", value: function(e21) { + null == this.dragging && this.select(this.lastEvent), this.dragging || e21.preventDefault(), this.destroy(); + } }, { key: "destroy", value: function() { + this.setScrollSpeed(0, 0); + var e21 = this.view.contentDOM.ownerDocument; + e21.removeEventListener("mousemove", this.move), e21.removeEventListener("mouseup", this.up), this.view.inputState.mouseSelection = this.view.inputState.draggedContent = null; + } }, { key: "setScrollSpeed", value: function(e21, t10) { + var n10 = this; + this.scrollSpeed = { x: e21, y: t10 }, e21 || t10 ? this.scrolling < 0 && (this.scrolling = setInterval(function() { + return n10.scroll(); + }, 50)) : this.scrolling > -1 && (clearInterval(this.scrolling), this.scrolling = -1); + } }, { key: "scroll", value: function() { + this.scrollParent ? (this.scrollParent.scrollLeft += this.scrollSpeed.x, this.scrollParent.scrollTop += this.scrollSpeed.y) : this.view.win.scrollBy(this.scrollSpeed.x, this.scrollSpeed.y), false === this.dragging && this.select(this.lastEvent); + } }, { key: "skipAtoms", value: function(e21) { + for (var t10 = null, n10 = 0; n10 < e21.ranges.length; n10++) { + var r10 = e21.ranges[n10], o10 = null; + if (r10.empty) { + var i10 = yU(this.atoms, r10.from, 0); + i10 != r10.from && (o10 = $F.cursor(i10, -1)); + } else { + var a10 = yU(this.atoms, r10.from, -1), s10 = yU(this.atoms, r10.to, 1); + a10 == r10.from && s10 == r10.to || (o10 = $F.range(r10.from == r10.anchor ? a10 : s10, r10.from == r10.head ? a10 : s10)); + } + o10 && (t10 || (t10 = e21.ranges.slice()), t10[n10] = o10); + } + return t10 ? $F.create(t10, e21.mainIndex) : e21; + } }, { key: "select", value: function(e21) { + var t10 = this.view, n10 = this.skipAtoms(this.style.get(e21, this.extend, this.multiple)); + !this.mustSelect && n10.eq(t10.state.selection, false === this.dragging) || this.view.dispatch({ selection: n10, userEvent: "select.pointer" }), this.mustSelect = false; + } }, { key: "update", value: function(e21) { + var t10 = this; + this.style.update(e21) && setTimeout(function() { + return t10.select(t10.lastEvent); + }, 20); + } }]), e20; + }(); + var OU = /* @__PURE__ */ Object.create(null); + var MU = /* @__PURE__ */ Object.create(null); + var EU = AH.ie && AH.ie_version < 15 || AH.ios && AH.webkit_version < 604; + function AU(e20, t10) { + var n10, r10 = e20.state, o10 = 1, i10 = r10.toText(t10), a10 = i10.lines == r10.selection.ranges.length, s10 = null != VU && r10.selection.ranges.every(function(e21) { + return e21.empty; + }) && VU == i10.toString(); + if (s10) { + var c10 = -1; + n10 = r10.changeByRange(function(e21) { + var n11 = r10.doc.lineAt(e21.from); + if (n11.from == c10) + return { range: e21 }; + c10 = n11.from; + var s11 = r10.toText((a10 ? i10.line(o10++).text : t10) + r10.lineBreak); + return { changes: { from: n11.from, insert: s11 }, range: $F.cursor(e21.from + s11.length) }; + }); + } else + n10 = a10 ? r10.changeByRange(function(e21) { + var t11 = i10.line(o10++); + return { changes: { from: e21.from, to: e21.to, insert: t11.text }, range: $F.cursor(e21.from + t11.length) }; + }) : r10.replaceSelection(i10); + e20.dispatch(n10, { userEvent: "input.paste", scrollIntoView: true }); + } + function PU(e20, t10, n10, r10) { + if (1 == r10) + return $F.cursor(t10, n10); + if (2 == r10) + return function(e21, t11) { + var n11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, r11 = e21.charCategorizer(t11), o11 = e21.doc.lineAt(t11), i11 = t11 - o11.from; + if (0 == o11.length) + return $F.cursor(t11); + 0 == i11 ? n11 = 1 : i11 == o11.length && (n11 = -1); + var a11 = i11, s11 = i11; + n11 < 0 ? a11 = sF(o11.text, i11, false) : s11 = sF(o11.text, i11); + for (var c10 = r11(o11.text.slice(a11, s11)); a11 > 0; ) { + var l10 = sF(o11.text, a11, false); + if (r11(o11.text.slice(l10, a11)) != c10) + break; + a11 = l10; + } + for (; s11 < o11.length; ) { + var u10 = sF(o11.text, s11); + if (r11(o11.text.slice(s11, u10)) != c10) + break; + s11 = u10; + } + return $F.range(a11 + o11.from, s11 + o11.from); + }(e20.state, t10, n10); + var o10 = HH.find(e20.docView, t10), i10 = e20.state.doc.lineAt(o10 ? o10.posAtEnd : t10), a10 = o10 ? o10.posAtStart : i10.from, s10 = o10 ? o10.posAtEnd : i10.to; + return s10 < e20.state.doc.length && s10 == i10.to && s10++, $F.range(a10, s10); + } + MU.scroll = function(e20) { + e20.inputState.lastScrollTop = e20.scrollDOM.scrollTop, e20.inputState.lastScrollLeft = e20.scrollDOM.scrollLeft; + }, OU.keydown = function(e20, t10) { + return e20.inputState.setSelectionOrigin("select"), 27 == t10.keyCode && (e20.inputState.lastEscPress = Date.now()), false; + }, MU.touchstart = function(e20, t10) { + e20.inputState.lastTouchTime = Date.now(), e20.inputState.setSelectionOrigin("select.pointer"); + }, MU.touchmove = function(e20) { + e20.inputState.setSelectionOrigin("select.pointer"); + }, OU.mousedown = function(e20, t10) { + if (e20.observer.flush(), e20.inputState.lastTouchTime > Date.now() - 2e3) + return false; + var n10, r10 = null, o10 = bo(e20.state.facet(MW)); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + if (r10 = (0, n10.value)(e20, t10)) + break; + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + if (r10 || 0 != t10.button || (r10 = function(e21, t11) { + var n11 = IU(e21, t11), r11 = LU(t11), o11 = e21.state.selection; + return { update: function(e23) { + e23.docChanged && (n11.pos = e23.changes.mapPos(n11.pos), o11 = o11.map(e23.changes)); + }, get: function(t12, i11, a11) { + var s10, c10 = IU(e21, t12), l10 = PU(e21, c10.pos, c10.bias, r11); + if (n11.pos != c10.pos && !i11) { + var u10 = PU(e21, n11.pos, n11.bias, r11), f10 = Math.min(u10.from, l10.from), d10 = Math.max(u10.to, l10.to); + l10 = f10 < l10.from ? $F.range(f10, d10) : $F.range(d10, f10); + } + return i11 ? o11.replaceRange(o11.main.extend(l10.from, l10.to)) : a11 && 1 == r11 && o11.ranges.length > 1 && (s10 = function(e23, t13) { + for (var n12 = 0; n12 < e23.ranges.length; n12++) { + var r12 = e23.ranges[n12], o12 = r12.from, i12 = r12.to; + if (o12 <= t13 && i12 >= t13) + return $F.create(e23.ranges.slice(0, n12).concat(e23.ranges.slice(n12 + 1)), e23.mainIndex == n12 ? 0 : e23.mainIndex - (e23.mainIndex > n12 ? 1 : 0)); + } + return null; + }(o11, c10.pos)) ? s10 : a11 ? o11.addRange(l10) : $F.create([l10]); + } }; + }(e20, t10)), r10) { + var i10 = !e20.hasFocus; + e20.inputState.startMouseSelection(new _U(e20, t10, r10, i10)), i10 && e20.observer.ignore(function() { + return cH(e20.contentDOM); + }); + var a10 = e20.inputState.mouseSelection; + if (a10) + return a10.start(t10), false === a10.dragging; + } + return false; + }; + var TU = function(e20, t10) { + return e20 >= t10.top && e20 <= t10.bottom; + }; + var RU = function(e20, t10, n10) { + return TU(t10, n10) && e20 >= n10.left && e20 <= n10.right; + }; + function NU(e20, t10, n10, r10) { + var o10 = HH.find(e20.docView, t10); + if (!o10) + return 1; + var i10 = t10 - o10.posAtStart; + if (0 == i10) + return 1; + if (i10 == o10.length) + return -1; + var a10 = o10.coordsAt(i10, -1); + if (a10 && RU(n10, r10, a10)) + return -1; + var s10 = o10.coordsAt(i10, 1); + return s10 && RU(n10, r10, s10) ? 1 : a10 && TU(r10, a10) ? -1 : 1; + } + function IU(e20, t10) { + var n10 = e20.posAtCoords({ x: t10.clientX, y: t10.clientY }, false); + return { pos: n10, bias: NU(e20, n10, t10.clientX, t10.clientY) }; + } + var DU = AH.ie && AH.ie_version <= 11; + var qU = null; + var zU = 0; + var BU = 0; + function LU(e20) { + if (!DU) + return e20.detail; + var t10 = qU, n10 = BU; + return qU = e20, BU = Date.now(), zU = !t10 || n10 > Date.now() - 400 && Math.abs(t10.clientX - e20.clientX) < 2 && Math.abs(t10.clientY - e20.clientY) < 2 ? (zU + 1) % 3 : 1; + } + function FU(e20, t10, n10, r10) { + if (n10) { + var o10 = e20.posAtCoords({ x: t10.clientX, y: t10.clientY }, false), i10 = e20.inputState.draggedContent, a10 = r10 && i10 && function(e21, t11) { + var n11 = e21.state.facet(OW); + return n11.length ? n11[0](t11) : AH.mac ? !t11.altKey : !t11.ctrlKey; + }(e20, t10) ? { from: i10.from, to: i10.to } : null, s10 = { from: o10, insert: n10 }, c10 = e20.state.changes(a10 ? [a10, s10] : s10); + e20.focus(), e20.dispatch({ changes: c10, selection: { anchor: c10.mapPos(o10, -1), head: c10.mapPos(o10, 1) }, userEvent: a10 ? "move.drop" : "input.drop" }), e20.inputState.draggedContent = null; + } + } + OU.dragstart = function(e20, t10) { + var n10 = e20.state.selection.main; + if (t10.target.draggable) { + var r10 = e20.docView.nearest(t10.target); + if (r10 && r10.isWidget) { + var o10 = r10.posAtStart, i10 = o10 + r10.length; + (o10 >= n10.to || i10 <= n10.from) && (n10 = $F.range(o10, i10)); + } + } + var a10 = e20.inputState; + return a10.mouseSelection && (a10.mouseSelection.dragging = true), a10.draggedContent = n10, t10.dataTransfer && (t10.dataTransfer.setData("Text", e20.state.sliceDoc(n10.from, n10.to)), t10.dataTransfer.effectAllowed = "copyMove"), false; + }, OU.dragend = function(e20) { + return e20.inputState.draggedContent = null, false; + }, OU.drop = function(e20, t10) { + if (!t10.dataTransfer) + return false; + if (e20.state.readOnly) + return true; + var n10 = t10.dataTransfer.files; + if (n10 && n10.length) { + for (var r10 = Array(n10.length), o10 = 0, i10 = function() { + ++o10 == n10.length && FU(e20, t10, r10.filter(function(e21) { + return null != e21; + }).join(e20.state.lineBreak), false); + }, a10 = function(e21) { + var t11 = new FileReader(); + t11.onerror = i10, t11.onload = function() { + /[\x00-\x08\x0e-\x1f]{2}/.test(t11.result) || (r10[e21] = t11.result), i10(); + }, t11.readAsText(n10[e21]); + }, s10 = 0; s10 < n10.length; s10++) + a10(s10); + return true; + } + var c10 = t10.dataTransfer.getData("Text"); + return !!c10 && (FU(e20, t10, c10, true), true); + }, OU.paste = function(e20, t10) { + if (e20.state.readOnly) + return true; + e20.observer.flush(); + var n10 = EU ? null : t10.clipboardData; + return n10 ? (AU(e20, n10.getData("text/plain") || n10.getData("text/uri-text")), true) : (function(e21) { + var t11 = e21.dom.parentNode; + if (t11) { + var n11 = t11.appendChild(document.createElement("textarea")); + n11.style.cssText = "position: fixed; left: -10000px; top: 10px", n11.focus(), setTimeout(function() { + e21.focus(), n11.remove(), AU(e21, n11.value); + }, 50); + } + }(e20), false); + }; + var VU = null; + OU.copy = OU.cut = function(e20, t10) { + var n10 = function(e21) { + var t11, n11 = [], r11 = [], o11 = false, i11 = bo(e21.selection.ranges); + try { + for (i11.s(); !(t11 = i11.n()).done; ) { + var a11 = t11.value; + a11.empty || (n11.push(e21.sliceDoc(a11.from, a11.to)), r11.push(a11)); + } + } catch (e23) { + i11.e(e23); + } finally { + i11.f(); + } + if (!n11.length) { + var s10, c10 = -1, l10 = bo(e21.selection.ranges); + try { + for (l10.s(); !(s10 = l10.n()).done; ) { + var u10 = s10.value.from, f10 = e21.doc.lineAt(u10); + f10.number > c10 && (n11.push(f10.text), r11.push({ from: f10.from, to: Math.min(e21.doc.length, f10.to + 1) })), c10 = f10.number; + } + } catch (e23) { + l10.e(e23); + } finally { + l10.f(); + } + o11 = true; + } + return { text: n11.join(e21.lineBreak), ranges: r11, linewise: o11 }; + }(e20.state), r10 = n10.text, o10 = n10.ranges, i10 = n10.linewise; + if (!r10 && !i10) + return false; + VU = i10 ? r10 : null, "cut" != t10.type || e20.state.readOnly || e20.dispatch({ changes: o10, scrollIntoView: true, userEvent: "delete.cut" }); + var a10 = EU ? null : t10.clipboardData; + return a10 ? (a10.clearData(), a10.setData("text/plain", r10), true) : (function(e21, t11) { + var n11 = e21.dom.parentNode; + if (n11) { + var r11 = n11.appendChild(document.createElement("textarea")); + r11.style.cssText = "position: fixed; left: -10000px; top: 10px", r11.value = t11, r11.focus(), r11.selectionEnd = t11.length, r11.selectionStart = 0, setTimeout(function() { + r11.remove(), e21.focus(); + }, 50); + } + }(e20, r10), false); + }; + var HU = tV.define(); + function WU(e20, t10) { + var n10, r10 = [], o10 = bo(e20.facet(TW)); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = (0, n10.value)(e20, t10); + i10 && r10.push(i10); + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + return r10 ? e20.update({ effects: r10, annotations: HU.of(true) }) : null; + } + function UU(e20) { + setTimeout(function() { + var t10 = e20.hasFocus; + if (t10 != e20.inputState.notifiedFocused) { + var n10 = WU(e20.state, t10); + n10 ? e20.dispatch(n10) : e20.update([]); + } + }, 10); + } + MU.focus = function(e20) { + e20.inputState.lastFocusTime = Date.now(), e20.scrollDOM.scrollTop || !e20.inputState.lastScrollTop && !e20.inputState.lastScrollLeft || (e20.scrollDOM.scrollTop = e20.inputState.lastScrollTop, e20.scrollDOM.scrollLeft = e20.inputState.lastScrollLeft), UU(e20); + }, MU.blur = function(e20) { + e20.observer.clearSelectionRange(), UU(e20); + }, MU.compositionstart = MU.compositionupdate = function(e20) { + null == e20.inputState.compositionFirstChange && (e20.inputState.compositionFirstChange = true), e20.inputState.composing < 0 && (e20.inputState.composing = 0); + }, MU.compositionend = function(e20) { + e20.inputState.composing = -1, e20.inputState.compositionEndedAt = Date.now(), e20.inputState.compositionPendingKey = true, e20.inputState.compositionPendingChange = e20.observer.pendingRecords().length > 0, e20.inputState.compositionFirstChange = null, AH.chrome && AH.android ? e20.observer.flushSoon() : e20.inputState.compositionPendingChange ? Promise.resolve().then(function() { + return e20.observer.flush(); + }) : setTimeout(function() { + e20.inputState.composing < 0 && e20.docView.hasComposition && e20.update([]); + }, 50); + }, MU.contextmenu = function(e20) { + e20.inputState.lastContextMenu = Date.now(); + }, OU.beforeinput = function(e20, t10) { + var n10, r10; + if (AH.chrome && AH.android && (r10 = jU.find(function(e21) { + return e21.inputType == t10.inputType; + })) && (e20.observer.delayAndroidKey(r10.key, r10.keyCode), "Backspace" == r10.key || "Delete" == r10.key)) { + var o10 = (null === (n10 = window.visualViewport) || void 0 === n10 ? void 0 : n10.height) || 0; + setTimeout(function() { + var t11; + ((null === (t11 = window.visualViewport) || void 0 === t11 ? void 0 : t11.height) || 0) > o10 + 10 && e20.hasFocus && (e20.contentDOM.blur(), e20.focus()); + }, 100); + } + return false; + }; + var JU = /* @__PURE__ */ new Set(); + var KU = ["pre-wrap", "normal", "pre-line", "break-spaces"]; + var GU = function() { + function e20(t10) { + No(this, e20), this.lineWrapping = t10, this.doc = UL.empty, this.heightSamples = {}, this.lineHeight = 14, this.charWidth = 7, this.textHeight = 14, this.lineLength = 30, this.heightChanged = false; + } + return Do(e20, [{ key: "heightForGap", value: function(e21, t10) { + var n10 = this.doc.lineAt(t10).number - this.doc.lineAt(e21).number + 1; + return this.lineWrapping && (n10 += Math.max(0, Math.ceil((t10 - e21 - n10 * this.lineLength * 0.5) / this.lineLength))), this.lineHeight * n10; + } }, { key: "heightForLine", value: function(e21) { + return this.lineWrapping ? (1 + Math.max(0, Math.ceil((e21 - this.lineLength) / (this.lineLength - 5)))) * this.lineHeight : this.lineHeight; + } }, { key: "setDoc", value: function(e21) { + return this.doc = e21, this; + } }, { key: "mustRefreshForWrapping", value: function(e21) { + return KU.indexOf(e21) > -1 != this.lineWrapping; + } }, { key: "mustRefreshForHeights", value: function(e21) { + for (var t10 = false, n10 = 0; n10 < e21.length; n10++) { + var r10 = e21[n10]; + r10 < 0 ? n10++ : this.heightSamples[Math.floor(10 * r10)] || (t10 = true, this.heightSamples[Math.floor(10 * r10)] = true); + } + return t10; + } }, { key: "refresh", value: function(e21, t10, n10, r10, o10, i10) { + var a10 = KU.indexOf(e21) > -1, s10 = Math.round(t10) != Math.round(this.lineHeight) || this.lineWrapping != a10; + if (this.lineWrapping = a10, this.lineHeight = t10, this.charWidth = n10, this.textHeight = r10, this.lineLength = o10, s10) { + this.heightSamples = {}; + for (var c10 = 0; c10 < i10.length; c10++) { + var l10 = i10[c10]; + l10 < 0 ? c10++ : this.heightSamples[Math.floor(10 * l10)] = true; + } + } + return s10; + } }]), e20; + }(); + var QU = function() { + function e20(t10, n10) { + No(this, e20), this.from = t10, this.heights = n10, this.index = 0; + } + return Do(e20, [{ key: "more", get: function() { + return this.index < this.heights.length; + } }]), e20; + }(); + var YU = function() { + function e20(t10, n10, r10, o10, i10) { + No(this, e20), this.from = t10, this.length = n10, this.top = r10, this.height = o10, this._content = i10; + } + return Do(e20, [{ key: "type", get: function() { + return "number" == typeof this._content ? JH.Text : Array.isArray(this._content) ? this._content : this._content.type; + } }, { key: "to", get: function() { + return this.from + this.length; + } }, { key: "bottom", get: function() { + return this.top + this.height; + } }, { key: "widget", get: function() { + return this._content instanceof YH ? this._content.widget : null; + } }, { key: "widgetLineBreaks", get: function() { + return "number" == typeof this._content ? this._content : 0; + } }, { key: "join", value: function(t10) { + var n10 = (Array.isArray(this._content) ? this._content : [this]).concat(Array.isArray(t10._content) ? t10._content : [t10]); + return new e20(this.from, this.length + t10.length, this.top, this.height + t10.height, n10); + } }]), e20; + }(); + var XU = function(e20) { + return e20[e20.ByPos = 0] = "ByPos", e20[e20.ByHeight = 1] = "ByHeight", e20[e20.ByPosNoHeight = 2] = "ByPosNoHeight", e20; + }(XU || (XU = {})); + var ZU = 1e-3; + var eJ = function() { + function e20(t10, n10) { + var r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 2; + No(this, e20), this.length = t10, this.height = n10, this.flags = r10; + } + return Do(e20, [{ key: "outdated", get: function() { + return (2 & this.flags) > 0; + }, set: function(e21) { + this.flags = (e21 ? 2 : 0) | -3 & this.flags; + } }, { key: "setHeight", value: function(e21, t10) { + this.height != t10 && (Math.abs(this.height - t10) > ZU && (e21.heightChanged = true), this.height = t10); + } }, { key: "replace", value: function(t10, n10, r10) { + return e20.of(r10); + } }, { key: "decomposeLeft", value: function(e21, t10) { + t10.push(this); + } }, { key: "decomposeRight", value: function(e21, t10) { + t10.push(this); + } }, { key: "applyChanges", value: function(e21, t10, n10, r10) { + for (var o10 = this, i10 = n10.doc, a10 = r10.length - 1; a10 >= 0; a10--) { + var s10 = r10[a10], c10 = s10.fromA, l10 = s10.toA, u10 = s10.fromB, f10 = s10.toB, d10 = o10.lineAt(c10, XU.ByPosNoHeight, n10.setDoc(t10), 0, 0), h10 = d10.to >= l10 ? d10 : o10.lineAt(l10, XU.ByPosNoHeight, n10, 0, 0); + for (f10 += h10.to - l10, l10 = h10.to; a10 > 0 && d10.from <= r10[a10 - 1].toA; ) + c10 = r10[a10 - 1].fromA, u10 = r10[a10 - 1].fromB, a10--, c10 < d10.from && (d10 = o10.lineAt(c10, XU.ByPosNoHeight, n10, 0, 0)); + u10 += d10.from - c10, c10 = d10.from; + var v10 = aJ.build(n10.setDoc(i10), e21, u10, f10); + o10 = o10.replace(c10, l10, v10); + } + return o10.updateHeight(n10, 0); + } }], [{ key: "empty", value: function() { + return new nJ(0, 0); + } }, { key: "of", value: function(t10) { + if (1 == t10.length) + return t10[0]; + for (var n10 = 0, r10 = t10.length, o10 = 0, i10 = 0; ; ) + if (n10 == r10) + if (o10 > 2 * i10) { + var a10 = t10[n10 - 1]; + a10.break ? t10.splice(--n10, 1, a10.left, null, a10.right) : t10.splice(--n10, 1, a10.left, a10.right), r10 += 1 + a10.break, o10 -= a10.size; + } else { + if (!(i10 > 2 * o10)) + break; + var s10 = t10[r10]; + s10.break ? t10.splice(r10, 1, s10.left, null, s10.right) : t10.splice(r10, 1, s10.left, s10.right), r10 += 2 + s10.break, i10 -= s10.size; + } + else if (o10 < i10) { + var c10 = t10[n10++]; + c10 && (o10 += c10.size); + } else { + var l10 = t10[--r10]; + l10 && (i10 += l10.size); + } + var u10 = 0; + return null == t10[n10 - 1] ? (u10 = 1, n10--) : null == t10[n10] && (u10 = 1, r10++), new oJ(e20.of(t10.slice(0, n10)), u10, e20.of(t10.slice(r10))); + } }]), e20; + }(); + eJ.prototype.size = 1; + var tJ = function(e20) { + function t10(e21, n10, r10) { + var o10; + return No(this, t10), (o10 = _o(this, t10, [e21, n10])).deco = r10, o10; + } + return Ao(t10, eJ), Do(t10, [{ key: "blockAt", value: function(e21, t11, n10, r10) { + return new YU(r10, this.length, n10, this.height, this.deco || 0); + } }, { key: "lineAt", value: function(e21, t11, n10, r10, o10) { + return this.blockAt(0, n10, r10, o10); + } }, { key: "forEachLine", value: function(e21, t11, n10, r10, o10, i10) { + e21 <= o10 + this.length && t11 >= o10 && i10(this.blockAt(0, n10, r10, o10)); + } }, { key: "updateHeight", value: function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n10 = arguments.length > 3 ? arguments[3] : void 0; + return n10 && n10.from <= t11 && n10.more && this.setHeight(e21, n10.heights[n10.index++]), this.outdated = false, this; + } }, { key: "toString", value: function() { + return "block(".concat(this.length, ")"); + } }]), t10; + }(); + var nJ = function(e20) { + function t10(e21, n10) { + var r10; + return No(this, t10), (r10 = _o(this, t10, [e21, n10, null])).collapsed = 0, r10.widgetHeight = 0, r10.breaks = 0, r10; + } + return Ao(t10, tJ), Do(t10, [{ key: "blockAt", value: function(e21, t11, n10, r10) { + return new YU(r10, this.length, n10, this.height, this.breaks); + } }, { key: "replace", value: function(e21, n10, r10) { + var o10 = r10[0]; + return 1 == r10.length && (o10 instanceof t10 || o10 instanceof rJ && 4 & o10.flags) && Math.abs(this.length - o10.length) < 10 ? (o10 instanceof rJ ? o10 = new t10(o10.length, this.height) : o10.height = this.height, this.outdated || (o10.outdated = false), o10) : eJ.of(r10); + } }, { key: "updateHeight", value: function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n10 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], r10 = arguments.length > 3 ? arguments[3] : void 0; + return r10 && r10.from <= t11 && r10.more ? this.setHeight(e21, r10.heights[r10.index++]) : (n10 || this.outdated) && this.setHeight(e21, Math.max(this.widgetHeight, e21.heightForLine(this.length - this.collapsed)) + this.breaks * e21.lineHeight), this.outdated = false, this; + } }, { key: "toString", value: function() { + return "line(".concat(this.length).concat(this.collapsed ? -this.collapsed : "").concat(this.widgetHeight ? ":" + this.widgetHeight : "", ")"); + } }]), t10; + }(); + var rJ = function(e20) { + function t10(e21) { + return No(this, t10), _o(this, t10, [e21, 0]); + } + return Ao(t10, eJ), Do(t10, [{ key: "heightMetrics", value: function(e21, t11) { + var n10, r10 = e21.doc.lineAt(t11).number, o10 = e21.doc.lineAt(t11 + this.length).number, i10 = o10 - r10 + 1, a10 = 0; + if (e21.lineWrapping) { + var s10 = Math.min(this.height, e21.lineHeight * i10); + n10 = s10 / i10, this.length > i10 + 1 && (a10 = (this.height - s10) / (this.length - i10 - 1)); + } else + n10 = this.height / i10; + return { firstLine: r10, lastLine: o10, perLine: n10, perChar: a10 }; + } }, { key: "blockAt", value: function(e21, t11, n10, r10) { + var o10 = this.heightMetrics(t11, r10), i10 = o10.firstLine, a10 = o10.lastLine, s10 = o10.perLine, c10 = o10.perChar; + if (t11.lineWrapping) { + var l10 = r10 + Math.round(Math.max(0, Math.min(1, (e21 - n10) / this.height)) * this.length), u10 = t11.doc.lineAt(l10), f10 = s10 + u10.length * c10, d10 = Math.max(n10, e21 - f10 / 2); + return new YU(u10.from, u10.length, d10, f10, 0); + } + var h10 = Math.max(0, Math.min(a10 - i10, Math.floor((e21 - n10) / s10))), v10 = t11.doc.line(i10 + h10), p10 = v10.from, m10 = v10.length; + return new YU(p10, m10, n10 + s10 * h10, s10, 0); + } }, { key: "lineAt", value: function(e21, t11, n10, r10, o10) { + if (t11 == XU.ByHeight) + return this.blockAt(e21, n10, r10, o10); + if (t11 == XU.ByPosNoHeight) { + var i10 = n10.doc.lineAt(e21), a10 = i10.from, s10 = i10.to; + return new YU(a10, s10 - a10, 0, 0, 0); + } + var c10 = this.heightMetrics(n10, o10), l10 = c10.firstLine, u10 = c10.perLine, f10 = c10.perChar, d10 = n10.doc.lineAt(e21), h10 = u10 + d10.length * f10, v10 = d10.number - l10, p10 = r10 + u10 * v10 + f10 * (d10.from - o10 - v10); + return new YU(d10.from, d10.length, Math.max(r10, Math.min(p10, r10 + this.height - h10)), h10, 0); + } }, { key: "forEachLine", value: function(e21, t11, n10, r10, o10, i10) { + e21 = Math.max(e21, o10), t11 = Math.min(t11, o10 + this.length); + for (var a10 = this.heightMetrics(n10, o10), s10 = a10.firstLine, c10 = a10.perLine, l10 = a10.perChar, u10 = e21, f10 = r10; u10 <= t11; ) { + var d10 = n10.doc.lineAt(u10); + if (u10 == e21) { + var h10 = d10.number - s10; + f10 += c10 * h10 + l10 * (e21 - o10 - h10); + } + var v10 = c10 + l10 * d10.length; + i10(new YU(d10.from, d10.length, f10, v10, 0)), f10 += v10, u10 = d10.to + 1; + } + } }, { key: "replace", value: function(e21, n10, r10) { + var o10 = this.length - n10; + if (o10 > 0) { + var i10 = r10[r10.length - 1]; + i10 instanceof t10 ? r10[r10.length - 1] = new t10(i10.length + o10) : r10.push(null, new t10(o10 - 1)); + } + if (e21 > 0) { + var a10 = r10[0]; + a10 instanceof t10 ? r10[0] = new t10(e21 + a10.length) : r10.unshift(new t10(e21 - 1), null); + } + return eJ.of(r10); + } }, { key: "decomposeLeft", value: function(e21, n10) { + n10.push(new t10(e21 - 1), null); + } }, { key: "decomposeRight", value: function(e21, n10) { + n10.push(null, new t10(this.length - e21 - 1)); + } }, { key: "updateHeight", value: function(e21) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r10 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], o10 = arguments.length > 3 ? arguments[3] : void 0, i10 = n10 + this.length; + if (o10 && o10.from <= n10 + this.length && o10.more) { + var a10 = [], s10 = Math.max(n10, o10.from), c10 = -1; + for (o10.from > n10 && a10.push(new t10(o10.from - n10 - 1).updateHeight(e21, n10)); s10 <= i10 && o10.more; ) { + var l10 = e21.doc.lineAt(s10).length; + a10.length && a10.push(null); + var u10 = o10.heights[o10.index++]; + -1 == c10 ? c10 = u10 : Math.abs(u10 - c10) >= ZU && (c10 = -2); + var f10 = new nJ(l10, u10); + f10.outdated = false, a10.push(f10), s10 += l10 + 1; + } + s10 <= i10 && a10.push(null, new t10(i10 - s10).updateHeight(e21, s10)); + var d10 = eJ.of(a10); + return (c10 < 0 || Math.abs(d10.height - this.height) >= ZU || Math.abs(c10 - this.heightMetrics(e21, n10).perLine) >= ZU) && (e21.heightChanged = true), d10; + } + return (r10 || this.outdated) && (this.setHeight(e21, e21.heightForGap(n10, n10 + this.length)), this.outdated = false), this; + } }, { key: "toString", value: function() { + return "gap(".concat(this.length, ")"); + } }]), t10; + }(); + var oJ = function(e20) { + function t10(e21, n10, r10) { + var o10; + return No(this, t10), (o10 = _o(this, t10, [e21.length + n10 + r10.length, e21.height + r10.height, n10 | (e21.outdated || r10.outdated ? 2 : 0)])).left = e21, o10.right = r10, o10.size = e21.size + r10.size, o10; + } + return Ao(t10, eJ), Do(t10, [{ key: "break", get: function() { + return 1 & this.flags; + } }, { key: "blockAt", value: function(e21, t11, n10, r10) { + var o10 = n10 + this.left.height; + return e21 < o10 ? this.left.blockAt(e21, t11, n10, r10) : this.right.blockAt(e21, t11, o10, r10 + this.left.length + this.break); + } }, { key: "lineAt", value: function(e21, t11, n10, r10, o10) { + var i10 = r10 + this.left.height, a10 = o10 + this.left.length + this.break, s10 = t11 == XU.ByHeight ? e21 < i10 : e21 < a10, c10 = s10 ? this.left.lineAt(e21, t11, n10, r10, o10) : this.right.lineAt(e21, t11, n10, i10, a10); + if (this.break || (s10 ? c10.to < a10 : c10.from > a10)) + return c10; + var l10 = t11 == XU.ByPosNoHeight ? XU.ByPosNoHeight : XU.ByPos; + return s10 ? c10.join(this.right.lineAt(a10, l10, n10, i10, a10)) : this.left.lineAt(a10, l10, n10, r10, o10).join(c10); + } }, { key: "forEachLine", value: function(e21, t11, n10, r10, o10, i10) { + var a10 = r10 + this.left.height, s10 = o10 + this.left.length + this.break; + if (this.break) + e21 < s10 && this.left.forEachLine(e21, t11, n10, r10, o10, i10), t11 >= s10 && this.right.forEachLine(e21, t11, n10, a10, s10, i10); + else { + var c10 = this.lineAt(s10, XU.ByPos, n10, r10, o10); + e21 < c10.from && this.left.forEachLine(e21, c10.from - 1, n10, r10, o10, i10), c10.to >= e21 && c10.from <= t11 && i10(c10), t11 > c10.to && this.right.forEachLine(c10.to + 1, t11, n10, a10, s10, i10); + } + } }, { key: "replace", value: function(e21, t11, n10) { + var r10 = this.left.length + this.break; + if (t11 < r10) + return this.balanced(this.left.replace(e21, t11, n10), this.right); + if (e21 > this.left.length) + return this.balanced(this.left, this.right.replace(e21 - r10, t11 - r10, n10)); + var o10 = []; + e21 > 0 && this.decomposeLeft(e21, o10); + var i10, a10 = o10.length, s10 = bo(n10); + try { + for (s10.s(); !(i10 = s10.n()).done; ) { + var c10 = i10.value; + o10.push(c10); + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + if (e21 > 0 && iJ(o10, a10 - 1), t11 < this.length) { + var l10 = o10.length; + this.decomposeRight(t11, o10), iJ(o10, l10); + } + return eJ.of(o10); + } }, { key: "decomposeLeft", value: function(e21, t11) { + var n10 = this.left.length; + if (e21 <= n10) + return this.left.decomposeLeft(e21, t11); + t11.push(this.left), this.break && e21 >= ++n10 && t11.push(null), e21 > n10 && this.right.decomposeLeft(e21 - n10, t11); + } }, { key: "decomposeRight", value: function(e21, t11) { + var n10 = this.left.length, r10 = n10 + this.break; + if (e21 >= r10) + return this.right.decomposeRight(e21 - r10, t11); + e21 < n10 && this.left.decomposeRight(e21, t11), this.break && e21 < r10 && t11.push(null), t11.push(this.right); + } }, { key: "balanced", value: function(e21, t11) { + return e21.size > 2 * t11.size || t11.size > 2 * e21.size ? eJ.of(this.break ? [e21, null, t11] : [e21, t11]) : (this.left = e21, this.right = t11, this.height = e21.height + t11.height, this.outdated = e21.outdated || t11.outdated, this.size = e21.size + t11.size, this.length = e21.length + this.break + t11.length, this); + } }, { key: "updateHeight", value: function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n10 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], r10 = arguments.length > 3 ? arguments[3] : void 0, o10 = this.left, i10 = this.right, a10 = t11 + o10.length + this.break, s10 = null; + return r10 && r10.from <= t11 + o10.length && r10.more ? s10 = o10 = o10.updateHeight(e21, t11, n10, r10) : o10.updateHeight(e21, t11, n10), r10 && r10.from <= a10 + i10.length && r10.more ? s10 = i10 = i10.updateHeight(e21, a10, n10, r10) : i10.updateHeight(e21, a10, n10), s10 ? this.balanced(o10, i10) : (this.height = this.left.height + this.right.height, this.outdated = false, this); + } }, { key: "toString", value: function() { + return this.left + (this.break ? " " : "-") + this.right; + } }]), t10; + }(); + function iJ(e20, t10) { + var n10, r10; + null == e20[t10] && (n10 = e20[t10 - 1]) instanceof rJ && (r10 = e20[t10 + 1]) instanceof rJ && e20.splice(t10 - 1, 3, new rJ(n10.length + 1 + r10.length)); + } + var aJ = function() { + function e20(t10, n10) { + No(this, e20), this.pos = t10, this.oracle = n10, this.nodes = [], this.lineStart = -1, this.lineEnd = -1, this.covering = null, this.writtenTo = t10; + } + return Do(e20, [{ key: "isCovered", get: function() { + return this.covering && this.nodes[this.nodes.length - 1] == this.covering; + } }, { key: "span", value: function(e21, t10) { + if (this.lineStart > -1) { + var n10 = Math.min(t10, this.lineEnd), r10 = this.nodes[this.nodes.length - 1]; + r10 instanceof nJ ? r10.length += n10 - this.pos : (n10 > this.pos || !this.isCovered) && this.nodes.push(new nJ(n10 - this.pos, -1)), this.writtenTo = n10, t10 > n10 && (this.nodes.push(null), this.writtenTo++, this.lineStart = -1); + } + this.pos = t10; + } }, { key: "point", value: function(e21, t10, n10) { + if (e21 < t10 || n10.heightRelevant) { + var r10 = n10.widget ? n10.widget.estimatedHeight : 0, o10 = n10.widget ? n10.widget.lineBreaks : 0; + r10 < 0 && (r10 = this.oracle.lineHeight); + var i10 = t10 - e21; + n10.block ? this.addBlock(new tJ(i10, r10, n10)) : (i10 || o10 || r10 >= 5) && this.addLineDeco(r10, o10, i10); + } else + t10 > e21 && this.span(e21, t10); + this.lineEnd > -1 && this.lineEnd < this.pos && (this.lineEnd = this.oracle.doc.lineAt(this.pos).to); + } }, { key: "enterLine", value: function() { + if (!(this.lineStart > -1)) { + var e21 = this.oracle.doc.lineAt(this.pos), t10 = e21.from, n10 = e21.to; + this.lineStart = t10, this.lineEnd = n10, this.writtenTo < t10 && ((this.writtenTo < t10 - 1 || null == this.nodes[this.nodes.length - 1]) && this.nodes.push(this.blankContent(this.writtenTo, t10 - 1)), this.nodes.push(null)), this.pos > t10 && this.nodes.push(new nJ(this.pos - t10, -1)), this.writtenTo = this.pos; + } + } }, { key: "blankContent", value: function(e21, t10) { + var n10 = new rJ(t10 - e21); + return this.oracle.doc.lineAt(e21).to == t10 && (n10.flags |= 4), n10; + } }, { key: "ensureLine", value: function() { + this.enterLine(); + var e21 = this.nodes.length ? this.nodes[this.nodes.length - 1] : null; + if (e21 instanceof nJ) + return e21; + var t10 = new nJ(0, -1); + return this.nodes.push(t10), t10; + } }, { key: "addBlock", value: function(e21) { + this.enterLine(); + var t10 = e21.deco; + t10 && t10.startSide > 0 && !this.isCovered && this.ensureLine(), this.nodes.push(e21), this.writtenTo = this.pos = this.pos + e21.length, t10 && t10.endSide > 0 && (this.covering = e21); + } }, { key: "addLineDeco", value: function(e21, t10, n10) { + var r10 = this.ensureLine(); + r10.length += n10, r10.collapsed += n10, r10.widgetHeight = Math.max(r10.widgetHeight, e21), r10.breaks += t10, this.writtenTo = this.pos = this.pos + n10; + } }, { key: "finish", value: function(e21) { + var t10 = 0 == this.nodes.length ? null : this.nodes[this.nodes.length - 1]; + !(this.lineStart > -1) || t10 instanceof nJ || this.isCovered ? (this.writtenTo < this.pos || null == t10) && this.nodes.push(this.blankContent(this.writtenTo, this.pos)) : this.nodes.push(new nJ(0, -1)); + var n10, r10 = e21, o10 = bo(this.nodes); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = n10.value; + i10 instanceof nJ && i10.updateHeight(this.oracle, r10), r10 += i10 ? i10.length : 1; + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + return this.nodes; + } }], [{ key: "build", value: function(t10, n10, r10, o10) { + var i10 = new e20(r10, t10); + return xV.spans(n10, r10, o10, i10, 0), i10.finish(r10); + } }]), e20; + }(); + var sJ = function() { + function e20() { + No(this, e20), this.changes = []; + } + return Do(e20, [{ key: "compareRange", value: function() { + } }, { key: "comparePoint", value: function(e21, t10, n10, r10) { + (e21 < t10 || n10 && n10.heightRelevant || r10 && r10.heightRelevant) && ZH(e21, t10, this.changes, 5); + } }]), e20; + }(); + function cJ(e20, t10) { + for (var n10 = e20.getBoundingClientRect(), r10 = e20.ownerDocument, o10 = r10.defaultView || window, i10 = Math.max(0, n10.left), a10 = Math.min(o10.innerWidth, n10.right), s10 = Math.max(0, n10.top), c10 = Math.min(o10.innerHeight, n10.bottom), l10 = e20.parentNode; l10 && l10 != r10.body; ) + if (1 == l10.nodeType) { + var u10 = l10, f10 = window.getComputedStyle(u10); + if ((u10.scrollHeight > u10.clientHeight || u10.scrollWidth > u10.clientWidth) && "visible" != f10.overflow) { + var d10 = u10.getBoundingClientRect(); + i10 = Math.max(i10, d10.left), a10 = Math.min(a10, d10.right), s10 = Math.max(s10, d10.top), c10 = l10 == e20.parentNode ? d10.bottom : Math.min(c10, d10.bottom); + } + l10 = "absolute" == f10.position || "fixed" == f10.position ? u10.offsetParent : u10.parentNode; + } else { + if (11 != l10.nodeType) + break; + l10 = l10.host; + } + return { left: i10 - n10.left, right: Math.max(i10, a10) - n10.left, top: s10 - (n10.top + t10), bottom: Math.max(s10, c10) - (n10.top + t10) }; + } + function lJ(e20, t10) { + var n10 = e20.getBoundingClientRect(); + return { left: 0, right: n10.right - n10.left, top: t10, bottom: n10.bottom - (n10.top + t10) }; + } + var uJ = function() { + function e20(t10, n10, r10) { + No(this, e20), this.from = t10, this.to = n10, this.size = r10; + } + return Do(e20, [{ key: "draw", value: function(e21, t10) { + return KH.replace({ widget: new fJ(this.size * (t10 ? e21.scaleY : e21.scaleX), t10) }).range(this.from, this.to); + } }], [{ key: "same", value: function(e21, t10) { + if (e21.length != t10.length) + return false; + for (var n10 = 0; n10 < e21.length; n10++) { + var r10 = e21[n10], o10 = t10[n10]; + if (r10.from != o10.from || r10.to != o10.to || r10.size != o10.size) + return false; + } + return true; + } }]), e20; + }(); + var fJ = function(e20) { + function t10(e21, n10) { + var r10; + return No(this, t10), (r10 = _o(this, t10)).size = e21, r10.vertical = n10, r10; + } + return Ao(t10, UH), Do(t10, [{ key: "eq", value: function(e21) { + return e21.size == this.size && e21.vertical == this.vertical; + } }, { key: "toDOM", value: function() { + var e21 = document.createElement("div"); + return this.vertical ? e21.style.height = this.size + "px" : (e21.style.width = this.size + "px", e21.style.height = "2px", e21.style.display = "inline-block"), e21; + } }, { key: "estimatedHeight", get: function() { + return this.vertical ? this.size : -1; + } }]), t10; + }(); + var dJ = function() { + function e20(t10) { + var n10 = this; + No(this, e20), this.state = t10, this.pixelViewport = { left: 0, right: window.innerWidth, top: 0, bottom: 0 }, this.inView = true, this.paddingTop = 0, this.paddingBottom = 0, this.contentDOMWidth = 0, this.contentDOMHeight = 0, this.editorHeight = 0, this.editorWidth = 0, this.scrollTop = 0, this.scrolledToBottom = true, this.scaleX = 1, this.scaleY = 1, this.scrollAnchorPos = 0, this.scrollAnchorHeight = -1, this.scaler = gJ, this.scrollTarget = null, this.printing = false, this.mustMeasureContent = true, this.defaultTextDirection = rW.LTR, this.visibleRanges = [], this.mustEnforceCursorAssoc = false; + var r10 = t10.facet(WW).some(function(e21) { + return "function" != typeof e21 && "cm-lineWrapping" == e21.class; + }); + this.heightOracle = new GU(r10), this.stateDeco = t10.facet(UW).filter(function(e21) { + return "function" != typeof e21; + }), this.heightMap = eJ.empty().applyChanges(this.stateDeco, UL.empty, this.heightOracle.setDoc(t10.doc), [new eU(0, 0, 0, t10.doc.length)]), this.viewport = this.getViewport(0, null), this.updateViewportLines(), this.updateForViewport(), this.lineGaps = this.ensureLineGaps([]), this.lineGapDeco = KH.set(this.lineGaps.map(function(e21) { + return e21.draw(n10, false); + })), this.computeVisibleRanges(); + } + return Do(e20, [{ key: "updateForViewport", value: function() { + for (var e21 = this, t10 = [this.viewport], n10 = this.state.selection.main, r10 = function() { + var r11 = o10 ? n10.head : n10.anchor; + if (!t10.some(function(e23) { + var t11 = e23.from, n11 = e23.to; + return r11 >= t11 && r11 <= n11; + })) { + var i10 = e21.lineBlockAt(r11), a10 = i10.from, s10 = i10.to; + t10.push(new hJ(a10, s10)); + } + }, o10 = 0; o10 <= 1; o10++) + r10(); + this.viewports = t10.sort(function(e23, t11) { + return e23.from - t11.from; + }), this.scaler = this.heightMap.height <= 7e6 ? gJ : new yJ(this.heightOracle, this.heightMap, this.viewports); + } }, { key: "updateViewportLines", value: function() { + var e21 = this; + this.viewportLines = [], this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.heightOracle.setDoc(this.state.doc), 0, 0, function(t10) { + e21.viewportLines.push(1 == e21.scaler.scale ? t10 : bJ(t10, e21.scaler)); + }); + } }, { key: "update", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null; + this.state = e21.state; + var n10 = this.stateDeco; + this.stateDeco = this.state.facet(UW).filter(function(e23) { + return "function" != typeof e23; + }); + var r10, o10, i10, a10, s10 = e21.changedRanges, c10 = eU.extendWithRanges(s10, (r10 = n10, o10 = this.stateDeco, i10 = e21 ? e21.changes : yF.empty(this.state.doc.length), a10 = new sJ(), xV.compare(r10, o10, i10, a10, 0), a10.changes)), l10 = this.heightMap.height, u10 = this.scrolledToBottom ? null : this.scrollAnchorAt(this.scrollTop); + this.heightMap = this.heightMap.applyChanges(this.stateDeco, e21.startState.doc, this.heightOracle.setDoc(this.state.doc), c10), this.heightMap.height != l10 && (e21.flags |= 2), u10 ? (this.scrollAnchorPos = e21.changes.mapPos(u10.from, -1), this.scrollAnchorHeight = u10.top) : (this.scrollAnchorPos = -1, this.scrollAnchorHeight = this.heightMap.height); + var f10 = c10.length ? this.mapViewport(this.viewport, e21.changes) : this.viewport; + (t10 && (t10.range.head < f10.from || t10.range.head > f10.to) || !this.viewportIsAppropriate(f10)) && (f10 = this.getViewport(0, t10)); + var d10 = !e21.changes.empty || 2 & e21.flags || f10.from != this.viewport.from || f10.to != this.viewport.to; + this.viewport = f10, this.updateForViewport(), d10 && this.updateViewportLines(), (this.lineGaps.length || this.viewport.to - this.viewport.from > 4e3) && this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps, e21.changes))), e21.flags |= this.computeVisibleRanges(), t10 && (this.scrollTarget = t10), !this.mustEnforceCursorAssoc && e21.selectionSet && e21.view.lineWrapping && e21.state.selection.main.empty && e21.state.selection.main.assoc && !e21.state.facet(NW) && (this.mustEnforceCursorAssoc = true); + } }, { key: "measure", value: function(e21) { + var t10 = e21.contentDOM, n10 = window.getComputedStyle(t10), r10 = this.heightOracle, o10 = n10.whiteSpace; + this.defaultTextDirection = "rtl" == n10.direction ? rW.RTL : rW.LTR; + var i10 = this.heightOracle.mustRefreshForWrapping(o10), a10 = t10.getBoundingClientRect(), s10 = i10 || this.mustMeasureContent || this.contentDOMHeight != a10.height; + this.contentDOMHeight = a10.height, this.mustMeasureContent = false; + var c10 = 0, l10 = 0; + if (a10.width && a10.height) { + var u10 = oH(t10, a10), f10 = u10.scaleX, d10 = u10.scaleY; + this.scaleX == f10 && this.scaleY == d10 || (this.scaleX = f10, this.scaleY = d10, c10 |= 8, i10 = s10 = true); + } + var h10 = (parseInt(n10.paddingTop) || 0) * this.scaleY, v10 = (parseInt(n10.paddingBottom) || 0) * this.scaleY; + this.paddingTop == h10 && this.paddingBottom == v10 || (this.paddingTop = h10, this.paddingBottom = v10, c10 |= 10), this.editorWidth != e21.scrollDOM.clientWidth && (r10.lineWrapping && (s10 = true), this.editorWidth = e21.scrollDOM.clientWidth, c10 |= 8); + var p10 = e21.scrollDOM.scrollTop * this.scaleY; + this.scrollTop != p10 && (this.scrollAnchorHeight = -1, this.scrollTop = p10), this.scrolledToBottom = dH(e21.scrollDOM); + var m10 = (this.printing ? lJ : cJ)(t10, this.paddingTop), g10 = m10.top - this.pixelViewport.top, y10 = m10.bottom - this.pixelViewport.bottom; + this.pixelViewport = m10; + var b10 = this.pixelViewport.bottom > this.pixelViewport.top && this.pixelViewport.right > this.pixelViewport.left; + if (b10 != this.inView && (this.inView = b10, b10 && (s10 = true)), !this.inView && !this.scrollTarget) + return 0; + var k10 = a10.width; + if (this.contentDOMWidth == k10 && this.editorHeight == e21.scrollDOM.clientHeight || (this.contentDOMWidth = a10.width, this.editorHeight = e21.scrollDOM.clientHeight, c10 |= 8), s10) { + var w10 = e21.docView.measureVisibleLineHeights(this.viewport); + if (r10.mustRefreshForHeights(w10) && (i10 = true), i10 || r10.lineWrapping && Math.abs(k10 - this.contentDOMWidth) > r10.charWidth) { + var x10 = e21.docView.measureTextSize(), j10 = x10.lineHeight, S10 = x10.charWidth, C10 = x10.textHeight; + (i10 = j10 > 0 && r10.refresh(o10, j10, S10, C10, k10 / S10, w10)) && (e21.docView.minWidth = 0, c10 |= 8); + } + g10 > 0 && y10 > 0 ? l10 = Math.max(g10, y10) : g10 < 0 && y10 < 0 && (l10 = Math.min(g10, y10)), r10.heightChanged = false; + var $10, _10 = bo(this.viewports); + try { + for (_10.s(); !($10 = _10.n()).done; ) { + var O10 = $10.value, M10 = O10.from == this.viewport.from ? w10 : e21.docView.measureVisibleLineHeights(O10); + this.heightMap = (i10 ? eJ.empty().applyChanges(this.stateDeco, UL.empty, this.heightOracle, [new eU(0, 0, 0, e21.state.doc.length)]) : this.heightMap).updateHeight(r10, 0, i10, new QU(O10.from, M10)); + } + } catch (e23) { + _10.e(e23); + } finally { + _10.f(); + } + r10.heightChanged && (c10 |= 2); + } + var E10 = !this.viewportIsAppropriate(this.viewport, l10) || this.scrollTarget && (this.scrollTarget.range.head < this.viewport.from || this.scrollTarget.range.head > this.viewport.to); + return E10 && (this.viewport = this.getViewport(l10, this.scrollTarget)), this.updateForViewport(), (2 & c10 || E10) && this.updateViewportLines(), (this.lineGaps.length || this.viewport.to - this.viewport.from > 4e3) && this.updateLineGaps(this.ensureLineGaps(i10 ? [] : this.lineGaps, e21)), c10 |= this.computeVisibleRanges(), this.mustEnforceCursorAssoc && (this.mustEnforceCursorAssoc = false, e21.docView.enforceCursorAssoc()), c10; + } }, { key: "visibleTop", get: function() { + return this.scaler.fromDOM(this.pixelViewport.top); + } }, { key: "visibleBottom", get: function() { + return this.scaler.fromDOM(this.pixelViewport.bottom); + } }, { key: "getViewport", value: function(e21, t10) { + var n10 = 0.5 - Math.max(-0.5, Math.min(0.5, e21 / 1e3 / 2)), r10 = this.heightMap, o10 = this.heightOracle, i10 = this.visibleTop, a10 = this.visibleBottom, s10 = new hJ(r10.lineAt(i10 - 1e3 * n10, XU.ByHeight, o10, 0, 0).from, r10.lineAt(a10 + 1e3 * (1 - n10), XU.ByHeight, o10, 0, 0).to); + if (t10) { + var c10 = t10.range.head; + if (c10 < s10.from || c10 > s10.to) { + var l10, u10 = Math.min(this.editorHeight, this.pixelViewport.bottom - this.pixelViewport.top), f10 = r10.lineAt(c10, XU.ByPos, o10, 0, 0); + l10 = "center" == t10.y ? (f10.top + f10.bottom) / 2 - u10 / 2 : "start" == t10.y || "nearest" == t10.y && c10 < s10.from ? f10.top : f10.bottom - u10, s10 = new hJ(r10.lineAt(l10 - 500, XU.ByHeight, o10, 0, 0).from, r10.lineAt(l10 + u10 + 500, XU.ByHeight, o10, 0, 0).to); + } + } + return s10; + } }, { key: "mapViewport", value: function(e21, t10) { + var n10 = t10.mapPos(e21.from, -1), r10 = t10.mapPos(e21.to, 1); + return new hJ(this.heightMap.lineAt(n10, XU.ByPos, this.heightOracle, 0, 0).from, this.heightMap.lineAt(r10, XU.ByPos, this.heightOracle, 0, 0).to); + } }, { key: "viewportIsAppropriate", value: function(e21) { + var t10 = e21.from, n10 = e21.to, r10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; + if (!this.inView) + return true; + var o10 = this.heightMap.lineAt(t10, XU.ByPos, this.heightOracle, 0, 0).top, i10 = this.heightMap.lineAt(n10, XU.ByPos, this.heightOracle, 0, 0).bottom, a10 = this.visibleTop, s10 = this.visibleBottom; + return (0 == t10 || o10 <= a10 - Math.max(10, Math.min(-r10, 250))) && (n10 == this.state.doc.length || i10 >= s10 + Math.max(10, Math.min(r10, 250))) && o10 > a10 - 2e3 && i10 < s10 + 2e3; + } }, { key: "mapLineGaps", value: function(e21, t10) { + if (!e21.length || t10.empty) + return e21; + var n10, r10 = [], o10 = bo(e21); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = n10.value; + t10.touchesRange(i10.from, i10.to) || r10.push(new uJ(t10.mapPos(i10.from), t10.mapPos(i10.to), i10.size)); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + return r10; + } }, { key: "ensureLineGaps", value: function(e21, t10) { + var n10 = this, r10 = this.heightOracle.lineWrapping, o10 = r10 ? 1e4 : 2e3, i10 = o10 >> 1, a10 = o10 << 1; + if (this.defaultTextDirection != rW.LTR && !r10) + return []; + var s10, c10 = [], l10 = function o11(a11, s11, l11, u11) { + if (!(s11 - a11 < i10)) { + var f11 = n10.state.selection.main, d11 = [f11.from]; + f11.empty || d11.push(f11.to); + for (var h11 = 0, v11 = d11; h11 < v11.length; h11++) { + var p11 = v11[h11]; + if (p11 > a11 && p11 < s11) + return o11(a11, p11 - 10, l11, u11), void o11(p11 + 10, s11, l11, u11); + } + var m11 = function(e23, t11) { + var n11, r11 = bo(e23); + try { + for (r11.s(); !(n11 = r11.n()).done; ) { + var o12 = n11.value; + if (t11(o12)) + return o12; + } + } catch (e24) { + r11.e(e24); + } finally { + r11.f(); + } + return; + }(e21, function(e23) { + return e23.from >= l11.from && e23.to <= l11.to && Math.abs(e23.from - a11) < i10 && Math.abs(e23.to - s11) < i10 && !d11.some(function(t11) { + return e23.from < t11 && e23.to > t11; + }); + }); + if (!m11) { + if (s11 < l11.to && t10 && r10 && t10.visibleRanges.some(function(e23) { + return e23.from <= s11 && e23.to >= s11; + })) { + var g11 = t10.moveToLineBoundary($F.cursor(s11), false, true).head; + g11 > a11 && (s11 = g11); + } + m11 = new uJ(a11, s11, n10.gapSize(l11, a11, s11, u11)); + } + c10.push(m11); + } + }, u10 = bo(this.viewportLines); + try { + for (u10.s(); !(s10 = u10.n()).done; ) { + var f10 = s10.value; + if (!(f10.length < a10)) { + var d10 = vJ(f10.from, f10.to, this.stateDeco); + if (!(d10.total < a10)) { + var h10 = this.scrollTarget ? this.scrollTarget.range.head : null, v10 = void 0, p10 = void 0; + if (r10) { + var m10 = o10 / this.heightOracle.lineLength * this.heightOracle.lineHeight, g10 = void 0, y10 = void 0; + if (null != h10) { + var b10 = mJ(d10, h10), k10 = ((this.visibleBottom - this.visibleTop) / 2 + m10) / f10.height; + g10 = b10 - k10, y10 = b10 + k10; + } else + g10 = (this.visibleTop - f10.top - m10) / f10.height, y10 = (this.visibleBottom - f10.top + m10) / f10.height; + v10 = pJ(d10, g10), p10 = pJ(d10, y10); + } else { + var w10 = d10.total * this.heightOracle.charWidth, x10 = o10 * this.heightOracle.charWidth, j10 = void 0, S10 = void 0; + if (null != h10) { + var C10 = mJ(d10, h10), $10 = ((this.pixelViewport.right - this.pixelViewport.left) / 2 + x10) / w10; + j10 = C10 - $10, S10 = C10 + $10; + } else + j10 = (this.pixelViewport.left - x10) / w10, S10 = (this.pixelViewport.right + x10) / w10; + v10 = pJ(d10, j10), p10 = pJ(d10, S10); + } + v10 > f10.from && l10(f10.from, v10, f10, d10), p10 < f10.to && l10(p10, f10.to, f10, d10); + } + } + } + } catch (e23) { + u10.e(e23); + } finally { + u10.f(); + } + return c10; + } }, { key: "gapSize", value: function(e21, t10, n10, r10) { + var o10 = mJ(r10, n10) - mJ(r10, t10); + return this.heightOracle.lineWrapping ? e21.height * o10 : r10.total * this.heightOracle.charWidth * o10; + } }, { key: "updateLineGaps", value: function(e21) { + var t10 = this; + uJ.same(e21, this.lineGaps) || (this.lineGaps = e21, this.lineGapDeco = KH.set(e21.map(function(e23) { + return e23.draw(t10, t10.heightOracle.lineWrapping); + }))); + } }, { key: "computeVisibleRanges", value: function() { + var e21 = this.stateDeco; + this.lineGaps.length && (e21 = e21.concat(this.lineGapDeco)); + var t10 = []; + xV.spans(e21, this.viewport.from, this.viewport.to, { span: function(e23, n11) { + t10.push({ from: e23, to: n11 }); + }, point: function() { + } }, 20); + var n10 = t10.length != this.visibleRanges.length || this.visibleRanges.some(function(e23, n11) { + return e23.from != t10[n11].from || e23.to != t10[n11].to; + }); + return this.visibleRanges = t10, n10 ? 4 : 0; + } }, { key: "lineBlockAt", value: function(e21) { + return e21 >= this.viewport.from && e21 <= this.viewport.to && this.viewportLines.find(function(t10) { + return t10.from <= e21 && t10.to >= e21; + }) || bJ(this.heightMap.lineAt(e21, XU.ByPos, this.heightOracle, 0, 0), this.scaler); + } }, { key: "lineBlockAtHeight", value: function(e21) { + return bJ(this.heightMap.lineAt(this.scaler.fromDOM(e21), XU.ByHeight, this.heightOracle, 0, 0), this.scaler); + } }, { key: "scrollAnchorAt", value: function(e21) { + var t10 = this.lineBlockAtHeight(e21 + 8); + return t10.from >= this.viewport.from || this.viewportLines[0].top - e21 > 200 ? t10 : this.viewportLines[0]; + } }, { key: "elementAtHeight", value: function(e21) { + return bJ(this.heightMap.blockAt(this.scaler.fromDOM(e21), this.heightOracle, 0, 0), this.scaler); + } }, { key: "docHeight", get: function() { + return this.scaler.toDOM(this.heightMap.height); + } }, { key: "contentHeight", get: function() { + return this.docHeight + this.paddingTop + this.paddingBottom; + } }]), e20; + }(); + var hJ = Do(function e4(t10, n10) { + No(this, e4), this.from = t10, this.to = n10; + }); + function vJ(e20, t10, n10) { + var r10 = [], o10 = e20, i10 = 0; + return xV.spans(n10, e20, t10, { span: function() { + }, point: function(e21, t11) { + e21 > o10 && (r10.push({ from: o10, to: e21 }), i10 += e21 - o10), o10 = t11; + } }, 20), o10 < t10 && (r10.push({ from: o10, to: t10 }), i10 += t10 - o10), { total: i10, ranges: r10 }; + } + function pJ(e20, t10) { + var n10 = e20.total, r10 = e20.ranges; + if (t10 <= 0) + return r10[0].from; + if (t10 >= 1) + return r10[r10.length - 1].to; + for (var o10 = Math.floor(n10 * t10), i10 = 0; ; i10++) { + var a10 = r10[i10], s10 = a10.from, c10 = a10.to - s10; + if (o10 <= c10) + return s10 + o10; + o10 -= c10; + } + } + function mJ(e20, t10) { + var n10, r10 = 0, o10 = bo(e20.ranges); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = n10.value, a10 = i10.from, s10 = i10.to; + if (t10 <= s10) { + r10 += t10 - a10; + break; + } + r10 += s10 - a10; + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + return r10 / e20.total; + } + var gJ = { toDOM: function(e20) { + return e20; + }, fromDOM: function(e20) { + return e20; + }, scale: 1 }; + var yJ = function() { + function e20(t10, n10, r10) { + No(this, e20); + var o10 = 0, i10 = 0, a10 = 0; + this.viewports = r10.map(function(e21) { + var r11 = e21.from, i11 = e21.to, a11 = n10.lineAt(r11, XU.ByPos, t10, 0, 0).top, s11 = n10.lineAt(i11, XU.ByPos, t10, 0, 0).bottom; + return o10 += s11 - a11, { from: r11, to: i11, top: a11, bottom: s11, domTop: 0, domBottom: 0 }; + }), this.scale = (7e6 - o10) / (n10.height - o10); + var s10, c10 = bo(this.viewports); + try { + for (c10.s(); !(s10 = c10.n()).done; ) { + var l10 = s10.value; + l10.domTop = a10 + (l10.top - i10) * this.scale, a10 = l10.domBottom = l10.domTop + (l10.bottom - l10.top), i10 = l10.bottom; + } + } catch (e21) { + c10.e(e21); + } finally { + c10.f(); + } + } + return Do(e20, [{ key: "toDOM", value: function(e21) { + for (var t10 = 0, n10 = 0, r10 = 0; ; t10++) { + var o10 = t10 < this.viewports.length ? this.viewports[t10] : null; + if (!o10 || e21 < o10.top) + return r10 + (e21 - n10) * this.scale; + if (e21 <= o10.bottom) + return o10.domTop + (e21 - o10.top); + n10 = o10.bottom, r10 = o10.domBottom; + } + } }, { key: "fromDOM", value: function(e21) { + for (var t10 = 0, n10 = 0, r10 = 0; ; t10++) { + var o10 = t10 < this.viewports.length ? this.viewports[t10] : null; + if (!o10 || e21 < o10.domTop) + return n10 + (e21 - r10) / this.scale; + if (e21 <= o10.domBottom) + return o10.top + (e21 - o10.domTop); + n10 = o10.bottom, r10 = o10.domBottom; + } + } }]), e20; + }(); + function bJ(e20, t10) { + if (1 == t10.scale) + return e20; + var n10 = t10.toDOM(e20.top), r10 = t10.toDOM(e20.bottom); + return new YU(e20.from, e20.length, n10, r10 - n10, Array.isArray(e20._content) ? e20._content.map(function(e21) { + return bJ(e21, t10); + }) : e20._content); + } + var kJ = MF.define({ combine: function(e20) { + return e20.join(" "); + } }); + var wJ = MF.define({ combine: function(e20) { + return e20.indexOf(true) > -1; + } }); + var xJ = zV.newName(); + var jJ = zV.newName(); + var SJ = zV.newName(); + var CJ = { "&light": "." + jJ, "&dark": "." + SJ }; + function $J(e20, t10, n10) { + return new zV(t10, { finish: function(t11) { + return /&/.test(t11) ? t11.replace(/&\w*/, function(t12) { + if ("&" == t12) + return e20; + if (!n10 || !n10[t12]) + throw new RangeError("Unsupported selector: ".concat(t12)); + return n10[t12]; + }) : e20 + " " + t11; + } }); + } + var _J = $J("." + xJ, { "&": { position: "relative !important", boxSizing: "border-box", "&.cm-focused": { outline: "1px dotted #212121" }, display: "flex !important", flexDirection: "column" }, ".cm-scroller": { display: "flex !important", alignItems: "flex-start !important", fontFamily: "monospace", lineHeight: 1.4, height: "100%", overflowX: "auto", position: "relative", zIndex: 0 }, ".cm-content": { margin: 0, flexGrow: 2, flexShrink: 0, display: "block", whiteSpace: "pre", wordWrap: "normal", boxSizing: "border-box", minHeight: "100%", padding: "4px 0", outline: "none", "&[contenteditable=true]": { WebkitUserModify: "read-write-plaintext-only" } }, ".cm-lineWrapping": { whiteSpace_fallback: "pre-wrap", whiteSpace: "break-spaces", wordBreak: "break-word", overflowWrap: "anywhere", flexShrink: 1 }, "&light .cm-content": { caretColor: "black" }, "&dark .cm-content": { caretColor: "white" }, ".cm-line": { display: "block", padding: "0 2px 0 6px" }, ".cm-layer": { position: "absolute", left: 0, top: 0, contain: "size style", "& > *": { position: "absolute" } }, "&light .cm-selectionBackground": { background: "#d9d9d9" }, "&dark .cm-selectionBackground": { background: "#222" }, "&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": { background: "#d7d4f0" }, "&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": { background: "#233" }, ".cm-cursorLayer": { pointerEvents: "none" }, "&.cm-focused > .cm-scroller > .cm-cursorLayer": { animation: "steps(1) cm-blink 1.2s infinite" }, "@keyframes cm-blink": { "0%": {}, "50%": { opacity: 0 }, "100%": {} }, "@keyframes cm-blink2": { "0%": {}, "50%": { opacity: 0 }, "100%": {} }, ".cm-cursor, .cm-dropCursor": { borderLeft: "1.2px solid black", marginLeft: "-0.6px", pointerEvents: "none" }, ".cm-cursor": { display: "none" }, "&dark .cm-cursor": { borderLeftColor: "#444" }, ".cm-dropCursor": { position: "absolute" }, "&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor": { display: "block" }, ".cm-iso": { unicodeBidi: "isolate" }, ".cm-announced": { position: "fixed", top: "-10000px" }, "@media print": { ".cm-announced": { display: "none" } }, "&light .cm-activeLine": { backgroundColor: "#cceeff44" }, "&dark .cm-activeLine": { backgroundColor: "#99eeff33" }, "&light .cm-specialChar": { color: "red" }, "&dark .cm-specialChar": { color: "#f78" }, ".cm-gutters": { flexShrink: 0, display: "flex", height: "100%", boxSizing: "border-box", insetInlineStart: 0, zIndex: 200 }, "&light .cm-gutters": { backgroundColor: "#f5f5f5", color: "#6c6c6c", borderRight: "1px solid #ddd" }, "&dark .cm-gutters": { backgroundColor: "#333338", color: "#ccc" }, ".cm-gutter": { display: "flex !important", flexDirection: "column", flexShrink: 0, boxSizing: "border-box", minHeight: "100%", overflow: "hidden" }, ".cm-gutterElement": { boxSizing: "border-box" }, ".cm-lineNumbers .cm-gutterElement": { padding: "0 3px 0 5px", minWidth: "20px", textAlign: "right", whiteSpace: "nowrap" }, "&light .cm-activeLineGutter": { backgroundColor: "#e2f2ff" }, "&dark .cm-activeLineGutter": { backgroundColor: "#222227" }, ".cm-panels": { boxSizing: "border-box", position: "sticky", left: 0, right: 0 }, "&light .cm-panels": { backgroundColor: "#f5f5f5", color: "black" }, "&light .cm-panels-top": { borderBottom: "1px solid #ddd" }, "&light .cm-panels-bottom": { borderTop: "1px solid #ddd" }, "&dark .cm-panels": { backgroundColor: "#333338", color: "white" }, ".cm-tab": { display: "inline-block", overflow: "hidden", verticalAlign: "bottom" }, ".cm-widgetBuffer": { verticalAlign: "text-top", height: "1em", width: 0, display: "inline" }, ".cm-placeholder": { color: "#888", display: "inline-block", verticalAlign: "top" }, ".cm-highlightSpace:before": { content: "attr(data-display)", position: "absolute", pointerEvents: "none", color: "#888" }, ".cm-highlightTab": { backgroundImage: `url('data:image/svg+xml,')`, backgroundSize: "auto 100%", backgroundPosition: "right 90%", backgroundRepeat: "no-repeat" }, ".cm-trailingSpace": { backgroundColor: "#ff332255" }, ".cm-button": { verticalAlign: "middle", color: "inherit", fontSize: "70%", padding: ".2em 1em", borderRadius: "1px" }, "&light .cm-button": { backgroundImage: "linear-gradient(#eff1f5, #d9d9df)", border: "1px solid #888", "&:active": { backgroundImage: "linear-gradient(#b4b4b4, #d0d3d6)" } }, "&dark .cm-button": { backgroundImage: "linear-gradient(#393939, #111)", border: "1px solid #888", "&:active": { backgroundImage: "linear-gradient(#111, #333)" } }, ".cm-textfield": { verticalAlign: "middle", color: "inherit", fontSize: "70%", border: "1px solid silver", padding: ".2em .5em" }, "&light .cm-textfield": { backgroundColor: "white" }, "&dark .cm-textfield": { border: "1px solid #555", backgroundColor: "inherit" } }, CJ); + var OJ = "\uFFFF"; + var MJ = function() { + function e20(t10, n10) { + No(this, e20), this.points = t10, this.text = "", this.lineSeparator = n10.facet(mV.lineSeparator); + } + return Do(e20, [{ key: "append", value: function(e21) { + this.text += e21; + } }, { key: "lineBreak", value: function() { + this.text += OJ; + } }, { key: "readRange", value: function(e21, t10) { + if (!e21) + return this; + for (var n10 = e21.parentNode, r10 = e21; ; ) { + this.findPointBefore(n10, r10); + var o10 = this.text.length; + this.readNode(r10); + var i10 = r10.nextSibling; + if (i10 == t10) + break; + var a10 = pH.get(r10), s10 = pH.get(i10); + (a10 && s10 ? a10.breakAfter : (a10 ? a10.breakAfter : AJ(r10)) || AJ(i10) && ("BR" != r10.nodeName || r10.cmIgnore) && this.text.length > o10) && this.lineBreak(), r10 = i10; + } + return this.findPointBefore(n10, t10), this; + } }, { key: "readTextNode", value: function(e21) { + var t10, n10 = e21.nodeValue, r10 = bo(this.points); + try { + for (r10.s(); !(t10 = r10.n()).done; ) { + var o10 = t10.value; + o10.node == e21 && (o10.pos = this.text.length + Math.min(o10.offset, n10.length)); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + for (var i10 = 0, a10 = this.lineSeparator ? null : /\r\n?|\n/g; ; ) { + var s10 = -1, c10 = 1, l10 = void 0; + if (this.lineSeparator ? (s10 = n10.indexOf(this.lineSeparator, i10), c10 = this.lineSeparator.length) : (l10 = a10.exec(n10)) && (s10 = l10.index, c10 = l10[0].length), this.append(n10.slice(i10, s10 < 0 ? n10.length : s10)), s10 < 0) + break; + if (this.lineBreak(), c10 > 1) { + var u10, f10 = bo(this.points); + try { + for (f10.s(); !(u10 = f10.n()).done; ) { + var d10 = u10.value; + d10.node == e21 && d10.pos > this.text.length && (d10.pos -= c10 - 1); + } + } catch (e23) { + f10.e(e23); + } finally { + f10.f(); + } + } + i10 = s10 + c10; + } + } }, { key: "readNode", value: function(e21) { + if (!e21.cmIgnore) { + var t10 = pH.get(e21), n10 = t10 && t10.overrideDOMText; + if (null != n10) { + this.findPointInside(e21, n10.length); + for (var r10 = n10.iter(); !r10.next().done; ) + r10.lineBreak ? this.lineBreak() : this.append(r10.value); + } else + 3 == e21.nodeType ? this.readTextNode(e21) : "BR" == e21.nodeName ? e21.nextSibling && this.lineBreak() : 1 == e21.nodeType && this.readRange(e21.firstChild, null); + } + } }, { key: "findPointBefore", value: function(e21, t10) { + var n10, r10 = bo(this.points); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + o10.node == e21 && e21.childNodes[o10.offset] == t10 && (o10.pos = this.text.length); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + } }, { key: "findPointInside", value: function(e21, t10) { + var n10, r10 = bo(this.points); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + (3 == e21.nodeType ? o10.node == e21 : e21.contains(o10.node)) && (o10.pos = this.text.length + (EJ(e21, o10.node, o10.offset) ? t10 : 0)); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + } }]), e20; + }(); + function EJ(e20, t10, n10) { + for (; ; ) { + if (!t10 || n10 < tH(t10)) + return false; + if (t10 == e20) + return true; + n10 = ZV(t10) + 1, t10 = t10.parentNode; + } + } + function AJ(e20) { + return 1 == e20.nodeType && /^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e20.nodeName); + } + var PJ = Do(function e5(t10, n10) { + No(this, e5), this.node = t10, this.offset = n10, this.pos = -1; + }); + var TJ = Do(function e6(t10, n10, r10, o10) { + No(this, e6), this.typeOver = o10, this.bounds = null, this.text = ""; + var i10 = t10.docView, a10 = i10.impreciseHead, s10 = i10.impreciseAnchor; + if (t10.state.readOnly && n10 > -1) + this.newSel = null; + else if (n10 > -1 && (this.bounds = t10.docView.domBoundsAround(n10, r10, 0))) { + var c10 = a10 || s10 ? [] : function(e20) { + var t11 = []; + if (e20.root.activeElement != e20.contentDOM) + return t11; + var n11 = e20.observer.selectionRange, r11 = n11.anchorNode, o11 = n11.anchorOffset, i11 = n11.focusNode, a11 = n11.focusOffset; + r11 && (t11.push(new PJ(r11, o11)), i11 == r11 && a11 == o11 || t11.push(new PJ(i11, a11))); + return t11; + }(t10), l10 = new MJ(c10, t10.state); + l10.readRange(this.bounds.startDOM, this.bounds.endDOM), this.text = l10.text, this.newSel = function(e20, t11) { + if (0 == e20.length) + return null; + var n11 = e20[0].pos, r11 = 2 == e20.length ? e20[1].pos : n11; + return n11 > -1 && r11 > -1 ? $F.single(n11 + t11, r11 + t11) : null; + }(c10, this.bounds.from); + } else { + var u10 = t10.observer.selectionRange, f10 = a10 && a10.node == u10.focusNode && a10.offset == u10.focusOffset || !GV(t10.contentDOM, u10.focusNode) ? t10.state.selection.main.head : t10.docView.posFromDOM(u10.focusNode, u10.focusOffset), d10 = s10 && s10.node == u10.anchorNode && s10.offset == u10.anchorOffset || !GV(t10.contentDOM, u10.anchorNode) ? t10.state.selection.main.anchor : t10.docView.posFromDOM(u10.anchorNode, u10.anchorOffset), h10 = t10.viewport; + if (AH.ios && t10.state.selection.main.empty && f10 != d10 && (h10.from > 0 || h10.to < t10.state.doc.length)) { + var v10 = h10.from - Math.min(f10, d10), p10 = h10.to - Math.max(f10, d10); + 0 != v10 && 1 != v10 || 0 != p10 && -1 != p10 || (f10 = 0, d10 = t10.state.doc.length); + } + this.newSel = $F.single(d10, f10); + } + }); + function RJ(e20, t10) { + var n10, r10 = t10.newSel, o10 = e20.state.selection.main, i10 = e20.inputState.lastKeyTime > Date.now() - 100 ? e20.inputState.lastKeyCode : -1; + if (t10.bounds) { + var a10 = t10.bounds, s10 = a10.from, c10 = a10.to, l10 = o10.from, u10 = null; + (8 === i10 || AH.android && t10.text.length < c10 - s10) && (l10 = o10.to, u10 = "end"); + var f10 = function(e21, t11, n11, r11) { + var o11 = Math.min(e21.length, t11.length), i11 = 0; + for (; i11 < o11 && e21.charCodeAt(i11) == t11.charCodeAt(i11); ) + i11++; + if (i11 == o11 && e21.length == t11.length) + return null; + var a11 = e21.length, s11 = t11.length; + for (; a11 > 0 && s11 > 0 && e21.charCodeAt(a11 - 1) == t11.charCodeAt(s11 - 1); ) + a11--, s11--; + if ("end" == r11) { + n11 -= a11 + Math.max(0, i11 - Math.min(a11, s11)) - i11; + } + if (a11 < i11 && e21.length < t11.length) { + s11 = (i11 -= n11 <= i11 && n11 >= a11 ? i11 - n11 : 0) + (s11 - a11), a11 = i11; + } else if (s11 < i11) { + a11 = (i11 -= n11 <= i11 && n11 >= s11 ? i11 - n11 : 0) + (a11 - s11), s11 = i11; + } + return { from: i11, toA: a11, toB: s11 }; + }(e20.state.doc.sliceString(s10, c10, OJ), t10.text, l10 - s10, u10); + f10 && (AH.chrome && 13 == i10 && f10.toB == f10.from + 2 && t10.text.slice(f10.from, f10.toB) == OJ + OJ && f10.toB--, n10 = { from: s10 + f10.from, to: s10 + f10.toA, insert: UL.of(t10.text.slice(f10.from, f10.toB).split(OJ)) }); + } else + r10 && (!e20.hasFocus && e20.state.facet(zW) || r10.main.eq(o10)) && (r10 = null); + if (!n10 && !r10) + return false; + if (!n10 && t10.typeOver && !o10.empty && r10 && r10.main.empty ? n10 = { from: o10.from, to: o10.to, insert: e20.state.doc.slice(o10.from, o10.to) } : n10 && n10.from >= o10.from && n10.to <= o10.to && (n10.from != o10.from || n10.to != o10.to) && o10.to - o10.from - (n10.to - n10.from) <= 4 ? n10 = { from: o10.from, to: o10.to, insert: e20.state.doc.slice(o10.from, n10.from).append(n10.insert).append(e20.state.doc.slice(n10.to, o10.to)) } : (AH.mac || AH.android) && n10 && n10.from == n10.to && n10.from == o10.head - 1 && /^\. ?$/.test(n10.insert.toString()) && "off" == e20.contentDOM.getAttribute("autocorrect") ? (r10 && 2 == n10.insert.length && (r10 = $F.single(r10.main.anchor - 1, r10.main.head - 1)), n10 = { from: o10.from, to: o10.to, insert: UL.of([" "]) }) : AH.chrome && n10 && n10.from == n10.to && n10.from == o10.head && "\n " == n10.insert.toString() && e20.lineWrapping && (r10 && (r10 = $F.single(r10.main.anchor - 1, r10.main.head - 1)), n10 = { from: o10.from, to: o10.to, insert: UL.of([" "]) }), n10) { + if (AH.ios && e20.inputState.flushIOSKey()) + return true; + if (AH.android && (n10.from == o10.from && n10.to == o10.to && 1 == n10.insert.length && 2 == n10.insert.lines && uH(e20.contentDOM, "Enter", 13) || (n10.from == o10.from - 1 && n10.to == o10.to && 0 == n10.insert.length || 8 == i10 && n10.insert.length < n10.to - n10.from && n10.to > o10.head) && uH(e20.contentDOM, "Backspace", 8) || n10.from == o10.from && n10.to == o10.to + 1 && 0 == n10.insert.length && uH(e20.contentDOM, "Delete", 46))) + return true; + var d10, h10 = n10.insert.toString(); + e20.inputState.composing >= 0 && e20.inputState.composing++; + var v10 = function() { + return d10 || (d10 = function(e21, t11, n11) { + var r11, o11 = e21.state, i11 = o11.selection.main; + if (t11.from >= i11.from && t11.to <= i11.to && t11.to - t11.from >= (i11.to - i11.from) / 3 && (!n11 || n11.main.empty && n11.main.from == t11.from + t11.insert.length) && e21.inputState.composing < 0) { + var a11 = i11.from < t11.from ? o11.sliceDoc(i11.from, t11.from) : "", s11 = i11.to > t11.to ? o11.sliceDoc(t11.to, i11.to) : ""; + r11 = o11.replaceSelection(e21.state.toText(a11 + t11.insert.sliceString(0, void 0, e21.state.lineBreak) + s11)); + } else { + var c11 = o11.changes(t11), l11 = n11 && n11.main.to <= c11.newLength ? n11.main : void 0; + if (o11.selection.ranges.length > 1 && e21.inputState.composing >= 0 && t11.to <= i11.to && t11.to >= i11.to - 10) { + var u11, f11 = e21.state.sliceDoc(t11.from, t11.to), d11 = n11 && oU(e21, n11.main.head); + if (d11) { + var h11 = t11.insert.length - (t11.to - t11.from); + u11 = { from: d11.from, to: d11.to - h11 }; + } else + u11 = e21.state.doc.lineAt(i11.head); + var v11 = i11.to - t11.to, p11 = i11.to - i11.from; + r11 = o11.changeByRange(function(n12) { + if (n12.from == i11.from && n12.to == i11.to) + return { changes: c11, range: l11 || n12.map(c11) }; + var r12 = n12.to - v11, a12 = r12 - f11.length; + if (n12.to - n12.from != p11 || e21.state.sliceDoc(a12, r12) != f11 || n12.to >= u11.from && n12.from <= u11.to) + return { range: n12 }; + var s12 = o11.changes({ from: a12, to: r12, insert: t11.insert }), d12 = n12.to - i11.to; + return { changes: s12, range: l11 ? $F.range(Math.max(0, l11.anchor + d12), Math.max(0, l11.head + d12)) : n12.map(s12) }; + }); + } else + r11 = { changes: c11, selection: l11 && o11.selection.replaceRange(l11) }; + } + var m11 = "input.type"; + (e21.composing || e21.inputState.compositionPendingChange && e21.inputState.compositionEndedAt > Date.now() - 50) && (e21.inputState.compositionPendingChange = false, m11 += ".compose", e21.inputState.compositionFirstChange && (m11 += ".start", e21.inputState.compositionFirstChange = false)); + return o11.update(r11, { userEvent: m11, scrollIntoView: true }); + }(e20, n10, r10)); + }; + return e20.state.facet(PW).some(function(t11) { + return t11(e20, n10.from, n10.to, h10, v10); + }) || e20.dispatch(v10()), true; + } + if (r10 && !r10.main.eq(o10)) { + var p10 = false, m10 = "select"; + return e20.inputState.lastSelectionTime > Date.now() - 50 && ("select" == e20.inputState.lastSelectionOrigin && (p10 = true), m10 = e20.inputState.lastSelectionOrigin), e20.dispatch({ selection: r10, scrollIntoView: p10, userEvent: m10 }), true; + } + return false; + } + var NJ = { childList: true, characterData: true, subtree: true, attributes: true, characterDataOldValue: true }; + var IJ = AH.ie && AH.ie_version <= 11; + var DJ = function() { + function e20(t10) { + var n10 = this; + No(this, e20), this.view = t10, this.active = false, this.selectionRange = new aH(), this.selectionChanged = false, this.delayedFlush = -1, this.resizeTimeout = -1, this.queue = [], this.delayedAndroidKey = null, this.flushingAndroidKey = -1, this.lastChange = 0, this.scrollTargets = [], this.intersection = null, this.resizeScroll = null, this.intersecting = false, this.gapIntersection = null, this.gaps = [], this.parentCheck = -1, this.dom = t10.contentDOM, this.observer = new MutationObserver(function(e21) { + var r10, o10 = bo(e21); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + n10.queue.push(i10); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + (AH.ie && AH.ie_version <= 11 || AH.ios && t10.composing) && e21.some(function(e23) { + return "childList" == e23.type && e23.removedNodes.length || "characterData" == e23.type && e23.oldValue.length > e23.target.nodeValue.length; + }) ? n10.flushSoon() : n10.flush(); + }), IJ && (this.onCharData = function(e21) { + n10.queue.push({ target: e21.target, type: "characterData", oldValue: e21.prevValue }), n10.flushSoon(); + }), this.onSelectionChange = this.onSelectionChange.bind(this), this.onResize = this.onResize.bind(this), this.onPrint = this.onPrint.bind(this), this.onScroll = this.onScroll.bind(this), "function" == typeof ResizeObserver && (this.resizeScroll = new ResizeObserver(function() { + var e21; + (null === (e21 = n10.view.docView) || void 0 === e21 ? void 0 : e21.lastUpdate) < Date.now() - 75 && n10.onResize(); + }), this.resizeScroll.observe(t10.scrollDOM)), this.addWindowListeners(this.win = t10.win), this.start(), "function" == typeof IntersectionObserver && (this.intersection = new IntersectionObserver(function(e21) { + n10.parentCheck < 0 && (n10.parentCheck = setTimeout(n10.listenForScroll.bind(n10), 1e3)), e21.length > 0 && e21[e21.length - 1].intersectionRatio > 0 != n10.intersecting && (n10.intersecting = !n10.intersecting, n10.intersecting != n10.view.inView && n10.onScrollChanged(document.createEvent("Event"))); + }, { threshold: [0, 1e-3] }), this.intersection.observe(this.dom), this.gapIntersection = new IntersectionObserver(function(e21) { + e21.length > 0 && e21[e21.length - 1].intersectionRatio > 0 && n10.onScrollChanged(document.createEvent("Event")); + }, {})), this.listenForScroll(), this.readSelectionRange(); + } + return Do(e20, [{ key: "onScrollChanged", value: function(e21) { + this.view.inputState.runHandlers("scroll", e21), this.intersecting && this.view.measure(); + } }, { key: "onScroll", value: function(e21) { + this.intersecting && this.flush(false), this.onScrollChanged(e21); + } }, { key: "onResize", value: function() { + var e21 = this; + this.resizeTimeout < 0 && (this.resizeTimeout = setTimeout(function() { + e21.resizeTimeout = -1, e21.view.requestMeasure(); + }, 50)); + } }, { key: "onPrint", value: function() { + var e21 = this; + this.view.viewState.printing = true, this.view.measure(), setTimeout(function() { + e21.view.viewState.printing = false, e21.view.requestMeasure(); + }, 500); + } }, { key: "updateGaps", value: function(e21) { + if (this.gapIntersection && (e21.length != this.gaps.length || this.gaps.some(function(t11, n11) { + return t11 != e21[n11]; + }))) { + this.gapIntersection.disconnect(); + var t10, n10 = bo(e21); + try { + for (n10.s(); !(t10 = n10.n()).done; ) { + var r10 = t10.value; + this.gapIntersection.observe(r10); + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + this.gaps = e21; + } + } }, { key: "onSelectionChange", value: function(e21) { + var t10 = this.selectionChanged; + if (this.readSelectionRange() && !this.delayedAndroidKey) { + var n10 = this.view, r10 = this.selectionRange; + if (n10.state.facet(zW) ? n10.root.activeElement == this.dom : QV(n10.dom, r10)) { + var o10 = r10.anchorNode && n10.docView.nearest(r10.anchorNode); + o10 && o10.ignoreEvent(e21) ? t10 || (this.selectionChanged = false) : (AH.ie && AH.ie_version <= 11 || AH.android && AH.chrome) && !n10.state.selection.main.empty && r10.focusNode && XV(r10.focusNode, r10.focusOffset, r10.anchorNode, r10.anchorOffset) ? this.flushSoon() : this.flush(false); + } + } + } }, { key: "readSelectionRange", value: function() { + var e21 = this.view, t10 = AH.safari && 11 == e21.root.nodeType && function(e23) { + for (var t11 = e23.activeElement; t11 && t11.shadowRoot; ) + t11 = t11.shadowRoot.activeElement; + return t11; + }(this.dom.ownerDocument) == this.dom && function(e23) { + var t11 = null; + function n11(e24) { + e24.preventDefault(), e24.stopImmediatePropagation(), t11 = e24.getTargetRanges()[0]; + } + if (e23.contentDOM.addEventListener("beforeinput", n11, true), e23.dom.ownerDocument.execCommand("indent"), e23.contentDOM.removeEventListener("beforeinput", n11, true), !t11) + return null; + var r10 = t11.startContainer, o10 = t11.startOffset, i10 = t11.endContainer, a10 = t11.endOffset, s10 = e23.docView.domAtPos(e23.state.selection.main.anchor); + if (XV(s10.node, s10.offset, i10, a10)) { + var c10 = [i10, a10, r10, o10]; + r10 = c10[0], o10 = c10[1], i10 = c10[2], a10 = c10[3]; + } + return { anchorNode: r10, anchorOffset: o10, focusNode: i10, focusOffset: a10 }; + }(this.view) || KV(e21.root); + if (!t10 || this.selectionRange.eq(t10)) + return false; + var n10 = QV(this.dom, t10); + return n10 && !this.selectionChanged && e21.inputState.lastFocusTime > Date.now() - 200 && e21.inputState.lastTouchTime < Date.now() - 300 && function(e23, t11) { + var n11 = t11.focusNode, r10 = t11.focusOffset; + if (!n11 || t11.anchorNode != n11 || t11.anchorOffset != r10) + return false; + for (r10 = Math.min(r10, tH(n11)); ; ) + if (r10) { + if (1 != n11.nodeType) + return false; + var o10 = n11.childNodes[r10 - 1]; + "false" == o10.contentEditable ? r10-- : r10 = tH(n11 = o10); + } else { + if (n11 == e23) + return true; + r10 = ZV(n11), n11 = n11.parentNode; + } + }(this.dom, t10) ? (this.view.inputState.lastFocusTime = 0, e21.docView.updateSelection(), false) : (this.selectionRange.setRange(t10), n10 && (this.selectionChanged = true), true); + } }, { key: "setSelectionRange", value: function(e21, t10) { + this.selectionRange.set(e21.node, e21.offset, t10.node, t10.offset), this.selectionChanged = false; + } }, { key: "clearSelectionRange", value: function() { + this.selectionRange.set(null, 0, null, 0); + } }, { key: "listenForScroll", value: function() { + this.parentCheck = -1; + for (var e21 = 0, t10 = null, n10 = this.dom; n10; ) + if (1 == n10.nodeType) + !t10 && e21 < this.scrollTargets.length && this.scrollTargets[e21] == n10 ? e21++ : t10 || (t10 = this.scrollTargets.slice(0, e21)), t10 && t10.push(n10), n10 = n10.assignedSlot || n10.parentNode; + else { + if (11 != n10.nodeType) + break; + n10 = n10.host; + } + if (e21 < this.scrollTargets.length && !t10 && (t10 = this.scrollTargets.slice(0, e21)), t10) { + var r10, o10 = bo(this.scrollTargets); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + r10.value.removeEventListener("scroll", this.onScroll); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + var i10, a10 = bo(this.scrollTargets = t10); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + i10.value.addEventListener("scroll", this.onScroll); + } + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + } + } }, { key: "ignore", value: function(e21) { + if (!this.active) + return e21(); + try { + return this.stop(), e21(); + } finally { + this.start(), this.clear(); + } + } }, { key: "start", value: function() { + this.active || (this.observer.observe(this.dom, NJ), IJ && this.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.active = true); + } }, { key: "stop", value: function() { + this.active && (this.active = false, this.observer.disconnect(), IJ && this.dom.removeEventListener("DOMCharacterDataModified", this.onCharData)); + } }, { key: "clear", value: function() { + this.processRecords(), this.queue.length = 0, this.selectionChanged = false; + } }, { key: "delayAndroidKey", value: function(e21, t10) { + var n10, r10 = this; + if (!this.delayedAndroidKey) { + this.flushingAndroidKey = this.view.win.requestAnimationFrame(function() { + var e23 = r10.delayedAndroidKey; + e23 && (r10.clearDelayedAndroidKey(), r10.view.inputState.lastKeyCode = e23.keyCode, r10.view.inputState.lastKeyTime = Date.now(), !r10.flush() && e23.force && uH(r10.dom, e23.key, e23.keyCode)); + }); + } + this.delayedAndroidKey && "Enter" != e21 || (this.delayedAndroidKey = { key: e21, keyCode: t10, force: this.lastChange < Date.now() - 50 || !!(null === (n10 = this.delayedAndroidKey) || void 0 === n10 ? void 0 : n10.force) }); + } }, { key: "clearDelayedAndroidKey", value: function() { + this.win.cancelAnimationFrame(this.flushingAndroidKey), this.delayedAndroidKey = null, this.flushingAndroidKey = -1; + } }, { key: "flushSoon", value: function() { + var e21 = this; + this.delayedFlush < 0 && (this.delayedFlush = this.view.win.requestAnimationFrame(function() { + e21.delayedFlush = -1, e21.flush(); + })); + } }, { key: "forceFlush", value: function() { + this.delayedFlush >= 0 && (this.view.win.cancelAnimationFrame(this.delayedFlush), this.delayedFlush = -1), this.flush(); + } }, { key: "pendingRecords", value: function() { + var e21, t10 = bo(this.observer.takeRecords()); + try { + for (t10.s(); !(e21 = t10.n()).done; ) { + var n10 = e21.value; + this.queue.push(n10); + } + } catch (e23) { + t10.e(e23); + } finally { + t10.f(); + } + return this.queue; + } }, { key: "processRecords", value: function() { + var e21 = this.pendingRecords(); + e21.length && (this.queue = []); + var t10, n10 = -1, r10 = -1, o10 = false, i10 = bo(e21); + try { + for (i10.s(); !(t10 = i10.n()).done; ) { + var a10 = t10.value, s10 = this.readMutation(a10); + s10 && (s10.typeOver && (o10 = true), -1 == n10 ? (n10 = s10.from, r10 = s10.to) : (n10 = Math.min(s10.from, n10), r10 = Math.max(s10.to, r10))); + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + return { from: n10, to: r10, typeOver: o10 }; + } }, { key: "readChange", value: function() { + var e21 = this.processRecords(), t10 = e21.from, n10 = e21.to, r10 = e21.typeOver, o10 = this.selectionChanged && QV(this.dom, this.selectionRange); + if (t10 < 0 && !o10) + return null; + t10 > -1 && (this.lastChange = Date.now()), this.view.inputState.lastFocusTime = 0, this.selectionChanged = false; + var i10 = new TJ(this.view, t10, n10, r10); + return this.view.docView.domChanged = { newSel: i10.newSel ? i10.newSel.main : null }, i10; + } }, { key: "flush", value: function() { + var e21 = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; + if (this.delayedFlush >= 0 || this.delayedAndroidKey) + return false; + e21 && this.readSelectionRange(); + var t10 = this.readChange(); + if (!t10) + return this.view.requestMeasure(), false; + var n10 = this.view.state, r10 = RJ(this.view, t10); + return this.view.state == n10 && this.view.update([]), r10; + } }, { key: "readMutation", value: function(e21) { + var t10 = this.view.docView.nearest(e21.target); + if (!t10 || t10.ignoreMutation(e21)) + return null; + if (t10.markDirty("attributes" == e21.type), "attributes" == e21.type && (t10.flags |= 4), "childList" == e21.type) { + var n10 = qJ(t10, e21.previousSibling || e21.target.previousSibling, -1), r10 = qJ(t10, e21.nextSibling || e21.target.nextSibling, 1); + return { from: n10 ? t10.posAfter(n10) : t10.posAtStart, to: r10 ? t10.posBefore(r10) : t10.posAtEnd, typeOver: false }; + } + return "characterData" == e21.type ? { from: t10.posAtStart, to: t10.posAtEnd, typeOver: e21.target.nodeValue == e21.oldValue } : null; + } }, { key: "setWindow", value: function(e21) { + e21 != this.win && (this.removeWindowListeners(this.win), this.win = e21, this.addWindowListeners(this.win)); + } }, { key: "addWindowListeners", value: function(e21) { + e21.addEventListener("resize", this.onResize), e21.addEventListener("beforeprint", this.onPrint), e21.addEventListener("scroll", this.onScroll), e21.document.addEventListener("selectionchange", this.onSelectionChange); + } }, { key: "removeWindowListeners", value: function(e21) { + e21.removeEventListener("scroll", this.onScroll), e21.removeEventListener("resize", this.onResize), e21.removeEventListener("beforeprint", this.onPrint), e21.document.removeEventListener("selectionchange", this.onSelectionChange); + } }, { key: "destroy", value: function() { + var e21, t10, n10; + this.stop(), null === (e21 = this.intersection) || void 0 === e21 || e21.disconnect(), null === (t10 = this.gapIntersection) || void 0 === t10 || t10.disconnect(), null === (n10 = this.resizeScroll) || void 0 === n10 || n10.disconnect(); + var r10, o10 = bo(this.scrollTargets); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + r10.value.removeEventListener("scroll", this.onScroll); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + this.removeWindowListeners(this.win), clearTimeout(this.parentCheck), clearTimeout(this.resizeTimeout), this.win.cancelAnimationFrame(this.delayedFlush), this.win.cancelAnimationFrame(this.flushingAndroidKey); + } }]), e20; + }(); + function qJ(e20, t10, n10) { + for (; t10; ) { + var r10 = pH.get(t10); + if (r10 && r10.parent == e20) + return r10; + var o10 = t10.parentNode; + t10 = o10 != e20.dom ? o10 : n10 > 0 ? t10.nextSibling : t10.previousSibling; + } + return null; + } + var zJ = function() { + function e20() { + var t10 = this, n10 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + No(this, e20), this.plugins = [], this.pluginMap = /* @__PURE__ */ new Map(), this.editorAttrs = {}, this.contentAttrs = {}, this.bidiCache = [], this.destroyed = false, this.updateState = 2, this.measureScheduled = -1, this.measureRequests = [], this.contentDOM = document.createElement("div"), this.scrollDOM = document.createElement("div"), this.scrollDOM.tabIndex = -1, this.scrollDOM.className = "cm-scroller", this.scrollDOM.appendChild(this.contentDOM), this.announceDOM = document.createElement("div"), this.announceDOM.className = "cm-announced", this.announceDOM.setAttribute("aria-live", "polite"), this.dom = document.createElement("div"), this.dom.appendChild(this.announceDOM), this.dom.appendChild(this.scrollDOM), n10.parent && n10.parent.appendChild(this.dom); + var r10 = n10.dispatch; + this.dispatchTransactions = n10.dispatchTransactions || r10 && function(e21) { + return e21.forEach(function(e23) { + return r10(e23, t10); + }); + } || function(e21) { + return t10.update(e21); + }, this.dispatch = this.dispatch.bind(this), this._root = n10.root || function(e21) { + for (; e21; ) { + if (e21 && (9 == e21.nodeType || 11 == e21.nodeType && e21.host)) + return e21; + e21 = e21.assignedSlot || e21.parentNode; + } + return null; + }(n10.parent) || document, this.viewState = new dJ(n10.state || mV.create(n10)), n10.scrollTo && n10.scrollTo.is(DW) && (this.viewState.scrollTarget = n10.scrollTo.value.clip(this.viewState.state)), this.plugins = this.state.facet(LW).map(function(e21) { + return new VW(e21); + }); + var o10, i10 = bo(this.plugins); + try { + for (i10.s(); !(o10 = i10.n()).done; ) { + o10.value.update(this); + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + this.observer = new DJ(this), this.inputState = new kU(this), this.inputState.ensureHandlers(this.plugins), this.docView = new nU(this), this.mountStyles(), this.updateAttrs(), this.updateState = 0, this.requestMeasure(); + } + return Do(e20, [{ key: "state", get: function() { + return this.viewState.state; + } }, { key: "viewport", get: function() { + return this.viewState.viewport; + } }, { key: "visibleRanges", get: function() { + return this.viewState.visibleRanges; + } }, { key: "inView", get: function() { + return this.viewState.inView; + } }, { key: "composing", get: function() { + return this.inputState.composing > 0; + } }, { key: "compositionStarted", get: function() { + return this.inputState.composing >= 0; + } }, { key: "root", get: function() { + return this._root; + } }, { key: "win", get: function() { + return this.dom.ownerDocument.defaultView || window; + } }, { key: "dispatch", value: function() { + for (var e21, t10 = arguments.length, n10 = new Array(t10), r10 = 0; r10 < t10; r10++) + n10[r10] = arguments[r10]; + var o10 = 1 == n10.length && n10[0] instanceof iV ? n10 : 1 == n10.length && Array.isArray(n10[0]) ? n10[0] : [(e21 = this.state).update.apply(e21, n10)]; + this.dispatchTransactions(o10, this); + } }, { key: "update", value: function(e21) { + var t10 = this; + if (0 != this.updateState) + throw new Error("Calls to EditorView.update are not allowed while an update is in progress"); + var n10, r10, o10 = false, i10 = false, a10 = this.state, s10 = bo(e21); + try { + for (s10.s(); !(r10 = s10.n()).done; ) { + var c10 = r10.value; + if (c10.startState != a10) + throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state."); + a10 = c10.state; + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + if (this.destroyed) + this.viewState.state = a10; + else { + var l10 = this.hasFocus, u10 = 0, f10 = null; + e21.some(function(e23) { + return e23.annotation(HU); + }) ? (this.inputState.notifiedFocused = l10, u10 = 1) : l10 != this.inputState.notifiedFocused && (this.inputState.notifiedFocused = l10, (f10 = WU(a10, l10)) || (u10 = 1)); + var d10 = this.observer.delayedAndroidKey, h10 = null; + if (d10 ? (this.observer.clearDelayedAndroidKey(), ((h10 = this.observer.readChange()) && !this.state.doc.eq(a10.doc) || !this.state.selection.eq(a10.selection)) && (h10 = null)) : this.observer.clear(), a10.facet(mV.phrases) != this.state.facet(mV.phrases)) + return this.setState(a10); + n10 = tU.create(this, a10, e21), n10.flags |= u10; + var v10 = this.viewState.scrollTarget; + try { + this.updateState = 2; + var p10, m10 = bo(e21); + try { + for (m10.s(); !(p10 = m10.n()).done; ) { + var g10 = p10.value; + if (v10 && (v10 = v10.map(g10.changes)), g10.scrollIntoView) { + var y10 = g10.state.selection.main; + v10 = new IW(y10.empty ? y10 : $F.cursor(y10.head, y10.head > y10.anchor ? -1 : 1)); + } + var b10, k10 = bo(g10.effects); + try { + for (k10.s(); !(b10 = k10.n()).done; ) { + var w10 = b10.value; + w10.is(DW) && (v10 = w10.value.clip(this.state)); + } + } catch (e23) { + k10.e(e23); + } finally { + k10.f(); + } + } + } catch (e23) { + m10.e(e23); + } finally { + m10.f(); + } + this.viewState.update(n10, v10), this.bidiCache = FJ.update(this.bidiCache, n10.changes), n10.empty || (this.updatePlugins(n10), this.inputState.update(n10)), o10 = this.docView.update(n10), this.state.facet(ZW) != this.styleModules && this.mountStyles(), i10 = this.updateAttrs(), this.showAnnouncements(e21), this.docView.updateSelection(o10, e21.some(function(e23) { + return e23.isUserEvent("select.pointer"); + })); + } finally { + this.updateState = 0; + } + if (n10.startState.facet(kJ) != n10.state.facet(kJ) && (this.viewState.mustMeasureContent = true), (o10 || i10 || v10 || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent) && this.requestMeasure(), !n10.empty) { + var x10, j10 = bo(this.state.facet(AW)); + try { + for (j10.s(); !(x10 = j10.n()).done; ) { + var S10 = x10.value; + try { + S10(n10); + } catch (w11) { + qW(this.state, w11, "update listener"); + } + } + } catch (e23) { + j10.e(e23); + } finally { + j10.f(); + } + } + (f10 || h10) && Promise.resolve().then(function() { + f10 && t10.state == f10.startState && t10.dispatch(f10), h10 && !RJ(t10, h10) && d10.force && uH(t10.contentDOM, d10.key, d10.keyCode); + }); + } + } }, { key: "setState", value: function(e21) { + if (0 != this.updateState) + throw new Error("Calls to EditorView.setState are not allowed while an update is in progress"); + if (this.destroyed) + this.viewState.state = e21; + else { + this.updateState = 2; + var t10 = this.hasFocus; + try { + var n10, r10 = bo(this.plugins); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + n10.value.destroy(this); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + this.viewState = new dJ(e21), this.plugins = e21.facet(LW).map(function(e23) { + return new VW(e23); + }), this.pluginMap.clear(); + var o10, i10 = bo(this.plugins); + try { + for (i10.s(); !(o10 = i10.n()).done; ) { + o10.value.update(this); + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + this.docView.destroy(), this.docView = new nU(this), this.inputState.ensureHandlers(this.plugins), this.mountStyles(), this.updateAttrs(), this.bidiCache = []; + } finally { + this.updateState = 0; + } + t10 && this.focus(), this.requestMeasure(); + } + } }, { key: "updatePlugins", value: function(e21) { + var t10 = e21.startState.facet(LW), n10 = e21.state.facet(LW); + if (t10 != n10) { + var r10, o10 = [], i10 = bo(n10); + try { + for (i10.s(); !(r10 = i10.n()).done; ) { + var a10 = r10.value, s10 = t10.indexOf(a10); + if (s10 < 0) + o10.push(new VW(a10)); + else { + var c10 = this.plugins[s10]; + c10.mustUpdate = e21, o10.push(c10); + } + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + var l10, u10 = bo(this.plugins); + try { + for (u10.s(); !(l10 = u10.n()).done; ) { + var f10 = l10.value; + f10.mustUpdate != e21 && f10.destroy(this); + } + } catch (e23) { + u10.e(e23); + } finally { + u10.f(); + } + this.plugins = o10, this.pluginMap.clear(); + } else { + var d10, h10 = bo(this.plugins); + try { + for (h10.s(); !(d10 = h10.n()).done; ) { + d10.value.mustUpdate = e21; + } + } catch (e23) { + h10.e(e23); + } finally { + h10.f(); + } + } + for (var v10 = 0; v10 < this.plugins.length; v10++) + this.plugins[v10].update(this); + t10 != n10 && this.inputState.ensureHandlers(this.plugins); + } }, { key: "measure", value: function() { + var e21 = this, t10 = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; + if (!this.destroyed) { + if (this.measureScheduled > -1 && this.win.cancelAnimationFrame(this.measureScheduled), this.observer.delayedAndroidKey) + return this.measureScheduled = -1, void this.requestMeasure(); + this.measureScheduled = 0, t10 && this.observer.forceFlush(); + var n10 = null, r10 = this.scrollDOM, o10 = r10.scrollTop * this.scaleY, i10 = this.viewState, a10 = i10.scrollAnchorPos, s10 = i10.scrollAnchorHeight; + Math.abs(o10 - this.viewState.scrollTop) > 1 && (s10 = -1), this.viewState.scrollAnchorHeight = -1; + try { + for (var c10 = 0; ; c10++) { + if (s10 < 0) + if (dH(r10)) + a10 = -1, s10 = this.viewState.heightMap.height; + else { + var l10 = this.viewState.scrollAnchorAt(o10); + a10 = l10.from, s10 = l10.top; + } + this.updateState = 1; + var u10 = this.viewState.measure(this); + if (!u10 && !this.measureRequests.length && null == this.viewState.scrollTarget) + break; + if (c10 > 5) { + console.warn(this.measureRequests.length ? "Measure loop restarted more than 5 times" : "Viewport failed to stabilize"); + break; + } + var f10 = []; + if (!(4 & u10)) { + var d10 = [f10, this.measureRequests]; + this.measureRequests = d10[0], f10 = d10[1]; + } + var h10 = f10.map(function(t11) { + try { + return t11.read(e21); + } catch (t12) { + return qW(e21.state, t12), LJ; + } + }), v10 = tU.create(this, this.state, []), p10 = false; + v10.flags |= u10, n10 ? n10.flags |= u10 : n10 = v10, this.updateState = 2, v10.empty || (this.updatePlugins(v10), this.inputState.update(v10), this.updateAttrs(), p10 = this.docView.update(v10)); + for (var m10 = 0; m10 < f10.length; m10++) + if (h10[m10] != LJ) + try { + var g10 = f10[m10]; + g10.write && g10.write(h10[m10], this); + } catch (e23) { + qW(this.state, e23); + } + if (p10 && this.docView.updateSelection(true), !v10.viewportChanged && 0 == this.measureRequests.length) { + if (this.viewState.editorHeight) { + if (this.viewState.scrollTarget) { + this.docView.scrollIntoView(this.viewState.scrollTarget), this.viewState.scrollTarget = null, s10 = -1; + continue; + } + var y10 = (a10 < 0 ? this.viewState.heightMap.height : this.viewState.lineBlockAt(a10).top) - s10; + if (y10 > 1 || y10 < -1) { + o10 += y10, r10.scrollTop = o10 / this.scaleY, s10 = -1; + continue; + } + } + break; + } + } + } finally { + this.updateState = 0, this.measureScheduled = -1; + } + if (n10 && !n10.empty) { + var b10, k10 = bo(this.state.facet(AW)); + try { + for (k10.s(); !(b10 = k10.n()).done; ) { + (0, b10.value)(n10); + } + } catch (e23) { + k10.e(e23); + } finally { + k10.f(); + } + } + } + } }, { key: "themeClasses", get: function() { + return xJ + " " + (this.state.facet(wJ) ? SJ : jJ) + " " + this.state.facet(kJ); + } }, { key: "updateAttrs", value: function() { + var e21 = this, t10 = VJ(this, HW, { class: "cm-editor" + (this.hasFocus ? " cm-focused " : " ") + this.themeClasses }), n10 = { spellcheck: "false", autocorrect: "off", autocapitalize: "off", translate: "no", contenteditable: this.state.facet(zW) ? "true" : "false", class: "cm-content", style: "".concat(AH.tabSize, ": ").concat(this.state.tabSize), role: "textbox", "aria-multiline": "true" }; + this.state.readOnly && (n10["aria-readonly"] = "true"), VJ(this, WW, n10); + var r10 = this.observer.ignore(function() { + var r11 = FH(e21.contentDOM, e21.contentAttrs, n10), o10 = FH(e21.dom, e21.editorAttrs, t10); + return r11 || o10; + }); + return this.editorAttrs = t10, this.contentAttrs = n10, r10; + } }, { key: "showAnnouncements", value: function(t10) { + var n10, r10 = true, o10 = bo(t10); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10, a10 = bo(n10.value.effects); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = i10.value; + if (s10.is(e20.announce)) + r10 && (this.announceDOM.textContent = ""), r10 = false, this.announceDOM.appendChild(document.createElement("div")).textContent = s10.value; + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + } }, { key: "mountStyles", value: function() { + this.styleModules = this.state.facet(ZW); + var t10 = this.state.facet(e20.cspNonce); + zV.mount(this.root, this.styleModules.concat(_J).reverse(), t10 ? { nonce: t10 } : void 0); + } }, { key: "readMeasured", value: function() { + if (2 == this.updateState) + throw new Error("Reading the editor layout isn't allowed during an update"); + 0 == this.updateState && this.measureScheduled > -1 && this.measure(false); + } }, { key: "requestMeasure", value: function(e21) { + var t10 = this; + if (this.measureScheduled < 0 && (this.measureScheduled = this.win.requestAnimationFrame(function() { + return t10.measure(); + })), e21) { + if (this.measureRequests.indexOf(e21) > -1) + return; + if (null != e21.key) { + for (var n10 = 0; n10 < this.measureRequests.length; n10++) + if (this.measureRequests[n10].key === e21.key) + return void (this.measureRequests[n10] = e21); + } + this.measureRequests.push(e21); + } + } }, { key: "plugin", value: function(e21) { + var t10 = this.pluginMap.get(e21); + return (void 0 === t10 || t10 && t10.spec != e21) && this.pluginMap.set(e21, t10 = this.plugins.find(function(t11) { + return t11.spec == e21; + }) || null), t10 && t10.update(this).value; + } }, { key: "documentTop", get: function() { + return this.contentDOM.getBoundingClientRect().top + this.viewState.paddingTop; + } }, { key: "documentPadding", get: function() { + return { top: this.viewState.paddingTop, bottom: this.viewState.paddingBottom }; + } }, { key: "scaleX", get: function() { + return this.viewState.scaleX; + } }, { key: "scaleY", get: function() { + return this.viewState.scaleY; + } }, { key: "elementAtHeight", value: function(e21) { + return this.readMeasured(), this.viewState.elementAtHeight(e21); + } }, { key: "lineBlockAtHeight", value: function(e21) { + return this.readMeasured(), this.viewState.lineBlockAtHeight(e21); + } }, { key: "viewportLineBlocks", get: function() { + return this.viewState.viewportLines; + } }, { key: "lineBlockAt", value: function(e21) { + return this.viewState.lineBlockAt(e21); + } }, { key: "contentHeight", get: function() { + return this.viewState.contentHeight; + } }, { key: "moveByChar", value: function(e21, t10, n10) { + return bU(this, e21, gU(this, e21, t10, n10)); + } }, { key: "moveByGroup", value: function(e21, t10) { + var n10 = this; + return bU(this, e21, gU(this, e21, t10, function(t11) { + return function(e23, t12, n11) { + var r10 = e23.state.charCategorizer(t12), o10 = r10(n11); + return function(e24) { + var t13 = r10(e24); + return o10 == hV.Space && (o10 = t13), o10 == t13; + }; + }(n10, e21.head, t11); + })); + } }, { key: "visualLineSide", value: function(e21, t10) { + var n10 = this.bidiSpans(e21), r10 = this.textDirectionAt(e21.from), o10 = n10[t10 ? n10.length - 1 : 0]; + return $F.cursor(o10.side(t10, r10) + e21.from, o10.forward(!t10, r10) ? 1 : -1); + } }, { key: "moveToLineBoundary", value: function(e21, t10) { + return function(e23, t11, n10, r10) { + var o10 = mU(e23, t11.head), i10 = r10 && o10.type == JH.Text && (e23.lineWrapping || o10.widgetLineBreaks) ? e23.coordsAtPos(t11.assoc < 0 && t11.head > o10.from ? t11.head - 1 : t11.head) : null; + if (i10) { + var a10 = e23.dom.getBoundingClientRect(), s10 = e23.textDirectionAt(o10.from), c10 = e23.posAtCoords({ x: n10 == (s10 == rW.LTR) ? a10.right - 1 : a10.left + 1, y: (i10.top + i10.bottom) / 2 }); + if (null != c10) + return $F.cursor(c10, n10 ? -1 : 1); + } + return $F.cursor(n10 ? o10.to : o10.from, n10 ? -1 : 1); + }(this, e21, t10, !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]); + } }, { key: "moveVertically", value: function(e21, t10, n10) { + return bU(this, e21, function(e23, t11, n11, r10) { + var o10 = t11.head, i10 = n11 ? 1 : -1; + if (o10 == (n11 ? e23.state.doc.length : 0)) + return $F.cursor(o10, t11.assoc); + var a10, s10 = t11.goalColumn, c10 = e23.contentDOM.getBoundingClientRect(), l10 = e23.coordsAtPos(o10, t11.assoc || -1), u10 = e23.documentTop; + if (l10) + null == s10 && (s10 = l10.left - c10.left), a10 = i10 < 0 ? l10.top : l10.bottom; + else { + var f10 = e23.viewState.lineBlockAt(o10); + null == s10 && (s10 = Math.min(c10.right - c10.left, e23.defaultCharacterWidth * (o10 - f10.from))), a10 = (i10 < 0 ? f10.top : f10.bottom) + u10; + } + for (var d10 = c10.left + s10, h10 = null != r10 ? r10 : e23.viewState.heightOracle.textHeight >> 1, v10 = 0; ; v10 += 10) { + var p10 = a10 + (h10 + v10) * i10, m10 = vU(e23, { x: d10, y: p10 }, false, i10); + if (p10 < c10.top || p10 > c10.bottom || (i10 < 0 ? m10 < o10 : m10 > o10)) { + var g10 = e23.docView.coordsForChar(m10), y10 = !g10 || p10 < g10.top ? -1 : 1; + return $F.cursor(m10, y10, void 0, s10); + } + } + }(this, e21, t10, n10)); + } }, { key: "domAtPos", value: function(e21) { + return this.docView.domAtPos(e21); + } }, { key: "posAtDOM", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; + return this.docView.posFromDOM(e21, t10); + } }, { key: "posAtCoords", value: function(e21) { + var t10 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]; + return this.readMeasured(), vU(this, e21, t10); + } }, { key: "coordsAtPos", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; + this.readMeasured(); + var n10 = this.docView.coordsAt(e21, t10); + if (!n10 || n10.left == n10.right) + return n10; + var r10 = this.state.doc.lineAt(e21), o10 = this.bidiSpans(r10); + return nH(n10, o10[yW.find(o10, e21 - r10.from, -1, t10)].dir == rW.LTR == t10 > 0); + } }, { key: "coordsForChar", value: function(e21) { + return this.readMeasured(), this.docView.coordsForChar(e21); + } }, { key: "defaultCharacterWidth", get: function() { + return this.viewState.heightOracle.charWidth; + } }, { key: "defaultLineHeight", get: function() { + return this.viewState.heightOracle.lineHeight; + } }, { key: "textDirection", get: function() { + return this.viewState.defaultTextDirection; + } }, { key: "textDirectionAt", value: function(e21) { + return !this.state.facet(RW) || e21 < this.viewport.from || e21 > this.viewport.to ? this.textDirection : (this.readMeasured(), this.docView.textDirectionAt(e21)); + } }, { key: "lineWrapping", get: function() { + return this.viewState.heightOracle.lineWrapping; + } }, { key: "bidiSpans", value: function(e21) { + if (e21.length > BJ) + return jW(e21.length); + var t10, n10, r10 = this.textDirectionAt(e21.from), o10 = bo(this.bidiCache); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = n10.value; + if (i10.from == e21.from && i10.dir == r10 && (i10.fresh || bW(i10.isolates, t10 = QW(this, e21)))) + return i10.order; + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + t10 || (t10 = QW(this, e21)); + var a10 = function(e23, t11, n11) { + if (!e23) + return [new yW(0, 0, t11 == iW ? 1 : 0)]; + if (t11 == oW && !n11.length && !gW.test(e23)) + return jW(e23.length); + if (n11.length) + for (; e23.length > kW.length; ) + kW[kW.length] = 256; + var r11 = [], o11 = t11 == oW ? 0 : 1; + return xW(e23, o11, o11, n11, 0, e23.length, r11), r11; + }(e21.text, r10, t10); + return this.bidiCache.push(new FJ(e21.from, e21.to, r10, t10, true, a10)), a10; + } }, { key: "hasFocus", get: function() { + var e21; + return (this.dom.ownerDocument.hasFocus() || AH.safari && (null === (e21 = this.inputState) || void 0 === e21 ? void 0 : e21.lastContextMenu) > Date.now() - 3e4) && this.root.activeElement == this.contentDOM; + } }, { key: "focus", value: function() { + var e21 = this; + this.observer.ignore(function() { + cH(e21.contentDOM), e21.docView.updateSelection(); + }); + } }, { key: "setRoot", value: function(e21) { + this._root != e21 && (this._root = e21, this.observer.setWindow((9 == e21.nodeType ? e21 : e21.ownerDocument).defaultView || window), this.mountStyles()); + } }, { key: "destroy", value: function() { + var e21, t10 = bo(this.plugins); + try { + for (t10.s(); !(e21 = t10.n()).done; ) { + e21.value.destroy(this); + } + } catch (e23) { + t10.e(e23); + } finally { + t10.f(); + } + this.plugins = [], this.inputState.destroy(), this.docView.destroy(), this.dom.remove(), this.observer.destroy(), this.measureScheduled > -1 && this.win.cancelAnimationFrame(this.measureScheduled), this.destroyed = true; + } }, { key: "scrollSnapshot", value: function() { + var e21 = this.scrollDOM, t10 = e21.scrollTop, n10 = e21.scrollLeft, r10 = this.viewState.scrollAnchorAt(t10); + return DW.of(new IW($F.cursor(r10.from), "start", "start", r10.top - t10, n10, true)); + } }], [{ key: "scrollIntoView", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + return DW.of(new IW("number" == typeof e21 ? $F.cursor(e21) : e21, t10.y, t10.x, t10.yMargin, t10.xMargin)); + } }, { key: "domEventHandlers", value: function(e21) { + return FW.define(function() { + return {}; + }, { eventHandlers: e21 }); + } }, { key: "domEventObservers", value: function(e21) { + return FW.define(function() { + return {}; + }, { eventObservers: e21 }); + } }, { key: "theme", value: function(e21, t10) { + var n10 = zV.newName(), r10 = [kJ.of(n10), ZW.of($J(".".concat(n10), e21))]; + return t10 && t10.dark && r10.push(wJ.of(true)), r10; + } }, { key: "baseTheme", value: function(e21) { + return LF.lowest(ZW.of($J("." + xJ, e21, CJ))); + } }, { key: "findFromDOM", value: function(e21) { + var t10, n10 = e21.querySelector(".cm-content"), r10 = n10 && pH.get(n10) || pH.get(e21); + return (null === (t10 = null == r10 ? void 0 : r10.rootView) || void 0 === t10 ? void 0 : t10.view) || null; + } }]), e20; + }(); + zJ.styleModule = ZW, zJ.inputHandler = PW, zJ.focusChangeEffect = TW, zJ.perLineTextDirection = RW, zJ.exceptionSink = EW, zJ.updateListener = AW, zJ.editable = zW, zJ.mouseSelectionStyle = MW, zJ.dragMovesSelection = OW, zJ.clickAddsSelectionRange = _W, zJ.decorations = UW, zJ.outerDecorations = JW, zJ.atomicRanges = KW, zJ.bidiIsolatedRanges = GW, zJ.scrollMargins = YW, zJ.darkTheme = wJ, zJ.cspNonce = MF.define({ combine: function(e20) { + return e20.length ? e20[0] : ""; + } }), zJ.contentAttributes = WW, zJ.editorAttributes = HW, zJ.lineWrapping = zJ.contentAttributes.of({ class: "cm-lineWrapping" }), zJ.announce = oV.define(); + var BJ = 4096; + var LJ = {}; + var FJ = function() { + function e20(t10, n10, r10, o10, i10, a10) { + No(this, e20), this.from = t10, this.to = n10, this.dir = r10, this.isolates = o10, this.fresh = i10, this.order = a10; + } + return Do(e20, null, [{ key: "update", value: function(t10, n10) { + if (n10.empty && !t10.some(function(e21) { + return e21.fresh; + })) + return t10; + for (var r10 = [], o10 = t10.length ? t10[t10.length - 1].dir : rW.LTR, i10 = Math.max(0, t10.length - 10); i10 < t10.length; i10++) { + var a10 = t10[i10]; + a10.dir != o10 || n10.touchesRange(a10.from, a10.to) || r10.push(new e20(n10.mapPos(a10.from, 1), n10.mapPos(a10.to, -1), a10.dir, a10.isolates, false, a10.order)); + } + return r10; + } }]), e20; + }(); + function VJ(e20, t10, n10) { + for (var r10 = e20.state.facet(t10), o10 = r10.length - 1; o10 >= 0; o10--) { + var i10 = r10[o10], a10 = "function" == typeof i10 ? i10(e20) : i10; + a10 && zH(a10, n10); + } + return n10; + } + var HJ = AH.mac ? "mac" : AH.windows ? "win" : AH.linux ? "linux" : "key"; + function WJ(e20, t10, n10) { + return t10.altKey && (e20 = "Alt-" + e20), t10.ctrlKey && (e20 = "Ctrl-" + e20), t10.metaKey && (e20 = "Meta-" + e20), false !== n10 && t10.shiftKey && (e20 = "Shift-" + e20), e20; + } + var UJ = LF.default(zJ.domEventHandlers({ keydown: function(e20, t10) { + return XJ(GJ(t10.state), e20, t10, "editor"); + } })); + var JJ = MF.define({ enables: UJ }); + var KJ = /* @__PURE__ */ new WeakMap(); + function GJ(e20) { + var t10 = e20.facet(JJ), n10 = KJ.get(t10); + return n10 || KJ.set(t10, n10 = function(e21) { + var t11, n11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : HJ, r10 = /* @__PURE__ */ Object.create(null), o10 = /* @__PURE__ */ Object.create(null), i10 = function(e23, t12) { + var n12 = o10[e23]; + if (null == n12) + o10[e23] = t12; + else if (n12 != t12) + throw new Error("Key binding " + e23 + " is used both as a regular binding and as a multi-stroke prefix"); + }, a10 = function(e23, t12, o11, a11, s11) { + for (var c11, l11, u11 = r10[e23] || (r10[e23] = /* @__PURE__ */ Object.create(null)), f11 = t12.split(/ (?!$)/).map(function(e24) { + return function(e25, t13) { + var n12, r11, o12, i11, a12 = e25.split(/-(?!$)/), s12 = a12[a12.length - 1]; + "Space" == s12 && (s12 = " "); + for (var c12 = 0; c12 < a12.length - 1; ++c12) { + var l12 = a12[c12]; + if (/^(cmd|meta|m)$/i.test(l12)) + i11 = true; + else if (/^a(lt)?$/i.test(l12)) + n12 = true; + else if (/^(c|ctrl|control)$/i.test(l12)) + r11 = true; + else if (/^s(hift)?$/i.test(l12)) + o12 = true; + else { + if (!/^mod$/i.test(l12)) + throw new Error("Unrecognized modifier name: " + l12); + "mac" == t13 ? i11 = true : r11 = true; + } + } + return n12 && (s12 = "Alt-" + s12), r11 && (s12 = "Ctrl-" + s12), i11 && (s12 = "Meta-" + s12), o12 && (s12 = "Shift-" + s12), s12; + }(e24, n11); + }), d11 = function() { + var t13 = f11.slice(0, h11).join(" "); + i10(t13, true), u11[t13] || (u11[t13] = { preventDefault: true, stopPropagation: false, run: [function(n12) { + var r11 = QJ = { view: n12, prefix: t13, scope: e23 }; + return setTimeout(function() { + QJ == r11 && (QJ = null); + }, YJ), true; + }] }); + }, h11 = 1; h11 < f11.length; h11++) + d11(); + var v11 = f11.join(" "); + i10(v11, false); + var p11 = u11[v11] || (u11[v11] = { preventDefault: false, stopPropagation: false, run: (null === (l11 = null === (c11 = u11._any) || void 0 === c11 ? void 0 : c11.run) || void 0 === l11 ? void 0 : l11.slice()) || [] }); + o11 && p11.run.push(o11), a11 && (p11.preventDefault = true), s11 && (p11.stopPropagation = true); + }, s10 = bo(e21); + try { + for (s10.s(); !(t11 = s10.n()).done; ) { + var c10 = t11.value, l10 = c10.scope ? c10.scope.split(" ") : ["editor"]; + if (c10.any) { + var u10, f10 = bo(l10); + try { + for (f10.s(); !(u10 = f10.n()).done; ) { + var d10 = u10.value, h10 = r10[d10] || (r10[d10] = /* @__PURE__ */ Object.create(null)); + for (var v10 in h10._any || (h10._any = { preventDefault: false, stopPropagation: false, run: [] }), h10) + h10[v10].run.push(c10.any); + } + } catch (e23) { + f10.e(e23); + } finally { + f10.f(); + } + } + var p10 = c10[n11] || c10.key; + if (p10) { + var m10, g10 = bo(l10); + try { + for (g10.s(); !(m10 = g10.n()).done; ) { + var y10 = m10.value; + a10(y10, p10, c10.run, c10.preventDefault, c10.stopPropagation), c10.shift && a10(y10, "Shift-" + p10, c10.shift, c10.preventDefault, c10.stopPropagation); + } + } catch (e23) { + g10.e(e23); + } finally { + g10.f(); + } + } + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + return r10; + }(t10.reduce(function(e21, t11) { + return e21.concat(t11); + }, []))), n10; + } + var QJ = null; + var YJ = 4e3; + function XJ(e20, t10, n10, r10) { + var o10 = function(e21) { + var t11 = !(HV && e21.metaKey && e21.shiftKey && !e21.ctrlKey && !e21.altKey || WV && e21.shiftKey && e21.key && 1 == e21.key.length || "Unidentified" == e21.key) && e21.key || (e21.shiftKey ? VV : FV)[e21.keyCode] || e21.key || "Unidentified"; + return "Esc" == t11 && (t11 = "Escape"), "Del" == t11 && (t11 = "Delete"), "Left" == t11 && (t11 = "ArrowLeft"), "Up" == t11 && (t11 = "ArrowUp"), "Right" == t11 && (t11 = "ArrowRight"), "Down" == t11 && (t11 = "ArrowDown"), t11; + }(t10), i10 = vF(dF(o10, 0)) == o10.length && " " != o10, a10 = "", s10 = false, c10 = false, l10 = false; + QJ && QJ.view == n10 && QJ.scope == r10 && (a10 = QJ.prefix + " ", CU.indexOf(t10.keyCode) < 0 && (c10 = true, QJ = null)); + var u10, f10, d10 = /* @__PURE__ */ new Set(), h10 = function(e21) { + if (e21) { + var r11, o11 = bo(e21.run); + try { + for (o11.s(); !(r11 = o11.n()).done; ) { + var i11 = r11.value; + if (!d10.has(i11) && (d10.add(i11), i11(n10, t10))) + return e21.stopPropagation && (l10 = true), true; + } + } catch (e23) { + o11.e(e23); + } finally { + o11.f(); + } + e21.preventDefault && (e21.stopPropagation && (l10 = true), c10 = true); + } + return false; + }, v10 = e20[r10]; + return v10 && (h10(v10[a10 + WJ(o10, t10, !i10)]) ? s10 = true : i10 && (t10.altKey || t10.metaKey || t10.ctrlKey) && !(AH.windows && t10.ctrlKey && t10.altKey) && (u10 = FV[t10.keyCode]) && u10 != o10 ? (h10(v10[a10 + WJ(u10, t10, true)]) || t10.shiftKey && (f10 = VV[t10.keyCode]) != o10 && f10 != u10 && h10(v10[a10 + WJ(f10, t10, false)])) && (s10 = true) : i10 && t10.shiftKey && h10(v10[a10 + WJ(o10, t10, true)]) && (s10 = true), !s10 && h10(v10._any) && (s10 = true)), c10 && (s10 = true), s10 && l10 && t10.stopPropagation(), s10; + } + var ZJ = function() { + function e20(t10, n10, r10, o10, i10) { + No(this, e20), this.className = t10, this.left = n10, this.top = r10, this.width = o10, this.height = i10; + } + return Do(e20, [{ key: "draw", value: function() { + var e21 = document.createElement("div"); + return e21.className = this.className, this.adjust(e21), e21; + } }, { key: "update", value: function(e21, t10) { + return t10.className == this.className && (this.adjust(e21), true); + } }, { key: "adjust", value: function(e21) { + e21.style.left = this.left + "px", e21.style.top = this.top + "px", null != this.width && (e21.style.width = this.width + "px"), e21.style.height = this.height + "px"; + } }, { key: "eq", value: function(e21) { + return this.left == e21.left && this.top == e21.top && this.width == e21.width && this.height == e21.height && this.className == e21.className; + } }], [{ key: "forRange", value: function(t10, n10, r10) { + if (r10.empty) { + var o10 = t10.coordsAtPos(r10.head, r10.assoc || 1); + if (!o10) + return []; + var i10 = eK(t10); + return [new e20(n10, o10.left - i10.left, o10.top - i10.top, null, o10.bottom - o10.top)]; + } + return nK(t10, n10, r10); + } }]), e20; + }(); + function eK(e20) { + var t10 = e20.scrollDOM.getBoundingClientRect(); + return { left: (e20.textDirection == rW.LTR ? t10.left : t10.right - e20.scrollDOM.clientWidth * e20.scaleX) - e20.scrollDOM.scrollLeft * e20.scaleX, top: t10.top - e20.scrollDOM.scrollTop * e20.scaleY }; + } + function tK(e20, t10, n10) { + var r10 = $F.cursor(t10); + return { from: Math.max(n10.from, e20.moveToLineBoundary(r10, false, true).from), to: Math.min(n10.to, e20.moveToLineBoundary(r10, true, true).from), type: JH.Text }; + } + function nK(e20, t10, n10) { + if (n10.to <= e20.viewport.from || n10.from >= e20.viewport.to) + return []; + var r10 = Math.max(n10.from, e20.viewport.from), o10 = Math.min(n10.to, e20.viewport.to), i10 = e20.textDirection == rW.LTR, a10 = e20.contentDOM, s10 = a10.getBoundingClientRect(), c10 = eK(e20), l10 = a10.querySelector(".cm-line"), u10 = l10 && window.getComputedStyle(l10), f10 = s10.left + (u10 ? parseInt(u10.paddingLeft) + Math.min(0, parseInt(u10.textIndent)) : 0), d10 = s10.right - (u10 ? parseInt(u10.paddingRight) : 0), h10 = mU(e20, r10), v10 = mU(e20, o10), p10 = h10.type == JH.Text ? h10 : null, m10 = v10.type == JH.Text ? v10 : null; + if (p10 && (e20.lineWrapping || h10.widgetLineBreaks) && (p10 = tK(e20, r10, p10)), m10 && (e20.lineWrapping || v10.widgetLineBreaks) && (m10 = tK(e20, o10, m10)), p10 && m10 && p10.from == m10.from) + return w10(x10(n10.from, n10.to, p10)); + var g10 = p10 ? x10(n10.from, null, p10) : j10(h10, false), y10 = m10 ? x10(null, n10.to, m10) : j10(v10, true), b10 = []; + return (p10 || h10).to < (m10 || v10).from - (p10 && m10 ? 1 : 0) || h10.widgetLineBreaks > 1 && g10.bottom + e20.defaultLineHeight / 2 < y10.top ? b10.push(k10(f10, g10.bottom, d10, y10.top)) : g10.bottom < y10.top && e20.elementAtHeight((g10.bottom + y10.top) / 2).type == JH.Text && (g10.bottom = y10.top = (g10.bottom + y10.top) / 2), w10(g10).concat(b10).concat(w10(y10)); + function k10(e21, n11, r11, o11) { + return new ZJ(t10, e21 - c10.left, n11 - c10.top - 0.01, r11 - e21, o11 - n11 + 0.01); + } + function w10(e21) { + for (var t11 = e21.top, n11 = e21.bottom, r11 = e21.horizontal, o11 = [], i11 = 0; i11 < r11.length; i11 += 2) + o11.push(k10(r11[i11], t11, r11[i11 + 1], n11)); + return o11; + } + function x10(t11, n11, r11) { + var o11 = 1e9, a11 = -1e9, s11 = []; + function c11(t12, n12, c12, l12, u12) { + var h12 = e20.coordsAtPos(t12, t12 == r11.to ? -2 : 2), v12 = e20.coordsAtPos(c12, c12 == r11.from ? 2 : -2); + h12 && v12 && (o11 = Math.min(h12.top, v12.top, o11), a11 = Math.max(h12.bottom, v12.bottom, a11), u12 == rW.LTR ? s11.push(i10 && n12 ? f10 : h12.left, i10 && l12 ? d10 : v12.right) : s11.push(!i10 && l12 ? f10 : v12.left, !i10 && n12 ? d10 : h12.right)); + } + var l11, u11 = null != t11 ? t11 : r11.from, h11 = null != n11 ? n11 : r11.to, v11 = bo(e20.visibleRanges); + try { + for (v11.s(); !(l11 = v11.n()).done; ) { + var p11 = l11.value; + if (p11.to > u11 && p11.from < h11) + for (var m11 = Math.max(p11.from, u11), g11 = Math.min(p11.to, h11); ; ) { + var y11, b11 = e20.state.doc.lineAt(m11), k11 = bo(e20.bidiSpans(b11)); + try { + for (k11.s(); !(y11 = k11.n()).done; ) { + var w11 = y11.value, x11 = w11.from + b11.from, j11 = w11.to + b11.from; + if (x11 >= g11) + break; + j11 > m11 && c11(Math.max(x11, m11), null == t11 && x11 <= u11, Math.min(j11, g11), null == n11 && j11 >= h11, w11.dir); + } + } catch (e21) { + k11.e(e21); + } finally { + k11.f(); + } + if ((m11 = b11.to + 1) >= g11) + break; + } + } + } catch (e21) { + v11.e(e21); + } finally { + v11.f(); + } + return 0 == s11.length && c11(u11, null == t11, h11, null == n11, e20.textDirection), { top: o11, bottom: a11, horizontal: s11 }; + } + function j10(e21, t11) { + var n11 = s10.top + (t11 ? e21.top : e21.bottom); + return { top: n11, bottom: n11, horizontal: [] }; + } + } + var rK = function() { + function e20(t10, n10) { + No(this, e20), this.view = t10, this.layer = n10, this.drawn = [], this.scaleX = 1, this.scaleY = 1, this.measureReq = { read: this.measure.bind(this), write: this.draw.bind(this) }, this.dom = t10.scrollDOM.appendChild(document.createElement("div")), this.dom.classList.add("cm-layer"), n10.above && this.dom.classList.add("cm-layer-above"), n10.class && this.dom.classList.add(n10.class), this.scale(), this.dom.setAttribute("aria-hidden", "true"), this.setOrder(t10.state), t10.requestMeasure(this.measureReq), n10.mount && n10.mount(this.dom, t10); + } + return Do(e20, [{ key: "update", value: function(e21) { + e21.startState.facet(oK) != e21.state.facet(oK) && this.setOrder(e21.state), (this.layer.update(e21, this.dom) || e21.geometryChanged) && (this.scale(), e21.view.requestMeasure(this.measureReq)); + } }, { key: "setOrder", value: function(e21) { + for (var t10 = 0, n10 = e21.facet(oK); t10 < n10.length && n10[t10] != this.layer; ) + t10++; + this.dom.style.zIndex = String((this.layer.above ? 150 : -1) - t10); + } }, { key: "measure", value: function() { + return this.layer.markers(this.view); + } }, { key: "scale", value: function() { + var e21 = this.view, t10 = e21.scaleX, n10 = e21.scaleY; + t10 == this.scaleX && n10 == this.scaleY || (this.scaleX = t10, this.scaleY = n10, this.dom.style.transform = "scale(".concat(1 / t10, ", ").concat(1 / n10, ")")); + } }, { key: "draw", value: function(e21) { + var t10 = this; + if (e21.length != this.drawn.length || e21.some(function(e23, n11) { + return r11 = e23, o11 = t10.drawn[n11], !(r11.constructor == o11.constructor && r11.eq(o11)); + var r11, o11; + })) { + var n10, r10 = this.dom.firstChild, o10 = 0, i10 = bo(e21); + try { + for (i10.s(); !(n10 = i10.n()).done; ) { + var a10 = n10.value; + a10.update && r10 && a10.constructor && this.drawn[o10].constructor && a10.update(r10, this.drawn[o10]) ? (r10 = r10.nextSibling, o10++) : this.dom.insertBefore(a10.draw(), r10); + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + for (; r10; ) { + var s10 = r10.nextSibling; + r10.remove(), r10 = s10; + } + this.drawn = e21; + } + } }, { key: "destroy", value: function() { + this.layer.destroy && this.layer.destroy(this.dom, this.view), this.dom.remove(); + } }]), e20; + }(); + var oK = MF.define(); + function iK(e20) { + return [FW.define(function(t10) { + return new rK(t10, e20); + }), oK.of(e20)]; + } + var aK = !AH.ios; + var sK = MF.define({ combine: function(e20) { + return gV(e20, { cursorBlinkRate: 1200, drawRangeCursor: true }, { cursorBlinkRate: function(e21, t10) { + return Math.min(e21, t10); + }, drawRangeCursor: function(e21, t10) { + return e21 || t10; + } }); + } }); + function cK() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return [sK.of(e20), uK, dK, vK, NW.of(true)]; + } + function lK(e20) { + return e20.startState.facet(sK) != e20.state.facet(sK); + } + var uK = iK({ above: true, markers: function(e20) { + var t10, n10 = e20.state, r10 = n10.facet(sK), o10 = [], i10 = bo(n10.selection.ranges); + try { + for (i10.s(); !(t10 = i10.n()).done; ) { + var a10 = t10.value, s10 = a10 == n10.selection.main; + if (a10.empty ? !s10 || aK : r10.drawRangeCursor) { + var c10, l10 = s10 ? "cm-cursor cm-cursor-primary" : "cm-cursor cm-cursor-secondary", u10 = a10.empty ? a10 : $F.cursor(a10.head, a10.head > a10.anchor ? -1 : 1), f10 = bo(ZJ.forRange(e20, l10, u10)); + try { + for (f10.s(); !(c10 = f10.n()).done; ) { + var d10 = c10.value; + o10.push(d10); + } + } catch (e21) { + f10.e(e21); + } finally { + f10.f(); + } + } + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + return o10; + }, update: function(e20, t10) { + e20.transactions.some(function(e21) { + return e21.selection; + }) && (t10.style.animationName = "cm-blink" == t10.style.animationName ? "cm-blink2" : "cm-blink"); + var n10 = lK(e20); + return n10 && fK(e20.state, t10), e20.docChanged || e20.selectionSet || n10; + }, mount: function(e20, t10) { + fK(t10.state, e20); + }, class: "cm-cursorLayer" }); + function fK(e20, t10) { + t10.style.animationDuration = e20.facet(sK).cursorBlinkRate + "ms"; + } + var dK = iK({ above: false, markers: function(e20) { + return e20.state.selection.ranges.map(function(t10) { + return t10.empty ? [] : ZJ.forRange(e20, "cm-selectionBackground", t10); + }).reduce(function(e21, t10) { + return e21.concat(t10); + }); + }, update: function(e20, t10) { + return e20.docChanged || e20.selectionSet || e20.viewportChanged || lK(e20); + }, class: "cm-selectionLayer" }); + var hK = { ".cm-line": { "& ::selection": { backgroundColor: "transparent !important" }, "&::selection": { backgroundColor: "transparent !important" } } }; + aK && (hK[".cm-line"].caretColor = "transparent !important", hK[".cm-content"] = { caretColor: "transparent !important" }); + var vK = LF.highest(zJ.theme(hK)); + var pK = oV.define({ map: function(e20, t10) { + return null == e20 ? null : t10.mapPos(e20); + } }); + var mK = NF.define({ create: function() { + return null; + }, update: function(e20, t10) { + return null != e20 && (e20 = t10.changes.mapPos(e20)), t10.effects.reduce(function(e21, t11) { + return t11.is(pK) ? t11.value : e21; + }, e20); + } }); + var gK = FW.fromClass(function() { + function e20(t10) { + No(this, e20), this.view = t10, this.cursor = null, this.measureReq = { read: this.readPos.bind(this), write: this.drawCursor.bind(this) }; + } + return Do(e20, [{ key: "update", value: function(e21) { + var t10, n10 = e21.state.field(mK); + null == n10 ? null != this.cursor && (null === (t10 = this.cursor) || void 0 === t10 || t10.remove(), this.cursor = null) : (this.cursor || (this.cursor = this.view.scrollDOM.appendChild(document.createElement("div")), this.cursor.className = "cm-dropCursor"), (e21.startState.field(mK) != n10 || e21.docChanged || e21.geometryChanged) && this.view.requestMeasure(this.measureReq)); + } }, { key: "readPos", value: function() { + var e21 = this.view, t10 = e21.state.field(mK), n10 = null != t10 && e21.coordsAtPos(t10); + if (!n10) + return null; + var r10 = e21.scrollDOM.getBoundingClientRect(); + return { left: n10.left - r10.left + e21.scrollDOM.scrollLeft * e21.scaleX, top: n10.top - r10.top + e21.scrollDOM.scrollTop * e21.scaleY, height: n10.bottom - n10.top }; + } }, { key: "drawCursor", value: function(e21) { + if (this.cursor) { + var t10 = this.view, n10 = t10.scaleX, r10 = t10.scaleY; + e21 ? (this.cursor.style.left = e21.left / n10 + "px", this.cursor.style.top = e21.top / r10 + "px", this.cursor.style.height = e21.height / r10 + "px") : this.cursor.style.left = "-100000px"; + } + } }, { key: "destroy", value: function() { + this.cursor && this.cursor.remove(); + } }, { key: "setDropPos", value: function(e21) { + this.view.state.field(mK) != e21 && this.view.dispatch({ effects: pK.of(e21) }); + } }]), e20; + }(), { eventObservers: { dragover: function(e20) { + this.setDropPos(this.view.posAtCoords({ x: e20.clientX, y: e20.clientY })); + }, dragleave: function(e20) { + e20.target != this.view.contentDOM && this.view.contentDOM.contains(e20.relatedTarget) || this.setDropPos(null); + }, dragend: function() { + this.setDropPos(null); + }, drop: function() { + this.setDropPos(null); + } } }); + function yK(e20, t10, n10, r10, o10) { + t10.lastIndex = 0; + for (var i10, a10 = e20.iterRange(n10, r10), s10 = n10; !a10.next().done; s10 += a10.value.length) + if (!a10.lineBreak) + for (; i10 = t10.exec(a10.value); ) + o10(s10 + i10.index, i10); + } + var bK = function() { + function e20(t10) { + No(this, e20); + var n10 = t10.regexp, r10 = t10.decoration, o10 = t10.decorate, i10 = t10.boundary, a10 = t10.maxLength, s10 = void 0 === a10 ? 1e3 : a10; + if (!n10.global) + throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set"); + if (this.regexp = n10, o10) + this.addMatch = function(e21, t11, n11, r11) { + return o10(r11, n11, n11 + e21[0].length, e21, t11); + }; + else if ("function" == typeof r10) + this.addMatch = function(e21, t11, n11, o11) { + var i11 = r10(e21, t11, n11); + i11 && o11(n11, n11 + e21[0].length, i11); + }; + else { + if (!r10) + throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator"); + this.addMatch = function(e21, t11, n11, o11) { + return o11(n11, n11 + e21[0].length, r10); + }; + } + this.boundary = i10, this.maxLength = s10; + } + return Do(e20, [{ key: "createDeco", value: function(e21) { + var t10, n10 = this, r10 = new jV(), o10 = r10.add.bind(r10), i10 = bo(function(e23, t11) { + var n11 = e23.visibleRanges; + if (1 == n11.length && n11[0].from == e23.viewport.from && n11[0].to == e23.viewport.to) + return n11; + var r11, o11 = [], i11 = bo(n11); + try { + for (i11.s(); !(r11 = i11.n()).done; ) { + var a11 = r11.value, s11 = a11.from, c11 = a11.to; + s11 = Math.max(e23.state.doc.lineAt(s11).from, s11 - t11), c11 = Math.min(e23.state.doc.lineAt(c11).to, c11 + t11), o11.length && o11[o11.length - 1].to >= s11 ? o11[o11.length - 1].to = c11 : o11.push({ from: s11, to: c11 }); + } + } catch (e24) { + i11.e(e24); + } finally { + i11.f(); + } + return o11; + }(e21, this.maxLength)); + try { + for (i10.s(); !(t10 = i10.n()).done; ) { + var a10 = t10.value, s10 = a10.from, c10 = a10.to; + yK(e21.state.doc, this.regexp, s10, c10, function(t11, r11) { + return n10.addMatch(r11, e21, t11, o10); + }); + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + return r10.finish(); + } }, { key: "updateDeco", value: function(e21, t10) { + var n10 = 1e9, r10 = -1; + return e21.docChanged && e21.changes.iterChanges(function(t11, o10, i10, a10) { + a10 > e21.view.viewport.from && i10 < e21.view.viewport.to && (n10 = Math.min(i10, n10), r10 = Math.max(a10, r10)); + }), e21.viewportChanged || r10 - n10 > 1e3 ? this.createDeco(e21.view) : r10 > -1 ? this.updateRange(e21.view, t10.map(e21.changes), n10, r10) : t10; + } }, { key: "updateRange", value: function(e21, t10, n10, r10) { + var o10, i10 = this, a10 = bo(e21.visibleRanges); + try { + var s10 = function() { + var a11 = o10.value, s11 = Math.max(a11.from, n10), c10 = Math.min(a11.to, r10); + if (c10 > s11) { + var l10 = e21.state.doc.lineAt(s11), u10 = l10.to < c10 ? e21.state.doc.lineAt(c10) : l10, f10 = Math.max(a11.from, l10.from), d10 = Math.min(a11.to, u10.to); + if (i10.boundary) { + for (; s11 > l10.from; s11--) + if (i10.boundary.test(l10.text[s11 - 1 - l10.from])) { + f10 = s11; + break; + } + for (; c10 < u10.to; c10++) + if (i10.boundary.test(u10.text[c10 - u10.from])) { + d10 = c10; + break; + } + } + var h10, v10 = [], p10 = function(e23, t11, n11) { + return v10.push(n11.range(e23, t11)); + }; + if (l10 == u10) + for (i10.regexp.lastIndex = f10 - l10.from; (h10 = i10.regexp.exec(l10.text)) && h10.index < d10 - l10.from; ) + i10.addMatch(h10, e21, h10.index + l10.from, p10); + else + yK(e21.state.doc, i10.regexp, f10, d10, function(t11, n11) { + return i10.addMatch(n11, e21, t11, p10); + }); + t10 = t10.update({ filterFrom: f10, filterTo: d10, filter: function(e23, t11) { + return e23 < f10 || t11 > d10; + }, add: v10 }); + } + }; + for (a10.s(); !(o10 = a10.n()).done; ) + s10(); + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + return t10; + } }]), e20; + }(); + var kK = null != /x/.unicode ? "gu" : "g"; + var wK = new RegExp("[\0-\b\n-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]", kK); + var xK = { 0: "null", 7: "bell", 8: "backspace", 10: "newline", 11: "vertical tab", 13: "carriage return", 27: "escape", 8203: "zero width space", 8204: "zero width non-joiner", 8205: "zero width joiner", 8206: "left-to-right mark", 8207: "right-to-left mark", 8232: "line separator", 8237: "left-to-right override", 8238: "right-to-left override", 8294: "left-to-right isolate", 8295: "right-to-left isolate", 8297: "pop directional isolate", 8233: "paragraph separator", 65279: "zero width no-break space", 65532: "object replacement" }; + var jK = null; + var SK = MF.define({ combine: function(e20) { + var t10 = gV(e20, { render: null, specialChars: wK, addSpecialChars: null }); + return (t10.replaceTabs = !function() { + var e21; + if (null == jK && "undefined" != typeof document && document.body) { + var t11 = document.body.style; + jK = null != (null !== (e21 = t11.tabSize) && void 0 !== e21 ? e21 : t11.MozTabSize); + } + return jK || false; + }()) && (t10.specialChars = new RegExp(" |" + t10.specialChars.source, kK)), t10.addSpecialChars && (t10.specialChars = new RegExp(t10.specialChars.source + "|" + t10.addSpecialChars.source, kK)), t10; + } }); + function CK() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return [SK.of(e20), $K || ($K = FW.fromClass(function() { + function e21(t10) { + No(this, e21), this.view = t10, this.decorations = KH.none, this.decorationCache = /* @__PURE__ */ Object.create(null), this.decorator = this.makeDecorator(t10.state.facet(SK)), this.decorations = this.decorator.createDeco(t10); + } + return Do(e21, [{ key: "makeDecorator", value: function(e23) { + var t10 = this; + return new bK({ regexp: e23.specialChars, decoration: function(n10, r10, o10) { + var i10 = r10.state.doc, a10 = dF(n10[0], 0); + if (9 == a10) { + var s10 = i10.lineAt(o10), c10 = r10.state.tabSize, l10 = RV(s10.text, c10, o10 - s10.from); + return KH.replace({ widget: new OK((c10 - l10 % c10) * t10.view.defaultCharacterWidth / t10.view.scaleX) }); + } + return t10.decorationCache[a10] || (t10.decorationCache[a10] = KH.replace({ widget: new _K(e23, a10) })); + }, boundary: e23.replaceTabs ? void 0 : /[^]/ }); + } }, { key: "update", value: function(e23) { + var t10 = e23.state.facet(SK); + e23.startState.facet(SK) != t10 ? (this.decorator = this.makeDecorator(t10), this.decorations = this.decorator.createDeco(e23.view)) : this.decorations = this.decorator.updateDeco(e23, this.decorations); + } }]), e21; + }(), { decorations: function(e21) { + return e21.decorations; + } }))]; + } + var $K = null; + var _K = function(e20) { + function t10(e21, n10) { + var r10; + return No(this, t10), (r10 = _o(this, t10)).options = e21, r10.code = n10, r10; + } + return Ao(t10, UH), Do(t10, [{ key: "eq", value: function(e21) { + return e21.code == this.code; + } }, { key: "toDOM", value: function(e21) { + var t11 = function(e23) { + return e23 >= 32 ? "\u2022" : 10 == e23 ? "\u2424" : String.fromCharCode(9216 + e23); + }(this.code), n10 = e21.state.phrase("Control character") + " " + (xK[this.code] || "0x" + this.code.toString(16)), r10 = this.options.render && this.options.render(this.code, n10, t11); + if (r10) + return r10; + var o10 = document.createElement("span"); + return o10.textContent = t11, o10.title = n10, o10.setAttribute("aria-label", n10), o10.className = "cm-specialChar", o10; + } }, { key: "ignoreEvent", value: function() { + return false; + } }]), t10; + }(); + var OK = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).width = e21, n10; + } + return Ao(t10, UH), Do(t10, [{ key: "eq", value: function(e21) { + return e21.width == this.width; + } }, { key: "toDOM", value: function() { + var e21 = document.createElement("span"); + return e21.textContent = " ", e21.className = "cm-tab", e21.style.width = this.width + "px", e21; + } }, { key: "ignoreEvent", value: function() { + return false; + } }]), t10; + }(); + var MK = KH.line({ class: "cm-activeLine" }); + var EK = FW.fromClass(function() { + function e20(t10) { + No(this, e20), this.decorations = this.getDeco(t10); + } + return Do(e20, [{ key: "update", value: function(e21) { + (e21.docChanged || e21.selectionSet) && (this.decorations = this.getDeco(e21.view)); + } }, { key: "getDeco", value: function(e21) { + var t10, n10 = -1, r10 = [], o10 = bo(e21.state.selection.ranges); + try { + for (o10.s(); !(t10 = o10.n()).done; ) { + var i10 = t10.value, a10 = e21.lineBlockAt(i10.head); + a10.from > n10 && (r10.push(MK.range(a10.from)), n10 = a10.from); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + return KH.set(r10); + } }]), e20; + }(), { decorations: function(e20) { + return e20.decorations; + } }); + var AK = 2e3; + function PK(e20, t10) { + var n10 = e20.posAtCoords({ x: t10.clientX, y: t10.clientY }, false), r10 = e20.state.doc.lineAt(n10), o10 = n10 - r10.from, i10 = o10 > AK ? -1 : o10 == r10.length ? function(e21, t11) { + var n11 = e21.coordsAtPos(e21.viewport.from); + return n11 ? Math.round(Math.abs((n11.left - t11) / e21.defaultCharacterWidth)) : -1; + }(e20, t10.clientX) : RV(r10.text, e20.state.tabSize, n10 - r10.from); + return { line: r10.number, col: i10, off: o10 }; + } + function TK(e20, t10) { + var n10 = PK(e20, t10), r10 = e20.state.selection; + return n10 ? { update: function(e21) { + if (e21.docChanged) { + var t11 = e21.changes.mapPos(e21.startState.doc.line(n10.line).from), o10 = e21.state.doc.lineAt(t11); + n10 = { line: o10.number, col: n10.col, off: Math.min(n10.off, o10.length) }, r10 = r10.map(e21.changes); + } + }, get: function(t11, o10, i10) { + var a10 = PK(e20, t11); + if (!a10) + return r10; + var s10 = function(e21, t12, n11) { + var r11 = Math.min(t12.line, n11.line), o11 = Math.max(t12.line, n11.line), i11 = []; + if (t12.off > AK || n11.off > AK || t12.col < 0 || n11.col < 0) + for (var a11 = Math.min(t12.off, n11.off), s11 = Math.max(t12.off, n11.off), c10 = r11; c10 <= o11; c10++) { + var l10 = e21.doc.line(c10); + l10.length <= s11 && i11.push($F.range(l10.from + a11, l10.to + s11)); + } + else + for (var u10 = Math.min(t12.col, n11.col), f10 = Math.max(t12.col, n11.col), d10 = r11; d10 <= o11; d10++) { + var h10 = e21.doc.line(d10), v10 = NV(h10.text, u10, e21.tabSize, true); + if (v10 < 0) + i11.push($F.cursor(h10.to)); + else { + var p10 = NV(h10.text, f10, e21.tabSize); + i11.push($F.range(h10.from + v10, h10.from + p10)); + } + } + return i11; + }(e20.state, n10, a10); + return s10.length ? i10 ? $F.create(s10.concat(r10.ranges)) : $F.create(s10) : r10; + } } : null; + } + function RK(e20) { + var t10 = (null == e20 ? void 0 : e20.eventFilter) || function(e21) { + return e21.altKey && 0 == e21.button; + }; + return zJ.mouseSelectionStyle.of(function(e21, n10) { + return t10(n10) ? TK(e21, n10) : null; + }); + } + var NK = { Alt: [18, function(e20) { + return !!e20.altKey; + }], Control: [17, function(e20) { + return !!e20.ctrlKey; + }], Shift: [16, function(e20) { + return !!e20.shiftKey; + }], Meta: [91, function(e20) { + return !!e20.metaKey; + }] }; + var IK = { style: "cursor: crosshair" }; + function DK() { + var e20 = jo(NK[(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).key || "Alt"], 2), t10 = e20[0], n10 = e20[1], r10 = FW.fromClass(function() { + function e21(t11) { + No(this, e21), this.view = t11, this.isDown = false; + } + return Do(e21, [{ key: "set", value: function(e23) { + this.isDown != e23 && (this.isDown = e23, this.view.update([])); + } }]), e21; + }(), { eventObservers: { keydown: function(e21) { + this.set(e21.keyCode == t10 || n10(e21)); + }, keyup: function(e21) { + e21.keyCode != t10 && n10(e21) || this.set(false); + }, mousemove: function(e21) { + this.set(n10(e21)); + } } }); + return [r10, zJ.contentAttributes.of(function(e21) { + var t11; + return (null === (t11 = e21.plugin(r10)) || void 0 === t11 ? void 0 : t11.isDown) ? IK : null; + })]; + } + var qK = "-10000px"; + var zK = function() { + function e20(t10, n10, r10) { + No(this, e20), this.facet = n10, this.createTooltipView = r10, this.input = t10.state.facet(n10), this.tooltips = this.input.filter(function(e21) { + return e21; + }), this.tooltipViews = this.tooltips.map(r10); + } + return Do(e20, [{ key: "update", value: function(e21, t10) { + var n10, r10 = e21.state.facet(this.facet), o10 = r10.filter(function(e23) { + return e23; + }); + if (r10 === this.input) { + var i10, a10 = bo(this.tooltipViews); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = i10.value; + s10.update && s10.update(e21); + } + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + return false; + } + for (var c10 = [], l10 = t10 ? [] : null, u10 = 0; u10 < o10.length; u10++) { + var f10 = o10[u10], d10 = -1; + if (f10) { + for (var h10 = 0; h10 < this.tooltips.length; h10++) { + var v10 = this.tooltips[h10]; + v10 && v10.create == f10.create && (d10 = h10); + } + if (d10 < 0) + c10[u10] = this.createTooltipView(f10), l10 && (l10[u10] = !!f10.above); + else { + var p10 = c10[u10] = this.tooltipViews[d10]; + l10 && (l10[u10] = t10[d10]), p10.update && p10.update(e21); + } + } + } + var m10, g10 = bo(this.tooltipViews); + try { + for (g10.s(); !(m10 = g10.n()).done; ) { + var y10 = m10.value; + c10.indexOf(y10) < 0 && (y10.dom.remove(), null === (n10 = y10.destroy) || void 0 === n10 || n10.call(y10)); + } + } catch (e23) { + g10.e(e23); + } finally { + g10.f(); + } + return t10 && (l10.forEach(function(e23, n11) { + return t10[n11] = e23; + }), t10.length = l10.length), this.input = r10, this.tooltips = o10, this.tooltipViews = c10, true; + } }]), e20; + }(); + function BK(e20) { + var t10 = e20.win; + return { top: 0, left: 0, bottom: t10.innerHeight, right: t10.innerWidth }; + } + var LK = MF.define({ combine: function(e20) { + var t10, n10, r10; + return { position: AH.ios ? "absolute" : (null === (t10 = e20.find(function(e21) { + return e21.position; + })) || void 0 === t10 ? void 0 : t10.position) || "fixed", parent: (null === (n10 = e20.find(function(e21) { + return e21.parent; + })) || void 0 === n10 ? void 0 : n10.parent) || null, tooltipSpace: (null === (r10 = e20.find(function(e21) { + return e21.tooltipSpace; + })) || void 0 === r10 ? void 0 : r10.tooltipSpace) || BK }; + } }); + var FK = /* @__PURE__ */ new WeakMap(); + var VK = FW.fromClass(function() { + function e20(t10) { + var n10 = this; + No(this, e20), this.view = t10, this.above = [], this.inView = true, this.madeAbsolute = false, this.lastTransaction = 0, this.measureTimeout = -1; + var r10 = t10.state.facet(LK); + this.position = r10.position, this.parent = r10.parent, this.classes = t10.themeClasses, this.createContainer(), this.measureReq = { read: this.readMeasure.bind(this), write: this.writeMeasure.bind(this), key: this }, this.manager = new zK(t10, UK, function(e21) { + return n10.createTooltip(e21); + }), this.intersectionObserver = "function" == typeof IntersectionObserver ? new IntersectionObserver(function(e21) { + Date.now() > n10.lastTransaction - 50 && e21.length > 0 && e21[e21.length - 1].intersectionRatio < 1 && n10.measureSoon(); + }, { threshold: [1] }) : null, this.observeIntersection(), t10.win.addEventListener("resize", this.measureSoon = this.measureSoon.bind(this)), this.maybeMeasure(); + } + return Do(e20, [{ key: "createContainer", value: function() { + this.parent ? (this.container = document.createElement("div"), this.container.style.position = "relative", this.container.className = this.view.themeClasses, this.parent.appendChild(this.container)) : this.container = this.view.dom; + } }, { key: "observeIntersection", value: function() { + if (this.intersectionObserver) { + this.intersectionObserver.disconnect(); + var e21, t10 = bo(this.manager.tooltipViews); + try { + for (t10.s(); !(e21 = t10.n()).done; ) { + var n10 = e21.value; + this.intersectionObserver.observe(n10.dom); + } + } catch (e23) { + t10.e(e23); + } finally { + t10.f(); + } + } + } }, { key: "measureSoon", value: function() { + var e21 = this; + this.measureTimeout < 0 && (this.measureTimeout = setTimeout(function() { + e21.measureTimeout = -1, e21.maybeMeasure(); + }, 50)); + } }, { key: "update", value: function(e21) { + e21.transactions.length && (this.lastTransaction = Date.now()); + var t10 = this.manager.update(e21, this.above); + t10 && this.observeIntersection(); + var n10 = t10 || e21.geometryChanged, r10 = e21.state.facet(LK); + if (r10.position != this.position && !this.madeAbsolute) { + this.position = r10.position; + var o10, i10 = bo(this.manager.tooltipViews); + try { + for (i10.s(); !(o10 = i10.n()).done; ) { + o10.value.dom.style.position = this.position; + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + n10 = true; + } + if (r10.parent != this.parent) { + this.parent && this.container.remove(), this.parent = r10.parent, this.createContainer(); + var a10, s10 = bo(this.manager.tooltipViews); + try { + for (s10.s(); !(a10 = s10.n()).done; ) { + var c10 = a10.value; + this.container.appendChild(c10.dom); + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + n10 = true; + } else + this.parent && this.view.themeClasses != this.classes && (this.classes = this.container.className = this.view.themeClasses); + n10 && this.maybeMeasure(); + } }, { key: "createTooltip", value: function(e21) { + var t10 = e21.create(this.view); + if (t10.dom.classList.add("cm-tooltip"), e21.arrow && !t10.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")) { + var n10 = document.createElement("div"); + n10.className = "cm-tooltip-arrow", t10.dom.appendChild(n10); + } + return t10.dom.style.position = this.position, t10.dom.style.top = qK, t10.dom.style.left = "0px", this.container.appendChild(t10.dom), t10.mount && t10.mount(this.view), t10; + } }, { key: "destroy", value: function() { + var e21, t10; + this.view.win.removeEventListener("resize", this.measureSoon); + var n10, r10 = bo(this.manager.tooltipViews); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + o10.dom.remove(), null === (e21 = o10.destroy) || void 0 === e21 || e21.call(o10); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + this.parent && this.container.remove(), null === (t10 = this.intersectionObserver) || void 0 === t10 || t10.disconnect(), clearTimeout(this.measureTimeout); + } }, { key: "readMeasure", value: function() { + var e21 = this, t10 = this.view.dom.getBoundingClientRect(), n10 = 1, r10 = 1, o10 = false; + if ("fixed" == this.position && this.manager.tooltipViews.length) { + var i10 = this.manager.tooltipViews[0].dom; + if (AH.gecko) + o10 = i10.offsetParent != this.container.ownerDocument.body; + else if (i10.style.top == qK && "0px" == i10.style.left) { + var a10 = i10.getBoundingClientRect(); + o10 = Math.abs(a10.top + 1e4) > 1 || Math.abs(a10.left) > 1; + } + } + if (o10 || "absolute" == this.position) + if (this.parent) { + var s10 = this.parent.getBoundingClientRect(); + s10.width && s10.height && (n10 = s10.width / this.parent.offsetWidth, r10 = s10.height / this.parent.offsetHeight); + } else { + var c10 = this.view.viewState; + n10 = c10.scaleX, r10 = c10.scaleY; + } + return { editor: t10, parent: this.parent ? this.container.getBoundingClientRect() : t10, pos: this.manager.tooltips.map(function(t11, n11) { + var r11 = e21.manager.tooltipViews[n11]; + return r11.getCoords ? r11.getCoords(t11.pos) : e21.view.coordsAtPos(t11.pos); + }), size: this.manager.tooltipViews.map(function(e23) { + return e23.dom.getBoundingClientRect(); + }), space: this.view.state.facet(LK).tooltipSpace(this.view), scaleX: n10, scaleY: r10, makeAbsolute: o10 }; + } }, { key: "writeMeasure", value: function(e21) { + var t10; + if (e21.makeAbsolute) { + this.madeAbsolute = true, this.position = "absolute"; + var n10, r10 = bo(this.manager.tooltipViews); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + n10.value.dom.style.position = "absolute"; + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + } + for (var o10 = e21.editor, i10 = e21.space, a10 = e21.scaleX, s10 = e21.scaleY, c10 = [], l10 = 0; l10 < this.manager.tooltips.length; l10++) { + var u10 = this.manager.tooltips[l10], f10 = this.manager.tooltipViews[l10], d10 = f10.dom, h10 = e21.pos[l10], v10 = e21.size[l10]; + if (!h10 || h10.bottom <= Math.max(o10.top, i10.top) || h10.top >= Math.min(o10.bottom, i10.bottom) || h10.right < Math.max(o10.left, i10.left) - 0.1 || h10.left > Math.min(o10.right, i10.right) + 0.1) + d10.style.top = qK; + else { + var p10 = u10.arrow ? f10.dom.querySelector(".cm-tooltip-arrow") : null, m10 = p10 ? 7 : 0, g10 = v10.right - v10.left, y10 = null !== (t10 = FK.get(f10)) && void 0 !== t10 ? t10 : v10.bottom - v10.top, b10 = f10.offset || WK, k10 = this.view.textDirection == rW.LTR, w10 = v10.width > i10.right - i10.left ? k10 ? i10.left : i10.right - v10.width : k10 ? Math.min(h10.left - (p10 ? 14 : 0) + b10.x, i10.right - g10) : Math.max(i10.left, h10.left - g10 + (p10 ? 14 : 0) - b10.x), x10 = this.above[l10]; + !u10.strictSide && (x10 ? h10.top - (v10.bottom - v10.top) - b10.y < i10.top : h10.bottom + (v10.bottom - v10.top) + b10.y > i10.bottom) && x10 == i10.bottom - h10.bottom > h10.top - i10.top && (x10 = this.above[l10] = !x10); + var j10 = (x10 ? h10.top - i10.top : i10.bottom - h10.bottom) - m10; + if (j10 < y10 && false !== f10.resize) { + if (j10 < this.view.defaultLineHeight) { + d10.style.top = qK; + continue; + } + FK.set(f10, y10), d10.style.height = (y10 = j10) / s10 + "px"; + } else + d10.style.height && (d10.style.height = ""); + var S10 = x10 ? h10.top - y10 - m10 - b10.y : h10.bottom + m10 + b10.y, C10 = w10 + g10; + if (true !== f10.overlap) { + var $10, _10 = bo(c10); + try { + for (_10.s(); !($10 = _10.n()).done; ) { + var O10 = $10.value; + O10.left < C10 && O10.right > w10 && O10.top < S10 + y10 && O10.bottom > S10 && (S10 = x10 ? O10.top - y10 - 2 - m10 : O10.bottom + m10 + 2); + } + } catch (e23) { + _10.e(e23); + } finally { + _10.f(); + } + } + if ("absolute" == this.position ? (d10.style.top = (S10 - e21.parent.top) / s10 + "px", d10.style.left = (w10 - e21.parent.left) / a10 + "px") : (d10.style.top = S10 / s10 + "px", d10.style.left = w10 / a10 + "px"), p10) { + var M10 = h10.left + (k10 ? b10.x : -b10.x) - (w10 + 14 - 7); + p10.style.left = M10 / a10 + "px"; + } + true !== f10.overlap && c10.push({ left: w10, top: S10, right: C10, bottom: S10 + y10 }), d10.classList.toggle("cm-tooltip-above", x10), d10.classList.toggle("cm-tooltip-below", !x10), f10.positioned && f10.positioned(e21.space); + } + } + } }, { key: "maybeMeasure", value: function() { + if (this.manager.tooltips.length && (this.view.inView && this.view.requestMeasure(this.measureReq), this.inView != this.view.inView && (this.inView = this.view.inView, !this.inView))) { + var e21, t10 = bo(this.manager.tooltipViews); + try { + for (t10.s(); !(e21 = t10.n()).done; ) { + e21.value.dom.style.top = qK; + } + } catch (e23) { + t10.e(e23); + } finally { + t10.f(); + } + } + } }]), e20; + }(), { eventObservers: { scroll: function() { + this.maybeMeasure(); + } } }); + var HK = zJ.baseTheme({ ".cm-tooltip": { zIndex: 100, boxSizing: "border-box" }, "&light .cm-tooltip": { border: "1px solid #bbb", backgroundColor: "#f5f5f5" }, "&light .cm-tooltip-section:not(:first-child)": { borderTop: "1px solid #bbb" }, "&dark .cm-tooltip": { backgroundColor: "#333338", color: "white" }, ".cm-tooltip-arrow": { height: "".concat(7, "px"), width: "".concat(14, "px"), position: "absolute", zIndex: -1, overflow: "hidden", "&:before, &:after": { content: "''", position: "absolute", width: 0, height: 0, borderLeft: "".concat(7, "px solid transparent"), borderRight: "".concat(7, "px solid transparent") }, ".cm-tooltip-above &": { bottom: "-".concat(7, "px"), "&:before": { borderTop: "".concat(7, "px solid #bbb") }, "&:after": { borderTop: "".concat(7, "px solid #f5f5f5"), bottom: "1px" } }, ".cm-tooltip-below &": { top: "-".concat(7, "px"), "&:before": { borderBottom: "".concat(7, "px solid #bbb") }, "&:after": { borderBottom: "".concat(7, "px solid #f5f5f5"), top: "1px" } } }, "&dark .cm-tooltip .cm-tooltip-arrow": { "&:before": { borderTopColor: "#333338", borderBottomColor: "#333338" }, "&:after": { borderTopColor: "transparent", borderBottomColor: "transparent" } } }); + var WK = { x: 0, y: 0 }; + var UK = MF.define({ enables: [VK, HK] }); + var JK = MF.define(); + var KK = function() { + function e20(t10) { + var n10 = this; + No(this, e20), this.view = t10, this.mounted = false, this.dom = document.createElement("div"), this.dom.classList.add("cm-tooltip-hover"), this.manager = new zK(t10, JK, function(e21) { + return n10.createHostedView(e21); + }); + } + return Do(e20, [{ key: "createHostedView", value: function(e21) { + var t10 = e21.create(this.view); + return t10.dom.classList.add("cm-tooltip-section"), this.dom.appendChild(t10.dom), this.mounted && t10.mount && t10.mount(this.view), t10; + } }, { key: "mount", value: function(e21) { + var t10, n10 = bo(this.manager.tooltipViews); + try { + for (n10.s(); !(t10 = n10.n()).done; ) { + var r10 = t10.value; + r10.mount && r10.mount(e21); + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + this.mounted = true; + } }, { key: "positioned", value: function(e21) { + var t10, n10 = bo(this.manager.tooltipViews); + try { + for (n10.s(); !(t10 = n10.n()).done; ) { + var r10 = t10.value; + r10.positioned && r10.positioned(e21); + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + } }, { key: "update", value: function(e21) { + this.manager.update(e21); + } }, { key: "destroy", value: function() { + var e21, t10, n10 = bo(this.manager.tooltipViews); + try { + for (n10.s(); !(t10 = n10.n()).done; ) { + var r10 = t10.value; + null === (e21 = r10.destroy) || void 0 === e21 || e21.call(r10); + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + } }, { key: "passProp", value: function(e21) { + var t10, n10 = void 0, r10 = bo(this.manager.tooltipViews); + try { + for (r10.s(); !(t10 = r10.n()).done; ) { + var o10 = t10.value[e21]; + if (void 0 !== o10) { + if (void 0 === n10) + n10 = o10; + else if (n10 !== o10) + return; + } + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + return n10; + } }, { key: "offset", get: function() { + return this.passProp("offset"); + } }, { key: "getCoords", get: function() { + return this.passProp("getCoords"); + } }, { key: "overlap", get: function() { + return this.passProp("overlap"); + } }, { key: "resize", get: function() { + return this.passProp("resize"); + } }], [{ key: "create", value: function(t10) { + return new e20(t10); + } }]), e20; + }(); + var GK = UK.compute([JK], function(e20) { + var t10 = e20.facet(JK).filter(function(e21) { + return e21; + }); + return 0 === t10.length ? null : { pos: Math.min.apply(Math, Bo(t10.map(function(e21) { + return e21.pos; + }))), end: Math.max.apply(Math, Bo(t10.map(function(e21) { + var t11; + return null !== (t11 = e21.end) && void 0 !== t11 ? t11 : e21.pos; + }))), create: KK.create, above: t10[0].above, arrow: t10.some(function(e21) { + return e21.arrow; + }) }; + }); + var QK = function() { + function e20(t10, n10, r10, o10, i10) { + No(this, e20), this.view = t10, this.source = n10, this.field = r10, this.setHover = o10, this.hoverTime = i10, this.hoverTimeout = -1, this.restartTimeout = -1, this.pending = null, this.lastMove = { x: 0, y: 0, target: t10.dom, time: 0 }, this.checkHover = this.checkHover.bind(this), t10.dom.addEventListener("mouseleave", this.mouseleave = this.mouseleave.bind(this)), t10.dom.addEventListener("mousemove", this.mousemove = this.mousemove.bind(this)); + } + return Do(e20, [{ key: "update", value: function() { + var e21 = this; + this.pending && (this.pending = null, clearTimeout(this.restartTimeout), this.restartTimeout = setTimeout(function() { + return e21.startHover(); + }, 20)); + } }, { key: "active", get: function() { + return this.view.state.field(this.field); + } }, { key: "checkHover", value: function() { + if (this.hoverTimeout = -1, !this.active) { + var e21 = Date.now() - this.lastMove.time; + e21 < this.hoverTime ? this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime - e21) : this.startHover(); + } + } }, { key: "startHover", value: function() { + var e21 = this; + clearTimeout(this.restartTimeout); + var t10 = this.view, n10 = this.lastMove, r10 = t10.docView.nearest(n10.target); + if (r10) { + var o10, i10 = 1; + if (r10 instanceof RH) + o10 = r10.posAtStart; + else { + if (null == (o10 = t10.posAtCoords(n10))) + return; + var a10 = t10.coordsAtPos(o10); + if (!a10 || n10.y < a10.top || n10.y > a10.bottom || n10.x < a10.left - t10.defaultCharacterWidth || n10.x > a10.right + t10.defaultCharacterWidth) + return; + var s10 = t10.bidiSpans(t10.state.doc.lineAt(o10)).find(function(e23) { + return e23.from <= o10 && e23.to >= o10; + }), c10 = s10 && s10.dir == rW.RTL ? -1 : 1; + i10 = n10.x < a10.left ? -c10 : c10; + } + var l10 = this.source(t10, o10, i10); + if (null == l10 ? void 0 : l10.then) { + var u10 = this.pending = { pos: o10 }; + l10.then(function(n11) { + e21.pending == u10 && (e21.pending = null, n11 && t10.dispatch({ effects: e21.setHover.of(n11) })); + }, function(e23) { + return qW(t10.state, e23, "hover tooltip"); + }); + } else + l10 && t10.dispatch({ effects: this.setHover.of(l10) }); + } + } }, { key: "tooltip", get: function() { + var e21 = this.view.plugin(VK), t10 = e21 ? e21.manager.tooltips.findIndex(function(e23) { + return e23.create == KK.create; + }) : -1; + return t10 > -1 ? e21.manager.tooltipViews[t10] : null; + } }, { key: "mousemove", value: function(e21) { + var t10; + this.lastMove = { x: e21.clientX, y: e21.clientY, target: e21.target, time: Date.now() }, this.hoverTimeout < 0 && (this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime)); + var n10 = this.active, r10 = this.tooltip; + if (n10 && r10 && !function(e23, t11) { + var n11 = e23.getBoundingClientRect(); + return t11.clientX >= n11.left - YK && t11.clientX <= n11.right + YK && t11.clientY >= n11.top - YK && t11.clientY <= n11.bottom + YK; + }(r10.dom, e21) || this.pending) { + var o10 = (n10 || this.pending).pos, i10 = null !== (t10 = null == n10 ? void 0 : n10.end) && void 0 !== t10 ? t10 : o10; + (o10 == i10 ? this.view.posAtCoords(this.lastMove) == o10 : function(e23, t11, n11, r11, o11, i11) { + var a10 = e23.scrollDOM.getBoundingClientRect(), s10 = e23.documentTop + e23.documentPadding.top + e23.contentHeight; + if (a10.left > r11 || a10.right < r11 || a10.top > o11 || Math.min(a10.bottom, s10) < o11) + return false; + var c10 = e23.posAtCoords({ x: r11, y: o11 }, false); + return c10 >= t11 && c10 <= n11; + }(this.view, o10, i10, e21.clientX, e21.clientY)) || (this.view.dispatch({ effects: this.setHover.of(null) }), this.pending = null); + } + } }, { key: "mouseleave", value: function(e21) { + if (clearTimeout(this.hoverTimeout), this.hoverTimeout = -1, this.active) { + var t10 = this.tooltip; + t10 && t10.dom.contains(e21.relatedTarget) ? this.watchTooltipLeave(t10.dom) : this.view.dispatch({ effects: this.setHover.of(null) }); + } + } }, { key: "watchTooltipLeave", value: function(e21) { + var t10 = this; + e21.addEventListener("mouseleave", function n10(r10) { + e21.removeEventListener("mouseleave", n10), t10.active && !t10.view.dom.contains(r10.relatedTarget) && t10.view.dispatch({ effects: t10.setHover.of(null) }); + }); + } }, { key: "destroy", value: function() { + clearTimeout(this.hoverTimeout), this.view.dom.removeEventListener("mouseleave", this.mouseleave), this.view.dom.removeEventListener("mousemove", this.mousemove); + } }]), e20; + }(); + var YK = 4; + function XK(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n10 = oV.define(), r10 = NF.define({ create: function() { + return null; + }, update: function(e21, r11) { + if (e21 && (t10.hideOnChange && (r11.docChanged || r11.selection) || t10.hideOn && t10.hideOn(r11, e21))) + return null; + if (e21 && r11.docChanged) { + var o10 = r11.changes.mapPos(e21.pos, -1, mF.TrackDel); + if (null == o10) + return null; + var i10 = Object.assign(/* @__PURE__ */ Object.create(null), e21); + i10.pos = o10, null != e21.end && (i10.end = r11.changes.mapPos(e21.end)), e21 = i10; + } + var a10, s10 = bo(r11.effects); + try { + for (s10.s(); !(a10 = s10.n()).done; ) { + var c10 = a10.value; + c10.is(n10) && (e21 = c10.value), c10.is(eG) && (e21 = null); + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + return e21; + }, provide: function(e21) { + return JK.from(e21); + } }); + return [r10, FW.define(function(o10) { + return new QK(o10, e20, r10, n10, t10.hoverTime || 300); + }), GK]; + } + function ZK(e20, t10) { + var n10 = e20.plugin(VK); + if (!n10) + return null; + var r10 = n10.manager.tooltips.indexOf(t10); + return r10 < 0 ? null : n10.manager.tooltipViews[r10]; + } + var eG = oV.define(); + var tG = MF.define({ combine: function(e20) { + var t10, n10, r10, o10 = bo(e20); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + t10 = t10 || i10.topContainer, n10 = n10 || i10.bottomContainer; + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + return { topContainer: t10, bottomContainer: n10 }; + } }); + function nG(e20, t10) { + var n10 = e20.plugin(rG), r10 = n10 ? n10.specs.indexOf(t10) : -1; + return r10 > -1 ? n10.panels[r10] : null; + } + var rG = FW.fromClass(function() { + function e20(t10) { + No(this, e20), this.input = t10.state.facet(aG), this.specs = this.input.filter(function(e21) { + return e21; + }), this.panels = this.specs.map(function(e21) { + return e21(t10); + }); + var n10 = t10.state.facet(tG); + this.top = new oG(t10, true, n10.topContainer), this.bottom = new oG(t10, false, n10.bottomContainer), this.top.sync(this.panels.filter(function(e21) { + return e21.top; + })), this.bottom.sync(this.panels.filter(function(e21) { + return !e21.top; + })); + var r10, o10 = bo(this.panels); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + i10.dom.classList.add("cm-panel"), i10.mount && i10.mount(); + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + } + return Do(e20, [{ key: "update", value: function(e21) { + var t10 = e21.state.facet(tG); + this.top.container != t10.topContainer && (this.top.sync([]), this.top = new oG(e21.view, true, t10.topContainer)), this.bottom.container != t10.bottomContainer && (this.bottom.sync([]), this.bottom = new oG(e21.view, false, t10.bottomContainer)), this.top.syncClasses(), this.bottom.syncClasses(); + var n10 = e21.state.facet(aG); + if (n10 != this.input) { + var r10, o10 = n10.filter(function(e23) { + return e23; + }), i10 = [], a10 = [], s10 = [], c10 = [], l10 = bo(o10); + try { + for (l10.s(); !(r10 = l10.n()).done; ) { + var u10 = r10.value, f10 = this.specs.indexOf(u10), d10 = void 0; + f10 < 0 ? (d10 = u10(e21.view), c10.push(d10)) : (d10 = this.panels[f10]).update && d10.update(e21), i10.push(d10), (d10.top ? a10 : s10).push(d10); + } + } catch (e23) { + l10.e(e23); + } finally { + l10.f(); + } + this.specs = o10, this.panels = i10, this.top.sync(a10), this.bottom.sync(s10); + for (var h10 = 0, v10 = c10; h10 < v10.length; h10++) { + var p10 = v10[h10]; + p10.dom.classList.add("cm-panel"), p10.mount && p10.mount(); + } + } else { + var m10, g10 = bo(this.panels); + try { + for (g10.s(); !(m10 = g10.n()).done; ) { + var y10 = m10.value; + y10.update && y10.update(e21); + } + } catch (e23) { + g10.e(e23); + } finally { + g10.f(); + } + } + } }, { key: "destroy", value: function() { + this.top.sync([]), this.bottom.sync([]); + } }]), e20; + }(), { provide: function(e20) { + return zJ.scrollMargins.of(function(t10) { + var n10 = t10.plugin(e20); + return n10 && { top: n10.top.scrollMargin(), bottom: n10.bottom.scrollMargin() }; + }); + } }); + var oG = function() { + function e20(t10, n10, r10) { + No(this, e20), this.view = t10, this.top = n10, this.container = r10, this.dom = void 0, this.classes = "", this.panels = [], this.syncClasses(); + } + return Do(e20, [{ key: "sync", value: function(e21) { + var t10, n10 = bo(this.panels); + try { + for (n10.s(); !(t10 = n10.n()).done; ) { + var r10 = t10.value; + r10.destroy && e21.indexOf(r10) < 0 && r10.destroy(); + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + this.panels = e21, this.syncDOM(); + } }, { key: "syncDOM", value: function() { + if (0 != this.panels.length) { + if (!this.dom) { + this.dom = document.createElement("div"), this.dom.className = this.top ? "cm-panels cm-panels-top" : "cm-panels cm-panels-bottom", this.dom.style[this.top ? "top" : "bottom"] = "0"; + var e21 = this.container || this.view.dom; + e21.insertBefore(this.dom, this.top ? e21.firstChild : null); + } + var t10, n10 = this.dom.firstChild, r10 = bo(this.panels); + try { + for (r10.s(); !(t10 = r10.n()).done; ) { + var o10 = t10.value; + if (o10.dom.parentNode == this.dom) { + for (; n10 != o10.dom; ) + n10 = iG(n10); + n10 = n10.nextSibling; + } else + this.dom.insertBefore(o10.dom, n10); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + for (; n10; ) + n10 = iG(n10); + } else + this.dom && (this.dom.remove(), this.dom = void 0); + } }, { key: "scrollMargin", value: function() { + return !this.dom || this.container ? 0 : Math.max(0, this.top ? this.dom.getBoundingClientRect().bottom - Math.max(0, this.view.scrollDOM.getBoundingClientRect().top) : Math.min(innerHeight, this.view.scrollDOM.getBoundingClientRect().bottom) - this.dom.getBoundingClientRect().top); + } }, { key: "syncClasses", value: function() { + if (this.container && this.classes != this.view.themeClasses) { + var e21, t10 = bo(this.classes.split(" ")); + try { + for (t10.s(); !(e21 = t10.n()).done; ) { + var n10 = e21.value; + n10 && this.container.classList.remove(n10); + } + } catch (e23) { + t10.e(e23); + } finally { + t10.f(); + } + var r10, o10 = bo((this.classes = this.view.themeClasses).split(" ")); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + i10 && this.container.classList.add(i10); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + } + } }]), e20; + }(); + function iG(e20) { + var t10 = e20.nextSibling; + return e20.remove(), t10; + } + var aG = MF.define({ enables: rG }); + var sG = function(e20) { + function t10() { + return No(this, t10), _o(this, t10, arguments); + } + return Ao(t10, yV), Do(t10, [{ key: "compare", value: function(e21) { + return this == e21 || this.constructor == e21.constructor && this.eq(e21); + } }, { key: "eq", value: function(e21) { + return false; + } }, { key: "destroy", value: function(e21) { + } }]), t10; + }(); + sG.prototype.elementClass = "", sG.prototype.toDOM = void 0, sG.prototype.mapMode = mF.TrackBefore, sG.prototype.startSide = sG.prototype.endSide = -1, sG.prototype.point = true; + var cG = MF.define(); + var lG = { class: "", renderEmptyElements: false, elementStyle: "", markers: function() { + return xV.empty; + }, lineMarker: function() { + return null; + }, widgetMarker: function() { + return null; + }, lineMarkerChange: null, initialSpacer: null, updateSpacer: null, domEventHandlers: {} }; + var uG = MF.define(); + function fG(e20) { + return [hG(), uG.of(Object.assign(Object.assign({}, lG), e20))]; + } + var dG = MF.define({ combine: function(e20) { + return e20.some(function(e21) { + return e21; + }); + } }); + function hG(e20) { + var t10 = [vG]; + return e20 && false === e20.fixed && t10.push(dG.of(true)), t10; + } + var vG = FW.fromClass(function() { + function e20(t10) { + No(this, e20), this.view = t10, this.prevViewport = t10.viewport, this.dom = document.createElement("div"), this.dom.className = "cm-gutters", this.dom.setAttribute("aria-hidden", "true"), this.dom.style.minHeight = this.view.contentHeight / this.view.scaleY + "px", this.gutters = t10.state.facet(uG).map(function(e21) { + return new yG(t10, e21); + }); + var n10, r10 = bo(this.gutters); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + this.dom.appendChild(o10.dom); + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + this.fixed = !t10.state.facet(dG), this.fixed && (this.dom.style.position = "sticky"), this.syncGutters(false), t10.scrollDOM.insertBefore(this.dom, t10.contentDOM); + } + return Do(e20, [{ key: "update", value: function(e21) { + if (this.updateGutters(e21)) { + var t10 = this.prevViewport, n10 = e21.view.viewport, r10 = Math.min(t10.to, n10.to) - Math.max(t10.from, n10.from); + this.syncGutters(r10 < 0.8 * (n10.to - n10.from)); + } + e21.geometryChanged && (this.dom.style.minHeight = this.view.contentHeight + "px"), this.view.state.facet(dG) != !this.fixed && (this.fixed = !this.fixed, this.dom.style.position = this.fixed ? "sticky" : ""), this.prevViewport = e21.view.viewport; + } }, { key: "syncGutters", value: function(e21) { + var t10 = this, n10 = this.dom.nextSibling; + e21 && this.dom.remove(); + var r10, o10 = xV.iter(this.view.state.facet(cG), this.view.viewport.from), i10 = [], a10 = this.gutters.map(function(e23) { + return new gG(e23, t10.view.viewport, -t10.view.documentPadding.top); + }), s10 = bo(this.view.viewportLineBlocks); + try { + for (s10.s(); !(r10 = s10.n()).done; ) { + var c10 = r10.value; + if (i10.length && (i10 = []), Array.isArray(c10.type)) { + var l10, u10 = true, f10 = bo(c10.type); + try { + for (f10.s(); !(l10 = f10.n()).done; ) { + var d10 = l10.value; + if (d10.type == JH.Text && u10) { + mG(o10, i10, d10.from); + var h10, v10 = bo(a10); + try { + for (v10.s(); !(h10 = v10.n()).done; ) { + h10.value.line(this.view, d10, i10); + } + } catch (e23) { + v10.e(e23); + } finally { + v10.f(); + } + u10 = false; + } else if (d10.widget) { + var p10, m10 = bo(a10); + try { + for (m10.s(); !(p10 = m10.n()).done; ) { + p10.value.widget(this.view, d10); + } + } catch (e23) { + m10.e(e23); + } finally { + m10.f(); + } + } + } + } catch (e23) { + f10.e(e23); + } finally { + f10.f(); + } + } else if (c10.type == JH.Text) { + mG(o10, i10, c10.from); + var g10, y10 = bo(a10); + try { + for (y10.s(); !(g10 = y10.n()).done; ) { + g10.value.line(this.view, c10, i10); + } + } catch (e23) { + y10.e(e23); + } finally { + y10.f(); + } + } else if (c10.widget) { + var b10, k10 = bo(a10); + try { + for (k10.s(); !(b10 = k10.n()).done; ) { + b10.value.widget(this.view, c10); + } + } catch (e23) { + k10.e(e23); + } finally { + k10.f(); + } + } + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + var w10, x10 = bo(a10); + try { + for (x10.s(); !(w10 = x10.n()).done; ) { + w10.value.finish(); + } + } catch (e23) { + x10.e(e23); + } finally { + x10.f(); + } + e21 && this.view.scrollDOM.insertBefore(this.dom, n10); + } }, { key: "updateGutters", value: function(e21) { + var t10 = e21.startState.facet(uG), n10 = e21.state.facet(uG), r10 = e21.docChanged || e21.heightChanged || e21.viewportChanged || !xV.eq(e21.startState.facet(cG), e21.state.facet(cG), e21.view.viewport.from, e21.view.viewport.to); + if (t10 == n10) { + var o10, i10 = bo(this.gutters); + try { + for (i10.s(); !(o10 = i10.n()).done; ) { + o10.value.update(e21) && (r10 = true); + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + } else { + r10 = true; + var a10, s10 = [], c10 = bo(n10); + try { + for (c10.s(); !(a10 = c10.n()).done; ) { + var l10 = a10.value, u10 = t10.indexOf(l10); + u10 < 0 ? s10.push(new yG(this.view, l10)) : (this.gutters[u10].update(e21), s10.push(this.gutters[u10])); + } + } catch (e23) { + c10.e(e23); + } finally { + c10.f(); + } + var f10, d10 = bo(this.gutters); + try { + for (d10.s(); !(f10 = d10.n()).done; ) { + var h10 = f10.value; + h10.dom.remove(), s10.indexOf(h10) < 0 && h10.destroy(); + } + } catch (e23) { + d10.e(e23); + } finally { + d10.f(); + } + for (var v10 = 0, p10 = s10; v10 < p10.length; v10++) { + var m10 = p10[v10]; + this.dom.appendChild(m10.dom); + } + this.gutters = s10; + } + return r10; + } }, { key: "destroy", value: function() { + var e21, t10 = bo(this.gutters); + try { + for (t10.s(); !(e21 = t10.n()).done; ) { + e21.value.destroy(); + } + } catch (e23) { + t10.e(e23); + } finally { + t10.f(); + } + this.dom.remove(); + } }]), e20; + }(), { provide: function(e20) { + return zJ.scrollMargins.of(function(t10) { + var n10 = t10.plugin(e20); + return n10 && 0 != n10.gutters.length && n10.fixed ? t10.textDirection == rW.LTR ? { left: n10.dom.offsetWidth * t10.scaleX } : { right: n10.dom.offsetWidth * t10.scaleX } : null; + }); + } }); + function pG(e20) { + return Array.isArray(e20) ? e20 : [e20]; + } + function mG(e20, t10, n10) { + for (; e20.value && e20.from <= n10; ) + e20.from == n10 && t10.push(e20.value), e20.next(); + } + var gG = function() { + function e20(t10, n10, r10) { + No(this, e20), this.gutter = t10, this.height = r10, this.i = 0, this.cursor = xV.iter(t10.markers, n10.from); + } + return Do(e20, [{ key: "addElement", value: function(e21, t10, n10) { + var r10 = this.gutter, o10 = (t10.top - this.height) / e21.scaleY, i10 = t10.height / e21.scaleY; + if (this.i == r10.elements.length) { + var a10 = new bG(e21, i10, o10, n10); + r10.elements.push(a10), r10.dom.appendChild(a10.dom); + } else + r10.elements[this.i].update(e21, i10, o10, n10); + this.height = t10.bottom, this.i++; + } }, { key: "line", value: function(e21, t10, n10) { + var r10 = []; + mG(this.cursor, r10, t10.from), n10.length && (r10 = r10.concat(n10)); + var o10 = this.gutter.config.lineMarker(e21, t10, r10); + o10 && r10.unshift(o10); + var i10 = this.gutter; + (0 != r10.length || i10.config.renderEmptyElements) && this.addElement(e21, t10, r10); + } }, { key: "widget", value: function(e21, t10) { + var n10 = this.gutter.config.widgetMarker(e21, t10.widget, t10); + n10 && this.addElement(e21, t10, [n10]); + } }, { key: "finish", value: function() { + for (var e21 = this.gutter; e21.elements.length > this.i; ) { + var t10 = e21.elements.pop(); + e21.dom.removeChild(t10.dom), t10.destroy(); + } + } }]), e20; + }(); + var yG = function() { + function e20(t10, n10) { + var r10 = this; + No(this, e20), this.view = t10, this.config = n10, this.elements = [], this.spacer = null, this.dom = document.createElement("div"), this.dom.className = "cm-gutter" + (this.config.class ? " " + this.config.class : ""); + var o10 = function(e21) { + r10.dom.addEventListener(e21, function(o11) { + var i11, a10 = o11.target; + if (a10 != r10.dom && r10.dom.contains(a10)) { + for (; a10.parentNode != r10.dom; ) + a10 = a10.parentNode; + var s10 = a10.getBoundingClientRect(); + i11 = (s10.top + s10.bottom) / 2; + } else + i11 = o11.clientY; + var c10 = t10.lineBlockAtHeight(i11 - t10.documentTop); + n10.domEventHandlers[e21](t10, c10, o11) && o11.preventDefault(); + }); + }; + for (var i10 in n10.domEventHandlers) + o10(i10); + this.markers = pG(n10.markers(t10)), n10.initialSpacer && (this.spacer = new bG(t10, 0, 0, [n10.initialSpacer(t10)]), this.dom.appendChild(this.spacer.dom), this.spacer.dom.style.cssText += "visibility: hidden; pointer-events: none"); + } + return Do(e20, [{ key: "update", value: function(e21) { + var t10 = this.markers; + if (this.markers = pG(this.config.markers(e21.view)), this.spacer && this.config.updateSpacer) { + var n10 = this.config.updateSpacer(this.spacer.markers[0], e21); + n10 != this.spacer.markers[0] && this.spacer.update(e21.view, 0, 0, [n10]); + } + var r10 = e21.view.viewport; + return !xV.eq(this.markers, t10, r10.from, r10.to) || !!this.config.lineMarkerChange && this.config.lineMarkerChange(e21); + } }, { key: "destroy", value: function() { + var e21, t10 = bo(this.elements); + try { + for (t10.s(); !(e21 = t10.n()).done; ) { + e21.value.destroy(); + } + } catch (e23) { + t10.e(e23); + } finally { + t10.f(); + } + } }]), e20; + }(); + var bG = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.height = -1, this.above = 0, this.markers = [], this.dom = document.createElement("div"), this.dom.className = "cm-gutterElement", this.update(t10, n10, r10, o10); + } + return Do(e20, [{ key: "update", value: function(e21, t10, n10, r10) { + this.height != t10 && (this.height = t10, this.dom.style.height = t10 + "px"), this.above != n10 && (this.dom.style.marginTop = (this.above = n10) ? n10 + "px" : ""), function(e23, t11) { + if (e23.length != t11.length) + return false; + for (var n11 = 0; n11 < e23.length; n11++) + if (!e23[n11].compare(t11[n11])) + return false; + return true; + }(this.markers, r10) || this.setMarkers(e21, r10); + } }, { key: "setMarkers", value: function(e21, t10) { + for (var n10 = "cm-gutterElement", r10 = this.dom.firstChild, o10 = 0, i10 = 0; ; ) { + var a10 = i10, s10 = o10 < t10.length ? t10[o10++] : null, c10 = false; + if (s10) { + var l10 = s10.elementClass; + l10 && (n10 += " " + l10); + for (var u10 = i10; u10 < this.markers.length; u10++) + if (this.markers[u10].compare(s10)) { + a10 = u10, c10 = true; + break; + } + } else + a10 = this.markers.length; + for (; i10 < a10; ) { + var f10 = this.markers[i10++]; + if (f10.toDOM) { + f10.destroy(r10); + var d10 = r10.nextSibling; + r10.remove(), r10 = d10; + } + } + if (!s10) + break; + s10.toDOM && (c10 ? r10 = r10.nextSibling : this.dom.insertBefore(s10.toDOM(e21), r10)), c10 && i10++; + } + this.dom.className = n10, this.markers = t10; + } }, { key: "destroy", value: function() { + this.setMarkers(null, []); + } }]), e20; + }(); + var kG = MF.define(); + var wG = MF.define({ combine: function(e20) { + return gV(e20, { formatNumber: String, domEventHandlers: {} }, { domEventHandlers: function(e21, t10) { + var n10 = Object.assign({}, e21), r10 = function() { + var e23 = n10[o10], r11 = t10[o10]; + n10[o10] = e23 ? function(t11, n11, o11) { + return e23(t11, n11, o11) || r11(t11, n11, o11); + } : r11; + }; + for (var o10 in t10) + r10(); + return n10; + } }); + } }); + var xG = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).number = e21, n10; + } + return Ao(t10, sG), Do(t10, [{ key: "eq", value: function(e21) { + return this.number == e21.number; + } }, { key: "toDOM", value: function() { + return document.createTextNode(this.number); + } }]), t10; + }(); + function jG(e20, t10) { + return e20.state.facet(wG).formatNumber(t10, e20.state); + } + var SG = uG.compute([wG], function(e20) { + return { class: "cm-lineNumbers", renderEmptyElements: false, markers: function(e21) { + return e21.state.facet(kG); + }, lineMarker: function(e21, t10, n10) { + return n10.some(function(e23) { + return e23.toDOM; + }) ? null : new xG(jG(e21, e21.state.doc.lineAt(t10.from).number)); + }, widgetMarker: function() { + return null; + }, lineMarkerChange: function(e21) { + return e21.startState.facet(wG) != e21.state.facet(wG); + }, initialSpacer: function(e21) { + return new xG(jG(e21, $G(e21.state.doc.lines))); + }, updateSpacer: function(e21, t10) { + var n10 = jG(t10.view, $G(t10.view.state.doc.lines)); + return n10 == e21.number ? e21 : new xG(n10); + }, domEventHandlers: e20.facet(wG).domEventHandlers }; + }); + function CG() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return [wG.of(e20), hG(), SG]; + } + function $G(e20) { + for (var t10 = 9; t10 < e20; ) + t10 = 10 * t10 + 9; + return t10; + } + var _G = new (function(e20) { + function t10() { + var e21; + return No(this, t10), (e21 = _o(this, t10, arguments)).elementClass = "cm-activeLineGutter", e21; + } + return Ao(t10, sG), Do(t10); + }())(); + var OG = cG.compute(["selection"], function(e20) { + var t10, n10 = [], r10 = -1, o10 = bo(e20.selection.ranges); + try { + for (o10.s(); !(t10 = o10.n()).done; ) { + var i10 = t10.value, a10 = e20.doc.lineAt(i10.head).from; + a10 > r10 && (r10 = a10, n10.push(_G.range(a10))); + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + return xV.of(n10); + }); + var MG = 0; + var EG = Do(function e7(t10, n10) { + No(this, e7), this.from = t10, this.to = n10; + }); + var AG = function() { + function e20() { + var t10 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + No(this, e20), this.id = MG++, this.perNode = !!t10.perNode, this.deserialize = t10.deserialize || function() { + throw new Error("This node type doesn't define a deserialize function"); + }; + } + return Do(e20, [{ key: "add", value: function(e21) { + var t10 = this; + if (this.perNode) + throw new RangeError("Can't add per-node props to node types"); + return "function" != typeof e21 && (e21 = RG.match(e21)), function(n10) { + var r10 = e21(n10); + return void 0 === r10 ? null : [t10, r10]; + }; + } }]), e20; + }(); + AG.closedBy = new AG({ deserialize: function(e20) { + return e20.split(" "); + } }), AG.openedBy = new AG({ deserialize: function(e20) { + return e20.split(" "); + } }), AG.group = new AG({ deserialize: function(e20) { + return e20.split(" "); + } }), AG.contextHash = new AG({ perNode: true }), AG.lookAhead = new AG({ perNode: true }), AG.mounted = new AG({ perNode: true }); + var PG = function() { + function e20(t10, n10, r10) { + No(this, e20), this.tree = t10, this.overlay = n10, this.parser = r10; + } + return Do(e20, null, [{ key: "get", value: function(e21) { + return e21 && e21.props && e21.props[AG.mounted.id]; + } }]), e20; + }(); + var TG = /* @__PURE__ */ Object.create(null); + var RG = function() { + function e20(t10, n10, r10) { + var o10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0; + No(this, e20), this.name = t10, this.props = n10, this.id = r10, this.flags = o10; + } + return Do(e20, [{ key: "prop", value: function(e21) { + return this.props[e21.id]; + } }, { key: "isTop", get: function() { + return (1 & this.flags) > 0; + } }, { key: "isSkipped", get: function() { + return (2 & this.flags) > 0; + } }, { key: "isError", get: function() { + return (4 & this.flags) > 0; + } }, { key: "isAnonymous", get: function() { + return (8 & this.flags) > 0; + } }, { key: "is", value: function(e21) { + if ("string" == typeof e21) { + if (this.name == e21) + return true; + var t10 = this.prop(AG.group); + return !!t10 && t10.indexOf(e21) > -1; + } + return this.id == e21; + } }], [{ key: "define", value: function(t10) { + var n10 = t10.props && t10.props.length ? /* @__PURE__ */ Object.create(null) : TG, r10 = (t10.top ? 1 : 0) | (t10.skipped ? 2 : 0) | (t10.error ? 4 : 0) | (null == t10.name ? 8 : 0), o10 = new e20(t10.name || "", n10, t10.id, r10); + if (t10.props) { + var i10, a10 = bo(t10.props); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = i10.value; + if (Array.isArray(s10) || (s10 = s10(o10)), s10) { + if (s10[0].perNode) + throw new RangeError("Can't store a per-node prop on a node type"); + n10[s10[0].id] = s10[1]; + } + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + } + return o10; + } }, { key: "match", value: function(e21) { + var t10 = /* @__PURE__ */ Object.create(null); + for (var n10 in e21) { + var r10, o10 = bo(n10.split(" ")); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + t10[i10] = e21[n10]; + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + } + return function(e23) { + for (var n11 = e23.prop(AG.group), r11 = -1; r11 < (n11 ? n11.length : 0); r11++) { + var o11 = t10[r11 < 0 ? e23.name : n11[r11]]; + if (o11) + return o11; + } + }; + } }]), e20; + }(); + RG.none = new RG("", /* @__PURE__ */ Object.create(null), 0, 8); + var NG; + var IG = function() { + function e20(t10) { + No(this, e20), this.types = t10; + for (var n10 = 0; n10 < t10.length; n10++) + if (t10[n10].id != n10) + throw new RangeError("Node type ids should correspond to array positions when creating a node set"); + } + return Do(e20, [{ key: "extend", value: function() { + for (var t10 = [], n10 = arguments.length, r10 = new Array(n10), o10 = 0; o10 < n10; o10++) + r10[o10] = arguments[o10]; + var i10, a10 = bo(this.types); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10, c10 = i10.value, l10 = null, u10 = bo(r10); + try { + for (u10.s(); !(s10 = u10.n()).done; ) { + var f10 = (0, s10.value)(c10); + f10 && (l10 || (l10 = Object.assign({}, c10.props)), l10[f10[0].id] = f10[1]); + } + } catch (e21) { + u10.e(e21); + } finally { + u10.f(); + } + t10.push(l10 ? new RG(c10.name, l10, c10.id, c10.flags) : c10); + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + return new e20(t10); + } }]), e20; + }(); + var DG = /* @__PURE__ */ new WeakMap(); + var qG = /* @__PURE__ */ new WeakMap(); + !function(e20) { + e20[e20.ExcludeBuffers = 1] = "ExcludeBuffers", e20[e20.IncludeAnonymous = 2] = "IncludeAnonymous", e20[e20.IgnoreMounts = 4] = "IgnoreMounts", e20[e20.IgnoreOverlays = 8] = "IgnoreOverlays"; + }(NG || (NG = {})); + var zG = function() { + function e20(t10, n10, r10, o10, i10) { + if (No(this, e20), this.type = t10, this.children = n10, this.positions = r10, this.length = o10, this.props = null, i10 && i10.length) { + this.props = /* @__PURE__ */ Object.create(null); + var a10, s10 = bo(i10); + try { + for (s10.s(); !(a10 = s10.n()).done; ) { + var c10 = jo(a10.value, 2), l10 = c10[0], u10 = c10[1]; + this.props["number" == typeof l10 ? l10 : l10.id] = u10; + } + } catch (e21) { + s10.e(e21); + } finally { + s10.f(); + } + } + } + return Do(e20, [{ key: "toString", value: function() { + var e21 = PG.get(this); + if (e21 && !e21.overlay) + return e21.tree.toString(); + var t10, n10 = "", r10 = bo(this.children); + try { + for (r10.s(); !(t10 = r10.n()).done; ) { + var o10 = t10.value.toString(); + o10 && (n10 && (n10 += ","), n10 += o10); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + return this.type.name ? (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (n10.length ? "(" + n10 + ")" : "") : n10; + } }, { key: "cursor", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0; + return new XG(this.topNode, e21); + } }, { key: "cursorAt", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n10 = DG.get(this) || this.topNode, r10 = new XG(n10); + return r10.moveTo(e21, t10), DG.set(this, r10._tree), r10; + } }, { key: "topNode", get: function() { + return new WG(this, 0, 0, null); + } }, { key: "resolve", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n10 = VG(DG.get(this) || this.topNode, e21, t10, false); + return DG.set(this, n10), n10; + } }, { key: "resolveInner", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n10 = VG(qG.get(this) || this.topNode, e21, t10, true); + return qG.set(this, n10), n10; + } }, { key: "resolveStack", value: function(e21) { + return function(e23, t10, n10) { + for (var r10 = e23.resolveInner(t10, n10), o10 = null, i10 = r10 instanceof WG ? r10 : r10.context.parent; i10; i10 = i10.parent) + if (i10.index < 0) { + var a10 = i10.parent; + (o10 || (o10 = [r10])).push(a10.resolve(t10, n10)), i10 = a10; + } else { + var s10 = PG.get(i10.tree); + if (s10 && s10.overlay && s10.overlay[0].from <= t10 && s10.overlay[s10.overlay.length - 1].to >= t10) { + var c10 = new WG(s10.tree, s10.overlay[0].from + i10.from, -1, i10); + (o10 || (o10 = [r10])).push(VG(c10, t10, n10, false)); + } + } + return o10 ? QG(o10) : r10; + }(this, e21, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0); + } }, { key: "iterate", value: function(e21) { + for (var t10 = e21.enter, n10 = e21.leave, r10 = e21.from, o10 = void 0 === r10 ? 0 : r10, i10 = e21.to, a10 = void 0 === i10 ? this.length : i10, s10 = e21.mode || 0, c10 = (s10 & NG.IncludeAnonymous) > 0, l10 = this.cursor(s10 | NG.IncludeAnonymous); ; ) { + var u10 = false; + if (l10.from <= a10 && l10.to >= o10 && (!c10 && l10.type.isAnonymous || false !== t10(l10))) { + if (l10.firstChild()) + continue; + u10 = true; + } + for (; u10 && n10 && (c10 || !l10.type.isAnonymous) && n10(l10), !l10.nextSibling(); ) { + if (!l10.parent()) + return; + u10 = true; + } + } + } }, { key: "prop", value: function(e21) { + return e21.perNode ? this.props ? this.props[e21.id] : void 0 : this.type.prop(e21); + } }, { key: "propValues", get: function() { + var e21 = []; + if (this.props) + for (var t10 in this.props) + e21.push([+t10, this.props[t10]]); + return e21; + } }, { key: "balance", value: function() { + var t10 = this, n10 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return this.children.length <= 8 ? this : rQ(RG.none, this.children, this.positions, 0, this.children.length, 0, this.length, function(n11, r10, o10) { + return new e20(t10.type, n11, r10, o10, t10.propValues); + }, n10.makeTree || function(t11, n11, r10) { + return new e20(RG.none, t11, n11, r10); + }); + } }], [{ key: "build", value: function(e21) { + return eQ(e21); + } }]), e20; + }(); + zG.empty = new zG(RG.none, [], [], 0); + var BG = function() { + function e20(t10, n10) { + No(this, e20), this.buffer = t10, this.index = n10; + } + return Do(e20, [{ key: "id", get: function() { + return this.buffer[this.index - 4]; + } }, { key: "start", get: function() { + return this.buffer[this.index - 3]; + } }, { key: "end", get: function() { + return this.buffer[this.index - 2]; + } }, { key: "size", get: function() { + return this.buffer[this.index - 1]; + } }, { key: "pos", get: function() { + return this.index; + } }, { key: "next", value: function() { + this.index -= 4; + } }, { key: "fork", value: function() { + return new e20(this.buffer, this.index); + } }]), e20; + }(); + var LG = function() { + function e20(t10, n10, r10) { + No(this, e20), this.buffer = t10, this.length = n10, this.set = r10; + } + return Do(e20, [{ key: "type", get: function() { + return RG.none; + } }, { key: "toString", value: function() { + for (var e21 = [], t10 = 0; t10 < this.buffer.length; ) + e21.push(this.childString(t10)), t10 = this.buffer[t10 + 3]; + return e21.join(","); + } }, { key: "childString", value: function(e21) { + var t10 = this.buffer[e21], n10 = this.buffer[e21 + 3], r10 = this.set.types[t10], o10 = r10.name; + if (/\W/.test(o10) && !r10.isError && (o10 = JSON.stringify(o10)), n10 == (e21 += 4)) + return o10; + for (var i10 = []; e21 < n10; ) + i10.push(this.childString(e21)), e21 = this.buffer[e21 + 3]; + return o10 + "(" + i10.join(",") + ")"; + } }, { key: "findChild", value: function(e21, t10, n10, r10, o10) { + for (var i10 = this.buffer, a10 = -1, s10 = e21; s10 != t10 && !(FG(o10, r10, i10[s10 + 1], i10[s10 + 2]) && (a10 = s10, n10 > 0)); s10 = i10[s10 + 3]) + ; + return a10; + } }, { key: "slice", value: function(t10, n10, r10) { + for (var o10 = this.buffer, i10 = new Uint16Array(n10 - t10), a10 = 0, s10 = t10, c10 = 0; s10 < n10; ) { + i10[c10++] = o10[s10++], i10[c10++] = o10[s10++] - r10; + var l10 = i10[c10++] = o10[s10++] - r10; + i10[c10++] = o10[s10++] - t10, a10 = Math.max(a10, l10); + } + return new e20(i10, a10, this.set); + } }]), e20; + }(); + function FG(e20, t10, n10, r10) { + switch (e20) { + case -2: + return n10 < t10; + case -1: + return r10 >= t10 && n10 < t10; + case 0: + return n10 < t10 && r10 > t10; + case 1: + return n10 <= t10 && r10 > t10; + case 2: + return r10 > t10; + case 4: + return true; + } + } + function VG(e20, t10, n10, r10) { + for (var o10; e20.from == e20.to || (n10 < 1 ? e20.from >= t10 : e20.from > t10) || (n10 > -1 ? e20.to <= t10 : e20.to < t10); ) { + var i10 = !r10 && e20 instanceof WG && e20.index < 0 ? null : e20.parent; + if (!i10) + return e20; + e20 = i10; + } + var a10 = r10 ? 0 : NG.IgnoreOverlays; + if (r10) + for (var s10 = e20, c10 = s10.parent; c10; c10 = (s10 = c10).parent) + s10 instanceof WG && s10.index < 0 && (null === (o10 = c10.enter(t10, n10, a10)) || void 0 === o10 ? void 0 : o10.from) != s10.from && (e20 = c10); + for (; ; ) { + var l10 = e20.enter(t10, n10, a10); + if (!l10) + return e20; + e20 = l10; + } + } + var HG = function() { + function e20() { + No(this, e20); + } + return Do(e20, [{ key: "cursor", value: function() { + return new XG(this, arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0); + } }, { key: "getChild", value: function(e21) { + var t10 = UG(this, e21, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null); + return t10.length ? t10[0] : null; + } }, { key: "getChildren", value: function(e21) { + return UG(this, e21, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null); + } }, { key: "resolve", value: function(e21) { + return VG(this, e21, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, false); + } }, { key: "resolveInner", value: function(e21) { + return VG(this, e21, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, true); + } }, { key: "matchContext", value: function(e21) { + return JG(this, e21); + } }, { key: "enterUnfinishedNodesBefore", value: function(e21) { + for (var t10 = this.childBefore(e21), n10 = this; t10; ) { + var r10 = t10.lastChild; + if (!r10 || r10.to != t10.to) + break; + r10.type.isError && r10.from == r10.to ? (n10 = t10, t10 = r10.prevSibling) : t10 = r10; + } + return n10; + } }, { key: "node", get: function() { + return this; + } }, { key: "next", get: function() { + return this.parent; + } }]), e20; + }(); + var WG = function(e20) { + function t10(e21, n10, r10, o10) { + var i10; + return No(this, t10), (i10 = _o(this, t10))._tree = e21, i10.from = n10, i10.index = r10, i10._parent = o10, i10; + } + return Ao(t10, HG), Do(t10, [{ key: "type", get: function() { + return this._tree.type; + } }, { key: "name", get: function() { + return this._tree.type.name; + } }, { key: "to", get: function() { + return this.from + this._tree.length; + } }, { key: "nextChild", value: function(e21, n10, r10, o10) { + for (var i10 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0, a10 = this; ; ) { + for (var s10 = a10._tree, c10 = s10.children, l10 = s10.positions, u10 = n10 > 0 ? c10.length : -1; e21 != u10; e21 += n10) { + var f10 = c10[e21], d10 = l10[e21] + a10.from; + if (FG(o10, r10, d10, d10 + f10.length)) { + if (f10 instanceof LG) { + if (i10 & NG.ExcludeBuffers) + continue; + var h10 = f10.findChild(0, f10.buffer.length, n10, r10 - d10, o10); + if (h10 > -1) + return new GG(new KG(a10, f10, e21, d10), null, h10); + } else if (i10 & NG.IncludeAnonymous || !f10.type.isAnonymous || ZG(f10)) { + var v10 = void 0; + if (!(i10 & NG.IgnoreMounts) && (v10 = PG.get(f10)) && !v10.overlay) + return new t10(v10.tree, d10, e21, a10); + var p10 = new t10(f10, d10, e21, a10); + return i10 & NG.IncludeAnonymous || !p10.type.isAnonymous ? p10 : p10.nextChild(n10 < 0 ? f10.children.length - 1 : 0, n10, r10, o10); + } + } + } + if (i10 & NG.IncludeAnonymous || !a10.type.isAnonymous) + return null; + if (e21 = a10.index >= 0 ? a10.index + n10 : n10 < 0 ? -1 : a10._parent._tree.children.length, !(a10 = a10._parent)) + return null; + } + } }, { key: "firstChild", get: function() { + return this.nextChild(0, 1, 0, 4); + } }, { key: "lastChild", get: function() { + return this.nextChild(this._tree.children.length - 1, -1, 0, 4); + } }, { key: "childAfter", value: function(e21) { + return this.nextChild(0, 1, e21, 2); + } }, { key: "childBefore", value: function(e21) { + return this.nextChild(this._tree.children.length - 1, -1, e21, -2); + } }, { key: "enter", value: function(e21, n10) { + var r10, o10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0; + if (!(o10 & NG.IgnoreOverlays) && (r10 = PG.get(this._tree)) && r10.overlay) { + var i10, a10 = e21 - this.from, s10 = bo(r10.overlay); + try { + for (s10.s(); !(i10 = s10.n()).done; ) { + var c10 = i10.value, l10 = c10.from, u10 = c10.to; + if ((n10 > 0 ? l10 <= a10 : l10 < a10) && (n10 < 0 ? u10 >= a10 : u10 > a10)) + return new t10(r10.tree, r10.overlay[0].from + this.from, -1, this); + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + } + return this.nextChild(0, 1, e21, n10, o10); + } }, { key: "nextSignificantParent", value: function() { + for (var e21 = this; e21.type.isAnonymous && e21._parent; ) + e21 = e21._parent; + return e21; + } }, { key: "parent", get: function() { + return this._parent ? this._parent.nextSignificantParent() : null; + } }, { key: "nextSibling", get: function() { + return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4) : null; + } }, { key: "prevSibling", get: function() { + return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4) : null; + } }, { key: "tree", get: function() { + return this._tree; + } }, { key: "toTree", value: function() { + return this._tree; + } }, { key: "toString", value: function() { + return this._tree.toString(); + } }]), t10; + }(); + function UG(e20, t10, n10, r10) { + var o10 = e20.cursor(), i10 = []; + if (!o10.firstChild()) + return i10; + if (null != n10) { + for (; !o10.type.is(n10); ) + if (!o10.nextSibling()) + return i10; + } + for (; ; ) { + if (null != r10 && o10.type.is(r10)) + return i10; + if (o10.type.is(t10) && i10.push(o10.node), !o10.nextSibling()) + return null == r10 ? i10 : []; + } + } + function JG(e20, t10) { + for (var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : t10.length - 1, r10 = e20.parent; n10 >= 0; r10 = r10.parent) { + if (!r10) + return false; + if (!r10.type.isAnonymous) { + if (t10[n10] && t10[n10] != r10.name) + return false; + n10--; + } + } + return true; + } + var KG = Do(function e8(t10, n10, r10, o10) { + No(this, e8), this.parent = t10, this.buffer = n10, this.index = r10, this.start = o10; + }); + var GG = function(e20) { + function t10(e21, n10, r10) { + var o10; + return No(this, t10), (o10 = _o(this, t10)).context = e21, o10._parent = n10, o10.index = r10, o10.type = e21.buffer.set.types[e21.buffer.buffer[r10]], o10; + } + return Ao(t10, HG), Do(t10, [{ key: "name", get: function() { + return this.type.name; + } }, { key: "from", get: function() { + return this.context.start + this.context.buffer.buffer[this.index + 1]; + } }, { key: "to", get: function() { + return this.context.start + this.context.buffer.buffer[this.index + 2]; + } }, { key: "child", value: function(e21, n10, r10) { + var o10 = this.context.buffer, i10 = o10.findChild(this.index + 4, o10.buffer[this.index + 3], e21, n10 - this.context.start, r10); + return i10 < 0 ? null : new t10(this.context, this, i10); + } }, { key: "firstChild", get: function() { + return this.child(1, 0, 4); + } }, { key: "lastChild", get: function() { + return this.child(-1, 0, 4); + } }, { key: "childAfter", value: function(e21) { + return this.child(1, e21, 2); + } }, { key: "childBefore", value: function(e21) { + return this.child(-1, e21, -2); + } }, { key: "enter", value: function(e21, n10) { + if ((arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0) & NG.ExcludeBuffers) + return null; + var r10 = this.context.buffer, o10 = r10.findChild(this.index + 4, r10.buffer[this.index + 3], n10 > 0 ? 1 : -1, e21 - this.context.start, n10); + return o10 < 0 ? null : new t10(this.context, this, o10); + } }, { key: "parent", get: function() { + return this._parent || this.context.parent.nextSignificantParent(); + } }, { key: "externalSibling", value: function(e21) { + return this._parent ? null : this.context.parent.nextChild(this.context.index + e21, e21, 0, 4); + } }, { key: "nextSibling", get: function() { + var e21 = this.context.buffer, n10 = e21.buffer[this.index + 3]; + return n10 < (this._parent ? e21.buffer[this._parent.index + 3] : e21.buffer.length) ? new t10(this.context, this._parent, n10) : this.externalSibling(1); + } }, { key: "prevSibling", get: function() { + var e21 = this.context.buffer, n10 = this._parent ? this._parent.index + 4 : 0; + return this.index == n10 ? this.externalSibling(-1) : new t10(this.context, this._parent, e21.findChild(n10, this.index, -1, 0, 4)); + } }, { key: "tree", get: function() { + return null; + } }, { key: "toTree", value: function() { + var e21 = [], t11 = [], n10 = this.context.buffer, r10 = this.index + 4, o10 = n10.buffer[this.index + 3]; + if (o10 > r10) { + var i10 = n10.buffer[this.index + 1]; + e21.push(n10.slice(r10, o10, i10)), t11.push(0); + } + return new zG(this.type, e21, t11, this.to - this.from); + } }, { key: "toString", value: function() { + return this.context.buffer.childString(this.index); + } }]), t10; + }(); + function QG(e20) { + if (!e20.length) + return null; + for (var t10 = 0, n10 = e20[0], r10 = 1; r10 < e20.length; r10++) { + var o10 = e20[r10]; + (o10.from > n10.from || o10.to < n10.to) && (n10 = o10, t10 = r10); + } + var i10 = n10 instanceof WG && n10.index < 0 ? null : n10.parent, a10 = e20.slice(); + return i10 ? a10[t10] = i10 : a10.splice(t10, 1), new YG(a10, n10); + } + var YG = function() { + function e20(t10, n10) { + No(this, e20), this.heads = t10, this.node = n10; + } + return Do(e20, [{ key: "next", get: function() { + return QG(this.heads); + } }]), e20; + }(); + var XG = function() { + function e20(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; + if (No(this, e20), this.mode = n10, this.buffer = null, this.stack = [], this.index = 0, this.bufferNode = null, t10 instanceof WG) + this.yieldNode(t10); + else { + this._tree = t10.context.parent, this.buffer = t10.context; + for (var r10 = t10._parent; r10; r10 = r10._parent) + this.stack.unshift(r10.index); + this.bufferNode = t10, this.yieldBuf(t10.index); + } + } + return Do(e20, [{ key: "name", get: function() { + return this.type.name; + } }, { key: "yieldNode", value: function(e21) { + return !!e21 && (this._tree = e21, this.type = e21.type, this.from = e21.from, this.to = e21.to, true); + } }, { key: "yieldBuf", value: function(e21, t10) { + this.index = e21; + var n10 = this.buffer, r10 = n10.start, o10 = n10.buffer; + return this.type = t10 || o10.set.types[o10.buffer[e21]], this.from = r10 + o10.buffer[e21 + 1], this.to = r10 + o10.buffer[e21 + 2], true; + } }, { key: "yield", value: function(e21) { + return !!e21 && (e21 instanceof WG ? (this.buffer = null, this.yieldNode(e21)) : (this.buffer = e21.context, this.yieldBuf(e21.index, e21.type))); + } }, { key: "toString", value: function() { + return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString(); + } }, { key: "enterChild", value: function(e21, t10, n10) { + if (!this.buffer) + return this.yield(this._tree.nextChild(e21 < 0 ? this._tree._tree.children.length - 1 : 0, e21, t10, n10, this.mode)); + var r10 = this.buffer.buffer, o10 = r10.findChild(this.index + 4, r10.buffer[this.index + 3], e21, t10 - this.buffer.start, n10); + return !(o10 < 0) && (this.stack.push(this.index), this.yieldBuf(o10)); + } }, { key: "firstChild", value: function() { + return this.enterChild(1, 0, 4); + } }, { key: "lastChild", value: function() { + return this.enterChild(-1, 0, 4); + } }, { key: "childAfter", value: function(e21) { + return this.enterChild(1, e21, 2); + } }, { key: "childBefore", value: function(e21) { + return this.enterChild(-1, e21, -2); + } }, { key: "enter", value: function(e21, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.mode; + return this.buffer ? !(n10 & NG.ExcludeBuffers) && this.enterChild(1, e21, t10) : this.yield(this._tree.enter(e21, t10, n10)); + } }, { key: "parent", value: function() { + if (!this.buffer) + return this.yieldNode(this.mode & NG.IncludeAnonymous ? this._tree._parent : this._tree.parent); + if (this.stack.length) + return this.yieldBuf(this.stack.pop()); + var e21 = this.mode & NG.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent(); + return this.buffer = null, this.yieldNode(e21); + } }, { key: "sibling", value: function(e21) { + if (!this.buffer) + return !!this._tree._parent && this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + e21, e21, 0, 4, this.mode)); + var t10 = this.buffer.buffer, n10 = this.stack.length - 1; + if (e21 < 0) { + var r10 = n10 < 0 ? 0 : this.stack[n10] + 4; + if (this.index != r10) + return this.yieldBuf(t10.findChild(r10, this.index, -1, 0, 4)); + } else { + var o10 = t10.buffer[this.index + 3]; + if (o10 < (n10 < 0 ? t10.buffer.length : t10.buffer[this.stack[n10] + 3])) + return this.yieldBuf(o10); + } + return n10 < 0 && this.yield(this.buffer.parent.nextChild(this.buffer.index + e21, e21, 0, 4, this.mode)); + } }, { key: "nextSibling", value: function() { + return this.sibling(1); + } }, { key: "prevSibling", value: function() { + return this.sibling(-1); + } }, { key: "atLastNode", value: function(e21) { + var t10, n10, r10 = this.buffer; + if (r10) { + if (e21 > 0) { + if (this.index < r10.buffer.buffer.length) + return false; + } else + for (var o10 = 0; o10 < this.index; o10++) + if (r10.buffer.buffer[o10 + 3] < this.index) + return false; + t10 = r10.index, n10 = r10.parent; + } else { + var i10 = this._tree; + t10 = i10.index, n10 = i10._parent; + } + for (; n10; t10 = (a10 = n10).index, n10 = a10._parent, a10) { + var a10; + if (t10 > -1) + for (var s10 = t10 + e21, c10 = e21 < 0 ? -1 : n10._tree.children.length; s10 != c10; s10 += e21) { + var l10 = n10._tree.children[s10]; + if (this.mode & NG.IncludeAnonymous || l10 instanceof LG || !l10.type.isAnonymous || ZG(l10)) + return false; + } + } + return true; + } }, { key: "move", value: function(e21, t10) { + if (t10 && this.enterChild(e21, 0, 4)) + return true; + for (; ; ) { + if (this.sibling(e21)) + return true; + if (this.atLastNode(e21) || !this.parent()) + return false; + } + } }, { key: "next", value: function() { + var e21 = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; + return this.move(1, e21); + } }, { key: "prev", value: function() { + var e21 = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; + return this.move(-1, e21); + } }, { key: "moveTo", value: function(e21) { + for (var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; (this.from == this.to || (t10 < 1 ? this.from >= e21 : this.from > e21) || (t10 > -1 ? this.to <= e21 : this.to < e21)) && this.parent(); ) + ; + for (; this.enterChild(1, e21, t10); ) + ; + return this; + } }, { key: "node", get: function() { + if (!this.buffer) + return this._tree; + var e21 = this.bufferNode, t10 = null, n10 = 0; + if (e21 && e21.context == this.buffer) + e: + for (var r10 = this.index, o10 = this.stack.length; o10 >= 0; ) { + for (var i10 = e21; i10; i10 = i10._parent) + if (i10.index == r10) { + if (r10 == this.index) + return i10; + t10 = i10, n10 = o10 + 1; + break e; + } + r10 = this.stack[--o10]; + } + for (var a10 = n10; a10 < this.stack.length; a10++) + t10 = new GG(this.buffer, t10, this.stack[a10]); + return this.bufferNode = new GG(this.buffer, t10, this.index); + } }, { key: "tree", get: function() { + return this.buffer ? null : this._tree._tree; + } }, { key: "iterate", value: function(e21, t10) { + for (var n10 = 0; ; ) { + var r10 = false; + if (this.type.isAnonymous || false !== e21(this)) { + if (this.firstChild()) { + n10++; + continue; + } + this.type.isAnonymous || (r10 = true); + } + for (; r10 && t10 && t10(this), r10 = this.type.isAnonymous, !this.nextSibling(); ) { + if (!n10) + return; + this.parent(), n10--, r10 = true; + } + } + } }, { key: "matchContext", value: function(e21) { + if (!this.buffer) + return JG(this.node, e21); + for (var t10 = this.buffer.buffer, n10 = t10.set.types, r10 = e21.length - 1, o10 = this.stack.length - 1; r10 >= 0; o10--) { + if (o10 < 0) + return JG(this.node, e21, r10); + var i10 = n10[t10.buffer[this.stack[o10]]]; + if (!i10.isAnonymous) { + if (e21[r10] && e21[r10] != i10.name) + return false; + r10--; + } + } + return true; + } }]), e20; + }(); + function ZG(e20) { + return e20.children.some(function(e21) { + return e21 instanceof LG || !e21.type.isAnonymous || ZG(e21); + }); + } + function eQ(e20) { + var t10, n10 = e20.buffer, r10 = e20.nodeSet, o10 = e20.maxBufferLength, i10 = void 0 === o10 ? 1024 : o10, a10 = e20.reused, s10 = void 0 === a10 ? [] : a10, c10 = e20.minRepeatType, l10 = void 0 === c10 ? r10.types.length : c10, u10 = Array.isArray(n10) ? new BG(n10, n10.length) : n10, f10 = r10.types, d10 = 0, h10 = 0; + function v10(e21, t11, n11, o11, a11, c11) { + for (var b11 = u10.id, k11 = u10.start, w11 = u10.end, x10 = u10.size, j10 = h10; x10 < 0; ) { + if (u10.next(), -1 == x10) { + var S10 = s10[b11]; + return n11.push(S10), void o11.push(k11 - e21); + } + if (-3 == x10) + return void (d10 = b11); + if (-4 == x10) + return void (h10 = b11); + throw new RangeError("Unrecognized record size: ".concat(x10)); + } + var C10, $10, _10 = f10[b11], O10 = k11 - e21; + if (w11 - k11 <= i10 && ($10 = function(e23, t12) { + var n12 = u10.fork(), r11 = 0, o12 = 0, a12 = 0, s11 = n12.end - i10, c12 = { size: 0, start: 0, skip: 0 }; + e: + for (var f11 = n12.pos - e23; n12.pos > f11; ) { + var d11 = n12.size; + if (n12.id == t12 && d11 >= 0) + c12.size = r11, c12.start = o12, c12.skip = a12, a12 += 4, r11 += 4, n12.next(); + else { + var h11 = n12.pos - d11; + if (d11 < 0 || h11 < f11 || n12.start < s11) + break; + var v11 = n12.id >= l10 ? 4 : 0, p11 = n12.start; + for (n12.next(); n12.pos > h11; ) { + if (n12.size < 0) { + if (-3 != n12.size) + break e; + v11 += 4; + } else + n12.id >= l10 && (v11 += 4); + n12.next(); + } + o12 = p11, r11 += d11, a12 += v11; + } + } + (t12 < 0 || r11 == e23) && (c12.size = r11, c12.start = o12, c12.skip = a12); + return c12.size > 4 ? c12 : void 0; + }(u10.pos - t11, a11))) { + for (var M10 = new Uint16Array($10.size - $10.skip), E10 = u10.pos - $10.size, A10 = M10.length; u10.pos > E10; ) + A10 = y10($10.start, M10, A10); + C10 = new LG(M10, w11 - $10.start, r10), O10 = $10.start - e21; + } else { + var P10 = u10.pos - x10; + u10.next(); + for (var T8 = [], R8 = [], N8 = b11 >= l10 ? b11 : -1, I10 = 0, D10 = w11; u10.pos > P10; ) + N8 >= 0 && u10.id == N8 && u10.size >= 0 ? (u10.end <= D10 - i10 && (m10(T8, R8, k11, I10, u10.end, D10, N8, j10), I10 = T8.length, D10 = u10.end), u10.next()) : c11 > 2500 ? p10(k11, P10, T8, R8) : v10(k11, P10, T8, R8, N8, c11 + 1); + if (N8 >= 0 && I10 > 0 && I10 < T8.length && m10(T8, R8, k11, I10, k11, D10, N8, j10), T8.reverse(), R8.reverse(), N8 > -1 && I10 > 0) { + var q10 = /* @__PURE__ */ function(e23) { + return function(t12, n12, r11) { + var o12, i11, a12 = 0, s11 = t12.length - 1; + if (s11 >= 0 && (o12 = t12[s11]) instanceof zG) { + if (!s11 && o12.type == e23 && o12.length == r11) + return o12; + (i11 = o12.prop(AG.lookAhead)) && (a12 = n12[s11] + o12.length + i11); + } + return g10(e23, t12, n12, r11, a12); + }; + }(_10); + C10 = rQ(_10, T8, R8, 0, T8.length, 0, w11 - k11, q10, q10); + } else + C10 = g10(_10, T8, R8, w11 - k11, j10 - w11); + } + n11.push(C10), o11.push(O10); + } + function p10(e21, t11, n11, o11) { + for (var a11 = [], s11 = 0, c11 = -1; u10.pos > t11; ) { + var l11 = u10.id, f11 = u10.start, d11 = u10.end; + if (u10.size > 4) + u10.next(); + else { + if (c11 > -1 && f11 < c11) + break; + c11 < 0 && (c11 = d11 - i10), a11.push(l11, f11, d11), s11++, u10.next(); + } + } + if (s11) { + for (var h11 = new Uint16Array(4 * s11), v11 = a11[a11.length - 2], p11 = a11.length - 3, m11 = 0; p11 >= 0; p11 -= 3) + h11[m11++] = a11[p11], h11[m11++] = a11[p11 + 1] - v11, h11[m11++] = a11[p11 + 2] - v11, h11[m11++] = m11; + n11.push(new LG(h11, a11[2] - v11, r10)), o11.push(v11 - e21); + } + } + function m10(e21, t11, n11, o11, i11, a11, s11, c11) { + for (var l11 = [], u11 = []; e21.length > o11; ) + l11.push(e21.pop()), u11.push(t11.pop() + n11 - i11); + e21.push(g10(r10.types[s11], l11, u11, a11 - i11, c11 - a11)), t11.push(i11 - n11); + } + function g10(e21, t11, n11, r11) { + var o11 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0, i11 = arguments.length > 5 ? arguments[5] : void 0; + if (d10) { + var a11 = [AG.contextHash, d10]; + i11 = i11 ? [a11].concat(i11) : [a11]; + } + if (o11 > 25) { + var s11 = [AG.lookAhead, o11]; + i11 = i11 ? [s11].concat(i11) : [s11]; + } + return new zG(e21, t11, n11, r11, i11); + } + function y10(e21, t11, n11) { + var r11 = u10.id, o11 = u10.start, i11 = u10.end, a11 = u10.size; + if (u10.next(), a11 >= 0 && r11 < l10) { + var s11 = n11; + if (a11 > 4) + for (var c11 = u10.pos - (a11 - 4); u10.pos > c11; ) + n11 = y10(e21, t11, n11); + t11[--n11] = s11, t11[--n11] = i11 - e21, t11[--n11] = o11 - e21, t11[--n11] = r11; + } else + -3 == a11 ? d10 = r11 : -4 == a11 && (h10 = r11); + return n11; + } + for (var b10 = [], k10 = []; u10.pos > 0; ) + v10(e20.start || 0, e20.bufferStart || 0, b10, k10, -1, 0); + var w10 = null !== (t10 = e20.length) && void 0 !== t10 ? t10 : b10.length ? k10[0] + b10[0].length : 0; + return new zG(f10[e20.topID], b10.reverse(), k10.reverse(), w10); + } + var tQ = /* @__PURE__ */ new WeakMap(); + function nQ(e20, t10) { + if (!e20.isAnonymous || t10 instanceof LG || t10.type != e20) + return 1; + var n10 = tQ.get(t10); + if (null == n10) { + n10 = 1; + var r10, o10 = bo(t10.children); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + if (i10.type != e20 || !(i10 instanceof zG)) { + n10 = 1; + break; + } + n10 += nQ(e20, i10); + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + tQ.set(t10, n10); + } + return n10; + } + function rQ(e20, t10, n10, r10, o10, i10, a10, s10, c10) { + for (var l10 = 0, u10 = r10; u10 < o10; u10++) + l10 += nQ(e20, t10[u10]); + var f10 = Math.ceil(1.5 * l10 / 8), d10 = [], h10 = []; + return function t11(n11, r11, o11, a11, s11) { + for (var l11 = o11; l11 < a11; ) { + var u11 = l11, v10 = r11[l11], p10 = nQ(e20, n11[l11]); + for (l11++; l11 < a11; l11++) { + var m10 = nQ(e20, n11[l11]); + if (p10 + m10 >= f10) + break; + p10 += m10; + } + if (l11 == u11 + 1) { + if (p10 > f10) { + var g10 = n11[u11]; + t11(g10.children, g10.positions, 0, g10.children.length, r11[u11] + s11); + continue; + } + d10.push(n11[u11]); + } else { + var y10 = r11[l11 - 1] + n11[l11 - 1].length - v10; + d10.push(rQ(e20, n11, r11, u11, l11, v10, y10, null, c10)); + } + h10.push(v10 + s11 - i10); + } + }(t10, n10, r10, o10, 0), (s10 || c10)(d10, h10, a10); + } + var oQ = function() { + function e20(t10, n10, r10, o10) { + var i10 = arguments.length > 4 && void 0 !== arguments[4] && arguments[4], a10 = arguments.length > 5 && void 0 !== arguments[5] && arguments[5]; + No(this, e20), this.from = t10, this.to = n10, this.tree = r10, this.offset = o10, this.open = (i10 ? 1 : 0) | (a10 ? 2 : 0); + } + return Do(e20, [{ key: "openStart", get: function() { + return (1 & this.open) > 0; + } }, { key: "openEnd", get: function() { + return (2 & this.open) > 0; + } }], [{ key: "addTree", value: function(t10) { + var n10, r10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], o10 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], i10 = [new e20(0, t10.length, t10, 0, false, o10)], a10 = bo(r10); + try { + for (a10.s(); !(n10 = a10.n()).done; ) { + var s10 = n10.value; + s10.to > t10.length && i10.push(s10); + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + return i10; + } }, { key: "applyChanges", value: function(t10, n10) { + var r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 128; + if (!n10.length) + return t10; + for (var o10 = [], i10 = 1, a10 = t10.length ? t10[0] : null, s10 = 0, c10 = 0, l10 = 0; ; s10++) { + var u10 = s10 < n10.length ? n10[s10] : null, f10 = u10 ? u10.fromA : 1e9; + if (f10 - c10 >= r10) + for (; a10 && a10.from < f10; ) { + var d10 = a10; + if (c10 >= d10.from || f10 <= d10.to || l10) { + var h10 = Math.max(d10.from, c10) - l10, v10 = Math.min(d10.to, f10) - l10; + d10 = h10 >= v10 ? null : new e20(h10, v10, d10.tree, d10.offset + l10, s10 > 0, !!u10); + } + if (d10 && o10.push(d10), a10.to > f10) + break; + a10 = i10 < t10.length ? t10[i10++] : null; + } + if (!u10) + break; + c10 = u10.toA, l10 = u10.toA - u10.toB; + } + return o10; + } }]), e20; + }(); + var iQ = function() { + function e20() { + No(this, e20); + } + return Do(e20, [{ key: "startParse", value: function(e21, t10, n10) { + return "string" == typeof e21 && (e21 = new aQ(e21)), n10 = n10 ? n10.length ? n10.map(function(e23) { + return new EG(e23.from, e23.to); + }) : [new EG(0, 0)] : [new EG(0, e21.length)], this.createParse(e21, t10 || [], n10); + } }, { key: "parse", value: function(e21, t10, n10) { + for (var r10 = this.startParse(e21, t10, n10); ; ) { + var o10 = r10.advance(); + if (o10) + return o10; + } + } }]), e20; + }(); + var aQ = function() { + function e20(t10) { + No(this, e20), this.string = t10; + } + return Do(e20, [{ key: "length", get: function() { + return this.string.length; + } }, { key: "chunk", value: function(e21) { + return this.string.slice(e21); + } }, { key: "lineChunks", get: function() { + return false; + } }, { key: "read", value: function(e21, t10) { + return this.string.slice(e21, t10); + } }]), e20; + }(); + new AG({ perNode: true }); + var sQ = 0; + var cQ = function() { + function e20(t10, n10, r10) { + No(this, e20), this.set = t10, this.base = n10, this.modified = r10, this.id = sQ++; + } + return Do(e20, null, [{ key: "define", value: function(t10) { + if (null == t10 ? void 0 : t10.base) + throw new Error("Can not derive from a modified tag"); + var n10 = new e20([], null, []); + if (n10.set.push(n10), t10) { + var r10, o10 = bo(t10.set); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + n10.set.push(i10); + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + } + return n10; + } }, { key: "defineModifier", value: function() { + var e21 = new uQ(); + return function(t10) { + return t10.modified.indexOf(e21) > -1 ? t10 : uQ.get(t10.base || t10, t10.modified.concat(e21).sort(function(e23, t11) { + return e23.id - t11.id; + })); + }; + } }]), e20; + }(); + var lQ = 0; + var uQ = function() { + function e20() { + No(this, e20), this.instances = [], this.id = lQ++; + } + return Do(e20, null, [{ key: "get", value: function(t10, n10) { + if (!n10.length) + return t10; + var r10 = n10[0].instances.find(function(e21) { + return e21.base == t10 && (r11 = n10, o11 = e21.modified, r11.length == o11.length && r11.every(function(e23, t11) { + return e23 == o11[t11]; + })); + var r11, o11; + }); + if (r10) + return r10; + var o10, i10 = [], a10 = new cQ(i10, t10, n10), s10 = bo(n10); + try { + for (s10.s(); !(o10 = s10.n()).done; ) { + o10.value.instances.push(a10); + } + } catch (e21) { + s10.e(e21); + } finally { + s10.f(); + } + var c10, l10 = function(e21) { + for (var t11 = [[]], n11 = 0; n11 < e21.length; n11++) + for (var r11 = 0, o11 = t11.length; r11 < o11; r11++) + t11.push(t11[r11].concat(e21[n11])); + return t11.sort(function(e23, t12) { + return t12.length - e23.length; + }); + }(n10), u10 = bo(t10.set); + try { + for (u10.s(); !(c10 = u10.n()).done; ) { + var f10 = c10.value; + if (!f10.modified.length) { + var d10, h10 = bo(l10); + try { + for (h10.s(); !(d10 = h10.n()).done; ) { + var v10 = d10.value; + i10.push(e20.get(f10, v10)); + } + } catch (e21) { + h10.e(e21); + } finally { + h10.f(); + } + } + } + } catch (e21) { + u10.e(e21); + } finally { + u10.f(); + } + return a10; + } }]), e20; + }(); + function fQ(e20) { + var t10 = /* @__PURE__ */ Object.create(null); + for (var n10 in e20) { + var r10 = e20[n10]; + Array.isArray(r10) || (r10 = [r10]); + var o10, i10 = bo(n10.split(" ")); + try { + for (i10.s(); !(o10 = i10.n()).done; ) { + var a10 = o10.value; + if (a10) { + for (var s10 = [], c10 = 2, l10 = a10, u10 = 0; ; ) { + if ("..." == l10 && u10 > 0 && u10 + 3 == a10.length) { + c10 = 1; + break; + } + var f10 = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l10); + if (!f10) + throw new RangeError("Invalid path: " + a10); + if (s10.push("*" == f10[0] ? "" : '"' == f10[0][0] ? JSON.parse(f10[0]) : f10[0]), (u10 += f10[0].length) == a10.length) + break; + var d10 = a10[u10++]; + if (u10 == a10.length && "!" == d10) { + c10 = 0; + break; + } + if ("/" != d10) + throw new RangeError("Invalid path: " + a10); + l10 = a10.slice(u10); + } + var h10 = s10.length - 1, v10 = s10[h10]; + if (!v10) + throw new RangeError("Invalid path: " + a10); + var p10 = new hQ(r10, c10, h10 > 0 ? s10.slice(0, h10) : null); + t10[v10] = p10.sort(t10[v10]); + } + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + } + return dQ.add(t10); + } + var dQ = new AG(); + var hQ = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.tags = t10, this.mode = n10, this.context = r10, this.next = o10; + } + return Do(e20, [{ key: "opaque", get: function() { + return 0 == this.mode; + } }, { key: "inherit", get: function() { + return 1 == this.mode; + } }, { key: "sort", value: function(e21) { + return !e21 || e21.depth < this.depth ? (this.next = e21, this) : (e21.next = this.sort(e21.next), e21); + } }, { key: "depth", get: function() { + return this.context ? this.context.length : 0; + } }]), e20; + }(); + function vQ(e20, t10) { + var n10, r10 = /* @__PURE__ */ Object.create(null), o10 = bo(e20); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = n10.value; + if (Array.isArray(i10.tag)) { + var a10, s10 = bo(i10.tag); + try { + for (s10.s(); !(a10 = s10.n()).done; ) { + var c10 = a10.value; + r10[c10.id] = i10.class; + } + } catch (e21) { + s10.e(e21); + } finally { + s10.f(); + } + } else + r10[i10.tag.id] = i10.class; + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + var l10 = t10 || {}, u10 = l10.scope, f10 = l10.all, d10 = void 0 === f10 ? null : f10; + return { style: function(e21) { + var t11, n11 = d10, o11 = bo(e21); + try { + for (o11.s(); !(t11 = o11.n()).done; ) { + var i11, a11 = bo(t11.value.set); + try { + for (a11.s(); !(i11 = a11.n()).done; ) { + var s11 = i11.value, c11 = r10[s11.id]; + if (c11) { + n11 = n11 ? n11 + " " + c11 : c11; + break; + } + } + } catch (e23) { + a11.e(e23); + } finally { + a11.f(); + } + } + } catch (e23) { + o11.e(e23); + } finally { + o11.f(); + } + return n11; + }, scope: u10 }; + } + function pQ(e20, t10, n10) { + var r10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, o10 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : e20.length, i10 = new mQ(r10, Array.isArray(t10) ? t10 : [t10], n10); + i10.highlightRange(e20.cursor(), r10, o10, "", i10.highlighters), i10.flush(o10); + } + hQ.empty = new hQ([], 2, null); + var mQ = function() { + function e20(t10, n10, r10) { + No(this, e20), this.at = t10, this.highlighters = n10, this.span = r10, this.class = ""; + } + return Do(e20, [{ key: "startSpan", value: function(e21, t10) { + t10 != this.class && (this.flush(e21), e21 > this.at && (this.at = e21), this.class = t10); + } }, { key: "flush", value: function(e21) { + e21 > this.at && this.class && this.span(this.at, e21, this.class); + } }, { key: "highlightRange", value: function(e21, t10, n10, r10, o10) { + var i10 = e21.type, a10 = e21.from, s10 = e21.to; + if (!(a10 >= n10 || s10 <= t10)) { + i10.isTop && (o10 = this.highlighters.filter(function(e23) { + return !e23.scope || e23.scope(i10); + })); + var c10 = r10, l10 = function(e23) { + var t11 = e23.type.prop(dQ); + for (; t11 && t11.context && !e23.matchContext(t11.context); ) + t11 = t11.next; + return t11 || null; + }(e21) || hQ.empty, u10 = function(e23, t11) { + var n11, r11 = null, o11 = bo(e23); + try { + for (o11.s(); !(n11 = o11.n()).done; ) { + var i11 = n11.value.style(t11); + i11 && (r11 = r11 ? r11 + " " + i11 : i11); + } + } catch (e24) { + o11.e(e24); + } finally { + o11.f(); + } + return r11; + }(o10, l10.tags); + if (u10 && (c10 && (c10 += " "), c10 += u10, 1 == l10.mode && (r10 += (r10 ? " " : "") + u10)), this.startSpan(Math.max(t10, a10), c10), !l10.opaque) { + var f10 = e21.tree && e21.tree.prop(AG.mounted); + if (f10 && f10.overlay) { + for (var d10 = e21.node.enter(f10.overlay[0].from + a10, 1), h10 = this.highlighters.filter(function(e23) { + return !e23.scope || e23.scope(f10.tree.type); + }), v10 = e21.firstChild(), p10 = 0, m10 = a10; ; p10++) { + var g10 = p10 < f10.overlay.length ? f10.overlay[p10] : null, y10 = g10 ? g10.from + a10 : s10, b10 = Math.max(t10, m10), k10 = Math.min(n10, y10); + if (b10 < k10 && v10) + for (; e21.from < k10 && (this.highlightRange(e21, b10, k10, r10, o10), this.startSpan(Math.min(k10, e21.to), c10), !(e21.to >= y10) && e21.nextSibling()); ) + ; + if (!g10 || y10 > n10) + break; + (m10 = g10.to + a10) > t10 && (this.highlightRange(d10.cursor(), Math.max(t10, g10.from + a10), Math.min(n10, m10), "", h10), this.startSpan(Math.min(n10, m10), c10)); + } + v10 && e21.parent(); + } else if (e21.firstChild()) { + f10 && (r10 = ""); + do { + if (!(e21.to <= t10)) { + if (e21.from >= n10) + break; + this.highlightRange(e21, t10, n10, r10, o10), this.startSpan(Math.min(n10, e21.to), c10); + } + } while (e21.nextSibling()); + e21.parent(); + } + } + } + } }]), e20; + }(); + var gQ; + var yQ = cQ.define; + var bQ = yQ(); + var kQ = yQ(); + var wQ = yQ(kQ); + var xQ = yQ(kQ); + var jQ = yQ(); + var SQ = yQ(jQ); + var CQ = yQ(jQ); + var $Q = yQ(); + var _Q = yQ($Q); + var OQ = yQ(); + var MQ = yQ(); + var EQ = yQ(); + var AQ = yQ(EQ); + var PQ = yQ(); + var TQ = { comment: bQ, lineComment: yQ(bQ), blockComment: yQ(bQ), docComment: yQ(bQ), name: kQ, variableName: yQ(kQ), typeName: wQ, tagName: yQ(wQ), propertyName: xQ, attributeName: yQ(xQ), className: yQ(kQ), labelName: yQ(kQ), namespace: yQ(kQ), macroName: yQ(kQ), literal: jQ, string: SQ, docString: yQ(SQ), character: yQ(SQ), attributeValue: yQ(SQ), number: CQ, integer: yQ(CQ), float: yQ(CQ), bool: yQ(jQ), regexp: yQ(jQ), escape: yQ(jQ), color: yQ(jQ), url: yQ(jQ), keyword: OQ, self: yQ(OQ), null: yQ(OQ), atom: yQ(OQ), unit: yQ(OQ), modifier: yQ(OQ), operatorKeyword: yQ(OQ), controlKeyword: yQ(OQ), definitionKeyword: yQ(OQ), moduleKeyword: yQ(OQ), operator: MQ, derefOperator: yQ(MQ), arithmeticOperator: yQ(MQ), logicOperator: yQ(MQ), bitwiseOperator: yQ(MQ), compareOperator: yQ(MQ), updateOperator: yQ(MQ), definitionOperator: yQ(MQ), typeOperator: yQ(MQ), controlOperator: yQ(MQ), punctuation: EQ, separator: yQ(EQ), bracket: AQ, angleBracket: yQ(AQ), squareBracket: yQ(AQ), paren: yQ(AQ), brace: yQ(AQ), content: $Q, heading: _Q, heading1: yQ(_Q), heading2: yQ(_Q), heading3: yQ(_Q), heading4: yQ(_Q), heading5: yQ(_Q), heading6: yQ(_Q), contentSeparator: yQ($Q), list: yQ($Q), quote: yQ($Q), emphasis: yQ($Q), strong: yQ($Q), link: yQ($Q), monospace: yQ($Q), strikethrough: yQ($Q), inserted: yQ(), deleted: yQ(), changed: yQ(), invalid: yQ(), meta: PQ, documentMeta: yQ(PQ), annotation: yQ(PQ), processingInstruction: yQ(PQ), definition: cQ.defineModifier(), constant: cQ.defineModifier(), function: cQ.defineModifier(), standard: cQ.defineModifier(), local: cQ.defineModifier(), special: cQ.defineModifier() }; + vQ([{ tag: TQ.link, class: "tok-link" }, { tag: TQ.heading, class: "tok-heading" }, { tag: TQ.emphasis, class: "tok-emphasis" }, { tag: TQ.strong, class: "tok-strong" }, { tag: TQ.keyword, class: "tok-keyword" }, { tag: TQ.atom, class: "tok-atom" }, { tag: TQ.bool, class: "tok-bool" }, { tag: TQ.url, class: "tok-url" }, { tag: TQ.labelName, class: "tok-labelName" }, { tag: TQ.inserted, class: "tok-inserted" }, { tag: TQ.deleted, class: "tok-deleted" }, { tag: TQ.literal, class: "tok-literal" }, { tag: TQ.string, class: "tok-string" }, { tag: TQ.number, class: "tok-number" }, { tag: [TQ.regexp, TQ.escape, TQ.special(TQ.string)], class: "tok-string2" }, { tag: TQ.variableName, class: "tok-variableName" }, { tag: TQ.local(TQ.variableName), class: "tok-variableName tok-local" }, { tag: TQ.definition(TQ.variableName), class: "tok-variableName tok-definition" }, { tag: TQ.special(TQ.variableName), class: "tok-variableName2" }, { tag: TQ.definition(TQ.propertyName), class: "tok-propertyName tok-definition" }, { tag: TQ.typeName, class: "tok-typeName" }, { tag: TQ.namespace, class: "tok-namespace" }, { tag: TQ.className, class: "tok-className" }, { tag: TQ.macroName, class: "tok-macroName" }, { tag: TQ.propertyName, class: "tok-propertyName" }, { tag: TQ.operator, class: "tok-operator" }, { tag: TQ.comment, class: "tok-comment" }, { tag: TQ.meta, class: "tok-meta" }, { tag: TQ.invalid, class: "tok-invalid" }, { tag: TQ.punctuation, class: "tok-punctuation" }]); + var RQ = new AG(); + var NQ = new AG(); + var IQ = function() { + function e20(t10, n10) { + var r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], o10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : ""; + No(this, e20), this.data = t10, this.name = o10, mV.prototype.hasOwnProperty("tree") || Object.defineProperty(mV.prototype, "tree", { get: function() { + return zQ(this); + } }), this.parser = n10, this.extension = [KQ.of(this), mV.languageData.of(function(e21, t11, n11) { + var r11 = DQ(e21, t11, n11), o11 = r11.type.prop(RQ); + if (!o11) + return []; + var i10 = e21.facet(o11), a10 = r11.type.prop(NQ); + if (a10) { + var s10, c10 = r11.resolve(t11 - r11.from, n11), l10 = bo(a10); + try { + for (l10.s(); !(s10 = l10.n()).done; ) { + var u10 = s10.value; + if (u10.test(c10, e21)) { + var f10 = e21.facet(u10.facet); + return "replace" == u10.type ? f10 : f10.concat(i10); + } + } + } catch (e23) { + l10.e(e23); + } finally { + l10.f(); + } + } + return i10; + })].concat(r10); + } + return Do(e20, [{ key: "isActiveAt", value: function(e21, t10) { + return DQ(e21, t10, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1).type.prop(RQ) == this.data; + } }, { key: "findRegions", value: function(e21) { + var t10 = this, n10 = e21.facet(KQ); + if ((null == n10 ? void 0 : n10.data) == this.data) + return [{ from: 0, to: e21.doc.length }]; + if (!n10 || !n10.allowsNesting) + return []; + var r10 = []; + return function e23(n11, o10) { + if (n11.prop(RQ) != t10.data) { + var i10 = n11.prop(AG.mounted); + if (i10) { + if (i10.tree.prop(RQ) == t10.data) { + if (i10.overlay) { + var a10, s10 = bo(i10.overlay); + try { + for (s10.s(); !(a10 = s10.n()).done; ) { + var c10 = a10.value; + r10.push({ from: c10.from + o10, to: c10.to + o10 }); + } + } catch (e24) { + s10.e(e24); + } finally { + s10.f(); + } + } else + r10.push({ from: o10, to: o10 + n11.length }); + return; + } + if (i10.overlay) { + var l10 = r10.length; + if (e23(i10.tree, i10.overlay[0].from + o10), r10.length > l10) + return; + } + } + for (var u10 = 0; u10 < n11.children.length; u10++) { + var f10 = n11.children[u10]; + f10 instanceof zG && e23(f10, n11.positions[u10] + o10); + } + } else + r10.push({ from: o10, to: o10 + n11.length }); + }(zQ(e21), 0), r10; + } }, { key: "allowsNesting", get: function() { + return true; + } }]), e20; + }(); + function DQ(e20, t10, n10) { + var r10 = e20.facet(KQ), o10 = zQ(e20).topNode; + if (!r10 || r10.allowsNesting) + for (var i10 = o10; i10; i10 = i10.enter(t10, n10, NG.ExcludeBuffers)) + i10.type.isTop && (o10 = i10); + return o10; + } + IQ.setState = oV.define(); + var qQ = function(e20) { + function t10(e21, n10, r10) { + var o10; + return No(this, t10), (o10 = _o(this, t10, [e21, n10, [], r10])).parser = n10, o10; + } + return Ao(t10, IQ), Do(t10, [{ key: "configure", value: function(e21, n10) { + return new t10(this.data, this.parser.configure(e21), n10 || this.name); + } }, { key: "allowsNesting", get: function() { + return this.parser.hasWrappers(); + } }], [{ key: "define", value: function(e21) { + var n10, r10 = (n10 = e21.languageData, MF.define({ combine: n10 ? function(e23) { + return e23.concat(n10); + } : void 0 })); + return new t10(r10, e21.parser.configure({ props: [RQ.add(function(e23) { + return e23.isTop ? r10 : void 0; + })] }), e21.name); + } }]), t10; + }(); + function zQ(e20) { + var t10 = e20.field(IQ.state, false); + return t10 ? t10.tree : zG.empty; + } + var BQ = function() { + function e20(t10) { + No(this, e20), this.doc = t10, this.cursorPos = 0, this.string = "", this.cursor = t10.iter(); + } + return Do(e20, [{ key: "length", get: function() { + return this.doc.length; + } }, { key: "syncTo", value: function(e21) { + return this.string = this.cursor.next(e21 - this.cursorPos).value, this.cursorPos = e21 + this.string.length, this.cursorPos - this.string.length; + } }, { key: "chunk", value: function(e21) { + return this.syncTo(e21), this.string; + } }, { key: "lineChunks", get: function() { + return true; + } }, { key: "read", value: function(e21, t10) { + var n10 = this.cursorPos - this.string.length; + return e21 < n10 || t10 >= this.cursorPos ? this.doc.sliceString(e21, t10) : this.string.slice(e21 - n10, t10 - n10); + } }]), e20; + }(); + var LQ = null; + var FQ = function() { + function e20(t10, n10) { + var r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], o10 = arguments.length > 3 ? arguments[3] : void 0, i10 = arguments.length > 4 ? arguments[4] : void 0, a10 = arguments.length > 5 ? arguments[5] : void 0, s10 = arguments.length > 6 ? arguments[6] : void 0, c10 = arguments.length > 7 ? arguments[7] : void 0; + No(this, e20), this.parser = t10, this.state = n10, this.fragments = r10, this.tree = o10, this.treeLen = i10, this.viewport = a10, this.skipped = s10, this.scheduleOn = c10, this.parse = null, this.tempSkipped = []; + } + return Do(e20, [{ key: "startParse", value: function() { + return this.parser.startParse(new BQ(this.state.doc), this.fragments); + } }, { key: "work", value: function(e21, t10) { + var n10 = this; + return null != t10 && t10 >= this.state.doc.length && (t10 = void 0), this.tree != zG.empty && this.isDone(null != t10 ? t10 : this.state.doc.length) ? (this.takeTree(), true) : this.withContext(function() { + var r10; + if ("number" == typeof e21) { + var o10 = Date.now() + e21; + e21 = function() { + return Date.now() > o10; + }; + } + for (n10.parse || (n10.parse = n10.startParse()), null != t10 && (null == n10.parse.stoppedAt || n10.parse.stoppedAt > t10) && t10 < n10.state.doc.length && n10.parse.stopAt(t10); ; ) { + var i10 = n10.parse.advance(); + if (i10) { + if (n10.fragments = n10.withoutTempSkipped(oQ.addTree(i10, n10.fragments, null != n10.parse.stoppedAt)), n10.treeLen = null !== (r10 = n10.parse.stoppedAt) && void 0 !== r10 ? r10 : n10.state.doc.length, n10.tree = i10, n10.parse = null, !(n10.treeLen < (null != t10 ? t10 : n10.state.doc.length))) + return true; + n10.parse = n10.startParse(); + } + if (e21()) + return false; + } + }); + } }, { key: "takeTree", value: function() { + var e21, t10, n10 = this; + this.parse && (e21 = this.parse.parsedPos) >= this.treeLen && ((null == this.parse.stoppedAt || this.parse.stoppedAt > e21) && this.parse.stopAt(e21), this.withContext(function() { + for (; !(t10 = n10.parse.advance()); ) + ; + }), this.treeLen = e21, this.tree = t10, this.fragments = this.withoutTempSkipped(oQ.addTree(this.tree, this.fragments, true)), this.parse = null); + } }, { key: "withContext", value: function(e21) { + var t10 = LQ; + LQ = this; + try { + return e21(); + } finally { + LQ = t10; + } + } }, { key: "withoutTempSkipped", value: function(e21) { + for (var t10; t10 = this.tempSkipped.pop(); ) + e21 = VQ(e21, t10.from, t10.to); + return e21; + } }, { key: "changes", value: function(t10, n10) { + var r10 = this.fragments, o10 = this.tree, i10 = this.treeLen, a10 = this.viewport, s10 = this.skipped; + if (this.takeTree(), !t10.empty) { + var c10 = []; + if (t10.iterChangedRanges(function(e21, t11, n11, r11) { + return c10.push({ fromA: e21, toA: t11, fromB: n11, toB: r11 }); + }), r10 = oQ.applyChanges(r10, c10), o10 = zG.empty, i10 = 0, a10 = { from: t10.mapPos(a10.from, -1), to: t10.mapPos(a10.to, 1) }, this.skipped.length) { + s10 = []; + var l10, u10 = bo(this.skipped); + try { + for (u10.s(); !(l10 = u10.n()).done; ) { + var f10 = l10.value, d10 = t10.mapPos(f10.from, 1), h10 = t10.mapPos(f10.to, -1); + d10 < h10 && s10.push({ from: d10, to: h10 }); + } + } catch (e21) { + u10.e(e21); + } finally { + u10.f(); + } + } + } + return new e20(this.parser, n10, r10, o10, i10, a10, s10, this.scheduleOn); + } }, { key: "updateViewport", value: function(e21) { + if (this.viewport.from == e21.from && this.viewport.to == e21.to) + return false; + this.viewport = e21; + for (var t10 = this.skipped.length, n10 = 0; n10 < this.skipped.length; n10++) { + var r10 = this.skipped[n10], o10 = r10.from, i10 = r10.to; + o10 < e21.to && i10 > e21.from && (this.fragments = VQ(this.fragments, o10, i10), this.skipped.splice(n10--, 1)); + } + return !(this.skipped.length >= t10) && (this.reset(), true); + } }, { key: "reset", value: function() { + this.parse && (this.takeTree(), this.parse = null); + } }, { key: "skipUntilInView", value: function(e21, t10) { + this.skipped.push({ from: e21, to: t10 }); + } }, { key: "isDone", value: function(e21) { + e21 = Math.min(e21, this.state.doc.length); + var t10 = this.fragments; + return this.treeLen >= e21 && t10.length && 0 == t10[0].from && t10[0].to >= e21; + } }], [{ key: "create", value: function(t10, n10, r10) { + return new e20(t10, n10, [], zG.empty, 0, r10, [], null); + } }, { key: "getSkippingParser", value: function(e21) { + return new (function(t10) { + function n10() { + return No(this, n10), _o(this, n10, arguments); + } + return Ao(n10, iQ), Do(n10, [{ key: "createParse", value: function(t11, n11, r10) { + var o10 = r10[0].from, i10 = r10[r10.length - 1].to; + return { parsedPos: o10, advance: function() { + var t12 = LQ; + if (t12) { + var n12, a10 = bo(r10); + try { + for (a10.s(); !(n12 = a10.n()).done; ) { + var s10 = n12.value; + t12.tempSkipped.push(s10); + } + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + e21 && (t12.scheduleOn = t12.scheduleOn ? Promise.all([t12.scheduleOn, e21]) : e21); + } + return this.parsedPos = i10, new zG(RG.none, [], [], i10 - o10); + }, stoppedAt: null, stopAt: function() { + } }; + } }]), n10; + }())(); + } }, { key: "get", value: function() { + return LQ; + } }]), e20; + }(); + function VQ(e20, t10, n10) { + return oQ.applyChanges(e20, [{ fromA: t10, toA: n10, fromB: t10, toB: n10 }]); + } + var HQ = function() { + function e20(t10) { + No(this, e20), this.context = t10, this.tree = t10.tree; + } + return Do(e20, [{ key: "apply", value: function(t10) { + if (!t10.docChanged && this.tree == this.context.tree) + return this; + var n10 = this.context.changes(t10.changes, t10.state), r10 = this.context.treeLen == t10.startState.doc.length ? void 0 : Math.max(t10.changes.mapPos(this.context.treeLen), n10.viewport.to); + return n10.work(20, r10) || n10.takeTree(), new e20(n10); + } }], [{ key: "init", value: function(t10) { + var n10 = Math.min(3e3, t10.doc.length), r10 = FQ.create(t10.facet(KQ).parser, t10, { from: 0, to: n10 }); + return r10.work(20, n10) || r10.takeTree(), new e20(r10); + } }]), e20; + }(); + IQ.state = NF.define({ create: HQ.init, update: function(e20, t10) { + var n10, r10 = bo(t10.effects); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + if (o10.is(IQ.setState)) + return o10.value; + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + return t10.startState.facet(KQ) != t10.state.facet(KQ) ? HQ.init(t10.state) : e20.apply(t10); + } }); + var WQ = function(e20) { + var t10 = setTimeout(function() { + return e20(); + }, 500); + return function() { + return clearTimeout(t10); + }; + }; + "undefined" != typeof requestIdleCallback && (WQ = function(e20) { + var t10 = -1, n10 = setTimeout(function() { + t10 = requestIdleCallback(e20, { timeout: 400 }); + }, 100); + return function() { + return t10 < 0 ? clearTimeout(n10) : cancelIdleCallback(t10); + }; + }); + var UQ = "undefined" != typeof navigator && (null === (gQ = navigator.scheduling) || void 0 === gQ ? void 0 : gQ.isInputPending) ? function() { + return navigator.scheduling.isInputPending(); + } : null; + var JQ = FW.fromClass(function() { + function e20(t10) { + No(this, e20), this.view = t10, this.working = null, this.workScheduled = 0, this.chunkEnd = -1, this.chunkBudget = -1, this.work = this.work.bind(this), this.scheduleWork(); + } + return Do(e20, [{ key: "update", value: function(e21) { + var t10 = this.view.state.field(IQ.state).context; + (t10.updateViewport(e21.view.viewport) || this.view.viewport.to > t10.treeLen) && this.scheduleWork(), (e21.docChanged || e21.selectionSet) && (this.view.hasFocus && (this.chunkBudget += 50), this.scheduleWork()), this.checkAsyncSchedule(t10); + } }, { key: "scheduleWork", value: function() { + if (!this.working) { + var e21 = this.view.state, t10 = e21.field(IQ.state); + t10.tree == t10.context.tree && t10.context.isDone(e21.doc.length) || (this.working = WQ(this.work)); + } + } }, { key: "work", value: function(e21) { + this.working = null; + var t10 = Date.now(); + if (this.chunkEnd < t10 && (this.chunkEnd < 0 || this.view.hasFocus) && (this.chunkEnd = t10 + 3e4, this.chunkBudget = 3e3), !(this.chunkBudget <= 0)) { + var n10 = this.view, r10 = n10.state, o10 = n10.viewport.to, i10 = r10.field(IQ.state); + if (i10.tree != i10.context.tree || !i10.context.isDone(o10 + 1e5)) { + var a10 = Date.now() + Math.min(this.chunkBudget, 100, e21 && !UQ ? Math.max(25, e21.timeRemaining() - 5) : 1e9), s10 = i10.context.treeLen < o10 && r10.doc.length > o10 + 1e3, c10 = i10.context.work(function() { + return UQ && UQ() || Date.now() > a10; + }, o10 + (s10 ? 0 : 1e5)); + this.chunkBudget -= Date.now() - t10, (c10 || this.chunkBudget <= 0) && (i10.context.takeTree(), this.view.dispatch({ effects: IQ.setState.of(new HQ(i10.context)) })), this.chunkBudget > 0 && (!c10 || s10) && this.scheduleWork(), this.checkAsyncSchedule(i10.context); + } + } + } }, { key: "checkAsyncSchedule", value: function(e21) { + var t10 = this; + e21.scheduleOn && (this.workScheduled++, e21.scheduleOn.then(function() { + return t10.scheduleWork(); + }).catch(function(e23) { + return qW(t10.view.state, e23); + }).then(function() { + return t10.workScheduled--; + }), e21.scheduleOn = null); + } }, { key: "destroy", value: function() { + this.working && this.working(); + } }, { key: "isWorking", value: function() { + return !!(this.working || this.workScheduled > 0); + } }]), e20; + }(), { eventHandlers: { focus: function() { + this.scheduleWork(); + } } }); + var KQ = MF.define({ combine: function(e20) { + return e20.length ? e20[0] : null; + }, enables: function(e20) { + return [IQ.state, JQ, zJ.contentAttributes.compute([e20], function(t10) { + var n10 = t10.facet(e20); + return n10 && n10.name ? { "data-language": n10.name } : {}; + })]; + } }); + var GQ = Do(function e9(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : []; + No(this, e9), this.language = t10, this.support = n10, this.extension = [t10, n10]; + }); + var QQ = MF.define(); + var YQ = MF.define({ combine: function(e20) { + if (!e20.length) + return " "; + var t10 = e20[0]; + if (!t10 || /\S/.test(t10) || Array.from(t10).some(function(e21) { + return e21 != t10[0]; + })) + throw new Error("Invalid indent unit: " + JSON.stringify(e20[0])); + return t10; + } }); + function XQ(e20) { + var t10 = e20.facet(YQ); + return 9 == t10.charCodeAt(0) ? e20.tabSize * t10.length : t10.length; + } + function ZQ(e20, t10) { + var n10 = "", r10 = e20.tabSize, o10 = e20.facet(YQ)[0]; + if (" " == o10) { + for (; t10 >= r10; ) + n10 += " ", t10 -= r10; + o10 = " "; + } + for (var i10 = 0; i10 < t10; i10++) + n10 += o10; + return n10; + } + function eY(e20, t10) { + e20 instanceof mV && (e20 = new tY(e20)); + var n10, r10 = bo(e20.state.facet(QQ)); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = (0, n10.value)(e20, t10); + if (void 0 !== o10) + return o10; + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + var i10 = zQ(e20.state); + return i10.length >= t10 ? function(e21, t11, n11) { + var r11 = t11.resolveStack(n11), o11 = r11.node.enterUnfinishedNodesBefore(n11); + if (o11 != r11.node) { + for (var i11 = [], a10 = o11; a10 != r11.node; a10 = a10.parent) + i11.push(a10); + for (var s10 = i11.length - 1; s10 >= 0; s10--) + r11 = { node: i11[s10], next: r11 }; + } + return rY(r11, e21, n11); + }(e20, i10, t10) : null; + } + var tY = function() { + function e20(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + No(this, e20), this.state = t10, this.options = n10, this.unit = XQ(t10); + } + return Do(e20, [{ key: "lineAt", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, n10 = this.state.doc.lineAt(e21), r10 = this.options, o10 = r10.simulateBreak, i10 = r10.simulateDoubleBreak; + return null != o10 && o10 >= n10.from && o10 <= n10.to ? i10 && o10 == e21 ? { text: "", from: e21 } : (t10 < 0 ? o10 < e21 : o10 <= e21) ? { text: n10.text.slice(o10 - n10.from), from: o10 } : { text: n10.text.slice(0, o10 - n10.from), from: n10.from } : n10; + } }, { key: "textAfterPos", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; + if (this.options.simulateDoubleBreak && e21 == this.options.simulateBreak) + return ""; + var n10 = this.lineAt(e21, t10), r10 = n10.text, o10 = n10.from; + return r10.slice(e21 - o10, Math.min(r10.length, e21 + 100 - o10)); + } }, { key: "column", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, n10 = this.lineAt(e21, t10), r10 = n10.text, o10 = n10.from, i10 = this.countColumn(r10, e21 - o10), a10 = this.options.overrideIndentation ? this.options.overrideIndentation(o10) : -1; + return a10 > -1 && (i10 += a10 - this.countColumn(r10, r10.search(/\S|$/))), i10; + } }, { key: "countColumn", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21.length; + return RV(e21, this.state.tabSize, t10); + } }, { key: "lineIndent", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, n10 = this.lineAt(e21, t10), r10 = n10.text, o10 = n10.from, i10 = this.options.overrideIndentation; + if (i10) { + var a10 = i10(o10); + if (a10 > -1) + return a10; + } + return this.countColumn(r10, r10.search(/\S|$/)); + } }, { key: "simulatedBreak", get: function() { + return this.options.simulateBreak || null; + } }]), e20; + }(); + var nY = new AG(); + function rY(e20, t10, n10) { + for (var r10 = e20; r10; r10 = r10.next) { + var o10 = oY(r10.node); + if (o10) + return o10(aY.create(t10, n10, r10)); + } + return 0; + } + function oY(e20) { + var t10 = e20.type.prop(nY); + if (t10) + return t10; + var n10, r10 = e20.firstChild; + if (r10 && (n10 = r10.type.prop(AG.closedBy))) { + var o10 = e20.lastChild, i10 = o10 && n10.indexOf(o10.name) > -1; + return function(e21) { + return function(e23, t11, n11, r11, o11) { + var i11 = e23.textAfter, a10 = i11.match(/^\s*/)[0].length, s10 = r11 && i11.slice(a10, a10 + r11.length) == r11 || o11 == e23.pos + a10, c10 = t11 ? function(e24) { + var t12 = e24.node, n12 = t12.childAfter(t12.from), r12 = t12.lastChild; + if (!n12) + return null; + for (var o12 = e24.options.simulateBreak, i12 = e24.state.doc.lineAt(n12.from), a11 = null == o12 || o12 <= i12.from ? i12.to : Math.min(i12.to, o12), s11 = n12.to; ; ) { + var c11 = t12.childAfter(s11); + if (!c11 || c11 == r12) + return null; + if (!c11.type.isSkipped) + return c11.from < a11 ? n12 : null; + s11 = c11.to; + } + }(e23) : null; + return c10 ? s10 ? e23.column(c10.from) : e23.column(c10.to) : e23.baseIndent + (s10 ? 0 : e23.unit * n11); + }(e21, true, 1, void 0, i10 && !function(e23) { + return e23.pos == e23.options.simulateBreak && e23.options.simulateDoubleBreak; + }(e21) ? o10.from : void 0); + }; + } + return null == e20.parent ? iY : null; + } + function iY() { + return 0; + } + var aY = function(e20) { + function t10(e21, n10, r10) { + var o10; + return No(this, t10), (o10 = _o(this, t10, [e21.state, e21.options])).base = e21, o10.pos = n10, o10.context = r10, o10; + } + return Ao(t10, tY), Do(t10, [{ key: "node", get: function() { + return this.context.node; + } }, { key: "textAfter", get: function() { + return this.textAfterPos(this.pos); + } }, { key: "baseIndent", get: function() { + return this.baseIndentFor(this.node); + } }, { key: "baseIndentFor", value: function(e21) { + for (var t11 = this.state.doc.lineAt(e21.from); ; ) { + for (var n10 = e21.resolve(t11.from); n10.parent && n10.parent.from == n10.from; ) + n10 = n10.parent; + if (sY(n10, e21)) + break; + t11 = this.state.doc.lineAt(n10.from); + } + return this.lineIndent(t11.from); + } }, { key: "continue", value: function() { + return rY(this.context.next, this.base, this.pos); + } }], [{ key: "create", value: function(e21, n10, r10) { + return new t10(e21, n10, r10); + } }]), t10; + }(); + function sY(e20, t10) { + for (var n10 = t10; n10; n10 = n10.parent) + if (e20 == n10) + return true; + return false; + } + function cY() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, t10 = e20.except, n10 = e20.units, r10 = void 0 === n10 ? 1 : n10; + return function(e21) { + var n11 = t10 && t10.test(e21.textAfter); + return e21.baseIndent + (n11 ? 0 : r10 * e21.unit); + }; + } + var lY = 200; + var uY = MF.define(); + var fY = new AG(); + function dY(e20, t10, n10) { + var r10, o10 = bo(e20.facet(uY)); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = (0, r10.value)(e20, t10, n10); + if (i10) + return i10; + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + return function(e21, t11, n11) { + var r11 = zQ(e21); + if (r11.length < n11) + return null; + for (var o11, i11, a10 = null, s10 = r11.resolveStack(n11, 1); s10; s10 = s10.next) { + var c10 = s10.node; + if (!(c10.to <= n11 || c10.from > n11)) { + if (a10 && c10.from < t11) + break; + var l10 = c10.type.prop(fY); + if (l10 && (c10.to < r11.length - 50 || r11.length == e21.doc.length || (i11 = void 0, !(i11 = (o11 = c10).lastChild) || i11.to != o11.to || !i11.type.isError))) { + var u10 = l10(c10, e21); + u10 && u10.from <= n11 && u10.from >= t11 && u10.to > n11 && (a10 = u10); + } + } + } + return a10; + }(e20, t10, n10); + } + function hY(e20, t10) { + var n10 = t10.mapPos(e20.from, 1), r10 = t10.mapPos(e20.to, -1); + return n10 >= r10 ? void 0 : { from: n10, to: r10 }; + } + var vY = oV.define({ map: hY }); + var pY = oV.define({ map: hY }); + function mY(e20) { + var t10, n10 = [], r10 = bo(e20.state.selection.ranges); + try { + var o10 = function() { + var r11 = t10.value.head; + if (n10.some(function(e21) { + return e21.from <= r11 && e21.to >= r11; + })) + return 1; + n10.push(e20.lineBlockAt(r11)); + }; + for (r10.s(); !(t10 = r10.n()).done; ) + o10(); + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + return n10; + } + var gY = NF.define({ create: function() { + return KH.none; + }, update: function(e20, t10) { + e20 = e20.map(t10.changes); + var n10, r10 = bo(t10.effects); + try { + var o10 = function() { + var r11 = n10.value; + if (r11.is(vY) && !function(e21, t11, n11) { + var r12 = false; + return e21.between(t11, t11, function(e23, o12) { + e23 == t11 && o12 == n11 && (r12 = true); + }), r12; + }(e20, r11.value.from, r11.value.to)) { + var o11 = t10.state.facet(jY).preparePlaceholder, i11 = o11 ? KH.replace({ widget: new _Y(o11(t10.state, r11.value)) }) : $Y; + e20 = e20.update({ add: [i11.range(r11.value.from, r11.value.to)] }); + } else + r11.is(pY) && (e20 = e20.update({ filter: function(e21, t11) { + return r11.value.from != e21 || r11.value.to != t11; + }, filterFrom: r11.value.from, filterTo: r11.value.to })); + }; + for (r10.s(); !(n10 = r10.n()).done; ) + o10(); + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + if (t10.selection) { + var i10 = false, a10 = t10.selection.main.head; + e20.between(a10, a10, function(e21, t11) { + e21 < a10 && t11 > a10 && (i10 = true); + }), i10 && (e20 = e20.update({ filterFrom: a10, filterTo: a10, filter: function(e21, t11) { + return t11 <= a10 || e21 >= a10; + } })); + } + return e20; + }, provide: function(e20) { + return zJ.decorations.from(e20); + }, toJSON: function(e20, t10) { + var n10 = []; + return e20.between(0, t10.doc.length, function(e21, t11) { + n10.push(e21, t11); + }), n10; + }, fromJSON: function(e20) { + if (!Array.isArray(e20) || e20.length % 2) + throw new RangeError("Invalid JSON for fold state"); + for (var t10 = [], n10 = 0; n10 < e20.length; ) { + var r10 = e20[n10++], o10 = e20[n10++]; + if ("number" != typeof r10 || "number" != typeof o10) + throw new RangeError("Invalid JSON for fold state"); + t10.push($Y.range(r10, o10)); + } + return KH.set(t10, true); + } }); + function yY(e20, t10, n10) { + var r10, o10 = null; + return null === (r10 = e20.field(gY, false)) || void 0 === r10 || r10.between(t10, n10, function(e21, t11) { + (!o10 || o10.from > e21) && (o10 = { from: e21, to: t11 }); + }), o10; + } + function bY(e20, t10) { + return e20.field(gY, false) ? t10 : t10.concat(oV.appendConfig.of(SY())); + } + function kY(e20, t10) { + var n10 = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], r10 = e20.state.doc.lineAt(t10.from).number, o10 = e20.state.doc.lineAt(t10.to).number; + return zJ.announce.of("".concat(e20.state.phrase(n10 ? "Folded lines" : "Unfolded lines"), " ").concat(r10, " ").concat(e20.state.phrase("to"), " ").concat(o10, ".")); + } + var wY = [{ key: "Ctrl-Shift-[", mac: "Cmd-Alt-[", run: function(e20) { + var t10, n10 = bo(mY(e20)); + try { + for (n10.s(); !(t10 = n10.n()).done; ) { + var r10 = t10.value, o10 = dY(e20.state, r10.from, r10.to); + if (o10) + return e20.dispatch({ effects: bY(e20.state, [vY.of(o10), kY(e20, o10)]) }), true; + } + } catch (e21) { + n10.e(e21); + } finally { + n10.f(); + } + return false; + } }, { key: "Ctrl-Shift-]", mac: "Cmd-Alt-]", run: function(e20) { + if (!e20.state.field(gY, false)) + return false; + var t10, n10 = [], r10 = bo(mY(e20)); + try { + for (r10.s(); !(t10 = r10.n()).done; ) { + var o10 = t10.value, i10 = yY(e20.state, o10.from, o10.to); + i10 && n10.push(pY.of(i10), kY(e20, i10, false)); + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + return n10.length && e20.dispatch({ effects: n10 }), n10.length > 0; + } }, { key: "Ctrl-Alt-[", run: function(e20) { + for (var t10 = e20.state, n10 = [], r10 = 0; r10 < t10.doc.length; ) { + var o10 = e20.lineBlockAt(r10), i10 = dY(t10, o10.from, o10.to); + i10 && n10.push(vY.of(i10)), r10 = (i10 ? e20.lineBlockAt(i10.to) : o10).to + 1; + } + return n10.length && e20.dispatch({ effects: bY(e20.state, n10) }), !!n10.length; + } }, { key: "Ctrl-Alt-]", run: function(e20) { + var t10 = e20.state.field(gY, false); + if (!t10 || !t10.size) + return false; + var n10 = []; + return t10.between(0, e20.state.doc.length, function(e21, t11) { + n10.push(pY.of({ from: e21, to: t11 })); + }), e20.dispatch({ effects: n10 }), true; + } }]; + var xY = { placeholderDOM: null, preparePlaceholder: null, placeholderText: "\u2026" }; + var jY = MF.define({ combine: function(e20) { + return gV(e20, xY); + } }); + function SY(e20) { + var t10 = [gY, AY]; + return e20 && t10.push(jY.of(e20)), t10; + } + function CY(e20, t10) { + var n10 = e20.state, r10 = n10.facet(jY), o10 = function(t11) { + var n11 = e20.lineBlockAt(e20.posAtDOM(t11.target)), r11 = yY(e20.state, n11.from, n11.to); + r11 && e20.dispatch({ effects: pY.of(r11) }), t11.preventDefault(); + }; + if (r10.placeholderDOM) + return r10.placeholderDOM(e20, o10, t10); + var i10 = document.createElement("span"); + return i10.textContent = r10.placeholderText, i10.setAttribute("aria-label", n10.phrase("folded code")), i10.title = n10.phrase("unfold"), i10.className = "cm-foldPlaceholder", i10.onclick = o10, i10; + } + var $Y = KH.replace({ widget: new (function(e20) { + function t10() { + return No(this, t10), _o(this, t10, arguments); + } + return Ao(t10, UH), Do(t10, [{ key: "toDOM", value: function(e21) { + return CY(e21, null); + } }]), t10; + }())() }); + var _Y = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).value = e21, n10; + } + return Ao(t10, UH), Do(t10, [{ key: "eq", value: function(e21) { + return this.value == e21.value; + } }, { key: "toDOM", value: function(e21) { + return CY(e21, this.value); + } }]), t10; + }(); + var OY = { openText: "\u2304", closedText: "\u203A", markerDOM: null, domEventHandlers: {}, foldingChanged: function() { + return false; + } }; + var MY = function(e20) { + function t10(e21, n10) { + var r10; + return No(this, t10), (r10 = _o(this, t10)).config = e21, r10.open = n10, r10; + } + return Ao(t10, sG), Do(t10, [{ key: "eq", value: function(e21) { + return this.config == e21.config && this.open == e21.open; + } }, { key: "toDOM", value: function(e21) { + if (this.config.markerDOM) + return this.config.markerDOM(this.open); + var t11 = document.createElement("span"); + return t11.textContent = this.open ? this.config.openText : this.config.closedText, t11.title = e21.state.phrase(this.open ? "Fold line" : "Unfold line"), t11; + } }]), t10; + }(); + function EY() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, t10 = Object.assign(Object.assign({}, OY), e20), n10 = new MY(t10, true), r10 = new MY(t10, false), o10 = FW.fromClass(function() { + function e21(t11) { + No(this, e21), this.from = t11.viewport.from, this.markers = this.buildMarkers(t11); + } + return Do(e21, [{ key: "update", value: function(e23) { + (e23.docChanged || e23.viewportChanged || e23.startState.facet(KQ) != e23.state.facet(KQ) || e23.startState.field(gY, false) != e23.state.field(gY, false) || zQ(e23.startState) != zQ(e23.state) || t10.foldingChanged(e23)) && (this.markers = this.buildMarkers(e23.view)); + } }, { key: "buildMarkers", value: function(e23) { + var t11, o11 = new jV(), i11 = bo(e23.viewportLineBlocks); + try { + for (i11.s(); !(t11 = i11.n()).done; ) { + var a10 = t11.value, s10 = yY(e23.state, a10.from, a10.to) ? r10 : dY(e23.state, a10.from, a10.to) ? n10 : null; + s10 && o11.add(a10.from, a10.from, s10); + } + } catch (e24) { + i11.e(e24); + } finally { + i11.f(); + } + return o11.finish(); + } }]), e21; + }()), i10 = t10.domEventHandlers; + return [o10, fG({ class: "cm-foldGutter", markers: function(e21) { + var t11; + return (null === (t11 = e21.plugin(o10)) || void 0 === t11 ? void 0 : t11.markers) || xV.empty; + }, initialSpacer: function() { + return new MY(t10, false); + }, domEventHandlers: Object.assign(Object.assign({}, i10), { click: function(e21, t11, n11) { + if (i10.click && i10.click(e21, t11, n11)) + return true; + var r11 = yY(e21.state, t11.from, t11.to); + if (r11) + return e21.dispatch({ effects: pY.of(r11) }), true; + var o11 = dY(e21.state, t11.from, t11.to); + return !!o11 && (e21.dispatch({ effects: vY.of(o11) }), true); + } }) }), SY()]; + } + var AY = zJ.baseTheme({ ".cm-foldPlaceholder": { backgroundColor: "#eee", border: "1px solid #ddd", color: "#888", borderRadius: ".2em", margin: "0 1px", padding: "0 1px", cursor: "pointer" }, ".cm-foldGutter span": { padding: "0 1px", cursor: "pointer" } }); + var PY = function() { + function e20(t10, n10) { + var r10; + function o10(e21) { + var t11 = zV.newName(); + return (r10 || (r10 = /* @__PURE__ */ Object.create(null)))["." + t11] = e21, t11; + } + No(this, e20), this.specs = t10; + var i10 = "string" == typeof n10.all ? n10.all : n10.all ? o10(n10.all) : void 0, a10 = n10.scope; + this.scope = a10 instanceof IQ ? function(e21) { + return e21.prop(RQ) == a10.data; + } : a10 ? function(e21) { + return e21 == a10; + } : void 0, this.style = vQ(t10.map(function(e21) { + return { tag: e21.tag, class: e21.class || o10(Object.assign({}, e21, { tag: null })) }; + }), { all: i10 }).style, this.module = r10 ? new zV(r10) : null, this.themeType = n10.themeType; + } + return Do(e20, null, [{ key: "define", value: function(t10, n10) { + return new e20(t10, n10 || {}); + } }]), e20; + }(); + var TY = MF.define(); + var RY = MF.define({ combine: function(e20) { + return e20.length ? [e20[0]] : null; + } }); + function NY(e20) { + var t10 = e20.facet(TY); + return t10.length ? t10 : e20.facet(RY); + } + function IY(e20, t10) { + var n10, r10 = [qY]; + return e20 instanceof PY && (e20.module && r10.push(zJ.styleModule.of(e20.module)), n10 = e20.themeType), (null == t10 ? void 0 : t10.fallback) ? r10.push(RY.of(e20)) : n10 ? r10.push(TY.computeN([zJ.darkTheme], function(t11) { + return t11.facet(zJ.darkTheme) == ("dark" == n10) ? [e20] : []; + })) : r10.push(TY.of(e20)), r10; + } + var DY = function() { + function e20(t10) { + No(this, e20), this.markCache = /* @__PURE__ */ Object.create(null), this.tree = zQ(t10.state), this.decorations = this.buildDeco(t10, NY(t10.state)); + } + return Do(e20, [{ key: "update", value: function(e21) { + var t10 = zQ(e21.state), n10 = NY(e21.state), r10 = n10 != NY(e21.startState); + t10.length < e21.view.viewport.to && !r10 && t10.type == this.tree.type ? this.decorations = this.decorations.map(e21.changes) : (t10 != this.tree || e21.viewportChanged || r10) && (this.tree = t10, this.decorations = this.buildDeco(e21.view, n10)); + } }, { key: "buildDeco", value: function(e21, t10) { + var n10 = this; + if (!t10 || !this.tree.length) + return KH.none; + var r10, o10 = new jV(), i10 = bo(e21.visibleRanges); + try { + for (i10.s(); !(r10 = i10.n()).done; ) { + var a10 = r10.value, s10 = a10.from, c10 = a10.to; + pQ(this.tree, t10, function(e23, t11, r11) { + o10.add(e23, t11, n10.markCache[r11] || (n10.markCache[r11] = KH.mark({ class: r11 }))); + }, s10, c10); + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + return o10.finish(); + } }]), e20; + }(); + var qY = LF.high(FW.fromClass(DY, { decorations: function(e20) { + return e20.decorations; + } })); + var zY = PY.define([{ tag: TQ.meta, color: "#404740" }, { tag: TQ.link, textDecoration: "underline" }, { tag: TQ.heading, textDecoration: "underline", fontWeight: "bold" }, { tag: TQ.emphasis, fontStyle: "italic" }, { tag: TQ.strong, fontWeight: "bold" }, { tag: TQ.strikethrough, textDecoration: "line-through" }, { tag: TQ.keyword, color: "#708" }, { tag: [TQ.atom, TQ.bool, TQ.url, TQ.contentSeparator, TQ.labelName], color: "#219" }, { tag: [TQ.literal, TQ.inserted], color: "#164" }, { tag: [TQ.string, TQ.deleted], color: "#a11" }, { tag: [TQ.regexp, TQ.escape, TQ.special(TQ.string)], color: "#e40" }, { tag: TQ.definition(TQ.variableName), color: "#00f" }, { tag: TQ.local(TQ.variableName), color: "#30a" }, { tag: [TQ.typeName, TQ.namespace], color: "#085" }, { tag: TQ.className, color: "#167" }, { tag: [TQ.special(TQ.variableName), TQ.macroName], color: "#256" }, { tag: TQ.definition(TQ.propertyName), color: "#00c" }, { tag: TQ.comment, color: "#940" }, { tag: TQ.invalid, color: "#f00" }]); + var BY = zJ.baseTheme({ "&.cm-focused .cm-matchingBracket": { backgroundColor: "#328c8252" }, "&.cm-focused .cm-nonmatchingBracket": { backgroundColor: "#bb555544" } }); + var LY = 1e4; + var FY = "()[]{}"; + var VY = MF.define({ combine: function(e20) { + return gV(e20, { afterCursor: true, brackets: FY, maxScanDistance: LY, renderMatch: UY }); + } }); + var HY = KH.mark({ class: "cm-matchingBracket" }); + var WY = KH.mark({ class: "cm-nonmatchingBracket" }); + function UY(e20) { + var t10 = [], n10 = e20.matched ? HY : WY; + return t10.push(n10.range(e20.start.from, e20.start.to)), e20.end && t10.push(n10.range(e20.end.from, e20.end.to)), t10; + } + var JY = NF.define({ create: function() { + return KH.none; + }, update: function(e20, t10) { + if (!t10.docChanged && !t10.selection) + return e20; + var n10, r10 = [], o10 = t10.state.facet(VY), i10 = bo(t10.state.selection.ranges); + try { + for (i10.s(); !(n10 = i10.n()).done; ) { + var a10 = n10.value; + if (a10.empty) { + var s10 = ZY(t10.state, a10.head, -1, o10) || a10.head > 0 && ZY(t10.state, a10.head - 1, 1, o10) || o10.afterCursor && (ZY(t10.state, a10.head, 1, o10) || a10.head < t10.state.doc.length && ZY(t10.state, a10.head + 1, -1, o10)); + s10 && (r10 = r10.concat(o10.renderMatch(s10, t10.state))); + } + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + return KH.set(r10, true); + }, provide: function(e20) { + return zJ.decorations.from(e20); + } }); + var KY = [JY, BY]; + function GY() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return [VY.of(e20), KY]; + } + var QY = new AG(); + function YY(e20, t10, n10) { + var r10 = e20.prop(t10 < 0 ? AG.openedBy : AG.closedBy); + if (r10) + return r10; + if (1 == e20.name.length) { + var o10 = n10.indexOf(e20.name); + if (o10 > -1 && o10 % 2 == (t10 < 0 ? 1 : 0)) + return [n10[o10 + t10]]; + } + return null; + } + function XY(e20) { + var t10 = e20.type.prop(QY); + return t10 ? t10(e20.node) : e20; + } + function ZY(e20, t10, n10) { + for (var r10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}, o10 = r10.maxScanDistance || LY, i10 = r10.brackets || FY, a10 = zQ(e20), s10 = a10.resolveInner(t10, n10), c10 = s10; c10; c10 = c10.parent) { + var l10 = YY(c10.type, n10, i10); + if (l10 && c10.from < c10.to) { + var u10 = XY(c10); + if (u10 && (n10 > 0 ? t10 >= u10.from && t10 < u10.to : t10 > u10.from && t10 <= u10.to)) + return eX(e20, t10, n10, c10, u10, l10, i10); + } + } + return function(e21, t11, n11, r11, o11, i11, a11) { + var s11 = n11 < 0 ? e21.sliceDoc(t11 - 1, t11) : e21.sliceDoc(t11, t11 + 1), c11 = a11.indexOf(s11); + if (c11 < 0 || c11 % 2 == 0 != n11 > 0) + return null; + for (var l11 = { from: n11 < 0 ? t11 - 1 : t11, to: n11 > 0 ? t11 + 1 : t11 }, u11 = e21.doc.iterRange(t11, n11 > 0 ? e21.doc.length : 0), f10 = 0, d10 = 0; !u11.next().done && d10 <= i11; ) { + var h10 = u11.value; + n11 < 0 && (d10 += h10.length); + for (var v10 = t11 + d10 * n11, p10 = n11 > 0 ? 0 : h10.length - 1, m10 = n11 > 0 ? h10.length : -1; p10 != m10; p10 += n11) { + var g10 = a11.indexOf(h10[p10]); + if (!(g10 < 0 || r11.resolveInner(v10 + p10, 1).type != o11)) + if (g10 % 2 == 0 == n11 > 0) + f10++; + else { + if (1 == f10) + return { start: l11, end: { from: v10 + p10, to: v10 + p10 + 1 }, matched: g10 >> 1 == c11 >> 1 }; + f10--; + } + } + n11 > 0 && (d10 += h10.length); + } + return u11.done ? { start: l11, matched: false } : null; + }(e20, t10, n10, a10, s10.type, o10, i10); + } + function eX(e20, t10, n10, r10, o10, i10, a10) { + var s10 = r10.parent, c10 = { from: o10.from, to: o10.to }, l10 = 0, u10 = null == s10 ? void 0 : s10.cursor(); + if (u10 && (n10 < 0 ? u10.childBefore(r10.from) : u10.childAfter(r10.to))) + do { + if (n10 < 0 ? u10.to <= r10.from : u10.from >= r10.to) { + if (0 == l10 && i10.indexOf(u10.type.name) > -1 && u10.from < u10.to) { + var f10 = XY(u10); + return { start: c10, end: f10 ? { from: f10.from, to: f10.to } : void 0, matched: true }; + } + if (YY(u10.type, n10, a10)) + l10++; + else if (YY(u10.type, -n10, a10)) { + if (0 == l10) { + var d10 = XY(u10); + return { start: c10, end: d10 && d10.from < d10.to ? { from: d10.from, to: d10.to } : void 0, matched: false }; + } + l10--; + } + } + } while (n10 < 0 ? u10.prevSibling() : u10.nextSibling()); + return { start: c10, matched: false }; + } + for (tX = /* @__PURE__ */ Object.create(null), nX = [RG.none], rX = [], oX = /* @__PURE__ */ Object.create(null), iX = /* @__PURE__ */ Object.create(null), aX = 0, sX = [["variable", "variableName"], ["variable-2", "variableName.special"], ["string-2", "string.special"], ["def", "variableName.definition"], ["tag", "tagName"], ["attribute", "attributeName"], ["type", "typeName"], ["builtin", "variableName.standard"], ["qualifier", "modifier"], ["error", "invalid"], ["header", "heading"], ["property", "propertyName"]]; aX < sX.length; aX++) { + cX = jo(sX[aX], 2), lX = cX[0], uX = cX[1]; + iX[lX] = dX(tX, uX); + } + var cX; + var lX; + var uX; + var tX; + var nX; + var rX; + var oX; + var iX; + var aX; + var sX; + function fX(e20, t10) { + rX.indexOf(e20) > -1 || (rX.push(e20), console.warn(t10)); + } + function dX(e20, t10) { + var n10, r10 = [], o10 = bo(t10.split(" ")); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10, a10 = n10.value, s10 = [], c10 = bo(a10.split(".")); + try { + for (c10.s(); !(i10 = c10.n()).done; ) { + var l10 = i10.value, u10 = e20[l10] || TQ[l10]; + u10 ? "function" == typeof u10 ? s10.length ? s10 = s10.map(u10) : fX(l10, "Modifier ".concat(l10, " used at start of tag")) : s10.length ? fX(l10, "Tag ".concat(l10, " used as modifier")) : s10 = Array.isArray(u10) ? u10 : [u10] : fX(l10, "Unknown highlighting tag ".concat(l10)); + } + } catch (e21) { + c10.e(e21); + } finally { + c10.f(); + } + var f10, d10 = bo(s10); + try { + for (d10.s(); !(f10 = d10.n()).done; ) { + var h10 = f10.value; + r10.push(h10); + } + } catch (e21) { + d10.e(e21); + } finally { + d10.f(); + } + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + if (!r10.length) + return 0; + var v10 = t10.replace(/ /g, "_"), p10 = v10 + " " + r10.map(function(e21) { + return e21.id; + }), m10 = oX[p10]; + if (m10) + return m10.id; + var g10 = oX[p10] = RG.define({ id: nX.length, name: v10, props: [fQ(qo({}, v10, r10))] }); + return nX.push(g10), g10.id; + } + rW.RTL, rW.LTR; + function hX(e20, t10) { + return function(n10) { + var r10 = n10.state, o10 = n10.dispatch; + if (r10.readOnly) + return false; + var i10 = e20(t10, r10); + return !!i10 && (o10(r10.update(i10)), true); + }; + } + var vX = hX(kX, 0); + var pX = hX(bX, 0); + var mX = hX(function(e20, t10) { + return bX(e20, t10, function(e21) { + var t11, n10 = [], r10 = bo(e21.selection.ranges); + try { + for (r10.s(); !(t11 = r10.n()).done; ) { + var o10 = t11.value, i10 = e21.doc.lineAt(o10.from), a10 = o10.to <= i10.to ? i10 : e21.doc.lineAt(o10.to), s10 = n10.length - 1; + s10 >= 0 && n10[s10].to > i10.from ? n10[s10].to = a10.to : n10.push({ from: i10.from + /^\s*/.exec(i10.text)[0].length, to: a10.to }); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + return n10; + }(t10)); + }, 0); + function gX(e20, t10) { + var n10 = e20.languageDataAt("commentTokens", t10); + return n10.length ? n10[0] : {}; + } + var yX = 50; + function bX(e20, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : t10.selection.ranges, r10 = n10.map(function(e21) { + return gX(t10, e21.from).block; + }); + if (!r10.every(function(e21) { + return e21; + })) + return null; + var o10 = n10.map(function(e21, n11) { + return function(e23, t11, n12, r11) { + var o11, i11, a11 = t11.open, s11 = t11.close, c11 = e23.sliceDoc(n12 - yX, n12), l11 = e23.sliceDoc(r11, r11 + yX), u11 = /\s*$/.exec(c11)[0].length, f11 = /^\s*/.exec(l11)[0].length, d10 = c11.length - u11; + if (c11.slice(d10 - a11.length, d10) == a11 && l11.slice(f11, f11 + s11.length) == s11) + return { open: { pos: n12 - u11, margin: u11 && 1 }, close: { pos: r11 + f11, margin: f11 && 1 } }; + r11 - n12 <= 2 * yX ? o11 = i11 = e23.sliceDoc(n12, r11) : (o11 = e23.sliceDoc(n12, n12 + yX), i11 = e23.sliceDoc(r11 - yX, r11)); + var h10 = /^\s*/.exec(o11)[0].length, v10 = /\s*$/.exec(i11)[0].length, p10 = i11.length - v10 - s11.length; + return o11.slice(h10, h10 + a11.length) == a11 && i11.slice(p10, p10 + s11.length) == s11 ? { open: { pos: n12 + h10 + a11.length, margin: /\s/.test(o11.charAt(h10 + a11.length)) ? 1 : 0 }, close: { pos: r11 - v10 - s11.length, margin: /\s/.test(i11.charAt(p10 - 1)) ? 1 : 0 } } : null; + }(t10, r10[n11], e21.from, e21.to); + }); + if (2 != e20 && !o10.every(function(e21) { + return e21; + })) + return { changes: t10.changes(n10.map(function(e21, t11) { + return o10[t11] ? [] : [{ from: e21.from, insert: r10[t11].open + " " }, { from: e21.to, insert: " " + r10[t11].close }]; + })) }; + if (1 != e20 && o10.some(function(e21) { + return e21; + })) { + for (var i10, a10 = [], s10 = 0; s10 < o10.length; s10++) + if (i10 = o10[s10]) { + var c10 = r10[s10], l10 = i10, u10 = l10.open, f10 = l10.close; + a10.push({ from: u10.pos - c10.open.length, to: u10.pos + u10.margin }, { from: f10.pos - f10.margin, to: f10.pos + c10.close.length }); + } + return { changes: a10 }; + } + return null; + } + function kX(e20, t10) { + var n10, r10 = [], o10 = -1, i10 = bo(arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : t10.selection.ranges); + try { + for (i10.s(); !(n10 = i10.n()).done; ) { + var a10 = n10.value, s10 = a10.from, c10 = a10.to, l10 = r10.length, u10 = 1e9, f10 = gX(t10, s10).line; + if (f10) { + for (var d10 = s10; d10 <= c10; ) { + var h10 = t10.doc.lineAt(d10); + if (h10.from > o10 && (s10 == c10 || c10 > h10.from)) { + o10 = h10.from; + var v10 = /^\s*/.exec(h10.text)[0].length, p10 = v10 == h10.length, m10 = h10.text.slice(v10, v10 + f10.length) == f10 ? v10 : -1; + v10 < h10.text.length && v10 < u10 && (u10 = v10), r10.push({ line: h10, comment: m10, token: f10, indent: v10, empty: p10, single: false }); + } + d10 = h10.to + 1; + } + if (u10 < 1e9) + for (var g10 = l10; g10 < r10.length; g10++) + r10[g10].indent < r10[g10].line.text.length && (r10[g10].indent = u10); + r10.length == l10 + 1 && (r10[l10].single = true); + } + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + if (2 != e20 && r10.some(function(e21) { + return e21.comment < 0 && (!e21.empty || e21.single); + })) { + var y10, b10 = [], k10 = bo(r10); + try { + for (k10.s(); !(y10 = k10.n()).done; ) { + var w10 = y10.value, x10 = w10.line, j10 = w10.token, S10 = w10.indent, C10 = w10.empty; + !w10.single && C10 || b10.push({ from: x10.from + S10, insert: j10 + " " }); + } + } catch (e21) { + k10.e(e21); + } finally { + k10.f(); + } + var $10 = t10.changes(b10); + return { changes: $10, selection: t10.selection.map($10, 1) }; + } + if (1 != e20 && r10.some(function(e21) { + return e21.comment >= 0; + })) { + var _10, O10 = [], M10 = bo(r10); + try { + for (M10.s(); !(_10 = M10.n()).done; ) { + var E10 = _10.value, A10 = E10.line, P10 = E10.comment, T8 = E10.token; + if (P10 >= 0) { + var R8 = A10.from + P10, N8 = R8 + T8.length; + " " == A10.text[N8 - A10.from] && N8++, O10.push({ from: R8, to: N8 }); + } + } + } catch (e21) { + M10.e(e21); + } finally { + M10.f(); + } + return { changes: O10 }; + } + return null; + } + var wX = tV.define(); + var xX = tV.define(); + var jX = MF.define(); + var SX = MF.define({ combine: function(e20) { + return gV(e20, { minDepth: 100, newGroupDelay: 500, joinToEvent: function(e21, t10) { + return t10; + } }, { minDepth: Math.max, newGroupDelay: Math.min, joinToEvent: function(e21, t10) { + return function(n10, r10) { + return e21(n10, r10) || t10(n10, r10); + }; + } }); + } }); + var CX = NF.define({ create: function() { + return WX.empty; + }, update: function(e20, t10) { + var n10 = t10.state.facet(SX), r10 = t10.annotation(wX); + if (r10) { + var o10 = NX.fromTransaction(t10, r10.selection), i10 = r10.side, a10 = 0 == i10 ? e20.undone : e20.done; + return a10 = o10 ? IX(a10, a10.length, n10.minDepth, o10) : BX(a10, t10.startState.selection), new WX(0 == i10 ? r10.rest : a10, 0 == i10 ? a10 : r10.rest); + } + var s10 = t10.annotation(xX); + if ("full" != s10 && "before" != s10 || (e20 = e20.isolate()), false === t10.annotation(iV.addToHistory)) + return t10.changes.empty ? e20 : e20.addMapping(t10.changes.desc); + var c10 = NX.fromTransaction(t10), l10 = t10.annotation(iV.time), u10 = t10.annotation(iV.userEvent); + return c10 ? e20 = e20.addChanges(c10, l10, u10, n10, t10) : t10.selection && (e20 = e20.addSelection(t10.startState.selection, l10, u10, n10.newGroupDelay)), "full" != s10 && "after" != s10 || (e20 = e20.isolate()), e20; + }, toJSON: function(e20) { + return { done: e20.done.map(function(e21) { + return e21.toJSON(); + }), undone: e20.undone.map(function(e21) { + return e21.toJSON(); + }) }; + }, fromJSON: function(e20) { + return new WX(e20.done.map(NX.fromJSON), e20.undone.map(NX.fromJSON)); + } }); + function $X() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return [CX, SX.of(e20), zJ.domEventHandlers({ beforeinput: function(e21, t10) { + var n10 = "historyUndo" == e21.inputType ? OX : "historyRedo" == e21.inputType ? MX : null; + return !!n10 && (e21.preventDefault(), n10(t10)); + } })]; + } + function _X(e20, t10) { + return function(n10) { + var r10 = n10.state, o10 = n10.dispatch; + if (!t10 && r10.readOnly) + return false; + var i10 = r10.field(CX, false); + if (!i10) + return false; + var a10 = i10.pop(e20, r10, t10); + return !!a10 && (o10(a10), true); + }; + } + var OX = _X(0, false); + var MX = _X(1, false); + var EX = _X(0, true); + var AX = _X(1, true); + function PX(e20) { + return function(t10) { + var n10 = t10.field(CX, false); + if (!n10) + return 0; + var r10 = 0 == e20 ? n10.done : n10.undone; + return r10.length - (r10.length && !r10[0].changes ? 1 : 0); + }; + } + var TX = PX(0); + var RX = PX(1); + var NX = function() { + function e20(t10, n10, r10, o10, i10) { + No(this, e20), this.changes = t10, this.effects = n10, this.mapped = r10, this.startSelection = o10, this.selectionsAfter = i10; + } + return Do(e20, [{ key: "setSelAfter", value: function(t10) { + return new e20(this.changes, this.effects, this.mapped, this.startSelection, t10); + } }, { key: "toJSON", value: function() { + var e21, t10, n10; + return { changes: null === (e21 = this.changes) || void 0 === e21 ? void 0 : e21.toJSON(), mapped: null === (t10 = this.mapped) || void 0 === t10 ? void 0 : t10.toJSON(), startSelection: null === (n10 = this.startSelection) || void 0 === n10 ? void 0 : n10.toJSON(), selectionsAfter: this.selectionsAfter.map(function(e23) { + return e23.toJSON(); + }) }; + } }], [{ key: "fromJSON", value: function(t10) { + return new e20(t10.changes && yF.fromJSON(t10.changes), [], t10.mapped && gF.fromJSON(t10.mapped), t10.startSelection && $F.fromJSON(t10.startSelection), t10.selectionsAfter.map($F.fromJSON)); + } }, { key: "fromTransaction", value: function(t10, n10) { + var r10, o10 = qX, i10 = bo(t10.startState.facet(jX)); + try { + for (i10.s(); !(r10 = i10.n()).done; ) { + var a10 = (0, r10.value)(t10); + a10.length && (o10 = o10.concat(a10)); + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + return !o10.length && t10.changes.empty ? null : new e20(t10.changes.invert(t10.startState.doc), o10, void 0, n10 || t10.startState.selection, qX); + } }, { key: "selection", value: function(t10) { + return new e20(void 0, qX, void 0, void 0, t10); + } }]), e20; + }(); + function IX(e20, t10, n10, r10) { + var o10 = t10 + 1 > n10 + 20 ? t10 - n10 - 1 : 0, i10 = e20.slice(o10, t10); + return i10.push(r10), i10; + } + function DX(e20, t10) { + return e20.length ? t10.length ? e20.concat(t10) : e20 : t10; + } + var qX = []; + var zX = 200; + function BX(e20, t10) { + if (e20.length) { + var n10 = e20[e20.length - 1], r10 = n10.selectionsAfter.slice(Math.max(0, n10.selectionsAfter.length - zX)); + return r10.length && r10[r10.length - 1].eq(t10) ? e20 : (r10.push(t10), IX(e20, e20.length - 1, 1e9, n10.setSelAfter(r10))); + } + return [NX.selection([t10])]; + } + function LX(e20) { + var t10 = e20[e20.length - 1], n10 = e20.slice(); + return n10[e20.length - 1] = t10.setSelAfter(t10.selectionsAfter.slice(0, t10.selectionsAfter.length - 1)), n10; + } + function FX(e20, t10) { + if (!e20.length) + return e20; + for (var n10 = e20.length, r10 = qX; n10; ) { + var o10 = VX(e20[n10 - 1], t10, r10); + if (o10.changes && !o10.changes.empty || o10.effects.length) { + var i10 = e20.slice(0, n10); + return i10[n10 - 1] = o10, i10; + } + t10 = o10.mapped, n10--, r10 = o10.selectionsAfter; + } + return r10.length ? [NX.selection(r10)] : qX; + } + function VX(e20, t10, n10) { + var r10 = DX(e20.selectionsAfter.length ? e20.selectionsAfter.map(function(e21) { + return e21.map(t10); + }) : qX, n10); + if (!e20.changes) + return NX.selection(r10); + var o10 = e20.changes.map(t10), i10 = t10.mapDesc(e20.changes, true), a10 = e20.mapped ? e20.mapped.composeDesc(i10) : i10; + return new NX(o10, oV.mapEffects(e20.effects, t10), a10, e20.startSelection.map(i10), r10); + } + var HX = /^(input\.type|delete)($|\.)/; + var WX = function() { + function e20(t10, n10) { + var r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, o10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : void 0; + No(this, e20), this.done = t10, this.undone = n10, this.prevTime = r10, this.prevUserEvent = o10; + } + return Do(e20, [{ key: "isolate", value: function() { + return this.prevTime ? new e20(this.done, this.undone) : this; + } }, { key: "addChanges", value: function(t10, n10, r10, o10, i10) { + var a10 = this.done, s10 = a10[a10.length - 1]; + return a10 = s10 && s10.changes && !s10.changes.empty && t10.changes && (!r10 || HX.test(r10)) && (!s10.selectionsAfter.length && n10 - this.prevTime < o10.newGroupDelay && o10.joinToEvent(i10, function(e21, t11) { + var n11 = [], r11 = false; + return e21.iterChangedRanges(function(e23, t12) { + return n11.push(e23, t12); + }), t11.iterChangedRanges(function(e23, t12, o11, i11) { + for (var a11 = 0; a11 < n11.length; ) { + var s11 = n11[a11++], c10 = n11[a11++]; + i11 >= s11 && o11 <= c10 && (r11 = true); + } + }), r11; + }(s10.changes, t10.changes)) || "input.type.compose" == r10) ? IX(a10, a10.length - 1, o10.minDepth, new NX(t10.changes.compose(s10.changes), DX(t10.effects, s10.effects), s10.mapped, s10.startSelection, qX)) : IX(a10, a10.length, o10.minDepth, t10), new e20(a10, qX, n10, r10); + } }, { key: "addSelection", value: function(t10, n10, r10, o10) { + var i10, a10, s10 = this.done.length ? this.done[this.done.length - 1].selectionsAfter : qX; + return s10.length > 0 && n10 - this.prevTime < o10 && r10 == this.prevUserEvent && r10 && /^select($|\.)/.test(r10) && (i10 = s10[s10.length - 1], a10 = t10, i10.ranges.length == a10.ranges.length && 0 === i10.ranges.filter(function(e21, t11) { + return e21.empty != a10.ranges[t11].empty; + }).length) ? this : new e20(BX(this.done, t10), this.undone, n10, r10); + } }, { key: "addMapping", value: function(t10) { + return new e20(FX(this.done, t10), FX(this.undone, t10), this.prevTime, this.prevUserEvent); + } }, { key: "pop", value: function(e21, t10, n10) { + var r10 = 0 == e21 ? this.done : this.undone; + if (0 == r10.length) + return null; + var o10 = r10[r10.length - 1], i10 = o10.selectionsAfter[0] || t10.selection; + if (n10 && o10.selectionsAfter.length) + return t10.update({ selection: o10.selectionsAfter[o10.selectionsAfter.length - 1], annotations: wX.of({ side: e21, rest: LX(r10), selection: i10 }), userEvent: 0 == e21 ? "select.undo" : "select.redo", scrollIntoView: true }); + if (o10.changes) { + var a10 = 1 == r10.length ? qX : r10.slice(0, r10.length - 1); + return o10.mapped && (a10 = FX(a10, o10.mapped)), t10.update({ changes: o10.changes, selection: o10.startSelection, effects: o10.effects, annotations: wX.of({ side: e21, rest: a10, selection: i10 }), filter: false, userEvent: 0 == e21 ? "undo" : "redo", scrollIntoView: true }); + } + return null; + } }]), e20; + }(); + WX.empty = new WX(qX, qX); + var UX = [{ key: "Mod-z", run: OX, preventDefault: true }, { key: "Mod-y", mac: "Mod-Shift-z", run: MX, preventDefault: true }, { linux: "Ctrl-Shift-z", run: MX, preventDefault: true }, { key: "Mod-u", run: EX, preventDefault: true }, { key: "Alt-u", mac: "Mod-Shift-u", run: AX, preventDefault: true }]; + function JX(e20, t10) { + return $F.create(e20.ranges.map(t10), e20.mainIndex); + } + function KX(e20, t10) { + return e20.update({ selection: t10, scrollIntoView: true, userEvent: "select" }); + } + function GX(e20, t10) { + var n10 = e20.state, r10 = e20.dispatch, o10 = JX(n10.selection, t10); + return !o10.eq(n10.selection, true) && (r10(KX(n10, o10)), true); + } + function QX(e20, t10) { + return $F.cursor(t10 ? e20.to : e20.from); + } + function YX(e20, t10) { + return GX(e20, function(n10) { + return n10.empty ? e20.moveByChar(n10, t10) : QX(n10, t10); + }); + } + function XX(e20) { + return e20.textDirectionAt(e20.state.selection.main.head) == rW.LTR; + } + var ZX = function(e20) { + return YX(e20, !XX(e20)); + }; + var eZ = function(e20) { + return YX(e20, XX(e20)); + }; + function tZ(e20, t10) { + return GX(e20, function(n10) { + return n10.empty ? e20.moveByGroup(n10, t10) : QX(n10, t10); + }); + } + function nZ(e20, t10, n10) { + if (t10.type.prop(n10)) + return true; + var r10 = t10.to - t10.from; + return r10 && (r10 > 2 || /[^\s,.;:]/.test(e20.sliceDoc(t10.from, t10.to))) || t10.firstChild; + } + function rZ(e20, t10, n10) { + for (var r10 = zQ(e20).resolveInner(t10.head), o10 = n10 ? AG.closedBy : AG.openedBy, i10 = t10.head; ; ) { + var a10 = n10 ? r10.childAfter(i10) : r10.childBefore(i10); + if (!a10) + break; + nZ(e20, a10, o10) ? r10 = a10 : i10 = n10 ? a10.to : a10.from; + } + var s10, c10; + return c10 = r10.type.prop(o10) && (s10 = n10 ? ZY(e20, r10.from, 1) : ZY(e20, r10.to, -1)) && s10.matched ? n10 ? s10.end.to : s10.end.from : n10 ? r10.to : r10.from, $F.cursor(c10, n10 ? -1 : 1); + } + function oZ(e20, t10) { + return GX(e20, function(n10) { + if (!n10.empty) + return QX(n10, t10); + var r10 = e20.moveVertically(n10, t10); + return r10.head != n10.head ? r10 : e20.moveToLineBoundary(n10, t10); + }); + } + var iZ = function(e20) { + return oZ(e20, false); + }; + var aZ = function(e20) { + return oZ(e20, true); + }; + function sZ(e20) { + var t10, n10 = e20.scrollDOM.clientHeight < e20.scrollDOM.scrollHeight - 2, r10 = 0, o10 = 0; + if (n10) { + var i10, a10 = bo(e20.state.facet(zJ.scrollMargins)); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = (0, i10.value)(e20); + (null == s10 ? void 0 : s10.top) && (r10 = Math.max(null == s10 ? void 0 : s10.top, r10)), (null == s10 ? void 0 : s10.bottom) && (o10 = Math.max(null == s10 ? void 0 : s10.bottom, o10)); + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + t10 = e20.scrollDOM.clientHeight - r10 - o10; + } else + t10 = (e20.dom.ownerDocument.defaultView || window).innerHeight; + return { marginTop: r10, marginBottom: o10, selfScroll: n10, height: Math.max(e20.defaultLineHeight, t10 - 5) }; + } + function cZ(e20, t10) { + var n10, r10 = sZ(e20), o10 = e20.state, i10 = JX(o10.selection, function(n11) { + return n11.empty ? e20.moveVertically(n11, t10, r10.height) : QX(n11, t10); + }); + if (i10.eq(o10.selection)) + return false; + if (r10.selfScroll) { + var a10 = e20.coordsAtPos(o10.selection.main.head), s10 = e20.scrollDOM.getBoundingClientRect(), c10 = s10.top + r10.marginTop, l10 = s10.bottom - r10.marginBottom; + a10 && a10.top > c10 && a10.bottom < l10 && (n10 = zJ.scrollIntoView(i10.main.head, { y: "start", yMargin: a10.top - c10 })); + } + return e20.dispatch(KX(o10, i10), { effects: n10 }), true; + } + var lZ = function(e20) { + return cZ(e20, false); + }; + var uZ = function(e20) { + return cZ(e20, true); + }; + function fZ(e20, t10, n10) { + var r10 = e20.lineBlockAt(t10.head), o10 = e20.moveToLineBoundary(t10, n10); + if (o10.head == t10.head && o10.head != (n10 ? r10.to : r10.from) && (o10 = e20.moveToLineBoundary(t10, n10, false)), !n10 && o10.head == r10.from && r10.length) { + var i10 = /^\s*/.exec(e20.state.sliceDoc(r10.from, Math.min(r10.from + 100, r10.to)))[0].length; + i10 && t10.head != r10.from + i10 && (o10 = $F.cursor(r10.from + i10)); + } + return o10; + } + function dZ(e20, t10) { + var n10 = JX(e20.state.selection, function(e21) { + var n11 = t10(e21); + return $F.range(e21.anchor, n11.head, n11.goalColumn, n11.bidiLevel || void 0); + }); + return !n10.eq(e20.state.selection) && (e20.dispatch(KX(e20.state, n10)), true); + } + function hZ(e20, t10) { + return dZ(e20, function(n10) { + return e20.moveByChar(n10, t10); + }); + } + var vZ = function(e20) { + return hZ(e20, !XX(e20)); + }; + var pZ = function(e20) { + return hZ(e20, XX(e20)); + }; + function mZ(e20, t10) { + return dZ(e20, function(n10) { + return e20.moveByGroup(n10, t10); + }); + } + function gZ(e20, t10) { + return dZ(e20, function(n10) { + return e20.moveVertically(n10, t10); + }); + } + var yZ = function(e20) { + return gZ(e20, false); + }; + var bZ = function(e20) { + return gZ(e20, true); + }; + function kZ(e20, t10) { + return dZ(e20, function(n10) { + return e20.moveVertically(n10, t10, sZ(e20).height); + }); + } + var wZ = function(e20) { + return kZ(e20, false); + }; + var xZ = function(e20) { + return kZ(e20, true); + }; + var jZ = function(e20) { + var t10 = e20.state; + return (0, e20.dispatch)(KX(t10, { anchor: 0 })), true; + }; + var SZ = function(e20) { + var t10 = e20.state; + return (0, e20.dispatch)(KX(t10, { anchor: t10.doc.length })), true; + }; + var CZ = function(e20) { + var t10 = e20.state; + return (0, e20.dispatch)(KX(t10, { anchor: t10.selection.main.anchor, head: 0 })), true; + }; + var $Z = function(e20) { + var t10 = e20.state; + return (0, e20.dispatch)(KX(t10, { anchor: t10.selection.main.anchor, head: t10.doc.length })), true; + }; + function _Z(e20, t10) { + if (e20.state.readOnly) + return false; + var n10 = "delete.selection", r10 = e20.state, o10 = r10.changeByRange(function(r11) { + var o11 = r11.from, i10 = r11.to; + if (o11 == i10) { + var a10 = t10(r11); + a10 < o11 ? (n10 = "delete.backward", a10 = OZ(e20, a10, false)) : a10 > o11 && (n10 = "delete.forward", a10 = OZ(e20, a10, true)), o11 = Math.min(o11, a10), i10 = Math.max(i10, a10); + } else + o11 = OZ(e20, o11, false), i10 = OZ(e20, i10, true); + return o11 == i10 ? { range: r11 } : { changes: { from: o11, to: i10 }, range: $F.cursor(o11, o11 < r11.head ? -1 : 1) }; + }); + return !o10.changes.empty && (e20.dispatch(r10.update(o10, { scrollIntoView: true, userEvent: n10, effects: "delete.selection" == n10 ? zJ.announce.of(r10.phrase("Selection deleted")) : void 0 })), true); + } + function OZ(e20, t10, n10) { + if (e20 instanceof zJ) { + var r10, o10 = bo(e20.state.facet(zJ.atomicRanges).map(function(t11) { + return t11(e20); + })); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + r10.value.between(t10, t10, function(e21, r11) { + e21 < t10 && r11 > t10 && (t10 = n10 ? r11 : e21); + }); + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + } + return t10; + } + var MZ = function(e20, t10) { + return _Z(e20, function(n10) { + var r10, o10, i10 = n10.from, a10 = e20.state, s10 = a10.doc.lineAt(i10); + if (!t10 && i10 > s10.from && i10 < s10.from + 200 && !/[^ \t]/.test(r10 = s10.text.slice(0, i10 - s10.from))) { + if (" " == r10[r10.length - 1]) + return i10 - 1; + for (var c10 = RV(r10, a10.tabSize) % XQ(a10) || XQ(a10), l10 = 0; l10 < c10 && " " == r10[r10.length - 1 - l10]; l10++) + i10--; + o10 = i10; + } else + (o10 = sF(s10.text, i10 - s10.from, t10, t10) + s10.from) == i10 && s10.number != (t10 ? a10.doc.lines : 1) ? o10 += t10 ? 1 : -1 : !t10 && /[\ufe00-\ufe0f]/.test(s10.text.slice(o10 - s10.from, i10 - s10.from)) && (o10 = sF(s10.text, o10 - s10.from, false, false) + s10.from); + return o10; + }); + }; + var EZ = function(e20) { + return MZ(e20, false); + }; + var AZ = function(e20) { + return MZ(e20, true); + }; + var PZ = function(e20, t10) { + return _Z(e20, function(n10) { + for (var r10 = n10.head, o10 = e20.state, i10 = o10.doc.lineAt(r10), a10 = o10.charCategorizer(r10), s10 = null; ; ) { + if (r10 == (t10 ? i10.to : i10.from)) { + r10 == n10.head && i10.number != (t10 ? o10.doc.lines : 1) && (r10 += t10 ? 1 : -1); + break; + } + var c10 = sF(i10.text, r10 - i10.from, t10) + i10.from, l10 = i10.text.slice(Math.min(r10, c10) - i10.from, Math.max(r10, c10) - i10.from), u10 = a10(l10); + if (null != s10 && u10 != s10) + break; + " " == l10 && r10 == n10.head || (s10 = u10), r10 = c10; + } + return r10; + }); + }; + var TZ = function(e20) { + return PZ(e20, false); + }; + function RZ(e20) { + var t10, n10 = [], r10 = -1, o10 = bo(e20.selection.ranges); + try { + for (o10.s(); !(t10 = o10.n()).done; ) { + var i10 = t10.value, a10 = e20.doc.lineAt(i10.from), s10 = e20.doc.lineAt(i10.to); + if (i10.empty || i10.to != s10.from || (s10 = e20.doc.lineAt(i10.to - 1)), r10 >= a10.number) { + var c10 = n10[n10.length - 1]; + c10.to = s10.to, c10.ranges.push(i10); + } else + n10.push({ from: a10.from, to: s10.to, ranges: [i10] }); + r10 = s10.number + 1; + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + return n10; + } + function NZ(e20, t10, n10) { + if (e20.readOnly) + return false; + var r10, o10 = [], i10 = [], a10 = bo(RZ(e20)); + try { + for (a10.s(); !(r10 = a10.n()).done; ) { + var s10 = r10.value; + if (n10 ? s10.to != e20.doc.length : 0 != s10.from) { + var c10 = e20.doc.lineAt(n10 ? s10.to + 1 : s10.from - 1), l10 = c10.length + 1; + if (n10) { + o10.push({ from: s10.to, to: c10.to }, { from: s10.from, insert: c10.text + e20.lineBreak }); + var u10, f10 = bo(s10.ranges); + try { + for (f10.s(); !(u10 = f10.n()).done; ) { + var d10 = u10.value; + i10.push($F.range(Math.min(e20.doc.length, d10.anchor + l10), Math.min(e20.doc.length, d10.head + l10))); + } + } catch (e21) { + f10.e(e21); + } finally { + f10.f(); + } + } else { + o10.push({ from: c10.from, to: s10.from }, { from: s10.to, insert: e20.lineBreak + c10.text }); + var h10, v10 = bo(s10.ranges); + try { + for (v10.s(); !(h10 = v10.n()).done; ) { + var p10 = h10.value; + i10.push($F.range(p10.anchor - l10, p10.head - l10)); + } + } catch (e21) { + v10.e(e21); + } finally { + v10.f(); + } + } + } + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + return !!o10.length && (t10(e20.update({ changes: o10, scrollIntoView: true, selection: $F.create(i10, e20.selection.mainIndex), userEvent: "move.line" })), true); + } + function IZ(e20, t10, n10) { + if (e20.readOnly) + return false; + var r10, o10 = [], i10 = bo(RZ(e20)); + try { + for (i10.s(); !(r10 = i10.n()).done; ) { + var a10 = r10.value; + n10 ? o10.push({ from: a10.from, insert: e20.doc.slice(a10.from, a10.to) + e20.lineBreak }) : o10.push({ from: a10.to, insert: e20.lineBreak + e20.doc.slice(a10.from, a10.to) }); + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + return t10(e20.update({ changes: o10, scrollIntoView: true, userEvent: "input.copyline" })), true; + } + var DZ = zZ(false); + var qZ = zZ(true); + function zZ(e20) { + return function(t10) { + var n10 = t10.state, r10 = t10.dispatch; + if (n10.readOnly) + return false; + var o10 = n10.changeByRange(function(t11) { + var r11 = t11.from, o11 = t11.to, i10 = n10.doc.lineAt(r11), a10 = !e20 && r11 == o11 && function(e21, t12) { + if (/\(\)|\[\]|\{\}/.test(e21.sliceDoc(t12 - 1, t12 + 1))) + return { from: t12, to: t12 }; + var n11, r12 = zQ(e21).resolveInner(t12), o12 = r12.childBefore(t12), i11 = r12.childAfter(t12); + return o12 && i11 && o12.to <= t12 && i11.from >= t12 && (n11 = o12.type.prop(AG.closedBy)) && n11.indexOf(i11.name) > -1 && e21.doc.lineAt(o12.to).from == e21.doc.lineAt(i11.from).from && !/\S/.test(e21.sliceDoc(o12.to, i11.from)) ? { from: o12.to, to: i11.from } : null; + }(n10, r11); + e20 && (r11 = o11 = (o11 <= i10.to ? i10 : n10.doc.lineAt(o11)).to); + var s10 = new tY(n10, { simulateBreak: r11, simulateDoubleBreak: !!a10 }), c10 = eY(s10, r11); + for (null == c10 && (c10 = RV(/^\s*/.exec(n10.doc.lineAt(r11).text)[0], n10.tabSize)); o11 < i10.to && /\s/.test(i10.text[o11 - i10.from]); ) + o11++; + a10 ? (r11 = a10.from, o11 = a10.to) : r11 > i10.from && r11 < i10.from + 100 && !/\S/.test(i10.text.slice(0, r11)) && (r11 = i10.from); + var l10 = ["", ZQ(n10, c10)]; + return a10 && l10.push(ZQ(n10, s10.lineIndent(i10.from, -1))), { changes: { from: r11, to: o11, insert: UL.of(l10) }, range: $F.cursor(r11 + 1 + l10[1].length) }; + }); + return r10(n10.update(o10, { scrollIntoView: true, userEvent: "input" })), true; + }; + } + function BZ(e20, t10) { + var n10 = -1; + return e20.changeByRange(function(r10) { + for (var o10 = [], i10 = r10.from; i10 <= r10.to; ) { + var a10 = e20.doc.lineAt(i10); + a10.number > n10 && (r10.empty || r10.to > a10.from) && (t10(a10, o10, r10), n10 = a10.number), i10 = a10.to + 1; + } + var s10 = e20.changes(o10); + return { changes: o10, range: $F.range(s10.mapPos(r10.anchor, 1), s10.mapPos(r10.head, 1)) }; + }); + } + var LZ = function(e20) { + var t10 = e20.state, n10 = e20.dispatch; + return !t10.readOnly && (n10(t10.update(BZ(t10, function(e21, n11) { + n11.push({ from: e21.from, insert: t10.facet(YQ) }); + }), { userEvent: "input.indent" })), true); + }; + var FZ = function(e20) { + var t10 = e20.state, n10 = e20.dispatch; + return !t10.readOnly && (n10(t10.update(BZ(t10, function(e21, n11) { + var r10 = /^\s*/.exec(e21.text)[0]; + if (r10) { + for (var o10 = RV(r10, t10.tabSize), i10 = 0, a10 = ZQ(t10, Math.max(0, o10 - XQ(t10))); i10 < r10.length && i10 < a10.length && r10.charCodeAt(i10) == a10.charCodeAt(i10); ) + i10++; + n11.push({ from: e21.from + i10, to: e21.from + r10.length, insert: a10.slice(i10) }); + } + }), { userEvent: "delete.dedent" })), true); + }; + var VZ = [{ key: "Ctrl-b", run: ZX, shift: vZ, preventDefault: true }, { key: "Ctrl-f", run: eZ, shift: pZ }, { key: "Ctrl-p", run: iZ, shift: yZ }, { key: "Ctrl-n", run: aZ, shift: bZ }, { key: "Ctrl-a", run: function(e20) { + return GX(e20, function(t10) { + return $F.cursor(e20.lineBlockAt(t10.head).from, 1); + }); + }, shift: function(e20) { + return dZ(e20, function(t10) { + return $F.cursor(e20.lineBlockAt(t10.head).from); + }); + } }, { key: "Ctrl-e", run: function(e20) { + return GX(e20, function(t10) { + return $F.cursor(e20.lineBlockAt(t10.head).to, -1); + }); + }, shift: function(e20) { + return dZ(e20, function(t10) { + return $F.cursor(e20.lineBlockAt(t10.head).to); + }); + } }, { key: "Ctrl-d", run: AZ }, { key: "Ctrl-h", run: EZ }, { key: "Ctrl-k", run: function(e20) { + return _Z(e20, function(t10) { + var n10 = e20.lineBlockAt(t10.head).to; + return t10.head < n10 ? n10 : Math.min(e20.state.doc.length, t10.head + 1); + }); + } }, { key: "Ctrl-Alt-h", run: TZ }, { key: "Ctrl-o", run: function(e20) { + var t10 = e20.state, n10 = e20.dispatch; + if (t10.readOnly) + return false; + var r10 = t10.changeByRange(function(e21) { + return { changes: { from: e21.from, to: e21.to, insert: UL.of(["", ""]) }, range: $F.cursor(e21.from) }; + }); + return n10(t10.update(r10, { scrollIntoView: true, userEvent: "input" })), true; + } }, { key: "Ctrl-t", run: function(e20) { + var t10 = e20.state, n10 = e20.dispatch; + if (t10.readOnly) + return false; + var r10 = t10.changeByRange(function(e21) { + if (!e21.empty || 0 == e21.from || e21.from == t10.doc.length) + return { range: e21 }; + var n11 = e21.from, r11 = t10.doc.lineAt(n11), o10 = n11 == r11.from ? n11 - 1 : sF(r11.text, n11 - r11.from, false) + r11.from, i10 = n11 == r11.to ? n11 + 1 : sF(r11.text, n11 - r11.from, true) + r11.from; + return { changes: { from: o10, to: i10, insert: t10.doc.slice(n11, i10).append(t10.doc.slice(o10, n11)) }, range: $F.cursor(i10) }; + }); + return !r10.changes.empty && (n10(t10.update(r10, { scrollIntoView: true, userEvent: "move.character" })), true); + } }, { key: "Ctrl-v", run: uZ }]; + var HZ = [{ key: "ArrowLeft", run: ZX, shift: vZ, preventDefault: true }, { key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: function(e20) { + return tZ(e20, !XX(e20)); + }, shift: function(e20) { + return mZ(e20, !XX(e20)); + }, preventDefault: true }, { mac: "Cmd-ArrowLeft", run: function(e20) { + return GX(e20, function(t10) { + return fZ(e20, t10, !XX(e20)); + }); + }, shift: function(e20) { + return dZ(e20, function(t10) { + return fZ(e20, t10, !XX(e20)); + }); + }, preventDefault: true }, { key: "ArrowRight", run: eZ, shift: pZ, preventDefault: true }, { key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: function(e20) { + return tZ(e20, XX(e20)); + }, shift: function(e20) { + return mZ(e20, XX(e20)); + }, preventDefault: true }, { mac: "Cmd-ArrowRight", run: function(e20) { + return GX(e20, function(t10) { + return fZ(e20, t10, XX(e20)); + }); + }, shift: function(e20) { + return dZ(e20, function(t10) { + return fZ(e20, t10, XX(e20)); + }); + }, preventDefault: true }, { key: "ArrowUp", run: iZ, shift: yZ, preventDefault: true }, { mac: "Cmd-ArrowUp", run: jZ, shift: CZ }, { mac: "Ctrl-ArrowUp", run: lZ, shift: wZ }, { key: "ArrowDown", run: aZ, shift: bZ, preventDefault: true }, { mac: "Cmd-ArrowDown", run: SZ, shift: $Z }, { mac: "Ctrl-ArrowDown", run: uZ, shift: xZ }, { key: "PageUp", run: lZ, shift: wZ }, { key: "PageDown", run: uZ, shift: xZ }, { key: "Home", run: function(e20) { + return GX(e20, function(t10) { + return fZ(e20, t10, false); + }); + }, shift: function(e20) { + return dZ(e20, function(t10) { + return fZ(e20, t10, false); + }); + }, preventDefault: true }, { key: "Mod-Home", run: jZ, shift: CZ }, { key: "End", run: function(e20) { + return GX(e20, function(t10) { + return fZ(e20, t10, true); + }); + }, shift: function(e20) { + return dZ(e20, function(t10) { + return fZ(e20, t10, true); + }); + }, preventDefault: true }, { key: "Mod-End", run: SZ, shift: $Z }, { key: "Enter", run: DZ }, { key: "Mod-a", run: function(e20) { + var t10 = e20.state; + return (0, e20.dispatch)(t10.update({ selection: { anchor: 0, head: t10.doc.length }, userEvent: "select" })), true; + } }, { key: "Backspace", run: EZ, shift: EZ }, { key: "Delete", run: AZ }, { key: "Mod-Backspace", mac: "Alt-Backspace", run: TZ }, { key: "Mod-Delete", mac: "Alt-Delete", run: function(e20) { + return PZ(e20, true); + } }, { mac: "Mod-Backspace", run: function(e20) { + return _Z(e20, function(t10) { + var n10 = e20.moveToLineBoundary(t10, false).head; + return t10.head > n10 ? n10 : Math.max(0, t10.head - 1); + }); + } }, { mac: "Mod-Delete", run: function(e20) { + return _Z(e20, function(t10) { + var n10 = e20.moveToLineBoundary(t10, true).head; + return t10.head < n10 ? n10 : Math.min(e20.state.doc.length, t10.head + 1); + }); + } }].concat(VZ.map(function(e20) { + return { mac: e20.key, run: e20.run, shift: e20.shift }; + })); + var WZ = [{ key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: function(e20) { + return GX(e20, function(t10) { + return rZ(e20.state, t10, !XX(e20)); + }); + }, shift: function(e20) { + return dZ(e20, function(t10) { + return rZ(e20.state, t10, !XX(e20)); + }); + } }, { key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: function(e20) { + return GX(e20, function(t10) { + return rZ(e20.state, t10, XX(e20)); + }); + }, shift: function(e20) { + return dZ(e20, function(t10) { + return rZ(e20.state, t10, XX(e20)); + }); + } }, { key: "Alt-ArrowUp", run: function(e20) { + return NZ(e20.state, e20.dispatch, false); + } }, { key: "Shift-Alt-ArrowUp", run: function(e20) { + return IZ(e20.state, e20.dispatch, false); + } }, { key: "Alt-ArrowDown", run: function(e20) { + return NZ(e20.state, e20.dispatch, true); + } }, { key: "Shift-Alt-ArrowDown", run: function(e20) { + return IZ(e20.state, e20.dispatch, true); + } }, { key: "Escape", run: function(e20) { + var t10 = e20.state, n10 = e20.dispatch, r10 = t10.selection, o10 = null; + return r10.ranges.length > 1 ? o10 = $F.create([r10.main]) : r10.main.empty || (o10 = $F.create([$F.cursor(r10.main.head)])), !!o10 && (n10(KX(t10, o10)), true); + } }, { key: "Mod-Enter", run: qZ }, { key: "Alt-l", mac: "Ctrl-l", run: function(e20) { + var t10 = e20.state, n10 = e20.dispatch, r10 = RZ(t10).map(function(e21) { + var n11 = e21.from, r11 = e21.to; + return $F.range(n11, Math.min(r11 + 1, t10.doc.length)); + }); + return n10(t10.update({ selection: $F.create(r10), userEvent: "select" })), true; + } }, { key: "Mod-i", run: function(e20) { + var t10 = e20.state, n10 = e20.dispatch, r10 = JX(t10.selection, function(e21) { + for (var n11, r11 = zQ(t10).resolveStack(e21.from, 1); r11; r11 = r11.next) { + var o10 = r11.node; + if ((o10.from < e21.from && o10.to >= e21.to || o10.to > e21.to && o10.from <= e21.from) && (null === (n11 = o10.parent) || void 0 === n11 ? void 0 : n11.parent)) + return $F.range(o10.to, o10.from); + } + return e21; + }); + return n10(KX(t10, r10)), true; + }, preventDefault: true }, { key: "Mod-[", run: FZ }, { key: "Mod-]", run: LZ }, { key: "Mod-Alt-\\", run: function(e20) { + var t10 = e20.state, n10 = e20.dispatch; + if (t10.readOnly) + return false; + var r10 = /* @__PURE__ */ Object.create(null), o10 = new tY(t10, { overrideIndentation: function(e21) { + var t11 = r10[e21]; + return null == t11 ? -1 : t11; + } }), i10 = BZ(t10, function(e21, n11, i11) { + var a10 = eY(o10, e21.from); + if (null != a10) { + /\S/.test(e21.text) || (a10 = 0); + var s10 = /^\s*/.exec(e21.text)[0], c10 = ZQ(t10, a10); + (s10 != c10 || i11.from < e21.from + s10.length) && (r10[e21.from] = a10, n11.push({ from: e21.from, to: e21.from + s10.length, insert: c10 })); + } + }); + return i10.changes.empty || n10(t10.update(i10, { userEvent: "indent" })), true; + } }, { key: "Shift-Mod-k", run: function(e20) { + if (e20.state.readOnly) + return false; + var t10 = e20.state, n10 = t10.changes(RZ(t10).map(function(e21) { + var n11 = e21.from, r11 = e21.to; + return n11 > 0 ? n11-- : r11 < t10.doc.length && r11++, { from: n11, to: r11 }; + })), r10 = JX(t10.selection, function(t11) { + return e20.moveVertically(t11, true); + }).map(n10); + return e20.dispatch({ changes: n10, selection: r10, scrollIntoView: true, userEvent: "delete.line" }), true; + } }, { key: "Shift-Mod-\\", run: function(e20) { + return function(e21, t10, n10) { + var r10 = false, o10 = JX(e21.selection, function(t11) { + var o11 = ZY(e21, t11.head, -1) || ZY(e21, t11.head, 1) || t11.head > 0 && ZY(e21, t11.head - 1, 1) || t11.head < e21.doc.length && ZY(e21, t11.head + 1, -1); + if (!o11 || !o11.end) + return t11; + r10 = true; + var i10 = o11.start.from == t11.head ? o11.end.to : o11.end.from; + return n10 ? $F.range(t11.anchor, i10) : $F.cursor(i10); + }); + return !!r10 && (t10(KX(e21, o10)), true); + }(e20.state, e20.dispatch, false); + } }, { key: "Mod-/", run: function(e20) { + var t10 = e20.state, n10 = t10.doc.lineAt(t10.selection.main.from), r10 = gX(e20.state, n10.from); + return r10.line ? vX(e20) : !!r10.block && mX(e20); + } }, { key: "Alt-A", run: pX }].concat(HZ); + var UZ = { key: "Tab", run: LZ, shift: FZ }; + function JZ() { + var e20 = arguments[0]; + "string" == typeof e20 && (e20 = document.createElement(e20)); + var t10 = 1, n10 = arguments[1]; + if (n10 && "object" == Ho(n10) && null == n10.nodeType && !Array.isArray(n10)) { + for (var r10 in n10) + if (Object.prototype.hasOwnProperty.call(n10, r10)) { + var o10 = n10[r10]; + "string" == typeof o10 ? e20.setAttribute(r10, o10) : null != o10 && (e20[r10] = o10); + } + t10++; + } + for (; t10 < arguments.length; t10++) + KZ(e20, arguments[t10]); + return e20; + } + function KZ(e20, t10) { + if ("string" == typeof t10) + e20.appendChild(document.createTextNode(t10)); + else if (null == t10) + ; + else if (null != t10.nodeType) + e20.appendChild(t10); + else { + if (!Array.isArray(t10)) + throw new RangeError("Unsupported child node: " + t10); + for (var n10 = 0; n10 < t10.length; n10++) + KZ(e20, t10[n10]); + } + } + var GZ = Do(function e10(t10, n10, r10) { + No(this, e10), this.from = t10, this.to = n10, this.diagnostic = r10; + }); + var QZ = function() { + function e20(t10, n10, r10) { + No(this, e20), this.diagnostics = t10, this.panel = n10, this.selected = r10; + } + return Do(e20, null, [{ key: "init", value: function(t10, n10, r10) { + var o10 = t10, i10 = r10.facet(u0).markerFilter; + i10 && (o10 = i10(o10)); + var a10 = KH.set(o10.map(function(e21) { + return e21.from == e21.to || e21.from == e21.to - 1 && r10.doc.lineAt(e21.from).to == e21.from ? KH.widget({ widget: new h0(e21), diagnostic: e21 }).range(e21.from) : KH.mark({ attributes: { class: "cm-lintRange cm-lintRange-" + e21.severity + (e21.markClass ? " " + e21.markClass : "") }, diagnostic: e21 }).range(e21.from, e21.to); + }), true); + return new e20(a10, n10, YZ(a10)); + } }]), e20; + }(); + function YZ(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, r10 = null; + return e20.between(n10, 1e9, function(e21, n11, o10) { + var i10 = o10.spec; + if (!t10 || i10.diagnostic == t10) + return r10 = new GZ(e21, n11, i10.diagnostic), false; + }), r10; + } + function XZ(e20, t10) { + var n10 = e20.startState.doc.lineAt(t10.pos); + return !(!e20.effects.some(function(e21) { + return e21.is(e0); + }) && !e20.changes.touchesRange(n10.from, n10.to)); + } + function ZZ(e20, t10) { + return e20.field(r0, false) ? t10 : t10.concat(oV.appendConfig.of(_0)); + } + var e0 = oV.define(); + var t0 = oV.define(); + var n0 = oV.define(); + var r0 = NF.define({ create: function() { + return new QZ(KH.none, null, null); + }, update: function(e20, t10) { + if (t10.docChanged) { + var n10 = e20.diagnostics.map(t10.changes), r10 = null; + if (e20.selected) { + var o10 = t10.changes.mapPos(e20.selected.from, 1); + r10 = YZ(n10, e20.selected.diagnostic, o10) || YZ(n10, null, o10); + } + e20 = new QZ(n10, e20.panel, r10); + } + var i10, a10 = bo(t10.effects); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = i10.value; + s10.is(e0) ? e20 = QZ.init(s10.value, e20.panel, t10.state) : s10.is(t0) ? e20 = new QZ(e20.diagnostics, s10.value ? p0.open : null, e20.selected) : s10.is(n0) && (e20 = new QZ(e20.diagnostics, e20.panel, s10.value)); + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + return e20; + }, provide: function(e20) { + return [aG.from(e20, function(e21) { + return e21.panel; + }), zJ.decorations.from(e20, function(e21) { + return e21.diagnostics; + })]; + } }); + var o0 = KH.mark({ class: "cm-lintRange cm-lintRange-active" }); + function i0(e20, t10, n10) { + var r10 = e20.state.field(r0).diagnostics, o10 = [], i10 = 2e8, a10 = 0; + r10.between(t10 - (n10 < 0 ? 1 : 0), t10 + (n10 > 0 ? 1 : 0), function(e21, r11, s11) { + var c10 = s11.spec; + t10 >= e21 && t10 <= r11 && (e21 == r11 || (t10 > e21 || n10 > 0) && (t10 < r11 || n10 < 0)) && (o10.push(c10.diagnostic), i10 = Math.min(e21, i10), a10 = Math.max(r11, a10)); + }); + var s10 = e20.state.facet(u0).tooltipFilter; + return s10 && (o10 = s10(o10)), o10.length ? { pos: i10, end: a10, above: e20.state.doc.lineAt(i10).to < a10, create: function() { + return { dom: a0(e20, o10) }; + } } : null; + } + function a0(e20, t10) { + return JZ("ul", { class: "cm-tooltip-lint" }, t10.map(function(t11) { + return d0(e20, t11, false); + })); + } + var s0 = function(e20) { + var t10 = e20.state.field(r0, false); + return !(!t10 || !t10.panel) && (e20.dispatch({ effects: t0.of(false) }), true); + }; + var c0 = [{ key: "Mod-Shift-m", run: function(e20) { + var t10 = e20.state.field(r0, false); + t10 && t10.panel || e20.dispatch({ effects: ZZ(e20.state, [t0.of(true)]) }); + var n10 = nG(e20, p0.open); + return n10 && n10.dom.querySelector(".cm-panel-lint ul").focus(), true; + }, preventDefault: true }, { key: "F8", run: function(e20) { + var t10 = e20.state.field(r0, false); + if (!t10) + return false; + var n10 = e20.state.selection.main, r10 = t10.diagnostics.iter(n10.to + 1); + return !(!r10.value && (!(r10 = t10.diagnostics.iter(0)).value || r10.from == n10.from && r10.to == n10.to)) && (e20.dispatch({ selection: { anchor: r10.from, head: r10.to }, scrollIntoView: true }), true); + } }]; + var l0 = FW.fromClass(function() { + function e20(t10) { + No(this, e20), this.view = t10, this.timeout = -1, this.set = true; + var n10 = t10.state.facet(u0).delay; + this.lintTime = Date.now() + n10, this.run = this.run.bind(this), this.timeout = setTimeout(this.run, n10); + } + return Do(e20, [{ key: "run", value: function() { + var e21 = this, t10 = Date.now(); + if (t10 < this.lintTime - 10) + this.timeout = setTimeout(this.run, this.lintTime - t10); + else { + this.set = false; + var n10 = this.view.state, r10 = n10.facet(u0).sources; + Promise.all(r10.map(function(t11) { + return Promise.resolve(t11(e21.view)); + })).then(function(t11) { + var r11 = t11.reduce(function(e23, t12) { + return e23.concat(t12); + }); + e21.view.state.doc == n10.doc && e21.view.dispatch(function(e23, t12) { + return { effects: ZZ(e23, [e0.of(t12)]) }; + }(e21.view.state, r11)); + }, function(t11) { + qW(e21.view.state, t11); + }); + } + } }, { key: "update", value: function(e21) { + var t10 = e21.state.facet(u0); + (e21.docChanged || t10 != e21.startState.facet(u0) || t10.needsRefresh && t10.needsRefresh(e21)) && (this.lintTime = Date.now() + t10.delay, this.set || (this.set = true, this.timeout = setTimeout(this.run, t10.delay))); + } }, { key: "force", value: function() { + this.set && (this.lintTime = Date.now(), this.run()); + } }, { key: "destroy", value: function() { + clearTimeout(this.timeout); + } }]), e20; + }()); + var u0 = MF.define({ combine: function(e20) { + return Object.assign({ sources: e20.map(function(e21) { + return e21.source; + }) }, gV(e20.map(function(e21) { + return e21.config; + }), { delay: 750, markerFilter: null, tooltipFilter: null, needsRefresh: null }, { needsRefresh: function(e21, t10) { + return e21 ? t10 ? function(n10) { + return e21(n10) || t10(n10); + } : e21 : t10; + } })); + } }); + function f0(e20) { + var t10 = []; + if (e20) { + var n10, r10 = bo(e20); + try { + e: + for (r10.s(); !(n10 = r10.n()).done; ) { + for (var o10 = n10.value.name, i10 = function() { + var e21 = o10[a10]; + if (/[a-zA-Z]/.test(e21) && !t10.some(function(t11) { + return t11.toLowerCase() == e21.toLowerCase(); + })) + return t10.push(e21), 1; + }, a10 = 0; a10 < o10.length; a10++) + if (i10()) + continue e; + t10.push(""); + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + } + return t10; + } + function d0(e20, t10, n10) { + var r10, o10 = n10 ? f0(t10.actions) : []; + return JZ("li", { class: "cm-diagnostic cm-diagnostic-" + t10.severity }, JZ("span", { class: "cm-diagnosticText" }, t10.renderMessage ? t10.renderMessage() : t10.message), null === (r10 = t10.actions) || void 0 === r10 ? void 0 : r10.map(function(n11, r11) { + var i10 = false, a10 = function(r12) { + if (r12.preventDefault(), !i10) { + i10 = true; + var o11 = YZ(e20.state.field(r0).diagnostics, t10); + o11 && n11.apply(e20, o11.from, o11.to); + } + }, s10 = n11.name, c10 = o10[r11] ? s10.indexOf(o10[r11]) : -1, l10 = c10 < 0 ? s10 : [s10.slice(0, c10), JZ("u", s10.slice(c10, c10 + 1)), s10.slice(c10 + 1)]; + return JZ("button", { type: "button", class: "cm-diagnosticAction", onclick: a10, onmousedown: a10, "aria-label": " Action: ".concat(s10).concat(c10 < 0 ? "" : ' (access key "'.concat(o10[r11], ')"'), ".") }, l10); + }), t10.source && JZ("div", { class: "cm-diagnosticSource" }, t10.source)); + } + var h0 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).diagnostic = e21, n10; + } + return Ao(t10, UH), Do(t10, [{ key: "eq", value: function(e21) { + return e21.diagnostic == this.diagnostic; + } }, { key: "toDOM", value: function() { + return JZ("span", { class: "cm-lintPoint cm-lintPoint-" + this.diagnostic.severity }); + } }]), t10; + }(); + var v0 = Do(function e11(t10, n10) { + No(this, e11), this.diagnostic = n10, this.id = "item_" + Math.floor(4294967295 * Math.random()).toString(16), this.dom = d0(t10, n10, true), this.dom.id = this.id, this.dom.setAttribute("role", "option"); + }); + var p0 = function() { + function e20(t10) { + var n10 = this; + No(this, e20), this.view = t10, this.items = []; + this.list = JZ("ul", { tabIndex: 0, role: "listbox", "aria-label": this.view.state.phrase("Diagnostics"), onkeydown: function(e21) { + if (27 == e21.keyCode) + s0(n10.view), n10.view.focus(); + else if (38 == e21.keyCode || 33 == e21.keyCode) + n10.moveSelection((n10.selectedIndex - 1 + n10.items.length) % n10.items.length); + else if (40 == e21.keyCode || 34 == e21.keyCode) + n10.moveSelection((n10.selectedIndex + 1) % n10.items.length); + else if (36 == e21.keyCode) + n10.moveSelection(0); + else if (35 == e21.keyCode) + n10.moveSelection(n10.items.length - 1); + else if (13 == e21.keyCode) + n10.view.focus(); + else { + if (!(e21.keyCode >= 65 && e21.keyCode <= 90 && n10.selectedIndex >= 0)) + return; + for (var r10 = n10.items[n10.selectedIndex].diagnostic, o10 = f0(r10.actions), i10 = 0; i10 < o10.length; i10++) + if (o10[i10].toUpperCase().charCodeAt(0) == e21.keyCode) { + var a10 = YZ(n10.view.state.field(r0).diagnostics, r10); + a10 && r10.actions[i10].apply(t10, a10.from, a10.to); + } + } + e21.preventDefault(); + }, onclick: function(e21) { + for (var t11 = 0; t11 < n10.items.length; t11++) + n10.items[t11].dom.contains(e21.target) && n10.moveSelection(t11); + } }), this.dom = JZ("div", { class: "cm-panel-lint" }, this.list, JZ("button", { type: "button", name: "close", "aria-label": this.view.state.phrase("close"), onclick: function() { + return s0(n10.view); + } }, "\xD7")), this.update(); + } + return Do(e20, [{ key: "selectedIndex", get: function() { + var e21 = this.view.state.field(r0).selected; + if (!e21) + return -1; + for (var t10 = 0; t10 < this.items.length; t10++) + if (this.items[t10].diagnostic == e21.diagnostic) + return t10; + return -1; + } }, { key: "update", value: function() { + var e21 = this, t10 = this.view.state.field(r0), n10 = t10.diagnostics, r10 = t10.selected, o10 = 0, i10 = false, a10 = null; + for (n10.between(0, this.view.state.doc.length, function(t11, n11, s10) { + for (var c10, l10 = s10.spec, u10 = -1, f10 = o10; f10 < e21.items.length; f10++) + if (e21.items[f10].diagnostic == l10.diagnostic) { + u10 = f10; + break; + } + u10 < 0 ? (c10 = new v0(e21.view, l10.diagnostic), e21.items.splice(o10, 0, c10), i10 = true) : (c10 = e21.items[u10], u10 > o10 && (e21.items.splice(o10, u10 - o10), i10 = true)), r10 && c10.diagnostic == r10.diagnostic ? c10.dom.hasAttribute("aria-selected") || (c10.dom.setAttribute("aria-selected", "true"), a10 = c10) : c10.dom.hasAttribute("aria-selected") && c10.dom.removeAttribute("aria-selected"), o10++; + }); o10 < this.items.length && !(1 == this.items.length && this.items[0].diagnostic.from < 0); ) + i10 = true, this.items.pop(); + 0 == this.items.length && (this.items.push(new v0(this.view, { from: -1, to: -1, severity: "info", message: this.view.state.phrase("No diagnostics") })), i10 = true), a10 ? (this.list.setAttribute("aria-activedescendant", a10.id), this.view.requestMeasure({ key: this, read: function() { + return { sel: a10.dom.getBoundingClientRect(), panel: e21.list.getBoundingClientRect() }; + }, write: function(t11) { + var n11 = t11.sel, r11 = t11.panel, o11 = r11.height / e21.list.offsetHeight; + n11.top < r11.top ? e21.list.scrollTop -= (r11.top - n11.top) / o11 : n11.bottom > r11.bottom && (e21.list.scrollTop += (n11.bottom - r11.bottom) / o11); + } })) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), i10 && this.sync(); + } }, { key: "sync", value: function() { + var e21 = this.list.firstChild; + function t10() { + var t11 = e21; + e21 = t11.nextSibling, t11.remove(); + } + var n10, r10 = bo(this.items); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + if (o10.dom.parentNode == this.list) { + for (; e21 != o10.dom; ) + t10(); + e21 = o10.dom.nextSibling; + } else + this.list.insertBefore(o10.dom, e21); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + for (; e21; ) + t10(); + } }, { key: "moveSelection", value: function(e21) { + if (!(this.selectedIndex < 0)) { + var t10 = YZ(this.view.state.field(r0).diagnostics, this.items[e21].diagnostic); + t10 && this.view.dispatch({ selection: { anchor: t10.from, head: t10.to }, scrollIntoView: true, effects: n0.of(t10) }); + } + } }], [{ key: "open", value: function(t10) { + return new e20(t10); + } }]), e20; + }(); + function m0(e20) { + return `url('data:image/svg+xml, 1 && void 0 !== arguments[1] ? arguments[1] : 'viewBox="0 0 40 40"', ">").concat(encodeURIComponent(e20), "')"); + } + function g0(e20) { + return m0(''), 'width="6" height="3"'); + } + var y0 = zJ.baseTheme({ ".cm-diagnostic": { padding: "3px 6px 3px 8px", marginLeft: "-1px", display: "block", whiteSpace: "pre-wrap" }, ".cm-diagnostic-error": { borderLeft: "5px solid #d11" }, ".cm-diagnostic-warning": { borderLeft: "5px solid orange" }, ".cm-diagnostic-info": { borderLeft: "5px solid #999" }, ".cm-diagnostic-hint": { borderLeft: "5px solid #66d" }, ".cm-diagnosticAction": { font: "inherit", border: "none", padding: "2px 4px", backgroundColor: "#444", color: "white", borderRadius: "3px", marginLeft: "8px", cursor: "pointer" }, ".cm-diagnosticSource": { fontSize: "70%", opacity: 0.7 }, ".cm-lintRange": { backgroundPosition: "left bottom", backgroundRepeat: "repeat-x", paddingBottom: "0.7px" }, ".cm-lintRange-error": { backgroundImage: g0("#d11") }, ".cm-lintRange-warning": { backgroundImage: g0("orange") }, ".cm-lintRange-info": { backgroundImage: g0("#999") }, ".cm-lintRange-hint": { backgroundImage: g0("#66d") }, ".cm-lintRange-active": { backgroundColor: "#ffdd9980" }, ".cm-tooltip-lint": { padding: 0, margin: 0 }, ".cm-lintPoint": { position: "relative", "&:after": { content: '""', position: "absolute", bottom: 0, left: "-2px", borderLeft: "3px solid transparent", borderRight: "3px solid transparent", borderBottom: "4px solid #d11" } }, ".cm-lintPoint-warning": { "&:after": { borderBottomColor: "orange" } }, ".cm-lintPoint-info": { "&:after": { borderBottomColor: "#999" } }, ".cm-lintPoint-hint": { "&:after": { borderBottomColor: "#66d" } }, ".cm-panel.cm-panel-lint": { position: "relative", "& ul": { maxHeight: "100px", overflowY: "auto", "& [aria-selected]": { backgroundColor: "#ddd", "& u": { textDecoration: "underline" } }, "&:focus [aria-selected]": { background_fallback: "#bdf", backgroundColor: "Highlight", color_fallback: "white", color: "HighlightText" }, "& u": { textDecoration: "none" }, padding: 0, margin: 0 }, "& [name=close]": { position: "absolute", top: "0", right: "2px", background: "inherit", border: "none", font: "inherit", padding: 0, margin: 0 } } }); + function b0(e20) { + return "error" == e20 ? 4 : "warning" == e20 ? 3 : "info" == e20 ? 2 : 1; + } + var k0 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), (n10 = _o(this, t10)).diagnostics = e21, n10.severity = e21.reduce(function(e23, t11) { + return b0(e23) < b0(t11.severity) ? t11.severity : e23; + }, "hint"), n10; + } + return Ao(t10, sG), Do(t10, [{ key: "toDOM", value: function(e21) { + var t11 = document.createElement("div"); + t11.className = "cm-lint-marker cm-lint-marker-" + this.severity; + var n10 = this.diagnostics, r10 = e21.state.facet(O0).tooltipFilter; + return r10 && (n10 = r10(n10)), n10.length && (t11.onmouseover = function() { + return function(e23, t12, n11) { + function r11() { + var r12 = e23.elementAtHeight(t12.getBoundingClientRect().top + 5 - e23.documentTop); + e23.coordsAtPos(r12.from) && e23.dispatch({ effects: S0.of({ pos: r12.from, above: false, create: function() { + return { dom: a0(e23, n11), getCoords: function() { + return t12.getBoundingClientRect(); + } }; + } }) }), t12.onmouseout = t12.onmousemove = null, function(e24, t13) { + var n12 = function n13(r13) { + var o11 = t13.getBoundingClientRect(); + if (!(r13.clientX > o11.left - 10 && r13.clientX < o11.right + 10 && r13.clientY > o11.top - 10 && r13.clientY < o11.bottom + 10)) { + for (var i11 = r13.target; i11; i11 = i11.parentNode) + if (1 == i11.nodeType && i11.classList.contains("cm-tooltip-lint")) + return; + window.removeEventListener("mousemove", n13), e24.state.field(C0) && e24.dispatch({ effects: S0.of(null) }); + } + }; + window.addEventListener("mousemove", n12); + }(e23, t12); + } + var o10 = e23.state.facet(O0), i10 = o10.hoverTime, a10 = setTimeout(r11, i10); + t12.onmouseout = function() { + clearTimeout(a10), t12.onmouseout = t12.onmousemove = null; + }, t12.onmousemove = function() { + clearTimeout(a10), a10 = setTimeout(r11, i10); + }; + }(e21, t11, n10); + }), t11; + } }]), t10; + }(); + function w0(e20, t10) { + var n10, r10 = /* @__PURE__ */ Object.create(null), o10 = bo(t10); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = n10.value, a10 = e20.lineAt(i10.from); + (r10[a10.from] || (r10[a10.from] = [])).push(i10); + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + var s10 = []; + for (var c10 in r10) + s10.push(new k0(r10[c10]).range(+c10)); + return xV.of(s10, true); + } + var x0 = fG({ class: "cm-gutter-lint", markers: function(e20) { + return e20.state.field(j0); + } }); + var j0 = NF.define({ create: function() { + return xV.empty; + }, update: function(e20, t10) { + e20 = e20.map(t10.changes); + var n10, r10 = t10.state.facet(O0).markerFilter, o10 = bo(t10.effects); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = n10.value; + if (i10.is(e0)) { + var a10 = i10.value; + r10 && (a10 = r10(a10 || [])), e20 = w0(t10.state.doc, a10.slice(0)); + } + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + return e20; + } }); + var S0 = oV.define(); + var C0 = NF.define({ create: function() { + return null; + }, update: function(e20, t10) { + return e20 && t10.docChanged && (e20 = XZ(t10, e20) ? null : Object.assign(Object.assign({}, e20), { pos: t10.changes.mapPos(e20.pos) })), t10.effects.reduce(function(e21, t11) { + return t11.is(S0) ? t11.value : e21; + }, e20); + }, provide: function(e20) { + return UK.from(e20); + } }); + var $0 = zJ.baseTheme({ ".cm-gutter-lint": { width: "1.4em", "& .cm-gutterElement": { padding: ".2em" } }, ".cm-lint-marker": { width: "1em", height: "1em" }, ".cm-lint-marker-info": { content: m0('') }, ".cm-lint-marker-warning": { content: m0('') }, ".cm-lint-marker-error": { content: m0('') } }); + var _0 = [r0, zJ.decorations.compute([r0], function(e20) { + var t10 = e20.field(r0), n10 = t10.selected, r10 = t10.panel; + return n10 && r10 && n10.from != n10.to ? KH.set([o0.range(n10.from, n10.to)]) : KH.none; + }), XK(i0, { hideOn: XZ }), y0]; + var O0 = MF.define({ combine: function(e20) { + return gV(e20, { hoverTime: 300, markerFilter: null, tooltipFilter: null }); + } }); + function M0() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return [O0.of(e20), j0, x0, $0, C0]; + } + var E0 = function() { + function e20(t10, n10, r10, o10, i10, a10, s10, c10, l10) { + var u10 = arguments.length > 9 && void 0 !== arguments[9] ? arguments[9] : 0, f10 = arguments.length > 10 ? arguments[10] : void 0; + No(this, e20), this.p = t10, this.stack = n10, this.state = r10, this.reducePos = o10, this.pos = i10, this.score = a10, this.buffer = s10, this.bufferBase = c10, this.curContext = l10, this.lookAhead = u10, this.parent = f10; + } + return Do(e20, [{ key: "toString", value: function() { + return "[".concat(this.stack.filter(function(e21, t10) { + return t10 % 3 == 0; + }).concat(this.state), "]@").concat(this.pos).concat(this.score ? "!" + this.score : ""); + } }, { key: "context", get: function() { + return this.curContext ? this.curContext.context : null; + } }, { key: "pushState", value: function(e21, t10) { + this.stack.push(this.state, t10, this.bufferBase + this.buffer.length), this.state = e21; + } }, { key: "reduce", value: function(e21) { + var t10, n10 = e21 >> 19, r10 = 65535 & e21, o10 = this.p.parser, i10 = o10.dynamicPrecedence(r10); + if (i10 && (this.score += i10), 0 == n10) + return this.pushState(o10.getGoto(this.state, r10, true), this.reducePos), r10 < o10.minRepeatTerm && this.storeNode(r10, this.reducePos, this.reducePos, 4, true), void this.reduceContext(r10, this.reducePos); + var a10 = this.stack.length - 3 * (n10 - 1) - (262144 & e21 ? 6 : 0), s10 = a10 ? this.stack[a10 - 2] : this.p.ranges[0].from, c10 = this.reducePos - s10; + c10 >= 2e3 && !(null === (t10 = this.p.parser.nodeSet.types[r10]) || void 0 === t10 ? void 0 : t10.isAnonymous) && (s10 == this.p.lastBigReductionStart ? (this.p.bigReductionCount++, this.p.lastBigReductionSize = c10) : this.p.lastBigReductionSize < c10 && (this.p.bigReductionCount = 1, this.p.lastBigReductionStart = s10, this.p.lastBigReductionSize = c10)); + var l10 = a10 ? this.stack[a10 - 1] : 0, u10 = this.bufferBase + this.buffer.length - l10; + if (r10 < o10.minRepeatTerm || 131072 & e21) { + var f10 = o10.stateFlag(this.state, 1) ? this.pos : this.reducePos; + this.storeNode(r10, s10, f10, u10 + 4, true); + } + if (262144 & e21) + this.state = this.stack[a10]; + else { + var d10 = this.stack[a10 - 3]; + this.state = o10.getGoto(d10, r10, true); + } + for (; this.stack.length > a10; ) + this.stack.pop(); + this.reduceContext(r10, s10); + } }, { key: "storeNode", value: function(e21, t10, n10) { + var r10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 4, o10 = arguments.length > 4 && void 0 !== arguments[4] && arguments[4]; + if (0 == e21 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) { + var i10 = this, a10 = this.buffer.length; + if (0 == a10 && i10.parent && (a10 = i10.bufferBase - i10.parent.bufferBase, i10 = i10.parent), a10 > 0 && 0 == i10.buffer[a10 - 4] && i10.buffer[a10 - 1] > -1) { + if (t10 == n10) + return; + if (i10.buffer[a10 - 2] >= t10) + return void (i10.buffer[a10 - 2] = n10); + } + } + if (o10 && this.pos != n10) { + var s10 = this.buffer.length; + if (s10 > 0 && 0 != this.buffer[s10 - 4]) + for (; s10 > 0 && this.buffer[s10 - 2] > n10; ) + this.buffer[s10] = this.buffer[s10 - 4], this.buffer[s10 + 1] = this.buffer[s10 - 3], this.buffer[s10 + 2] = this.buffer[s10 - 2], this.buffer[s10 + 3] = this.buffer[s10 - 1], s10 -= 4, r10 > 4 && (r10 -= 4); + this.buffer[s10] = e21, this.buffer[s10 + 1] = t10, this.buffer[s10 + 2] = n10, this.buffer[s10 + 3] = r10; + } else + this.buffer.push(e21, t10, n10, r10); + } }, { key: "shift", value: function(e21, t10, n10, r10) { + if (131072 & e21) + this.pushState(65535 & e21, this.pos); + else if (0 == (262144 & e21)) { + var o10 = e21, i10 = this.p.parser; + (r10 > this.pos || t10 <= i10.maxNode) && (this.pos = r10, i10.stateFlag(o10, 1) || (this.reducePos = r10)), this.pushState(o10, n10), this.shiftContext(t10, n10), t10 <= i10.maxNode && this.buffer.push(t10, n10, r10, 4); + } else + this.pos = r10, this.shiftContext(t10, n10), t10 <= this.p.parser.maxNode && this.buffer.push(t10, n10, r10, 4); + } }, { key: "apply", value: function(e21, t10, n10, r10) { + 65536 & e21 ? this.reduce(e21) : this.shift(e21, t10, n10, r10); + } }, { key: "useNode", value: function(e21, t10) { + var n10 = this.p.reused.length - 1; + (n10 < 0 || this.p.reused[n10] != e21) && (this.p.reused.push(e21), n10++); + var r10 = this.pos; + this.reducePos = this.pos = r10 + e21.length, this.pushState(t10, r10), this.buffer.push(n10, r10, this.reducePos, -1), this.curContext && this.updateContext(this.curContext.tracker.reuse(this.curContext.context, e21, this, this.p.stream.reset(this.pos - e21.length))); + } }, { key: "split", value: function() { + for (var t10 = this, n10 = t10.buffer.length; n10 > 0 && t10.buffer[n10 - 2] > t10.reducePos; ) + n10 -= 4; + for (var r10 = t10.buffer.slice(n10), o10 = t10.bufferBase + n10; t10 && o10 == t10.bufferBase; ) + t10 = t10.parent; + return new e20(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, r10, o10, this.curContext, this.lookAhead, t10); + } }, { key: "recoverByDelete", value: function(e21, t10) { + var n10 = e21 <= this.p.parser.maxNode; + n10 && this.storeNode(e21, this.pos, t10, 4), this.storeNode(0, this.pos, t10, n10 ? 8 : 4), this.pos = this.reducePos = t10, this.score -= 190; + } }, { key: "canShift", value: function(e21) { + for (var t10 = new P0(this); ; ) { + var n10 = this.p.parser.stateSlot(t10.state, 4) || this.p.parser.hasAction(t10.state, e21); + if (0 == n10) + return false; + if (0 == (65536 & n10)) + return true; + t10.reduce(n10); + } + } }, { key: "recoverByInsert", value: function(e21) { + if (this.stack.length >= 300) + return []; + var t10 = this.p.parser.nextStates(this.state); + if (t10.length > 8 || this.stack.length >= 120) { + for (var n10, r10 = [], o10 = 0; o10 < t10.length; o10 += 2) + (n10 = t10[o10 + 1]) != this.state && this.p.parser.hasAction(n10, e21) && r10.push(t10[o10], n10); + if (this.stack.length < 120) + for (var i10 = function() { + var e23 = t10[a10 + 1]; + r10.some(function(t11, n11) { + return 1 & n11 && t11 == e23; + }) || r10.push(t10[a10], e23); + }, a10 = 0; r10.length < 8 && a10 < t10.length; a10 += 2) + i10(); + t10 = r10; + } + for (var s10 = [], c10 = 0; c10 < t10.length && s10.length < 4; c10 += 2) { + var l10 = t10[c10 + 1]; + if (l10 != this.state) { + var u10 = this.split(); + u10.pushState(l10, this.pos), u10.storeNode(0, u10.pos, u10.pos, 4, true), u10.shiftContext(t10[c10], this.pos), u10.reducePos = this.pos, u10.score -= 200, s10.push(u10); + } + } + return s10; + } }, { key: "forceReduce", value: function() { + var e21 = this.p.parser, t10 = e21.stateSlot(this.state, 5); + if (0 == (65536 & t10)) + return false; + if (!e21.validAction(this.state, t10)) { + var n10 = t10 >> 19, r10 = 65535 & t10, o10 = this.stack.length - 3 * n10; + if (o10 < 0 || e21.getGoto(this.stack[o10], r10, false) < 0) { + var i10 = this.findForcedReduction(); + if (null == i10) + return false; + t10 = i10; + } + this.storeNode(0, this.pos, this.pos, 4, true), this.score -= 100; + } + return this.reducePos = this.pos, this.reduce(t10), true; + } }, { key: "findForcedReduction", value: function() { + var e21 = this, t10 = this.p.parser, n10 = []; + return function r10(o10, i10) { + if (!n10.includes(o10)) + return n10.push(o10), t10.allActions(o10, function(n11) { + if (393216 & n11) + ; + else if (65536 & n11) { + var o11 = (n11 >> 19) - i10; + if (o11 > 1) { + var a10 = 65535 & n11, s10 = e21.stack.length - 3 * o11; + if (s10 >= 0 && t10.getGoto(e21.stack[s10], a10, false) >= 0) + return o11 << 19 | 65536 | a10; + } + } else { + var c10 = r10(n11, i10 + 1); + if (null != c10) + return c10; + } + }); + }(this.state, 0); + } }, { key: "forceAll", value: function() { + for (; !this.p.parser.stateFlag(this.state, 2); ) + if (!this.forceReduce()) { + this.storeNode(0, this.pos, this.pos, 4, true); + break; + } + return this; + } }, { key: "deadEnd", get: function() { + if (3 != this.stack.length) + return false; + var e21 = this.p.parser; + return 65535 == e21.data[e21.stateSlot(this.state, 1)] && !e21.stateSlot(this.state, 4); + } }, { key: "restart", value: function() { + this.storeNode(0, this.pos, this.pos, 4, true), this.state = this.stack[0], this.stack.length = 0; + } }, { key: "sameState", value: function(e21) { + if (this.state != e21.state || this.stack.length != e21.stack.length) + return false; + for (var t10 = 0; t10 < this.stack.length; t10 += 3) + if (this.stack[t10] != e21.stack[t10]) + return false; + return true; + } }, { key: "parser", get: function() { + return this.p.parser; + } }, { key: "dialectEnabled", value: function(e21) { + return this.p.parser.dialect.flags[e21]; + } }, { key: "shiftContext", value: function(e21, t10) { + this.curContext && this.updateContext(this.curContext.tracker.shift(this.curContext.context, e21, this, this.p.stream.reset(t10))); + } }, { key: "reduceContext", value: function(e21, t10) { + this.curContext && this.updateContext(this.curContext.tracker.reduce(this.curContext.context, e21, this, this.p.stream.reset(t10))); + } }, { key: "emitContext", value: function() { + var e21 = this.buffer.length - 1; + (e21 < 0 || -3 != this.buffer[e21]) && this.buffer.push(this.curContext.hash, this.pos, this.pos, -3); + } }, { key: "emitLookAhead", value: function() { + var e21 = this.buffer.length - 1; + (e21 < 0 || -4 != this.buffer[e21]) && this.buffer.push(this.lookAhead, this.pos, this.pos, -4); + } }, { key: "updateContext", value: function(e21) { + if (e21 != this.curContext.context) { + var t10 = new A0(this.curContext.tracker, e21); + t10.hash != this.curContext.hash && this.emitContext(), this.curContext = t10; + } + } }, { key: "setLookAhead", value: function(e21) { + e21 > this.lookAhead && (this.emitLookAhead(), this.lookAhead = e21); + } }, { key: "close", value: function() { + this.curContext && this.curContext.tracker.strict && this.emitContext(), this.lookAhead > 0 && this.emitLookAhead(); + } }], [{ key: "start", value: function(t10, n10) { + var r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, o10 = t10.parser.context; + return new e20(t10, [], n10, r10, r10, 0, [], 0, o10 ? new A0(o10, o10.start) : null, 0, null); + } }]), e20; + }(); + var A0 = Do(function e12(t10, n10) { + No(this, e12), this.tracker = t10, this.context = n10, this.hash = t10.strict ? t10.hash(n10) : 0; + }); + var P0 = function() { + function e20(t10) { + No(this, e20), this.start = t10, this.state = t10.state, this.stack = t10.stack, this.base = this.stack.length; + } + return Do(e20, [{ key: "reduce", value: function(e21) { + var t10 = 65535 & e21, n10 = e21 >> 19; + 0 == n10 ? (this.stack == this.start.stack && (this.stack = this.stack.slice()), this.stack.push(this.state, 0, 0), this.base += 3) : this.base -= 3 * (n10 - 1); + var r10 = this.start.p.parser.getGoto(this.stack[this.base - 3], t10, true); + this.state = r10; + } }]), e20; + }(); + var T0 = function() { + function e20(t10, n10, r10) { + No(this, e20), this.stack = t10, this.pos = n10, this.index = r10, this.buffer = t10.buffer, 0 == this.index && this.maybeNext(); + } + return Do(e20, [{ key: "maybeNext", value: function() { + var e21 = this.stack.parent; + null != e21 && (this.index = this.stack.bufferBase - e21.bufferBase, this.stack = e21, this.buffer = e21.buffer); + } }, { key: "id", get: function() { + return this.buffer[this.index - 4]; + } }, { key: "start", get: function() { + return this.buffer[this.index - 3]; + } }, { key: "end", get: function() { + return this.buffer[this.index - 2]; + } }, { key: "size", get: function() { + return this.buffer[this.index - 1]; + } }, { key: "next", value: function() { + this.index -= 4, this.pos -= 4, 0 == this.index && this.maybeNext(); + } }, { key: "fork", value: function() { + return new e20(this.stack, this.pos, this.index); + } }], [{ key: "create", value: function(t10) { + var n10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : t10.bufferBase + t10.buffer.length; + return new e20(t10, n10, n10 - t10.bufferBase); + } }]), e20; + }(); + function R0(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Uint16Array; + if ("string" != typeof e20) + return e20; + for (var n10 = null, r10 = 0, o10 = 0; r10 < e20.length; ) { + for (var i10 = 0; ; ) { + var a10 = e20.charCodeAt(r10++), s10 = false; + if (126 == a10) { + i10 = 65535; + break; + } + a10 >= 92 && a10--, a10 >= 34 && a10--; + var c10 = a10 - 32; + if (c10 >= 46 && (c10 -= 46, s10 = true), i10 += c10, s10) + break; + i10 *= 46; + } + n10 ? n10[o10++] = i10 : n10 = new t10(i10); + } + return n10; + } + var N0 = Do(function e13() { + No(this, e13), this.start = -1, this.value = -1, this.end = -1, this.extended = -1, this.lookAhead = 0, this.mask = 0, this.context = 0; + }); + var I0 = new N0(); + var D0 = function() { + function e20(t10, n10) { + No(this, e20), this.input = t10, this.ranges = n10, this.chunk = "", this.chunkOff = 0, this.chunk2 = "", this.chunk2Pos = 0, this.next = -1, this.token = I0, this.rangeIndex = 0, this.pos = this.chunkPos = n10[0].from, this.range = n10[0], this.end = n10[n10.length - 1].to, this.readNext(); + } + return Do(e20, [{ key: "resolveOffset", value: function(e21, t10) { + for (var n10 = this.range, r10 = this.rangeIndex, o10 = this.pos + e21; o10 < n10.from; ) { + if (!r10) + return null; + var i10 = this.ranges[--r10]; + o10 -= n10.from - i10.to, n10 = i10; + } + for (; t10 < 0 ? o10 > n10.to : o10 >= n10.to; ) { + if (r10 == this.ranges.length - 1) + return null; + var a10 = this.ranges[++r10]; + o10 += a10.from - n10.to, n10 = a10; + } + return o10; + } }, { key: "clipPos", value: function(e21) { + if (e21 >= this.range.from && e21 < this.range.to) + return e21; + var t10, n10 = bo(this.ranges); + try { + for (n10.s(); !(t10 = n10.n()).done; ) { + var r10 = t10.value; + if (r10.to > e21) + return Math.max(e21, r10.from); + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + return this.end; + } }, { key: "peek", value: function(e21) { + var t10, n10, r10 = this.chunkOff + e21; + if (r10 >= 0 && r10 < this.chunk.length) + t10 = this.pos + e21, n10 = this.chunk.charCodeAt(r10); + else { + var o10 = this.resolveOffset(e21, 1); + if (null == o10) + return -1; + if ((t10 = o10) >= this.chunk2Pos && t10 < this.chunk2Pos + this.chunk2.length) + n10 = this.chunk2.charCodeAt(t10 - this.chunk2Pos); + else { + for (var i10 = this.rangeIndex, a10 = this.range; a10.to <= t10; ) + a10 = this.ranges[++i10]; + this.chunk2 = this.input.chunk(this.chunk2Pos = t10), t10 + this.chunk2.length > a10.to && (this.chunk2 = this.chunk2.slice(0, a10.to - t10)), n10 = this.chunk2.charCodeAt(0); + } + } + return t10 >= this.token.lookAhead && (this.token.lookAhead = t10 + 1), n10; + } }, { key: "acceptToken", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n10 = t10 ? this.resolveOffset(t10, -1) : this.pos; + if (null == n10 || n10 < this.token.start) + throw new RangeError("Token end out of bounds"); + this.token.value = e21, this.token.end = n10; + } }, { key: "getChunk", value: function() { + if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) { + var e21 = this.chunk, t10 = this.chunkPos; + this.chunk = this.chunk2, this.chunkPos = this.chunk2Pos, this.chunk2 = e21, this.chunk2Pos = t10, this.chunkOff = this.pos - this.chunkPos; + } else { + this.chunk2 = this.chunk, this.chunk2Pos = this.chunkPos; + var n10 = this.input.chunk(this.pos), r10 = this.pos + n10.length; + this.chunk = r10 > this.range.to ? n10.slice(0, this.range.to - this.pos) : n10, this.chunkPos = this.pos, this.chunkOff = 0; + } + } }, { key: "readNext", value: function() { + return this.chunkOff >= this.chunk.length && (this.getChunk(), this.chunkOff == this.chunk.length) ? this.next = -1 : this.next = this.chunk.charCodeAt(this.chunkOff); + } }, { key: "advance", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1; + for (this.chunkOff += e21; this.pos + e21 >= this.range.to; ) { + if (this.rangeIndex == this.ranges.length - 1) + return this.setDone(); + e21 -= this.range.to - this.pos, this.range = this.ranges[++this.rangeIndex], this.pos = this.range.from; + } + return this.pos += e21, this.pos >= this.token.lookAhead && (this.token.lookAhead = this.pos + 1), this.readNext(); + } }, { key: "setDone", value: function() { + return this.pos = this.chunkPos = this.end, this.range = this.ranges[this.rangeIndex = this.ranges.length - 1], this.chunk = "", this.next = -1; + } }, { key: "reset", value: function(e21, t10) { + if (t10 ? (this.token = t10, t10.start = e21, t10.lookAhead = e21 + 1, t10.value = t10.extended = -1) : this.token = I0, this.pos != e21) { + if (this.pos = e21, e21 == this.end) + return this.setDone(), this; + for (; e21 < this.range.from; ) + this.range = this.ranges[--this.rangeIndex]; + for (; e21 >= this.range.to; ) + this.range = this.ranges[++this.rangeIndex]; + e21 >= this.chunkPos && e21 < this.chunkPos + this.chunk.length ? this.chunkOff = e21 - this.chunkPos : (this.chunk = "", this.chunkOff = 0), this.readNext(); + } + return this; + } }, { key: "read", value: function(e21, t10) { + if (e21 >= this.chunkPos && t10 <= this.chunkPos + this.chunk.length) + return this.chunk.slice(e21 - this.chunkPos, t10 - this.chunkPos); + if (e21 >= this.chunk2Pos && t10 <= this.chunk2Pos + this.chunk2.length) + return this.chunk2.slice(e21 - this.chunk2Pos, t10 - this.chunk2Pos); + if (e21 >= this.range.from && t10 <= this.range.to) + return this.input.read(e21, t10); + var n10, r10 = "", o10 = bo(this.ranges); + try { + for (o10.s(); !(n10 = o10.n()).done; ) { + var i10 = n10.value; + if (i10.from >= t10) + break; + i10.to > e21 && (r10 += this.input.read(Math.max(i10.from, e21), Math.min(i10.to, t10))); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + return r10; + } }]), e20; + }(); + var q0 = function() { + function e20(t10, n10) { + No(this, e20), this.data = t10, this.id = n10; + } + return Do(e20, [{ key: "token", value: function(e21, t10) { + var n10 = t10.p.parser; + !function(e23, t11, n11, r10, o10, i10) { + var a10 = 0, s10 = 1 << r10, c10 = n11.p.parser.dialect; + e: + for (; 0 != (s10 & e23[a10]); ) { + for (var l10 = e23[a10 + 1], u10 = a10 + 3; u10 < l10; u10 += 2) + if ((e23[u10 + 1] & s10) > 0) { + var f10 = e23[u10]; + if (c10.allows(f10) && (-1 == t11.token.value || t11.token.value == f10 || B0(f10, t11.token.value, o10, i10))) { + t11.acceptToken(f10); + break; + } + } + var d10 = t11.next, h10 = 0, v10 = e23[a10 + 2]; + if (!(t11.next < 0 && v10 > h10 && 65535 == e23[l10 + 3 * v10 - 3])) { + for (; h10 < v10; ) { + var p10 = h10 + v10 >> 1, m10 = l10 + p10 + (p10 << 1), g10 = e23[m10], y10 = e23[m10 + 1] || 65536; + if (d10 < g10) + v10 = p10; + else { + if (!(d10 >= y10)) { + a10 = e23[m10 + 2], t11.advance(); + continue e; + } + h10 = p10 + 1; + } + } + break; + } + a10 = e23[l10 + 3 * v10 - 1]; + } + }(this.data, e21, t10, this.id, n10.data, n10.tokenPrecTable); + } }]), e20; + }(); + function z0(e20, t10, n10) { + for (var r10, o10 = t10; 65535 != (r10 = e20[o10]); o10++) + if (r10 == n10) + return o10 - t10; + return -1; + } + function B0(e20, t10, n10, r10) { + var o10 = z0(n10, r10, t10); + return o10 < 0 || z0(n10, r10, e20) < o10; + } + q0.prototype.contextual = q0.prototype.fallback = q0.prototype.extend = false, q0.prototype.fallback = q0.prototype.extend = false; + var L0 = "undefined" != typeof process && process.env && /\bparse\b/.test(process.env.LOG); + var F0 = null; + function V0(e20, t10, n10) { + var r10 = e20.cursor(NG.IncludeAnonymous); + for (r10.moveTo(t10); ; ) + if (!(n10 < 0 ? r10.childBefore(t10) : r10.childAfter(t10))) + for (; ; ) { + if ((n10 < 0 ? r10.to < t10 : r10.from > t10) && !r10.type.isError) + return n10 < 0 ? Math.max(0, Math.min(r10.to - 1, t10 - 25)) : Math.min(e20.length, Math.max(r10.from + 1, t10 + 25)); + if (n10 < 0 ? r10.prevSibling() : r10.nextSibling()) + break; + if (!r10.parent()) + return n10 < 0 ? 0 : e20.length; + } + } + var H0 = function() { + function e20(t10, n10) { + No(this, e20), this.fragments = t10, this.nodeSet = n10, this.i = 0, this.fragment = null, this.safeFrom = -1, this.safeTo = -1, this.trees = [], this.start = [], this.index = [], this.nextFragment(); + } + return Do(e20, [{ key: "nextFragment", value: function() { + var e21 = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++]; + if (e21) { + for (this.safeFrom = e21.openStart ? V0(e21.tree, e21.from + e21.offset, 1) - e21.offset : e21.from, this.safeTo = e21.openEnd ? V0(e21.tree, e21.to + e21.offset, -1) - e21.offset : e21.to; this.trees.length; ) + this.trees.pop(), this.start.pop(), this.index.pop(); + this.trees.push(e21.tree), this.start.push(-e21.offset), this.index.push(0), this.nextStart = this.safeFrom; + } else + this.nextStart = 1e9; + } }, { key: "nodeAt", value: function(e21) { + if (e21 < this.nextStart) + return null; + for (; this.fragment && this.safeTo <= e21; ) + this.nextFragment(); + if (!this.fragment) + return null; + for (; ; ) { + var t10 = this.trees.length - 1; + if (t10 < 0) + return this.nextFragment(), null; + var n10 = this.trees[t10], r10 = this.index[t10]; + if (r10 != n10.children.length) { + var o10 = n10.children[r10], i10 = this.start[t10] + n10.positions[r10]; + if (i10 > e21) + return this.nextStart = i10, null; + if (o10 instanceof zG) { + if (i10 == e21) { + if (i10 < this.safeFrom) + return null; + var a10 = i10 + o10.length; + if (a10 <= this.safeTo) { + var s10 = o10.prop(AG.lookAhead); + if (!s10 || a10 + s10 < this.fragment.to) + return o10; + } + } + this.index[t10]++, i10 + o10.length >= Math.max(this.safeFrom, e21) && (this.trees.push(o10), this.start.push(i10), this.index.push(0)); + } else + this.index[t10]++, this.nextStart = i10 + o10.length; + } else + this.trees.pop(), this.start.pop(), this.index.pop(); + } + } }]), e20; + }(); + var W0 = function() { + function e20(t10, n10) { + No(this, e20), this.stream = n10, this.tokens = [], this.mainToken = null, this.actions = [], this.tokens = t10.tokenizers.map(function(e21) { + return new N0(); + }); + } + return Do(e20, [{ key: "getActions", value: function(e21) { + for (var t10 = 0, n10 = null, r10 = e21.p.parser, o10 = r10.tokenizers, i10 = r10.stateSlot(e21.state, 3), a10 = e21.curContext ? e21.curContext.hash : 0, s10 = 0, c10 = 0; c10 < o10.length; c10++) + if (0 != (1 << c10 & i10)) { + var l10 = o10[c10], u10 = this.tokens[c10]; + if ((!n10 || l10.fallback) && ((l10.contextual || u10.start != e21.pos || u10.mask != i10 || u10.context != a10) && (this.updateCachedToken(u10, l10, e21), u10.mask = i10, u10.context = a10), u10.lookAhead > u10.end + 25 && (s10 = Math.max(u10.lookAhead, s10)), 0 != u10.value)) { + var f10 = t10; + if (u10.extended > -1 && (t10 = this.addActions(e21, u10.extended, u10.end, t10)), t10 = this.addActions(e21, u10.value, u10.end, t10), !l10.extend && (n10 = u10, t10 > f10)) + break; + } + } + for (; this.actions.length > t10; ) + this.actions.pop(); + return s10 && e21.setLookAhead(s10), n10 || e21.pos != this.stream.end || ((n10 = new N0()).value = e21.p.parser.eofTerm, n10.start = n10.end = e21.pos, t10 = this.addActions(e21, n10.value, n10.end, t10)), this.mainToken = n10, this.actions; + } }, { key: "getMainToken", value: function(e21) { + if (this.mainToken) + return this.mainToken; + var t10 = new N0(), n10 = e21.pos, r10 = e21.p; + return t10.start = n10, t10.end = Math.min(n10 + 1, r10.stream.end), t10.value = n10 == r10.stream.end ? r10.parser.eofTerm : 0, t10; + } }, { key: "updateCachedToken", value: function(e21, t10, n10) { + var r10 = this.stream.clipPos(n10.pos); + if (t10.token(this.stream.reset(r10, e21), n10), e21.value > -1) { + for (var o10 = n10.p.parser, i10 = 0; i10 < o10.specialized.length; i10++) + if (o10.specialized[i10] == e21.value) { + var a10 = o10.specializers[i10](this.stream.read(e21.start, e21.end), n10); + if (a10 >= 0 && n10.p.parser.dialect.allows(a10 >> 1)) { + 0 == (1 & a10) ? e21.value = a10 >> 1 : e21.extended = a10 >> 1; + break; + } + } + } else + e21.value = 0, e21.end = this.stream.clipPos(r10 + 1); + } }, { key: "putAction", value: function(e21, t10, n10, r10) { + for (var o10 = 0; o10 < r10; o10 += 3) + if (this.actions[o10] == e21) + return r10; + return this.actions[r10++] = e21, this.actions[r10++] = t10, this.actions[r10++] = n10, r10; + } }, { key: "addActions", value: function(e21, t10, n10, r10) { + for (var o10 = e21.state, i10 = e21.p.parser, a10 = i10.data, s10 = 0; s10 < 2; s10++) + for (var c10 = i10.stateSlot(o10, s10 ? 2 : 1); ; c10 += 3) { + if (65535 == a10[c10]) { + if (1 != a10[c10 + 1]) { + 0 == r10 && 2 == a10[c10 + 1] && (r10 = this.putAction(Q0(a10, c10 + 2), t10, n10, r10)); + break; + } + c10 = Q0(a10, c10 + 2); + } + a10[c10] == t10 && (r10 = this.putAction(Q0(a10, c10 + 1), t10, n10, r10)); + } + return r10; + } }]), e20; + }(); + var U0 = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.parser = t10, this.input = n10, this.ranges = o10, this.recovering = 0, this.nextStackID = 9812, this.minStackPos = 0, this.reused = [], this.stoppedAt = null, this.lastBigReductionStart = -1, this.lastBigReductionSize = 0, this.bigReductionCount = 0, this.stream = new D0(n10, o10), this.tokens = new W0(t10, this.stream), this.topTerm = t10.top[1]; + var i10 = o10[0].from; + this.stacks = [E0.start(this, t10.top[0], i10)], this.fragments = r10.length && this.stream.end - i10 > 4 * t10.bufferLength ? new H0(r10, t10.nodeSet) : null; + } + return Do(e20, [{ key: "parsedPos", get: function() { + return this.minStackPos; + } }, { key: "advance", value: function() { + var e21, t10, n10 = this.stacks, r10 = this.minStackPos, o10 = this.stacks = []; + if (this.bigReductionCount > 300 && 1 == n10.length) { + for (var i10 = jo(n10, 1)[0]; i10.forceReduce() && i10.stack.length && i10.stack[i10.stack.length - 2] >= this.lastBigReductionStart; ) + ; + this.bigReductionCount = this.lastBigReductionSize = 0; + } + for (var a10 = 0; a10 < n10.length; a10++) + for (var s10 = n10[a10]; ; ) { + if (this.tokens.mainToken = null, s10.pos > r10) + o10.push(s10); + else { + if (this.advanceStack(s10, o10, n10)) + continue; + e21 || (e21 = [], t10 = []), e21.push(s10); + var c10 = this.tokens.getMainToken(s10); + t10.push(c10.value, c10.end); + } + break; + } + if (!o10.length) { + var l10 = e21 && function(e23) { + var t11, n11 = null, r11 = bo(e23); + try { + for (r11.s(); !(t11 = r11.n()).done; ) { + var o11 = t11.value, i11 = o11.p.stoppedAt; + (o11.pos == o11.p.stream.end || null != i11 && o11.pos > i11) && o11.p.parser.stateFlag(o11.state, 2) && (!n11 || n11.score < o11.score) && (n11 = o11); + } + } catch (e24) { + r11.e(e24); + } finally { + r11.f(); + } + return n11; + }(e21); + if (l10) + return L0 && console.log("Finish with " + this.stackID(l10)), this.stackToTree(l10); + if (this.parser.strict) + throw L0 && e21 && console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none")), new SyntaxError("No parse at " + r10); + this.recovering || (this.recovering = 5); + } + if (this.recovering && e21) { + var u10 = null != this.stoppedAt && e21[0].pos > this.stoppedAt ? e21[0] : this.runRecovery(e21, t10, o10); + if (u10) + return L0 && console.log("Force-finish " + this.stackID(u10)), this.stackToTree(u10.forceAll()); + } + if (this.recovering) { + var f10 = 1 == this.recovering ? 1 : 3 * this.recovering; + if (o10.length > f10) + for (o10.sort(function(e23, t11) { + return t11.score - e23.score; + }); o10.length > f10; ) + o10.pop(); + o10.some(function(e23) { + return e23.reducePos > r10; + }) && this.recovering--; + } else if (o10.length > 1) { + e: + for (var d10 = 0; d10 < o10.length - 1; d10++) + for (var h10 = o10[d10], v10 = d10 + 1; v10 < o10.length; v10++) { + var p10 = o10[v10]; + if (h10.sameState(p10) || h10.buffer.length > 500 && p10.buffer.length > 500) { + if (!((h10.score - p10.score || h10.buffer.length - p10.buffer.length) > 0)) { + o10.splice(d10--, 1); + continue e; + } + o10.splice(v10--, 1); + } + } + o10.length > 12 && o10.splice(12, o10.length - 12); + } + this.minStackPos = o10[0].pos; + for (var m10 = 1; m10 < o10.length; m10++) + o10[m10].pos < this.minStackPos && (this.minStackPos = o10[m10].pos); + return null; + } }, { key: "stopAt", value: function(e21) { + if (null != this.stoppedAt && this.stoppedAt < e21) + throw new RangeError("Can't move stoppedAt forward"); + this.stoppedAt = e21; + } }, { key: "advanceStack", value: function(e21, t10, n10) { + var r10 = e21.pos, o10 = this.parser, i10 = L0 ? this.stackID(e21) + " -> " : ""; + if (null != this.stoppedAt && r10 > this.stoppedAt) + return e21.forceReduce() ? e21 : null; + if (this.fragments) + for (var a10 = e21.curContext && e21.curContext.tracker.strict, s10 = a10 ? e21.curContext.hash : 0, c10 = this.fragments.nodeAt(r10); c10; ) { + var l10 = this.parser.nodeSet.types[c10.type.id] == c10.type ? o10.getGoto(e21.state, c10.type.id) : -1; + if (l10 > -1 && c10.length && (!a10 || (c10.prop(AG.contextHash) || 0) == s10)) + return e21.useNode(c10, l10), L0 && console.log(i10 + this.stackID(e21) + " (via reuse of ".concat(o10.getName(c10.type.id), ")")), true; + if (!(c10 instanceof zG) || 0 == c10.children.length || c10.positions[0] > 0) + break; + var u10 = c10.children[0]; + if (!(u10 instanceof zG && 0 == c10.positions[0])) + break; + c10 = u10; + } + var f10 = o10.stateSlot(e21.state, 4); + if (f10 > 0) + return e21.reduce(f10), L0 && console.log(i10 + this.stackID(e21) + " (via always-reduce ".concat(o10.getName(65535 & f10), ")")), true; + if (e21.stack.length >= 8400) + for (; e21.stack.length > 6e3 && e21.forceReduce(); ) + ; + for (var d10 = this.tokens.getActions(e21), h10 = 0; h10 < d10.length; ) { + var v10 = d10[h10++], p10 = d10[h10++], m10 = d10[h10++], g10 = h10 == d10.length || !n10, y10 = g10 ? e21 : e21.split(), b10 = this.tokens.mainToken; + if (y10.apply(v10, p10, b10 ? b10.start : y10.pos, m10), L0 && console.log(i10 + this.stackID(y10) + " (via ".concat(0 == (65536 & v10) ? "shift" : "reduce of ".concat(o10.getName(65535 & v10)), " for ").concat(o10.getName(p10), " @ ").concat(r10).concat(y10 == e21 ? "" : ", split", ")")), g10) + return true; + y10.pos > r10 ? t10.push(y10) : n10.push(y10); + } + return false; + } }, { key: "advanceFully", value: function(e21, t10) { + for (var n10 = e21.pos; ; ) { + if (!this.advanceStack(e21, null, null)) + return false; + if (e21.pos > n10) + return J0(e21, t10), true; + } + } }, { key: "runRecovery", value: function(e21, t10, n10) { + for (var r10 = null, o10 = false, i10 = 0; i10 < e21.length; i10++) { + var a10 = e21[i10], s10 = t10[i10 << 1], c10 = t10[1 + (i10 << 1)], l10 = L0 ? this.stackID(a10) + " -> " : ""; + if (a10.deadEnd) { + if (o10) + continue; + if (o10 = true, a10.restart(), L0 && console.log(l10 + this.stackID(a10) + " (restarted)"), this.advanceFully(a10, n10)) + continue; + } + for (var u10 = a10.split(), f10 = l10, d10 = 0; u10.forceReduce() && d10 < 10; d10++) { + if (L0 && console.log(f10 + this.stackID(u10) + " (via force-reduce)"), this.advanceFully(u10, n10)) + break; + L0 && (f10 = this.stackID(u10) + " -> "); + } + var h10, v10 = bo(a10.recoverByInsert(s10)); + try { + for (v10.s(); !(h10 = v10.n()).done; ) { + var p10 = h10.value; + L0 && console.log(l10 + this.stackID(p10) + " (via recover-insert)"), this.advanceFully(p10, n10); + } + } catch (e23) { + v10.e(e23); + } finally { + v10.f(); + } + this.stream.end > a10.pos ? (c10 == a10.pos && (c10++, s10 = 0), a10.recoverByDelete(s10, c10), L0 && console.log(l10 + this.stackID(a10) + " (via recover-delete ".concat(this.parser.getName(s10), ")")), J0(a10, n10)) : (!r10 || r10.score < a10.score) && (r10 = a10); + } + return r10; + } }, { key: "stackToTree", value: function(e21) { + return e21.close(), zG.build({ buffer: T0.create(e21), nodeSet: this.parser.nodeSet, topID: this.topTerm, maxBufferLength: this.parser.bufferLength, reused: this.reused, start: this.ranges[0].from, length: e21.pos - this.ranges[0].from, minRepeatType: this.parser.minRepeatTerm }); + } }, { key: "stackID", value: function(e21) { + var t10 = (F0 || (F0 = /* @__PURE__ */ new WeakMap())).get(e21); + return t10 || F0.set(e21, t10 = String.fromCodePoint(this.nextStackID++)), t10 + e21; + } }]), e20; + }(); + function J0(e20, t10) { + for (var n10 = 0; n10 < t10.length; n10++) { + var r10 = t10[n10]; + if (r10.pos == e20.pos && r10.sameState(e20)) + return void (t10[n10].score < e20.score && (t10[n10] = e20)); + } + t10.push(e20); + } + var K0 = function() { + function e20(t10, n10, r10) { + No(this, e20), this.source = t10, this.flags = n10, this.disabled = r10; + } + return Do(e20, [{ key: "allows", value: function(e21) { + return !this.disabled || 0 == this.disabled[e21]; + } }]), e20; + }(); + var G0 = function(e20) { + function t10(e21) { + var n10, r10; + if (No(this, t10), (r10 = _o(this, t10)).wrappers = [], 14 != e21.version) + throw new RangeError("Parser version (".concat(e21.version, ") doesn't match runtime version (", 14, ")")); + var o10 = e21.nodeNames.split(" "); + r10.minRepeatTerm = o10.length; + for (var i10 = 0; i10 < e21.repeatNodeCount; i10++) + o10.push(""); + for (var a10 = Object.keys(e21.topRules).map(function(t11) { + return e21.topRules[t11][1]; + }), s10 = [], c10 = 0; c10 < o10.length; c10++) + s10.push([]); + function l10(e23, t11, n11) { + s10[e23].push([t11, t11.deserialize(String(n11))]); + } + if (e21.nodeProps) { + var u10, f10 = bo(e21.nodeProps); + try { + for (f10.s(); !(u10 = f10.n()).done; ) { + var d10 = u10.value, h10 = d10[0]; + "string" == typeof h10 && (h10 = AG[h10]); + for (var v10 = 1; v10 < d10.length; ) { + var p10 = d10[v10++]; + if (p10 >= 0) + l10(p10, h10, d10[v10++]); + else { + for (var m10 = d10[v10 + -p10], g10 = -p10; g10 > 0; g10--) + l10(d10[v10++], h10, m10); + v10++; + } + } + } + } catch (e23) { + f10.e(e23); + } finally { + f10.f(); + } + } + r10.nodeSet = new IG(o10.map(function(t11, n11) { + return RG.define({ name: n11 >= r10.minRepeatTerm ? void 0 : t11, id: n11, props: s10[n11], top: a10.indexOf(n11) > -1, error: 0 == n11, skipped: e21.skippedNodes && e21.skippedNodes.indexOf(n11) > -1 }); + })), e21.propSources && (r10.nodeSet = (n10 = r10.nodeSet).extend.apply(n10, Bo(e21.propSources))), r10.strict = false, r10.bufferLength = 1024; + var y10 = R0(e21.tokenData); + r10.context = e21.context, r10.specializerSpecs = e21.specialized || [], r10.specialized = new Uint16Array(r10.specializerSpecs.length); + for (var b10 = 0; b10 < r10.specializerSpecs.length; b10++) + r10.specialized[b10] = r10.specializerSpecs[b10].term; + return r10.specializers = r10.specializerSpecs.map(Y0), r10.states = R0(e21.states, Uint32Array), r10.data = R0(e21.stateData), r10.goto = R0(e21.goto), r10.maxTerm = e21.maxTerm, r10.tokenizers = e21.tokenizers.map(function(e23) { + return "number" == typeof e23 ? new q0(y10, e23) : e23; + }), r10.topRules = e21.topRules, r10.dialects = e21.dialects || {}, r10.dynamicPrecedences = e21.dynamicPrecedences || null, r10.tokenPrecTable = e21.tokenPrec, r10.termNames = e21.termNames || null, r10.maxNode = r10.nodeSet.types.length - 1, r10.dialect = r10.parseDialect(), r10.top = r10.topRules[Object.keys(r10.topRules)[0]], r10; + } + return Ao(t10, iQ), Do(t10, [{ key: "createParse", value: function(e21, t11, n10) { + var r10, o10 = new U0(this, e21, t11, n10), i10 = bo(this.wrappers); + try { + for (i10.s(); !(r10 = i10.n()).done; ) { + o10 = (0, r10.value)(o10, e21, t11, n10); + } + } catch (e23) { + i10.e(e23); + } finally { + i10.f(); + } + return o10; + } }, { key: "getGoto", value: function(e21, t11) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], r10 = this.goto; + if (t11 >= r10[0]) + return -1; + for (var o10 = r10[t11 + 1]; ; ) { + var i10 = r10[o10++], a10 = 1 & i10, s10 = r10[o10++]; + if (a10 && n10) + return s10; + for (var c10 = o10 + (i10 >> 1); o10 < c10; o10++) + if (r10[o10] == e21) + return s10; + if (a10) + return -1; + } + } }, { key: "hasAction", value: function(e21, t11) { + for (var n10 = this.data, r10 = 0; r10 < 2; r10++) + for (var o10, i10 = this.stateSlot(e21, r10 ? 2 : 1); ; i10 += 3) { + if (65535 == (o10 = n10[i10])) { + if (1 != n10[i10 + 1]) { + if (2 == n10[i10 + 1]) + return Q0(n10, i10 + 2); + break; + } + o10 = n10[i10 = Q0(n10, i10 + 2)]; + } + if (o10 == t11 || 0 == o10) + return Q0(n10, i10 + 1); + } + return 0; + } }, { key: "stateSlot", value: function(e21, t11) { + return this.states[6 * e21 + t11]; + } }, { key: "stateFlag", value: function(e21, t11) { + return (this.stateSlot(e21, 0) & t11) > 0; + } }, { key: "validAction", value: function(e21, t11) { + return !!this.allActions(e21, function(e23) { + return e23 == t11 || null; + }); + } }, { key: "allActions", value: function(e21, t11) { + for (var n10 = this.stateSlot(e21, 4), r10 = n10 ? t11(n10) : void 0, o10 = this.stateSlot(e21, 1); null == r10; o10 += 3) { + if (65535 == this.data[o10]) { + if (1 != this.data[o10 + 1]) + break; + o10 = Q0(this.data, o10 + 2); + } + r10 = t11(Q0(this.data, o10 + 1)); + } + return r10; + } }, { key: "nextStates", value: function(e21) { + for (var t11 = this, n10 = [], r10 = function(e23) { + if (65535 == t11.data[e23]) { + if (1 != t11.data[e23 + 1]) + return o10 = e23, 1; + e23 = Q0(t11.data, e23 + 2); + } + if (0 == (1 & t11.data[e23 + 2])) { + var r11 = t11.data[e23 + 1]; + n10.some(function(e24, t12) { + return 1 & t12 && e24 == r11; + }) || n10.push(t11.data[e23], r11); + } + o10 = e23; + }, o10 = this.stateSlot(e21, 1); !r10(o10); o10 += 3) + ; + return n10; + } }, { key: "configure", value: function(e21) { + var n10, r10 = Object.assign(Object.create(t10.prototype), this); + if (e21.props && (r10.nodeSet = (n10 = this.nodeSet).extend.apply(n10, Bo(e21.props))), e21.top) { + var o10 = this.topRules[e21.top]; + if (!o10) + throw new RangeError("Invalid top rule name ".concat(e21.top)); + r10.top = o10; + } + return e21.tokenizers && (r10.tokenizers = this.tokenizers.map(function(t11) { + var n11 = e21.tokenizers.find(function(e23) { + return e23.from == t11; + }); + return n11 ? n11.to : t11; + })), e21.specializers && (r10.specializers = this.specializers.slice(), r10.specializerSpecs = this.specializerSpecs.map(function(t11, n11) { + var o11 = e21.specializers.find(function(e23) { + return e23.from == t11.external; + }); + if (!o11) + return t11; + var i10 = Object.assign(Object.assign({}, t11), { external: o11.to }); + return r10.specializers[n11] = Y0(i10), i10; + })), e21.contextTracker && (r10.context = e21.contextTracker), e21.dialect && (r10.dialect = this.parseDialect(e21.dialect)), null != e21.strict && (r10.strict = e21.strict), e21.wrap && (r10.wrappers = r10.wrappers.concat(e21.wrap)), null != e21.bufferLength && (r10.bufferLength = e21.bufferLength), r10; + } }, { key: "hasWrappers", value: function() { + return this.wrappers.length > 0; + } }, { key: "getName", value: function(e21) { + return this.termNames ? this.termNames[e21] : String(e21 <= this.maxNode && this.nodeSet.types[e21].name || e21); + } }, { key: "eofTerm", get: function() { + return this.maxNode + 1; + } }, { key: "topNode", get: function() { + return this.nodeSet.types[this.top[1]]; + } }, { key: "dynamicPrecedence", value: function(e21) { + var t11 = this.dynamicPrecedences; + return null == t11 ? 0 : t11[e21] || 0; + } }, { key: "parseDialect", value: function(e21) { + var t11 = Object.keys(this.dialects), n10 = t11.map(function() { + return false; + }); + if (e21) { + var r10, o10 = bo(e21.split(" ")); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value, a10 = t11.indexOf(i10); + a10 >= 0 && (n10[a10] = true); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + } + for (var s10 = null, c10 = 0; c10 < t11.length; c10++) + if (!n10[c10]) + for (var l10, u10 = this.dialects[t11[c10]]; 65535 != (l10 = this.data[u10++]); ) + (s10 || (s10 = new Uint8Array(this.maxTerm + 1)))[l10] = 1; + return new K0(e21, n10, s10); + } }], [{ key: "deserialize", value: function(e21) { + return new t10(e21); + } }]), t10; + }(); + function Q0(e20, t10) { + return e20[t10] | e20[t10 + 1] << 16; + } + function Y0(e20) { + if (e20.external) { + var t10 = e20.extend ? 1 : 0; + return function(n10, r10) { + return e20.external(n10, r10) << 1 | t10; + }; + } + return e20.get; + } + var X0 = fQ({ String: TQ.string, Number: TQ.number, "True False": TQ.bool, PropertyName: TQ.propertyName, Null: TQ.null, ",": TQ.separator, "[ ]": TQ.squareBracket, "{ }": TQ.brace }); + var Z0 = G0.deserialize({ version: 14, states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j", stateData: "#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O", goto: "!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R", nodeNames: "\u26A0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array", maxTerm: 25, nodeProps: [["openedBy", 7, "{", 12, "["], ["closedBy", 8, "}", 13, "]"]], propSources: [X0], skippedNodes: [0], repeatNodeCount: 2, tokenData: "(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~", tokenizers: [0], topRules: { JsonText: [0, 1] }, tokenPrec: 0 }); + var e1 = qQ.define({ name: "json", parser: Z0.configure({ props: [nY.add({ Object: cY({ except: /^\s*\}/ }), Array: cY({ except: /^\s*\]/ }) }), fY.add({ "Object Array": function(e20) { + var t10 = e20.firstChild, n10 = e20.lastChild; + return t10 && t10.to < n10.from ? { from: t10.to, to: n10.type.isError ? e20.to : n10.from } : null; + } })] }), languageData: { closeBrackets: { brackets: ["[", "{", '"'] }, indentOnInput: /^\s*[\}\]]$/ } }); + var t1 = "function" == typeof String.prototype.normalize ? function(e20) { + return e20.normalize("NFKD"); + } : function(e20) { + return e20; + }; + var n1 = function() { + function e20(t10, n10) { + var r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, o10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : t10.length, i10 = arguments.length > 4 ? arguments[4] : void 0, a10 = arguments.length > 5 ? arguments[5] : void 0; + No(this, e20), this.test = a10, this.value = { from: 0, to: 0 }, this.done = false, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = t10.iterRange(r10, o10), this.bufferStart = r10, this.normalize = i10 ? function(e21) { + return i10(t1(e21)); + } : t1, this.query = this.normalize(n10); + } + return Do(e20, [{ key: "peek", value: function() { + if (this.bufferPos == this.buffer.length) { + if (this.bufferStart += this.buffer.length, this.iter.next(), this.iter.done) + return -1; + this.bufferPos = 0, this.buffer = this.iter.value; + } + return dF(this.buffer, this.bufferPos); + } }, { key: "next", value: function() { + for (; this.matches.length; ) + this.matches.pop(); + return this.nextOverlapping(); + } }, { key: "nextOverlapping", value: function() { + for (; ; ) { + var e21 = this.peek(); + if (e21 < 0) + return this.done = true, this; + var t10 = hF(e21), n10 = this.bufferStart + this.bufferPos; + this.bufferPos += vF(e21); + for (var r10 = this.normalize(t10), o10 = 0, i10 = n10; ; o10++) { + var a10 = r10.charCodeAt(o10), s10 = this.match(a10, i10); + if (o10 == r10.length - 1) { + if (s10) + return this.value = s10, this; + break; + } + i10 == n10 && o10 < t10.length && t10.charCodeAt(o10) == a10 && i10++; + } + } + } }, { key: "match", value: function(e21, t10) { + for (var n10 = null, r10 = 0; r10 < this.matches.length; r10 += 2) { + var o10 = this.matches[r10], i10 = false; + this.query.charCodeAt(o10) == e21 && (o10 == this.query.length - 1 ? n10 = { from: this.matches[r10 + 1], to: t10 + 1 } : (this.matches[r10]++, i10 = true)), i10 || (this.matches.splice(r10, 2), r10 -= 2); + } + return this.query.charCodeAt(0) == e21 && (1 == this.query.length ? n10 = { from: t10, to: t10 + 1 } : this.matches.push(1, t10)), n10 && this.test && !this.test(n10.from, n10.to, this.buffer, this.bufferStart) && (n10 = null), n10; + } }]), e20; + }(); + "undefined" != typeof Symbol && (n1.prototype[Symbol.iterator] = function() { + return this; + }); + var r1 = { from: -1, to: -1, match: /.*/.exec("") }; + var o1 = "gm" + (null == /x/.unicode ? "" : "u"); + var i1 = function() { + function e20(t10, n10, r10) { + var o10 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, i10 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : t10.length; + if (No(this, e20), this.text = t10, this.to = i10, this.curLine = "", this.done = false, this.value = r1, /\\[sWDnr]|\n|\r|\[\^/.test(n10)) + return new c1(t10, n10, r10, o10, i10); + this.re = new RegExp(n10, o1 + ((null == r10 ? void 0 : r10.ignoreCase) ? "i" : "")), this.test = null == r10 ? void 0 : r10.test, this.iter = t10.iter(); + var a10 = t10.lineAt(o10); + this.curLineStart = a10.from, this.matchPos = l1(t10, o10), this.getLine(this.curLineStart); + } + return Do(e20, [{ key: "getLine", value: function(e21) { + this.iter.next(e21), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next()); + } }, { key: "nextLine", value: function() { + this.curLineStart = this.curLineStart + this.curLine.length + 1, this.curLineStart > this.to ? this.curLine = "" : this.getLine(0); + } }, { key: "next", value: function() { + for (var e21 = this.matchPos - this.curLineStart; ; ) { + this.re.lastIndex = e21; + var t10 = this.matchPos <= this.to && this.re.exec(this.curLine); + if (t10) { + var n10 = this.curLineStart + t10.index, r10 = n10 + t10[0].length; + if (this.matchPos = l1(this.text, r10 + (n10 == r10 ? 1 : 0)), n10 == this.curLineStart + this.curLine.length && this.nextLine(), (n10 < r10 || n10 > this.value.to) && (!this.test || this.test(n10, r10, t10))) + return this.value = { from: n10, to: r10, match: t10 }, this; + e21 = this.matchPos - this.curLineStart; + } else { + if (!(this.curLineStart + this.curLine.length < this.to)) + return this.done = true, this; + this.nextLine(), e21 = 0; + } + } + } }]), e20; + }(); + var a1 = /* @__PURE__ */ new WeakMap(); + var s1 = function() { + function e20(t10, n10) { + No(this, e20), this.from = t10, this.text = n10; + } + return Do(e20, [{ key: "to", get: function() { + return this.from + this.text.length; + } }], [{ key: "get", value: function(t10, n10, r10) { + var o10 = a1.get(t10); + if (!o10 || o10.from >= r10 || o10.to <= n10) { + var i10 = new e20(n10, t10.sliceString(n10, r10)); + return a1.set(t10, i10), i10; + } + if (o10.from == n10 && o10.to == r10) + return o10; + var a10 = o10.text, s10 = o10.from; + return s10 > n10 && (a10 = t10.sliceString(n10, s10) + a10, s10 = n10), o10.to < r10 && (a10 += t10.sliceString(o10.to, r10)), a1.set(t10, new e20(s10, a10)), new e20(n10, a10.slice(n10 - s10, r10 - s10)); + } }]), e20; + }(); + var c1 = function() { + function e20(t10, n10, r10, o10, i10) { + No(this, e20), this.text = t10, this.to = i10, this.done = false, this.value = r1, this.matchPos = l1(t10, o10), this.re = new RegExp(n10, o1 + ((null == r10 ? void 0 : r10.ignoreCase) ? "i" : "")), this.test = null == r10 ? void 0 : r10.test, this.flat = s1.get(t10, o10, this.chunkEnd(o10 + 5e3)); + } + return Do(e20, [{ key: "chunkEnd", value: function(e21) { + return e21 >= this.to ? this.to : this.text.lineAt(e21).to; + } }, { key: "next", value: function() { + for (; ; ) { + var e21 = this.re.lastIndex = this.matchPos - this.flat.from, t10 = this.re.exec(this.flat.text); + if (t10 && !t10[0] && t10.index == e21 && (this.re.lastIndex = e21 + 1, t10 = this.re.exec(this.flat.text)), t10) { + var n10 = this.flat.from + t10.index, r10 = n10 + t10[0].length; + if ((this.flat.to >= this.to || t10.index + t10[0].length <= this.flat.text.length - 10) && (!this.test || this.test(n10, r10, t10))) + return this.value = { from: n10, to: r10, match: t10 }, this.matchPos = l1(this.text, r10 + (n10 == r10 ? 1 : 0)), this; + } + if (this.flat.to == this.to) + return this.done = true, this; + this.flat = s1.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + 2 * this.flat.text.length)); + } + } }]), e20; + }(); + function l1(e20, t10) { + if (t10 >= e20.length) + return t10; + for (var n10, r10 = e20.lineAt(t10); t10 < r10.to && (n10 = r10.text.charCodeAt(t10 - r10.from)) >= 56320 && n10 < 57344; ) + t10++; + return t10; + } + function u1(e20) { + var t10 = JZ("input", { class: "cm-textfield", name: "line", value: String(e20.state.doc.lineAt(e20.state.selection.main.head).number) }); + function n10() { + var n11 = /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t10.value); + if (n11) { + var r10 = e20.state, o10 = r10.doc.lineAt(r10.selection.main.head), i10 = jo(n11, 5), a10 = i10[1], s10 = i10[2], c10 = i10[3], l10 = i10[4], u10 = c10 ? +c10.slice(1) : 0, f10 = s10 ? +s10 : o10.number; + if (s10 && l10) { + var d10 = f10 / 100; + a10 && (d10 = d10 * ("-" == a10 ? -1 : 1) + o10.number / r10.doc.lines), f10 = Math.round(r10.doc.lines * d10); + } else + s10 && a10 && (f10 = f10 * ("-" == a10 ? -1 : 1) + o10.number); + var h10 = r10.doc.line(Math.max(1, Math.min(r10.doc.lines, f10))), v10 = $F.cursor(h10.from + Math.max(0, Math.min(u10, h10.length))); + e20.dispatch({ effects: [f1.of(false), zJ.scrollIntoView(v10.from, { y: "center" })], selection: v10 }), e20.focus(); + } + } + return { dom: JZ("form", { class: "cm-gotoLine", onkeydown: function(t11) { + 27 == t11.keyCode ? (t11.preventDefault(), e20.dispatch({ effects: f1.of(false) }), e20.focus()) : 13 == t11.keyCode && (t11.preventDefault(), n10()); + }, onsubmit: function(e21) { + e21.preventDefault(), n10(); + } }, JZ("label", e20.state.phrase("Go to line"), ": ", t10), " ", JZ("button", { class: "cm-button", type: "submit" }, e20.state.phrase("go"))) }; + } + "undefined" != typeof Symbol && (i1.prototype[Symbol.iterator] = c1.prototype[Symbol.iterator] = function() { + return this; + }); + var f1 = oV.define(); + var d1 = NF.define({ create: function() { + return true; + }, update: function(e20, t10) { + var n10, r10 = bo(t10.effects); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + o10.is(f1) && (e20 = o10.value); + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + return e20; + }, provide: function(e20) { + return aG.from(e20, function(e21) { + return e21 ? u1 : null; + }); + } }); + var h1 = zJ.baseTheme({ ".cm-panel.cm-gotoLine": { padding: "2px 6px 4px", "& label": { fontSize: "80%" } } }); + var v1 = { highlightWordAroundCursor: false, minSelectionLength: 1, maxMatches: 100, wholeWords: false }; + var p1 = MF.define({ combine: function(e20) { + return gV(e20, v1, { highlightWordAroundCursor: function(e21, t10) { + return e21 || t10; + }, minSelectionLength: Math.min, maxMatches: Math.min }); + } }); + var m1 = KH.mark({ class: "cm-selectionMatch" }); + var g1 = KH.mark({ class: "cm-selectionMatch cm-selectionMatch-main" }); + function y1(e20, t10, n10, r10) { + return !(0 != n10 && e20(t10.sliceDoc(n10 - 1, n10)) == hV.Word || r10 != t10.doc.length && e20(t10.sliceDoc(r10, r10 + 1)) == hV.Word); + } + var b1 = FW.fromClass(function() { + function e20(t10) { + No(this, e20), this.decorations = this.getDeco(t10); + } + return Do(e20, [{ key: "update", value: function(e21) { + (e21.selectionSet || e21.docChanged || e21.viewportChanged) && (this.decorations = this.getDeco(e21.view)); + } }, { key: "getDeco", value: function(e21) { + var t10 = e21.state.facet(p1), n10 = e21.state, r10 = n10.selection; + if (r10.ranges.length > 1) + return KH.none; + var o10, i10 = r10.main, a10 = null; + if (i10.empty) { + if (!t10.highlightWordAroundCursor) + return KH.none; + var s10 = n10.wordAt(i10.head); + if (!s10) + return KH.none; + a10 = n10.charCategorizer(i10.head), o10 = n10.sliceDoc(s10.from, s10.to); + } else { + var c10 = i10.to - i10.from; + if (c10 < t10.minSelectionLength || c10 > 200) + return KH.none; + if (t10.wholeWords) { + if (o10 = n10.sliceDoc(i10.from, i10.to), !y1(a10 = n10.charCategorizer(i10.head), n10, i10.from, i10.to) || !function(e23, t11, n11, r11) { + return e23(t11.sliceDoc(n11, n11 + 1)) == hV.Word && e23(t11.sliceDoc(r11 - 1, r11)) == hV.Word; + }(a10, n10, i10.from, i10.to)) + return KH.none; + } else if (!(o10 = n10.sliceDoc(i10.from, i10.to).trim())) + return KH.none; + } + var l10, u10 = [], f10 = bo(e21.visibleRanges); + try { + for (f10.s(); !(l10 = f10.n()).done; ) + for (var d10 = l10.value, h10 = new n1(n10.doc, o10, d10.from, d10.to); !h10.next().done; ) { + var v10 = h10.value, p10 = v10.from, m10 = v10.to; + if ((!a10 || y1(a10, n10, p10, m10)) && (i10.empty && p10 <= i10.from && m10 >= i10.to ? u10.push(g1.range(p10, m10)) : (p10 >= i10.to || m10 <= i10.from) && u10.push(m1.range(p10, m10)), u10.length > t10.maxMatches)) + return KH.none; + } + } catch (e23) { + f10.e(e23); + } finally { + f10.f(); + } + return KH.set(u10); + } }]), e20; + }(), { decorations: function(e20) { + return e20.decorations; + } }); + var k1 = zJ.baseTheme({ ".cm-selectionMatch": { backgroundColor: "#99ff7780" }, ".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" } }); + var w1 = MF.define({ combine: function(e20) { + return gV(e20, { top: false, caseSensitive: false, literal: false, regexp: false, wholeWord: false, createPanel: function(e21) { + return new Y1(e21); + }, scrollToMatch: function(e21) { + return zJ.scrollIntoView(e21); + } }); + } }); + function x1(e20) { + return e20 ? [w1.of(e20), r2] : r2; + } + var j1 = function() { + function e20(t10) { + No(this, e20), this.search = t10.search, this.caseSensitive = !!t10.caseSensitive, this.literal = !!t10.literal, this.regexp = !!t10.regexp, this.replace = t10.replace || "", this.valid = !!this.search && (!this.regexp || function(e21) { + try { + return new RegExp(e21, o1), true; + } catch (e23) { + return false; + } + }(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!t10.wholeWord; + } + return Do(e20, [{ key: "unquote", value: function(e21) { + return this.literal ? e21 : e21.replace(/\\([nrt\\])/g, function(e23, t10) { + return "n" == t10 ? "\n" : "r" == t10 ? "\r" : "t" == t10 ? " " : "\\"; + }); + } }, { key: "eq", value: function(e21) { + return this.search == e21.search && this.replace == e21.replace && this.caseSensitive == e21.caseSensitive && this.regexp == e21.regexp && this.wholeWord == e21.wholeWord; + } }, { key: "create", value: function() { + return this.regexp ? new E1(this) : new $1(this); + } }, { key: "getCursor", value: function(e21) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n10 = arguments.length > 2 ? arguments[2] : void 0, r10 = e21.doc ? e21 : mV.create({ doc: e21 }); + return null == n10 && (n10 = r10.doc.length), this.regexp ? _1(this, r10, t10, n10) : C1(this, r10, t10, n10); + } }]), e20; + }(); + var S1 = Do(function e14(t10) { + No(this, e14), this.spec = t10; + }); + function C1(e20, t10, n10, r10) { + return new n1(t10.doc, e20.unquoted, n10, r10, e20.caseSensitive ? void 0 : function(e21) { + return e21.toLowerCase(); + }, e20.wholeWord ? /* @__PURE__ */ function(e21, t11) { + return function(n11, r11, o10, i10) { + return (i10 > n11 || i10 + o10.length < r11) && (i10 = Math.max(0, n11 - 2), o10 = e21.sliceString(i10, Math.min(e21.length, r11 + 2))), !(t11(O1(o10, n11 - i10)) == hV.Word && t11(M1(o10, n11 - i10)) == hV.Word || t11(M1(o10, r11 - i10)) == hV.Word && t11(O1(o10, r11 - i10)) == hV.Word); + }; + }(t10.doc, t10.charCategorizer(t10.selection.main.head)) : void 0); + } + var $1 = function(e20) { + function t10(e21) { + return No(this, t10), _o(this, t10, [e21]); + } + return Ao(t10, S1), Do(t10, [{ key: "nextMatch", value: function(e21, t11, n10) { + var r10 = C1(this.spec, e21, n10, e21.doc.length).nextOverlapping(); + return r10.done && (r10 = C1(this.spec, e21, 0, t11).nextOverlapping()), r10.done ? null : r10.value; + } }, { key: "prevMatchInRange", value: function(e21, t11, n10) { + for (var r10 = n10; ; ) { + for (var o10 = Math.max(t11, r10 - 1e4 - this.spec.unquoted.length), i10 = C1(this.spec, e21, o10, r10), a10 = null; !i10.nextOverlapping().done; ) + a10 = i10.value; + if (a10) + return a10; + if (o10 == t11) + return null; + r10 -= 1e4; + } + } }, { key: "prevMatch", value: function(e21, t11, n10) { + return this.prevMatchInRange(e21, 0, t11) || this.prevMatchInRange(e21, n10, e21.doc.length); + } }, { key: "getReplacement", value: function(e21) { + return this.spec.unquote(this.spec.replace); + } }, { key: "matchAll", value: function(e21, t11) { + for (var n10 = C1(this.spec, e21, 0, e21.doc.length), r10 = []; !n10.next().done; ) { + if (r10.length >= t11) + return null; + r10.push(n10.value); + } + return r10; + } }, { key: "highlight", value: function(e21, t11, n10, r10) { + for (var o10 = C1(this.spec, e21, Math.max(0, t11 - this.spec.unquoted.length), Math.min(n10 + this.spec.unquoted.length, e21.doc.length)); !o10.next().done; ) + r10(o10.value.from, o10.value.to); + } }]), t10; + }(); + function _1(e20, t10, n10, r10) { + return new i1(t10.doc, e20.search, { ignoreCase: !e20.caseSensitive, test: e20.wholeWord ? (o10 = t10.charCategorizer(t10.selection.main.head), function(e21, t11, n11) { + return !n11[0].length || (o10(O1(n11.input, n11.index)) != hV.Word || o10(M1(n11.input, n11.index)) != hV.Word) && (o10(M1(n11.input, n11.index + n11[0].length)) != hV.Word || o10(O1(n11.input, n11.index + n11[0].length)) != hV.Word); + }) : void 0 }, n10, r10); + var o10; + } + function O1(e20, t10) { + return e20.slice(sF(e20, t10, false), t10); + } + function M1(e20, t10) { + return e20.slice(t10, sF(e20, t10)); + } + var E1 = function(e20) { + function t10() { + return No(this, t10), _o(this, t10, arguments); + } + return Ao(t10, S1), Do(t10, [{ key: "nextMatch", value: function(e21, t11, n10) { + var r10 = _1(this.spec, e21, n10, e21.doc.length).next(); + return r10.done && (r10 = _1(this.spec, e21, 0, t11).next()), r10.done ? null : r10.value; + } }, { key: "prevMatchInRange", value: function(e21, t11, n10) { + for (var r10 = 1; ; r10++) { + for (var o10 = Math.max(t11, n10 - 1e4 * r10), i10 = _1(this.spec, e21, o10, n10), a10 = null; !i10.next().done; ) + a10 = i10.value; + if (a10 && (o10 == t11 || a10.from > o10 + 10)) + return a10; + if (o10 == t11) + return null; + } + } }, { key: "prevMatch", value: function(e21, t11, n10) { + return this.prevMatchInRange(e21, 0, t11) || this.prevMatchInRange(e21, n10, e21.doc.length); + } }, { key: "getReplacement", value: function(e21) { + return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g, function(t11, n10) { + return "$" == n10 ? "$" : "&" == n10 ? e21.match[0] : "0" != n10 && +n10 < e21.match.length ? e21.match[n10] : t11; + }); + } }, { key: "matchAll", value: function(e21, t11) { + for (var n10 = _1(this.spec, e21, 0, e21.doc.length), r10 = []; !n10.next().done; ) { + if (r10.length >= t11) + return null; + r10.push(n10.value); + } + return r10; + } }, { key: "highlight", value: function(e21, t11, n10, r10) { + for (var o10 = _1(this.spec, e21, Math.max(0, t11 - 250), Math.min(n10 + 250, e21.doc.length)); !o10.next().done; ) + r10(o10.value.from, o10.value.to); + } }]), t10; + }(); + var A1 = oV.define(); + var P1 = oV.define(); + var T1 = NF.define({ create: function(e20) { + return new R1(W1(e20).create(), null); + }, update: function(e20, t10) { + var n10, r10 = bo(t10.effects); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + o10.is(A1) ? e20 = new R1(o10.value.create(), e20.panel) : o10.is(P1) && (e20 = new R1(e20.query, o10.value ? H1 : null)); + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + return e20; + }, provide: function(e20) { + return aG.from(e20, function(e21) { + return e21.panel; + }); + } }); + var R1 = Do(function e15(t10, n10) { + No(this, e15), this.query = t10, this.panel = n10; + }); + var N1 = KH.mark({ class: "cm-searchMatch" }); + var I1 = KH.mark({ class: "cm-searchMatch cm-searchMatch-selected" }); + var D1 = FW.fromClass(function() { + function e20(t10) { + No(this, e20), this.view = t10, this.decorations = this.highlight(t10.state.field(T1)); + } + return Do(e20, [{ key: "update", value: function(e21) { + var t10 = e21.state.field(T1); + (t10 != e21.startState.field(T1) || e21.docChanged || e21.selectionSet || e21.viewportChanged) && (this.decorations = this.highlight(t10)); + } }, { key: "highlight", value: function(e21) { + var t10 = e21.query; + if (!e21.panel || !t10.spec.valid) + return KH.none; + for (var n10 = this.view, r10 = new jV(), o10 = 0, i10 = n10.visibleRanges, a10 = i10.length; o10 < a10; o10++) { + for (var s10 = i10[o10], c10 = s10.from, l10 = s10.to; o10 < a10 - 1 && l10 > i10[o10 + 1].from - 500; ) + l10 = i10[++o10].to; + t10.highlight(n10.state, c10, l10, function(e23, t11) { + var o11 = n10.state.selection.ranges.some(function(n11) { + return n11.from == e23 && n11.to == t11; + }); + r10.add(e23, t11, o11 ? I1 : N1); + }); + } + return r10.finish(); + } }]), e20; + }(), { decorations: function(e20) { + return e20.decorations; + } }); + function q1(e20) { + return function(t10) { + var n10 = t10.state.field(T1, false); + return n10 && n10.query.spec.valid ? e20(t10, n10) : K1(t10); + }; + } + var z1 = q1(function(e20, t10) { + var n10 = t10.query, r10 = e20.state.selection.main.to, o10 = n10.nextMatch(e20.state, r10, r10); + if (!o10) + return false; + var i10 = $F.single(o10.from, o10.to), a10 = e20.state.facet(w1); + return e20.dispatch({ selection: i10, effects: [t2(e20, o10), a10.scrollToMatch(i10.main, e20)], userEvent: "select.search" }), J1(e20), true; + }); + var B1 = q1(function(e20, t10) { + var n10 = t10.query, r10 = e20.state, o10 = r10.selection.main.from, i10 = n10.prevMatch(r10, o10, o10); + if (!i10) + return false; + var a10 = $F.single(i10.from, i10.to), s10 = e20.state.facet(w1); + return e20.dispatch({ selection: a10, effects: [t2(e20, i10), s10.scrollToMatch(a10.main, e20)], userEvent: "select.search" }), J1(e20), true; + }); + var L1 = q1(function(e20, t10) { + var n10 = t10.query.matchAll(e20.state, 1e3); + return !(!n10 || !n10.length) && (e20.dispatch({ selection: $F.create(n10.map(function(e21) { + return $F.range(e21.from, e21.to); + })), userEvent: "select.search.matches" }), true); + }); + var F1 = q1(function(e20, t10) { + var n10 = t10.query, r10 = e20.state, o10 = r10.selection.main, i10 = o10.from, a10 = o10.to; + if (r10.readOnly) + return false; + var s10 = n10.nextMatch(r10, i10, i10); + if (!s10) + return false; + var c10, l10, u10 = [], f10 = []; + if (s10.from == i10 && s10.to == a10 && (l10 = r10.toText(n10.getReplacement(s10)), u10.push({ from: s10.from, to: s10.to, insert: l10 }), s10 = n10.nextMatch(r10, s10.from, s10.to), f10.push(zJ.announce.of(r10.phrase("replaced match on line $", r10.doc.lineAt(i10).number) + "."))), s10) { + var d10 = 0 == u10.length || u10[0].from >= s10.to ? 0 : s10.to - s10.from - l10.length; + c10 = $F.single(s10.from - d10, s10.to - d10), f10.push(t2(e20, s10)), f10.push(r10.facet(w1).scrollToMatch(c10.main, e20)); + } + return e20.dispatch({ changes: u10, selection: c10, effects: f10, userEvent: "input.replace" }), true; + }); + var V1 = q1(function(e20, t10) { + var n10 = t10.query; + if (e20.state.readOnly) + return false; + var r10 = n10.matchAll(e20.state, 1e9).map(function(e21) { + return { from: e21.from, to: e21.to, insert: n10.getReplacement(e21) }; + }); + if (!r10.length) + return false; + var o10 = e20.state.phrase("replaced $ matches", r10.length) + "."; + return e20.dispatch({ changes: r10, effects: zJ.announce.of(o10), userEvent: "input.replace.all" }), true; + }); + function H1(e20) { + return e20.state.facet(w1).createPanel(e20); + } + function W1(e20, t10) { + var n10, r10, o10, i10, a10, s10 = e20.selection.main, c10 = s10.empty || s10.to > s10.from + 100 ? "" : e20.sliceDoc(s10.from, s10.to); + if (t10 && !c10) + return t10; + var l10 = e20.facet(w1); + return new j1({ search: (null !== (n10 = null == t10 ? void 0 : t10.literal) && void 0 !== n10 ? n10 : l10.literal) ? c10 : c10.replace(/\n/g, "\\n"), caseSensitive: null !== (r10 = null == t10 ? void 0 : t10.caseSensitive) && void 0 !== r10 ? r10 : l10.caseSensitive, literal: null !== (o10 = null == t10 ? void 0 : t10.literal) && void 0 !== o10 ? o10 : l10.literal, regexp: null !== (i10 = null == t10 ? void 0 : t10.regexp) && void 0 !== i10 ? i10 : l10.regexp, wholeWord: null !== (a10 = null == t10 ? void 0 : t10.wholeWord) && void 0 !== a10 ? a10 : l10.wholeWord }); + } + function U1(e20) { + var t10 = nG(e20, H1); + return t10 && t10.dom.querySelector("[main-field]"); + } + function J1(e20) { + var t10 = U1(e20); + t10 && t10 == e20.root.activeElement && t10.select(); + } + var K1 = function(e20) { + var t10 = e20.state.field(T1, false); + if (t10 && t10.panel) { + var n10 = U1(e20); + if (n10 && n10 != e20.root.activeElement) { + var r10 = W1(e20.state, t10.query.spec); + r10.valid && e20.dispatch({ effects: A1.of(r10) }), n10.focus(), n10.select(); + } + } else + e20.dispatch({ effects: [P1.of(true), t10 ? A1.of(W1(e20.state, t10.query.spec)) : oV.appendConfig.of(r2)] }); + return true; + }; + var G1 = function(e20) { + var t10 = e20.state.field(T1, false); + if (!t10 || !t10.panel) + return false; + var n10 = nG(e20, H1); + return n10 && n10.dom.contains(e20.root.activeElement) && e20.focus(), e20.dispatch({ effects: P1.of(false) }), true; + }; + var Q1 = [{ key: "Mod-f", run: K1, scope: "editor search-panel" }, { key: "F3", run: z1, shift: B1, scope: "editor search-panel", preventDefault: true }, { key: "Mod-g", run: z1, shift: B1, scope: "editor search-panel", preventDefault: true }, { key: "Escape", run: G1, scope: "editor search-panel" }, { key: "Mod-Shift-l", run: function(e20) { + var t10 = e20.state, n10 = e20.dispatch, r10 = t10.selection; + if (r10.ranges.length > 1 || r10.main.empty) + return false; + for (var o10 = r10.main, i10 = o10.from, a10 = o10.to, s10 = [], c10 = 0, l10 = new n1(t10.doc, t10.sliceDoc(i10, a10)); !l10.next().done; ) { + if (s10.length > 1e3) + return false; + l10.value.from == i10 && (c10 = s10.length), s10.push($F.range(l10.value.from, l10.value.to)); + } + return n10(t10.update({ selection: $F.create(s10, c10), userEvent: "select.search.matches" })), true; + } }, { key: "Mod-Alt-g", run: function(e20) { + var t10 = nG(e20, u1); + if (!t10) { + var n10 = [f1.of(true)]; + null == e20.state.field(d1, false) && n10.push(oV.appendConfig.of([d1, h1])), e20.dispatch({ effects: n10 }), t10 = nG(e20, u1); + } + return t10 && t10.dom.querySelector("input").select(), true; + } }, { key: "Mod-d", run: function(e20) { + var t10 = e20.state, n10 = e20.dispatch, r10 = t10.selection.ranges; + if (r10.some(function(e21) { + return e21.from === e21.to; + })) + return function(e21) { + var t11 = e21.state, n11 = e21.dispatch, r11 = t11.selection, o11 = $F.create(r11.ranges.map(function(e23) { + return t11.wordAt(e23.head) || $F.cursor(e23.head); + }), r11.mainIndex); + return !o11.eq(r11) && (n11(t11.update({ selection: o11 })), true); + }({ state: t10, dispatch: n10 }); + var o10 = t10.sliceDoc(r10[0].from, r10[0].to); + if (t10.selection.ranges.some(function(e21) { + return t10.sliceDoc(e21.from, e21.to) != o10; + })) + return false; + var i10 = function(e21, t11) { + for (var n11, r11 = e21.selection, o11 = r11.main, i11 = r11.ranges, a10 = e21.wordAt(o11.head), s10 = a10 && a10.from == o11.from && a10.to == o11.to, c10 = function(n12, r12) { + if (r12.next(), !r12.done) { + if (n12 && i11.some(function(e23) { + return e23.from == r12.value.from; + })) + return l10 = n12, u10 = r12, 0; + if (s10) { + var o12 = e21.wordAt(r12.value.from); + if (!o12 || o12.from != r12.value.from || o12.to != r12.value.to) + return l10 = n12, u10 = r12, 0; + } + return { v: r12.value }; + } + if (n12) + return { v: null }; + r12 = new n1(e21.doc, t11, 0, Math.max(0, i11[i11.length - 1].from - 1)), l10 = n12 = true, u10 = r12; + }, l10 = false, u10 = new n1(e21.doc, t11, i11[i11.length - 1].to); ; ) + if (0 !== (n11 = c10(l10, u10)) && n11) + return n11.v; + }(t10, o10); + return !!i10 && (n10(t10.update({ selection: t10.selection.addRange($F.range(i10.from, i10.to), false), effects: zJ.scrollIntoView(i10.to) })), true); + }, preventDefault: true }]; + var Y1 = function() { + function e20(t10) { + var n10 = this; + No(this, e20), this.view = t10; + var r10 = this.query = t10.state.field(T1).query.spec; + function o10(e21, t11, n11) { + return JZ("button", { class: "cm-button", name: e21, onclick: t11, type: "button" }, n11); + } + this.commit = this.commit.bind(this), this.searchField = JZ("input", { value: r10.search, placeholder: X1(t10, "Find"), "aria-label": X1(t10, "Find"), class: "cm-textfield", name: "search", form: "", "main-field": "true", onchange: this.commit, onkeyup: this.commit }), this.replaceField = JZ("input", { value: r10.replace, placeholder: X1(t10, "Replace"), "aria-label": X1(t10, "Replace"), class: "cm-textfield", name: "replace", form: "", onchange: this.commit, onkeyup: this.commit }), this.caseField = JZ("input", { type: "checkbox", name: "case", form: "", checked: r10.caseSensitive, onchange: this.commit }), this.reField = JZ("input", { type: "checkbox", name: "re", form: "", checked: r10.regexp, onchange: this.commit }), this.wordField = JZ("input", { type: "checkbox", name: "word", form: "", checked: r10.wholeWord, onchange: this.commit }), this.dom = JZ("div", { onkeydown: function(e21) { + return n10.keydown(e21); + }, class: "cm-search" }, [this.searchField, o10("next", function() { + return z1(t10); + }, [X1(t10, "next")]), o10("prev", function() { + return B1(t10); + }, [X1(t10, "previous")]), o10("select", function() { + return L1(t10); + }, [X1(t10, "all")]), JZ("label", null, [this.caseField, X1(t10, "match case")]), JZ("label", null, [this.reField, X1(t10, "regexp")]), JZ("label", null, [this.wordField, X1(t10, "by word")])].concat(Bo(t10.state.readOnly ? [] : [JZ("br"), this.replaceField, o10("replace", function() { + return F1(t10); + }, [X1(t10, "replace")]), o10("replaceAll", function() { + return V1(t10); + }, [X1(t10, "replace all")])]), [JZ("button", { name: "close", onclick: function() { + return G1(t10); + }, "aria-label": X1(t10, "close"), type: "button" }, ["\xD7"])])); + } + return Do(e20, [{ key: "commit", value: function() { + var e21 = new j1({ search: this.searchField.value, caseSensitive: this.caseField.checked, regexp: this.reField.checked, wholeWord: this.wordField.checked, replace: this.replaceField.value }); + e21.eq(this.query) || (this.query = e21, this.view.dispatch({ effects: A1.of(e21) })); + } }, { key: "keydown", value: function(e21) { + !function(e23, t10, n10) { + return XJ(GJ(e23.state), t10, e23, n10); + }(this.view, e21, "search-panel") ? 13 == e21.keyCode && e21.target == this.searchField ? (e21.preventDefault(), (e21.shiftKey ? B1 : z1)(this.view)) : 13 == e21.keyCode && e21.target == this.replaceField && (e21.preventDefault(), F1(this.view)) : e21.preventDefault(); + } }, { key: "update", value: function(e21) { + var t10, n10 = bo(e21.transactions); + try { + for (n10.s(); !(t10 = n10.n()).done; ) { + var r10, o10 = bo(t10.value.effects); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + i10.is(A1) && !i10.value.eq(this.query) && this.setQuery(i10.value); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + } }, { key: "setQuery", value: function(e21) { + this.query = e21, this.searchField.value = e21.search, this.replaceField.value = e21.replace, this.caseField.checked = e21.caseSensitive, this.reField.checked = e21.regexp, this.wordField.checked = e21.wholeWord; + } }, { key: "mount", value: function() { + this.searchField.select(); + } }, { key: "pos", get: function() { + return 80; + } }, { key: "top", get: function() { + return this.view.state.facet(w1).top; + } }]), e20; + }(); + function X1(e20, t10) { + return e20.state.phrase(t10); + } + var Z1 = 30; + var e22 = /[\s\.,:;?!]/; + function t2(e20, t10) { + var n10 = t10.from, r10 = t10.to, o10 = e20.state.doc.lineAt(n10), i10 = e20.state.doc.lineAt(r10).to, a10 = Math.max(o10.from, n10 - Z1), s10 = Math.min(i10, r10 + Z1), c10 = e20.state.sliceDoc(a10, s10); + if (a10 != o10.from) { + for (var l10 = 0; l10 < Z1; l10++) + if (!e22.test(c10[l10 + 1]) && e22.test(c10[l10])) { + c10 = c10.slice(l10); + break; + } + } + if (s10 != i10) { + for (var u10 = c10.length - 1; u10 > c10.length - Z1; u10--) + if (!e22.test(c10[u10 - 1]) && e22.test(c10[u10])) { + c10 = c10.slice(0, u10); + break; + } + } + return zJ.announce.of("".concat(e20.state.phrase("current match"), ". ").concat(c10, " ").concat(e20.state.phrase("on line"), " ").concat(o10.number, ".")); + } + var n2 = zJ.baseTheme({ ".cm-panel.cm-search": { padding: "2px 6px 4px", position: "relative", "& [name=close]": { position: "absolute", top: "0", right: "4px", backgroundColor: "inherit", border: "none", font: "inherit", padding: 0, margin: 0 }, "& input, & button, & label": { margin: ".2em .6em .2em 0" }, "& input[type=checkbox]": { marginRight: ".2em" }, "& label": { fontSize: "80%", whiteSpace: "pre" } }, "&light .cm-searchMatch": { backgroundColor: "#ffff0054" }, "&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" }, "&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" }, "&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" } }); + var r2 = [T1, LF.low(D1), n2]; + var o2 = function() { + function e20(t10, n10, r10) { + No(this, e20), this.state = t10, this.pos = n10, this.explicit = r10, this.abortListeners = []; + } + return Do(e20, [{ key: "tokenBefore", value: function(e21) { + for (var t10 = zQ(this.state).resolveInner(this.pos, -1); t10 && e21.indexOf(t10.name) < 0; ) + t10 = t10.parent; + return t10 ? { from: t10.from, to: this.pos, text: this.state.sliceDoc(t10.from, this.pos), type: t10.type } : null; + } }, { key: "matchBefore", value: function(e21) { + var t10 = this.state.doc.lineAt(this.pos), n10 = Math.max(t10.from, this.pos - 250), r10 = t10.text.slice(n10 - t10.from, this.pos - t10.from), o10 = r10.search(l2(e21, false)); + return o10 < 0 ? null : { from: n10 + o10, to: this.pos, text: r10.slice(o10) }; + } }, { key: "aborted", get: function() { + return null == this.abortListeners; + } }, { key: "addEventListener", value: function(e21, t10) { + "abort" == e21 && this.abortListeners && this.abortListeners.push(t10); + } }]), e20; + }(); + function i2(e20) { + var t10 = Object.keys(e20).join(""), n10 = /\w/.test(t10); + return n10 && (t10 = t10.replace(/\w/g, "")), "[".concat(n10 ? "\\w" : "").concat(t10.replace(/[^\w\s]/g, "\\$&"), "]"); + } + function a2(e20) { + var t10 = e20.map(function(e21) { + return "string" == typeof e21 ? { label: e21 } : e21; + }), n10 = t10.every(function(e21) { + return /^\w+$/.test(e21.label); + }) ? [/\w*$/, /\w+$/] : function(e21) { + var t11, n11 = /* @__PURE__ */ Object.create(null), r11 = /* @__PURE__ */ Object.create(null), o11 = bo(e21); + try { + for (o11.s(); !(t11 = o11.n()).done; ) { + var i11 = t11.value.label; + n11[i11[0]] = true; + for (var a10 = 1; a10 < i11.length; a10++) + r11[i11[a10]] = true; + } + } catch (e23) { + o11.e(e23); + } finally { + o11.f(); + } + var s10 = i2(n11) + i2(r11) + "*$"; + return [new RegExp("^" + s10), new RegExp(s10)]; + }(t10), r10 = jo(n10, 2), o10 = r10[0], i10 = r10[1]; + return function(e21) { + var n11 = e21.matchBefore(i10); + return n11 || e21.explicit ? { from: n11 ? n11.from : e21.pos, options: t10, validFor: o10 } : null; + }; + } + var s2 = Do(function e16(t10, n10, r10, o10) { + No(this, e16), this.completion = t10, this.source = n10, this.match = r10, this.score = o10; + }); + function c2(e20) { + return e20.selection.main.from; + } + function l2(e20, t10) { + var n10, r10 = e20.source, o10 = t10 && "^" != r10[0], i10 = "$" != r10[r10.length - 1]; + return o10 || i10 ? new RegExp("".concat(o10 ? "^" : "", "(?:").concat(r10, ")").concat(i10 ? "$" : ""), null !== (n10 = e20.flags) && void 0 !== n10 ? n10 : e20.ignoreCase ? "i" : "") : e20; + } + var u2 = tV.define(); + var f2 = /* @__PURE__ */ new WeakMap(); + function d2(e20) { + if (!Array.isArray(e20)) + return e20; + var t10 = f2.get(e20); + return t10 || f2.set(e20, t10 = a2(e20)), t10; + } + var h2 = oV.define(); + var v2 = oV.define(); + var p2 = function() { + function e20(t10) { + No(this, e20), this.pattern = t10, this.chars = [], this.folded = [], this.any = [], this.precise = [], this.byWord = [], this.score = 0, this.matched = []; + for (var n10 = 0; n10 < t10.length; ) { + var r10 = dF(t10, n10), o10 = vF(r10); + this.chars.push(r10); + var i10 = t10.slice(n10, n10 + o10), a10 = i10.toUpperCase(); + this.folded.push(dF(a10 == i10 ? i10.toLowerCase() : a10, 0)), n10 += o10; + } + this.astral = t10.length != this.chars.length; + } + return Do(e20, [{ key: "ret", value: function(e21, t10) { + return this.score = e21, this.matched = t10, true; + } }, { key: "match", value: function(e21) { + if (0 == this.pattern.length) + return this.ret(-100, []); + if (e21.length < this.pattern.length) + return false; + var t10 = this.chars, n10 = this.folded, r10 = this.any, o10 = this.precise, i10 = this.byWord; + if (1 == t10.length) { + var a10 = dF(e21, 0), s10 = vF(a10), c10 = s10 == e21.length ? 0 : -100; + if (a10 == t10[0]) + ; + else { + if (a10 != n10[0]) + return false; + c10 += -200; + } + return this.ret(c10, [0, s10]); + } + var l10 = e21.indexOf(this.pattern); + if (0 == l10) + return this.ret(e21.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]); + var u10 = t10.length, f10 = 0; + if (l10 < 0) { + for (var d10 = 0, h10 = Math.min(e21.length, 200); d10 < h10 && f10 < u10; ) { + var v10 = dF(e21, d10); + v10 != t10[f10] && v10 != n10[f10] || (r10[f10++] = d10), d10 += vF(v10); + } + if (f10 < u10) + return false; + } + for (var p10 = 0, m10 = 0, g10 = false, y10 = 0, b10 = -1, k10 = -1, w10 = /[a-z]/.test(e21), x10 = true, j10 = 0, S10 = Math.min(e21.length, 200), C10 = 0; j10 < S10 && m10 < u10; ) { + var $10 = dF(e21, j10); + l10 < 0 && (p10 < u10 && $10 == t10[p10] && (o10[p10++] = j10), y10 < u10 && ($10 == t10[y10] || $10 == n10[y10] ? (0 == y10 && (b10 = j10), k10 = j10 + 1, y10++) : y10 = 0)); + var _10 = void 0, O10 = $10 < 255 ? $10 >= 48 && $10 <= 57 || $10 >= 97 && $10 <= 122 ? 2 : $10 >= 65 && $10 <= 90 ? 1 : 0 : (_10 = hF($10)) != _10.toLowerCase() ? 1 : _10 != _10.toUpperCase() ? 2 : 0; + (!j10 || 1 == O10 && w10 || 0 == C10 && 0 != O10) && (t10[m10] == $10 || n10[m10] == $10 && (g10 = true) ? i10[m10++] = j10 : i10.length && (x10 = false)), C10 = O10, j10 += vF($10); + } + return m10 == u10 && 0 == i10[0] && x10 ? this.result((g10 ? -200 : 0) - 100, i10, e21) : y10 == u10 && 0 == b10 ? this.ret(-200 - e21.length + (k10 == e21.length ? 0 : -100), [0, k10]) : l10 > -1 ? this.ret(-700 - e21.length, [l10, l10 + this.pattern.length]) : y10 == u10 ? this.ret(-900 - e21.length, [b10, k10]) : m10 == u10 ? this.result((g10 ? -200 : 0) - 100 - 700 + (x10 ? 0 : -1100), i10, e21) : 2 != t10.length && this.result((r10[0] ? -700 : 0) - 200 - 1100, r10, e21); + } }, { key: "result", value: function(e21, t10, n10) { + var r10, o10 = [], i10 = 0, a10 = bo(t10); + try { + for (a10.s(); !(r10 = a10.n()).done; ) { + var s10 = r10.value, c10 = s10 + (this.astral ? vF(dF(n10, s10)) : 1); + i10 && o10[i10 - 1] == s10 ? o10[i10 - 1] = c10 : (o10[i10++] = s10, o10[i10++] = c10); + } + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + return this.ret(e21 - n10.length, o10); + } }]), e20; + }(); + var m2 = MF.define({ combine: function(e20) { + return gV(e20, { activateOnTyping: true, selectOnOpen: true, override: null, closeOnBlur: true, maxRenderedOptions: 100, defaultKeymap: true, tooltipClass: function() { + return ""; + }, optionClass: function() { + return ""; + }, aboveCursor: false, icons: true, addToOptions: [], positionInfo: y2, compareCompletions: function(e21, t10) { + return e21.label.localeCompare(t10.label); + }, interactionDelay: 75, updateSyncTime: 100 }, { defaultKeymap: function(e21, t10) { + return e21 && t10; + }, closeOnBlur: function(e21, t10) { + return e21 && t10; + }, icons: function(e21, t10) { + return e21 && t10; + }, tooltipClass: function(e21, t10) { + return function(n10) { + return g2(e21(n10), t10(n10)); + }; + }, optionClass: function(e21, t10) { + return function(n10) { + return g2(e21(n10), t10(n10)); + }; + }, addToOptions: function(e21, t10) { + return e21.concat(t10); + } }); + } }); + function g2(e20, t10) { + return e20 ? t10 ? e20 + " " + t10 : e20 : t10; + } + function y2(e20, t10, n10, r10, o10, i10) { + var a10, s10, c10 = e20.textDirection == rW.RTL, l10 = c10, u10 = false, f10 = "top", d10 = t10.left - o10.left, h10 = o10.right - t10.right, v10 = r10.right - r10.left, p10 = r10.bottom - r10.top; + if (l10 && d10 < Math.min(v10, h10) ? l10 = false : !l10 && h10 < Math.min(v10, d10) && (l10 = true), v10 <= (l10 ? d10 : h10)) + a10 = Math.max(o10.top, Math.min(n10.top, o10.bottom - p10)) - t10.top, s10 = Math.min(400, l10 ? d10 : h10); + else { + u10 = true, s10 = Math.min(400, (c10 ? t10.right : o10.right - t10.left) - 30); + var m10 = o10.bottom - t10.bottom; + m10 >= p10 || m10 > t10.top ? a10 = n10.bottom - t10.top : (f10 = "bottom", a10 = t10.bottom - n10.top); + } + var g10 = (t10.bottom - t10.top) / i10.offsetHeight, y10 = (t10.right - t10.left) / i10.offsetWidth; + return { style: "".concat(f10, ": ").concat(a10 / g10, "px; max-width: ").concat(s10 / y10, "px"), class: "cm-completionInfo-" + (u10 ? c10 ? "left-narrow" : "right-narrow" : l10 ? "left" : "right") }; + } + function b2(e20, t10, n10) { + if (e20 <= n10) + return { from: 0, to: e20 }; + if (t10 < 0 && (t10 = 0), t10 <= e20 >> 1) { + var r10 = Math.floor(t10 / n10); + return { from: r10 * n10, to: (r10 + 1) * n10 }; + } + var o10 = Math.floor((e20 - t10) / n10); + return { from: e20 - (o10 + 1) * n10, to: e20 - o10 * n10 }; + } + var k2 = function() { + function e20(t10, n10, r10) { + var o10 = this; + No(this, e20), this.view = t10, this.stateField = n10, this.applyCompletion = r10, this.info = null, this.infoDestroy = null, this.placeInfoReq = { read: function() { + return o10.measureInfo(); + }, write: function(e21) { + return o10.placeInfo(e21); + }, key: this }, this.space = null, this.currentClass = ""; + var i10 = t10.state.field(n10), a10 = i10.open, s10 = a10.options, c10 = a10.selected, l10 = t10.state.facet(m2); + this.optionContent = function(e21) { + var t11 = e21.addToOptions.slice(); + return e21.icons && t11.push({ render: function(e23) { + var t12, n11 = document.createElement("div"); + return n11.classList.add("cm-completionIcon"), e23.type && (t12 = n11.classList).add.apply(t12, Bo(e23.type.split(/\s+/g).map(function(e24) { + return "cm-completionIcon-" + e24; + }))), n11.setAttribute("aria-hidden", "true"), n11; + }, position: 20 }), t11.push({ render: function(e23, t12, n11, r11) { + var o11 = document.createElement("span"); + o11.className = "cm-completionLabel"; + for (var i11 = e23.displayLabel || e23.label, a11 = 0, s11 = 0; s11 < r11.length; ) { + var c11 = r11[s11++], l11 = r11[s11++]; + c11 > a11 && o11.appendChild(document.createTextNode(i11.slice(a11, c11))); + var u10 = o11.appendChild(document.createElement("span")); + u10.appendChild(document.createTextNode(i11.slice(c11, l11))), u10.className = "cm-completionMatchedText", a11 = l11; + } + return a11 < i11.length && o11.appendChild(document.createTextNode(i11.slice(a11))), o11; + }, position: 50 }, { render: function(e23) { + if (!e23.detail) + return null; + var t12 = document.createElement("span"); + return t12.className = "cm-completionDetail", t12.textContent = e23.detail, t12; + }, position: 80 }), t11.sort(function(e23, t12) { + return e23.position - t12.position; + }).map(function(e23) { + return e23.render; + }); + }(l10), this.optionClass = l10.optionClass, this.tooltipClass = l10.tooltipClass, this.range = b2(s10.length, c10, l10.maxRenderedOptions), this.dom = document.createElement("div"), this.dom.className = "cm-tooltip-autocomplete", this.updateTooltipClass(t10.state), this.dom.addEventListener("mousedown", function(e21) { + for (var r11, i11 = t10.state.field(n10).open.options, a11 = e21.target; a11 && a11 != o10.dom; a11 = a11.parentNode) + if ("LI" == a11.nodeName && (r11 = /-(\d+)$/.exec(a11.id)) && +r11[1] < i11.length) + return o10.applyCompletion(t10, i11[+r11[1]]), void e21.preventDefault(); + }), this.dom.addEventListener("focusout", function(e21) { + var n11 = t10.state.field(o10.stateField, false); + n11 && n11.tooltip && t10.state.facet(m2).closeOnBlur && e21.relatedTarget != t10.contentDOM && t10.dispatch({ effects: v2.of(null) }); + }), this.showOptions(s10, i10.id); + } + return Do(e20, [{ key: "mount", value: function() { + this.updateSel(); + } }, { key: "showOptions", value: function(e21, t10) { + var n10 = this; + this.list && this.list.remove(), this.list = this.dom.appendChild(this.createListBox(e21, t10, this.range)), this.list.addEventListener("scroll", function() { + n10.info && n10.view.requestMeasure(n10.placeInfoReq); + }); + } }, { key: "update", value: function(e21) { + var t10, n10 = e21.state.field(this.stateField), r10 = e21.startState.field(this.stateField); + if (this.updateTooltipClass(e21.state), n10 != r10) { + var o10 = n10.open, i10 = o10.options, a10 = o10.selected, s10 = o10.disabled; + r10.open && r10.open.options == i10 || (this.range = b2(i10.length, a10, e21.state.facet(m2).maxRenderedOptions), this.showOptions(i10, n10.id)), this.updateSel(), s10 != (null === (t10 = r10.open) || void 0 === t10 ? void 0 : t10.disabled) && this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!s10); + } + } }, { key: "updateTooltipClass", value: function(e21) { + var t10 = this.tooltipClass(e21); + if (t10 != this.currentClass) { + var n10, r10 = bo(this.currentClass.split(" ")); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + o10 && this.dom.classList.remove(o10); + } + } catch (e23) { + r10.e(e23); + } finally { + r10.f(); + } + var i10, a10 = bo(t10.split(" ")); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = i10.value; + s10 && this.dom.classList.add(s10); + } + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + this.currentClass = t10; + } + } }, { key: "positioned", value: function(e21) { + this.space = e21, this.info && this.view.requestMeasure(this.placeInfoReq); + } }, { key: "updateSel", value: function() { + var e21 = this, t10 = this.view.state.field(this.stateField), n10 = t10.open; + if ((n10.selected > -1 && n10.selected < this.range.from || n10.selected >= this.range.to) && (this.range = b2(n10.options.length, n10.selected, this.view.state.facet(m2).maxRenderedOptions), this.showOptions(n10.options, t10.id)), this.updateSelectedOption(n10.selected)) { + this.destroyInfo(); + var r10 = n10.options[n10.selected].completion, o10 = r10.info; + if (!o10) + return; + var i10 = "string" == typeof o10 ? document.createTextNode(o10) : o10(r10); + if (!i10) + return; + "then" in i10 ? i10.then(function(n11) { + n11 && e21.view.state.field(e21.stateField, false) == t10 && e21.addInfoPane(n11, r10); + }).catch(function(t11) { + return qW(e21.view.state, t11, "completion info"); + }) : this.addInfoPane(i10, r10); + } + } }, { key: "addInfoPane", value: function(e21, t10) { + this.destroyInfo(); + var n10 = this.info = document.createElement("div"); + if (n10.className = "cm-tooltip cm-completionInfo", null != e21.nodeType) + n10.appendChild(e21), this.infoDestroy = null; + else { + var r10 = e21.dom, o10 = e21.destroy; + n10.appendChild(r10), this.infoDestroy = o10 || null; + } + this.dom.appendChild(n10), this.view.requestMeasure(this.placeInfoReq); + } }, { key: "updateSelectedOption", value: function(e21) { + for (var t10 = null, n10 = this.list.firstChild, r10 = this.range.from; n10; n10 = n10.nextSibling, r10++) + "LI" == n10.nodeName && n10.id ? r10 == e21 ? n10.hasAttribute("aria-selected") || (n10.setAttribute("aria-selected", "true"), t10 = n10) : n10.hasAttribute("aria-selected") && n10.removeAttribute("aria-selected") : r10--; + return t10 && function(e23, t11) { + var n11 = e23.getBoundingClientRect(), r11 = t11.getBoundingClientRect(), o10 = n11.height / e23.offsetHeight; + r11.top < n11.top ? e23.scrollTop -= (n11.top - r11.top) / o10 : r11.bottom > n11.bottom && (e23.scrollTop += (r11.bottom - n11.bottom) / o10); + }(this.list, t10), t10; + } }, { key: "measureInfo", value: function() { + var e21 = this.dom.querySelector("[aria-selected]"); + if (!e21 || !this.info) + return null; + var t10 = this.dom.getBoundingClientRect(), n10 = this.info.getBoundingClientRect(), r10 = e21.getBoundingClientRect(), o10 = this.space; + if (!o10) { + var i10 = this.dom.ownerDocument.defaultView || window; + o10 = { left: 0, top: 0, right: i10.innerWidth, bottom: i10.innerHeight }; + } + return r10.top > Math.min(o10.bottom, t10.bottom) - 10 || r10.bottom < Math.max(o10.top, t10.top) + 10 ? null : this.view.state.facet(m2).positionInfo(this.view, t10, r10, n10, o10, this.dom); + } }, { key: "placeInfo", value: function(e21) { + this.info && (e21 ? (e21.style && (this.info.style.cssText = e21.style), this.info.className = "cm-tooltip cm-completionInfo " + (e21.class || "")) : this.info.style.cssText = "top: -1e6px"); + } }, { key: "createListBox", value: function(e21, t10, n10) { + var r10 = document.createElement("ul"); + r10.id = t10, r10.setAttribute("role", "listbox"), r10.setAttribute("aria-expanded", "true"), r10.setAttribute("aria-label", this.view.state.phrase("Completions")); + for (var o10 = null, i10 = n10.from; i10 < n10.to; i10++) { + var a10 = e21[i10], s10 = a10.completion, c10 = a10.match, l10 = s10.section; + if (l10) { + var u10 = "string" == typeof l10 ? l10 : l10.name; + if (u10 != o10 && (i10 > n10.from || 0 == n10.from)) + if (o10 = u10, "string" != typeof l10 && l10.header) + r10.appendChild(l10.header(l10)); + else + r10.appendChild(document.createElement("completion-section")).textContent = u10; + } + var f10 = r10.appendChild(document.createElement("li")); + f10.id = t10 + "-" + i10, f10.setAttribute("role", "option"); + var d10 = this.optionClass(s10); + d10 && (f10.className = d10); + var h10, v10 = bo(this.optionContent); + try { + for (v10.s(); !(h10 = v10.n()).done; ) { + var p10 = (0, h10.value)(s10, this.view.state, this.view, c10); + p10 && f10.appendChild(p10); + } + } catch (e23) { + v10.e(e23); + } finally { + v10.f(); + } + } + return n10.from && r10.classList.add("cm-completionListIncompleteTop"), n10.to < e21.length && r10.classList.add("cm-completionListIncompleteBottom"), r10; + } }, { key: "destroyInfo", value: function() { + this.info && (this.infoDestroy && this.infoDestroy(), this.info.remove(), this.info = null); + } }, { key: "destroy", value: function() { + this.destroyInfo(); + } }]), e20; + }(); + function w2(e20, t10) { + return function(n10) { + return new k2(n10, e20, t10); + }; + } + function x2(e20) { + return 100 * (e20.boost || 0) + (e20.apply ? 10 : 0) + (e20.info ? 5 : 0) + (e20.type ? 1 : 0); + } + var j2 = function() { + function e20(t10, n10, r10, o10, i10, a10) { + No(this, e20), this.options = t10, this.attrs = n10, this.tooltip = r10, this.timestamp = o10, this.selected = i10, this.disabled = a10; + } + return Do(e20, [{ key: "setSelected", value: function(t10, n10) { + return t10 == this.selected || t10 >= this.options.length ? this : new e20(this.options, $2(n10, t10), this.tooltip, this.timestamp, t10, this.disabled); + } }, { key: "map", value: function(t10) { + return new e20(this.options, this.attrs, Object.assign(Object.assign({}, this.tooltip), { pos: t10.mapPos(this.tooltip.pos) }), this.timestamp, this.selected, this.disabled); + } }], [{ key: "build", value: function(t10, n10, r10, o10, i10) { + var a10 = function(e21, t11) { + var n11, r11 = [], o11 = null, i11 = function(e23) { + r11.push(e23); + var t12 = e23.completion.section; + if (t12) { + o11 || (o11 = []); + var n12 = "string" == typeof t12 ? t12 : t12.name; + o11.some(function(e24) { + return e24.name == n12; + }) || o11.push("string" == typeof t12 ? { name: n12 } : t12); + } + }, a11 = bo(e21); + try { + for (a11.s(); !(n11 = a11.n()).done; ) { + var s11 = n11.value; + if (s11.hasResult()) { + var c11 = s11.result.getMatch; + if (false === s11.result.filter) { + var l11, u10 = bo(s11.result.options); + try { + for (u10.s(); !(l11 = u10.n()).done; ) { + var f10 = l11.value; + i11(new s2(f10, s11.source, c11 ? c11(f10) : [], 1e9 - r11.length)); + } + } catch (e23) { + u10.e(e23); + } finally { + u10.f(); + } + } else { + var d10, h10 = new p2(t11.sliceDoc(s11.from, s11.to)), v10 = bo(s11.result.options); + try { + for (v10.s(); !(d10 = v10.n()).done; ) { + var p10 = d10.value; + if (h10.match(p10.label)) { + var m10 = p10.displayLabel ? c11 ? c11(p10, h10.matched) : [] : h10.matched; + i11(new s2(p10, s11.source, m10, h10.score + (p10.boost || 0))); + } + } + } catch (e23) { + v10.e(e23); + } finally { + v10.f(); + } + } + } + } + } catch (e23) { + a11.e(e23); + } finally { + a11.f(); + } + if (o11) { + var g10, y10 = /* @__PURE__ */ Object.create(null), b10 = 0, k10 = bo(o11.sort(function(e23, t12) { + var n12, r12; + return (null !== (n12 = e23.rank) && void 0 !== n12 ? n12 : 1e9) - (null !== (r12 = t12.rank) && void 0 !== r12 ? r12 : 1e9) || (e23.name < t12.name ? -1 : 1); + })); + try { + for (k10.s(); !(g10 = k10.n()).done; ) { + var w10 = g10.value; + b10 -= 1e5, y10[w10.name] = b10; + } + } catch (e23) { + k10.e(e23); + } finally { + k10.f(); + } + var x10, j10 = bo(r11); + try { + for (j10.s(); !(x10 = j10.n()).done; ) { + var S10 = x10.value, C10 = S10.completion.section; + C10 && (S10.score += y10["string" == typeof C10 ? C10 : C10.name]); + } + } catch (e23) { + j10.e(e23); + } finally { + j10.f(); + } + } + var $10, _10 = [], O10 = null, M10 = t11.facet(m2).compareCompletions, E10 = bo(r11.sort(function(e23, t12) { + return t12.score - e23.score || M10(e23.completion, t12.completion); + })); + try { + for (E10.s(); !($10 = E10.n()).done; ) { + var A10 = $10.value, P10 = A10.completion; + !O10 || O10.label != P10.label || O10.detail != P10.detail || null != O10.type && null != P10.type && O10.type != P10.type || O10.apply != P10.apply || O10.boost != P10.boost ? _10.push(A10) : x2(A10.completion) > x2(O10) && (_10[_10.length - 1] = A10), O10 = A10.completion; + } + } catch (e23) { + E10.e(e23); + } finally { + E10.f(); + } + return _10; + }(t10, n10); + if (!a10.length) + return o10 && t10.some(function(e21) { + return 1 == e21.state; + }) ? new e20(o10.options, o10.attrs, o10.tooltip, o10.timestamp, o10.selected, true) : null; + var s10 = n10.facet(m2).selectOnOpen ? 0 : -1; + if (o10 && o10.selected != s10 && -1 != o10.selected) { + for (var c10 = o10.options[o10.selected].completion, l10 = 0; l10 < a10.length; l10++) + if (a10[l10].completion == c10) { + s10 = l10; + break; + } + } + return new e20(a10, $2(r10, s10), { pos: t10.reduce(function(e21, t11) { + return t11.hasResult() ? Math.min(e21, t11.from) : e21; + }, 1e8), create: N2, above: i10.aboveCursor }, o10 ? o10.timestamp : Date.now(), s10, false); + } }]), e20; + }(); + var S2 = function() { + function e20(t10, n10, r10) { + No(this, e20), this.active = t10, this.id = n10, this.open = r10; + } + return Do(e20, [{ key: "update", value: function(t10) { + var n10 = this, r10 = t10.state, o10 = r10.facet(m2), i10 = (o10.override || r10.languageDataAt("autocomplete", c2(r10)).map(d2)).map(function(e21) { + return (n10.active.find(function(t11) { + return t11.source == e21; + }) || new M2(e21, n10.active.some(function(e23) { + return 0 != e23.state; + }) ? 1 : 0)).update(t10, o10); + }); + i10.length == this.active.length && i10.every(function(e21, t11) { + return e21 == n10.active[t11]; + }) && (i10 = this.active); + var a10 = this.open; + a10 && t10.docChanged && (a10 = a10.map(t10.changes)), t10.selection || i10.some(function(e21) { + return e21.hasResult() && t10.changes.touchesRange(e21.from, e21.to); + }) || !function(e21, t11) { + if (e21 == t11) + return true; + for (var n11 = 0, r11 = 0; ; ) { + for (; n11 < e21.length && !e21[n11].hasResult; ) + n11++; + for (; r11 < t11.length && !t11[r11].hasResult; ) + r11++; + var o11 = n11 == e21.length, i11 = r11 == t11.length; + if (o11 || i11) + return o11 == i11; + if (e21[n11++].result != t11[r11++].result) + return false; + } + }(i10, this.active) ? a10 = j2.build(i10, r10, this.id, a10, o10) : a10 && a10.disabled && !i10.some(function(e21) { + return 1 == e21.state; + }) && (a10 = null), !a10 && i10.every(function(e21) { + return 1 != e21.state; + }) && i10.some(function(e21) { + return e21.hasResult(); + }) && (i10 = i10.map(function(e21) { + return e21.hasResult() ? new M2(e21.source, 0) : e21; + })); + var s10, c10 = bo(t10.effects); + try { + for (c10.s(); !(s10 = c10.n()).done; ) { + var l10 = s10.value; + l10.is(P2) && (a10 = a10 && a10.setSelected(l10.value, this.id)); + } + } catch (e21) { + c10.e(e21); + } finally { + c10.f(); + } + return i10 == this.active && a10 == this.open ? this : new e20(i10, this.id, a10); + } }, { key: "tooltip", get: function() { + return this.open ? this.open.tooltip : null; + } }, { key: "attrs", get: function() { + return this.open ? this.open.attrs : C2; + } }], [{ key: "start", value: function() { + return new e20(_2, "cm-ac-" + Math.floor(2e6 * Math.random()).toString(36), null); + } }]), e20; + }(); + var C2 = { "aria-autocomplete": "list" }; + function $2(e20, t10) { + var n10 = { "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-controls": e20 }; + return t10 > -1 && (n10["aria-activedescendant"] = e20 + "-" + t10), n10; + } + var _2 = []; + function O2(e20) { + return e20.isUserEvent("input.type") ? "input" : e20.isUserEvent("delete.backward") ? "delete" : null; + } + var M2 = function() { + function e20(t10, n10) { + var r10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1; + No(this, e20), this.source = t10, this.state = n10, this.explicitPos = r10; + } + return Do(e20, [{ key: "hasResult", value: function() { + return false; + } }, { key: "update", value: function(t10, n10) { + var r10 = O2(t10), o10 = this; + r10 ? o10 = o10.handleUserEvent(t10, r10, n10) : t10.docChanged ? o10 = o10.handleChange(t10) : t10.selection && 0 != o10.state && (o10 = new e20(o10.source, 0)); + var i10, a10 = bo(t10.effects); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = i10.value; + if (s10.is(h2)) + o10 = new e20(o10.source, 1, s10.value ? c2(t10.state) : -1); + else if (s10.is(v2)) + o10 = new e20(o10.source, 0); + else if (s10.is(A2)) { + var c10, l10 = bo(s10.value); + try { + for (l10.s(); !(c10 = l10.n()).done; ) { + var u10 = c10.value; + u10.source == o10.source && (o10 = u10); + } + } catch (e21) { + l10.e(e21); + } finally { + l10.f(); + } + } + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + return o10; + } }, { key: "handleUserEvent", value: function(t10, n10, r10) { + return "delete" != n10 && r10.activateOnTyping ? new e20(this.source, 1) : this.map(t10.changes); + } }, { key: "handleChange", value: function(t10) { + return t10.changes.touchesRange(c2(t10.startState)) ? new e20(this.source, 0) : this.map(t10.changes); + } }, { key: "map", value: function(t10) { + return t10.empty || this.explicitPos < 0 ? this : new e20(this.source, this.state, t10.mapPos(this.explicitPos)); + } }]), e20; + }(); + var E2 = function(e20) { + function t10(e21, n10, r10, o10, i10) { + var a10; + return No(this, t10), (a10 = _o(this, t10, [e21, 2, n10])).result = r10, a10.from = o10, a10.to = i10, a10; + } + return Ao(t10, M2), Do(t10, [{ key: "hasResult", value: function() { + return true; + } }, { key: "handleUserEvent", value: function(e21, n10, r10) { + var o10, i10 = e21.changes.mapPos(this.from), a10 = e21.changes.mapPos(this.to, 1), s10 = c2(e21.state); + if ((this.explicitPos < 0 ? s10 <= i10 : s10 < this.from) || s10 > a10 || "delete" == n10 && c2(e21.startState) == this.from) + return new M2(this.source, "input" == n10 && r10.activateOnTyping ? 1 : 0); + var c10, l10 = this.explicitPos < 0 ? -1 : e21.changes.mapPos(this.explicitPos); + return function(e23, t11, n11, r11) { + if (!e23) + return false; + var o11 = t11.sliceDoc(n11, r11); + return "function" == typeof e23 ? e23(o11, n11, r11, t11) : l2(e23, true).test(o11); + }(this.result.validFor, e21.state, i10, a10) ? new t10(this.source, l10, this.result, i10, a10) : this.result.update && (c10 = this.result.update(this.result, i10, a10, new o2(e21.state, s10, l10 >= 0))) ? new t10(this.source, l10, c10, c10.from, null !== (o10 = c10.to) && void 0 !== o10 ? o10 : c2(e21.state)) : new M2(this.source, 1, l10); + } }, { key: "handleChange", value: function(e21) { + return e21.changes.touchesRange(this.from, this.to) ? new M2(this.source, 0) : this.map(e21.changes); + } }, { key: "map", value: function(e21) { + return e21.empty ? this : new t10(this.source, this.explicitPos < 0 ? -1 : e21.mapPos(this.explicitPos), this.result, e21.mapPos(this.from), e21.mapPos(this.to, 1)); + } }]), t10; + }(); + var A2 = oV.define({ map: function(e20, t10) { + return e20.map(function(e21) { + return e21.map(t10); + }); + } }); + var P2 = oV.define(); + var T2 = NF.define({ create: function() { + return S2.start(); + }, update: function(e20, t10) { + return e20.update(t10); + }, provide: function(e20) { + return [UK.from(e20, function(e21) { + return e21.tooltip; + }), zJ.contentAttributes.from(e20, function(e21) { + return e21.attrs; + })]; + } }); + function R2(e20, t10) { + var n10 = t10.completion.apply || t10.completion.label, r10 = e20.state.field(T2).active.find(function(e21) { + return e21.source == t10.source; + }); + return r10 instanceof E2 && ("string" == typeof n10 ? e20.dispatch(Object.assign(Object.assign({}, function(e21, t11, n11, r11) { + var o10 = e21.selection.main, i10 = n11 - o10.from, a10 = r11 - o10.from; + return Object.assign(Object.assign({}, e21.changeByRange(function(s10) { + return s10 != o10 && n11 != r11 && e21.sliceDoc(s10.from + i10, s10.from + a10) != e21.sliceDoc(n11, r11) ? { range: s10 } : { changes: { from: s10.from + i10, to: r11 == o10.from ? s10.to : s10.from + a10, insert: t11 }, range: $F.cursor(s10.from + i10 + t11.length) }; + })), { scrollIntoView: true, userEvent: "input.complete" }); + }(e20.state, n10, r10.from, r10.to)), { annotations: u2.of(t10.completion) })) : n10(e20, t10.completion, r10.from, r10.to), true); + } + var N2 = w2(T2, R2); + function I2(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "option"; + return function(n10) { + var r10 = n10.state.field(T2, false); + if (!r10 || !r10.open || r10.open.disabled || Date.now() - r10.open.timestamp < n10.state.facet(m2).interactionDelay) + return false; + var o10, i10 = 1; + "page" == t10 && (o10 = ZK(n10, r10.open.tooltip)) && (i10 = Math.max(2, Math.floor(o10.dom.offsetHeight / o10.dom.querySelector("li").offsetHeight) - 1)); + var a10 = r10.open.options.length, s10 = r10.open.selected > -1 ? r10.open.selected + i10 * (e20 ? 1 : -1) : e20 ? 0 : a10 - 1; + return s10 < 0 ? s10 = "page" == t10 ? 0 : a10 - 1 : s10 >= a10 && (s10 = "page" == t10 ? a10 - 1 : 0), n10.dispatch({ effects: P2.of(s10) }), true; + }; + } + var D2 = Do(function e17(t10, n10) { + No(this, e17), this.active = t10, this.context = n10, this.time = Date.now(), this.updates = [], this.done = void 0; + }); + var q2 = FW.fromClass(function() { + function e20(t10) { + No(this, e20), this.view = t10, this.debounceUpdate = -1, this.running = [], this.debounceAccept = -1, this.composing = 0; + var n10, r10 = bo(t10.state.field(T2).active); + try { + for (r10.s(); !(n10 = r10.n()).done; ) { + var o10 = n10.value; + 1 == o10.state && this.startQuery(o10); + } + } catch (e21) { + r10.e(e21); + } finally { + r10.f(); + } + } + return Do(e20, [{ key: "update", value: function(e21) { + var t10 = this, n10 = e21.state.field(T2); + if (e21.selectionSet || e21.docChanged || e21.startState.field(T2) != n10) { + for (var r10 = e21.transactions.some(function(e23) { + return (e23.selection || e23.docChanged) && !O2(e23); + }), o10 = 0; o10 < this.running.length; o10++) { + var i10 = this.running[o10]; + if (r10 || i10.updates.length + e21.transactions.length > 50 && Date.now() - i10.time > 1e3) { + var a10, s10 = bo(i10.context.abortListeners); + try { + for (s10.s(); !(a10 = s10.n()).done; ) { + var c10 = a10.value; + try { + c10(); + } catch (e23) { + qW(this.view.state, e23); + } + } + } catch (e23) { + s10.e(e23); + } finally { + s10.f(); + } + i10.context.abortListeners = null, this.running.splice(o10--, 1); + } else { + var l10; + (l10 = i10.updates).push.apply(l10, Bo(e21.transactions)); + } + } + if (this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), this.debounceUpdate = n10.active.some(function(e23) { + return 1 == e23.state && !t10.running.some(function(t11) { + return t11.active.source == e23.source; + }); + }) ? setTimeout(function() { + return t10.startUpdate(); + }, 50) : -1, 0 != this.composing) { + var u10, f10 = bo(e21.transactions); + try { + for (f10.s(); !(u10 = f10.n()).done; ) { + var d10 = u10.value; + "input" == O2(d10) ? this.composing = 2 : 2 == this.composing && d10.selection && (this.composing = 3); + } + } catch (e23) { + f10.e(e23); + } finally { + f10.f(); + } + } + } + } }, { key: "startUpdate", value: function() { + var e21 = this; + this.debounceUpdate = -1; + var t10, n10 = bo(this.view.state.field(T2).active); + try { + var r10 = function() { + var n11 = t10.value; + 1 != n11.state || e21.running.some(function(e23) { + return e23.active.source == n11.source; + }) || e21.startQuery(n11); + }; + for (n10.s(); !(t10 = n10.n()).done; ) + r10(); + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + } }, { key: "startQuery", value: function(e21) { + var t10 = this, n10 = this.view.state, r10 = c2(n10), o10 = new o2(n10, r10, e21.explicitPos == r10), i10 = new D2(e21, o10); + this.running.push(i10), Promise.resolve(e21.source(o10)).then(function(e23) { + i10.context.aborted || (i10.done = e23 || null, t10.scheduleAccept()); + }, function(e23) { + t10.view.dispatch({ effects: v2.of(null) }), qW(t10.view.state, e23); + }); + } }, { key: "scheduleAccept", value: function() { + var e21 = this; + this.running.every(function(e23) { + return void 0 !== e23.done; + }) ? this.accept() : this.debounceAccept < 0 && (this.debounceAccept = setTimeout(function() { + return e21.accept(); + }, this.view.state.facet(m2).updateSyncTime)); + } }, { key: "accept", value: function() { + var e21, t10 = this; + this.debounceAccept > -1 && clearTimeout(this.debounceAccept), this.debounceAccept = -1; + for (var n10 = [], r10 = this.view.state.facet(m2), o10 = function(o11) { + var a10 = t10.running[o11]; + if (void 0 === a10.done) + return i10 = o11, 0; + if (t10.running.splice(o11--, 1), a10.done) { + var s10, c10 = new E2(a10.active.source, a10.active.explicitPos, a10.done, a10.done.from, null !== (e21 = a10.done.to) && void 0 !== e21 ? e21 : c2(a10.updates.length ? a10.updates[0].startState : t10.view.state)), l10 = bo(a10.updates); + try { + for (l10.s(); !(s10 = l10.n()).done; ) { + var u10 = s10.value; + c10 = c10.update(u10, r10); + } + } catch (e23) { + l10.e(e23); + } finally { + l10.f(); + } + if (c10.hasResult()) + return n10.push(c10), i10 = o11, 0; + } + var f10 = t10.view.state.field(T2).active.find(function(e23) { + return e23.source == a10.active.source; + }); + if (f10 && 1 == f10.state) + if (null == a10.done) { + var d10, h10 = new M2(a10.active.source, 0), v10 = bo(a10.updates); + try { + for (v10.s(); !(d10 = v10.n()).done; ) { + var p10 = d10.value; + h10 = h10.update(p10, r10); + } + } catch (e23) { + v10.e(e23); + } finally { + v10.f(); + } + 1 != h10.state && n10.push(h10); + } else + t10.startQuery(f10); + i10 = o11; + }, i10 = 0; i10 < this.running.length; i10++) + o10(i10); + n10.length && this.view.dispatch({ effects: A2.of(n10) }); + } }]), e20; + }(), { eventHandlers: { blur: function(e20) { + var t10 = this.view.state.field(T2, false); + if (t10 && t10.tooltip && this.view.state.facet(m2).closeOnBlur) { + var n10 = t10.open && ZK(this.view, t10.open.tooltip); + n10 && n10.dom.contains(e20.relatedTarget) || this.view.dispatch({ effects: v2.of(null) }); + } + }, compositionstart: function() { + this.composing = 1; + }, compositionend: function() { + var e20 = this; + 3 == this.composing && setTimeout(function() { + return e20.view.dispatch({ effects: h2.of(false) }); + }, 20), this.composing = 0; + } } }); + var z2 = zJ.baseTheme({ ".cm-tooltip.cm-tooltip-autocomplete": { "& > ul": { fontFamily: "monospace", whiteSpace: "nowrap", overflow: "hidden auto", maxWidth_fallback: "700px", maxWidth: "min(700px, 95vw)", minWidth: "250px", maxHeight: "10em", height: "100%", listStyle: "none", margin: 0, padding: 0, "& > li, & > completion-section": { padding: "1px 3px", lineHeight: 1.2 }, "& > li": { overflowX: "hidden", textOverflow: "ellipsis", cursor: "pointer" }, "& > completion-section": { display: "list-item", borderBottom: "1px solid silver", paddingLeft: "0.5em", opacity: 0.7 } } }, "&light .cm-tooltip-autocomplete ul li[aria-selected]": { background: "#17c", color: "white" }, "&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { background: "#777" }, "&dark .cm-tooltip-autocomplete ul li[aria-selected]": { background: "#347", color: "white" }, "&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { background: "#444" }, ".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after": { content: '"\xB7\xB7\xB7"', opacity: 0.5, display: "block", textAlign: "center" }, ".cm-tooltip.cm-completionInfo": { position: "absolute", padding: "3px 9px", width: "max-content", maxWidth: "".concat(400, "px"), boxSizing: "border-box" }, ".cm-completionInfo.cm-completionInfo-left": { right: "100%" }, ".cm-completionInfo.cm-completionInfo-right": { left: "100%" }, ".cm-completionInfo.cm-completionInfo-left-narrow": { right: "".concat(30, "px") }, ".cm-completionInfo.cm-completionInfo-right-narrow": { left: "".concat(30, "px") }, "&light .cm-snippetField": { backgroundColor: "#00000022" }, "&dark .cm-snippetField": { backgroundColor: "#ffffff22" }, ".cm-snippetFieldPosition": { verticalAlign: "text-top", width: 0, height: "1.15em", display: "inline-block", margin: "0 -0.7px -.7em", borderLeft: "1.4px dotted #888" }, ".cm-completionMatchedText": { textDecoration: "underline" }, ".cm-completionDetail": { marginLeft: "0.5em", fontStyle: "italic" }, ".cm-completionIcon": { fontSize: "90%", width: ".8em", display: "inline-block", textAlign: "center", paddingRight: ".6em", opacity: "0.6", boxSizing: "content-box" }, ".cm-completionIcon-function, .cm-completionIcon-method": { "&:after": { content: "'\u0192'" } }, ".cm-completionIcon-class": { "&:after": { content: "'\u25CB'" } }, ".cm-completionIcon-interface": { "&:after": { content: "'\u25CC'" } }, ".cm-completionIcon-variable": { "&:after": { content: "'\u{1D465}'" } }, ".cm-completionIcon-constant": { "&:after": { content: "'\u{1D436}'" } }, ".cm-completionIcon-type": { "&:after": { content: "'\u{1D461}'" } }, ".cm-completionIcon-enum": { "&:after": { content: "'\u222A'" } }, ".cm-completionIcon-property": { "&:after": { content: "'\u25A1'" } }, ".cm-completionIcon-keyword": { "&:after": { content: "'\u{1F511}\uFE0E'" } }, ".cm-completionIcon-namespace": { "&:after": { content: "'\u25A2'" } }, ".cm-completionIcon-text": { "&:after": { content: "'abc'", fontSize: "50%", verticalAlign: "middle" } } }); + var B2 = { brackets: ["(", "[", "{", "'", '"'], before: ")]}:;>", stringPrefixes: [] }; + var L2 = oV.define({ map: function(e20, t10) { + var n10 = t10.mapPos(e20, -1, mF.TrackAfter); + return null == n10 ? void 0 : n10; + } }); + var F2 = new (function(e20) { + function t10() { + return No(this, t10), _o(this, t10, arguments); + } + return Ao(t10, yV), Do(t10); + }())(); + F2.startSide = 1, F2.endSide = -1; + var V2 = NF.define({ create: function() { + return xV.empty; + }, update: function(e20, t10) { + if (e20 = e20.map(t10.changes), t10.selection) { + var n10 = t10.state.doc.lineAt(t10.selection.main.head); + e20 = e20.update({ filter: function(e21) { + return e21 >= n10.from && e21 <= n10.to; + } }); + } + var r10, o10 = bo(t10.effects); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value; + i10.is(L2) && (e20 = e20.update({ add: [F2.range(i10.value, i10.value + 1)] })); + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + return e20; + } }); + var H2 = "()[]{}<>"; + function W2(e20) { + for (var t10 = 0; t10 < H2.length; t10 += 2) + if (H2.charCodeAt(t10) == e20) + return H2.charAt(t10 + 1); + return hF(e20 < 128 ? e20 : e20 + 1); + } + function U2(e20, t10) { + return e20.languageDataAt("closeBrackets", t10)[0] || B2; + } + var J2 = "object" == ("undefined" == typeof navigator ? "undefined" : Ho(navigator)) && /Android\b/.test(navigator.userAgent); + var K2 = zJ.inputHandler.of(function(e20, t10, n10, r10) { + if ((J2 ? e20.composing : e20.compositionStarted) || e20.state.readOnly) + return false; + var o10 = e20.state.selection.main; + if (r10.length > 2 || 2 == r10.length && 1 == vF(dF(r10, 0)) || t10 != o10.from || n10 != o10.to) + return false; + var i10 = function(e21, t11) { + var n11, r11 = U2(e21, e21.selection.main.head), o11 = r11.brackets || B2.brackets, i11 = bo(o11); + try { + for (i11.s(); !(n11 = i11.n()).done; ) { + var a10 = n11.value, s10 = W2(dF(a10, 0)); + if (t11 == a10) + return s10 == a10 ? e42(e21, a10, o11.indexOf(a10 + a10 + a10) > -1, r11) : X2(e21, a10, s10, r11.before || B2.before); + if (t11 == s10 && Q2(e21, e21.selection.main.from)) + return Z2(e21, a10, s10); + } + } catch (e23) { + i11.e(e23); + } finally { + i11.f(); + } + return null; + }(e20.state, r10); + return !!i10 && (e20.dispatch(i10), true); + }); + var G2 = [{ key: "Backspace", run: function(e20) { + var t10 = e20.state, n10 = e20.dispatch; + if (t10.readOnly) + return false; + var r10 = U2(t10, t10.selection.main.head).brackets || B2.brackets, o10 = null, i10 = t10.changeByRange(function(e21) { + if (e21.empty) { + var n11, i11 = function(e23, t11) { + var n12 = e23.sliceString(t11 - 2, t11); + return vF(dF(n12, 0)) == n12.length ? n12 : n12.slice(1); + }(t10.doc, e21.head), a10 = bo(r10); + try { + for (a10.s(); !(n11 = a10.n()).done; ) { + var s10 = n11.value; + if (s10 == i11 && Y2(t10.doc, e21.head) == W2(dF(s10, 0))) + return { changes: { from: e21.head - s10.length, to: e21.head + s10.length }, range: $F.cursor(e21.head - s10.length) }; + } + } catch (e23) { + a10.e(e23); + } finally { + a10.f(); + } + } + return { range: o10 = e21 }; + }); + return o10 || n10(t10.update(i10, { scrollIntoView: true, userEvent: "delete.backward" })), !o10; + } }]; + function Q2(e20, t10) { + var n10 = false; + return e20.field(V2).between(0, e20.doc.length, function(e21) { + e21 == t10 && (n10 = true); + }), n10; + } + function Y2(e20, t10) { + var n10 = e20.sliceString(t10, t10 + 2); + return n10.slice(0, vF(dF(n10, 0))); + } + function X2(e20, t10, n10, r10) { + var o10 = null, i10 = e20.changeByRange(function(i11) { + if (!i11.empty) + return { changes: [{ insert: t10, from: i11.from }, { insert: n10, from: i11.to }], effects: L2.of(i11.to + t10.length), range: $F.range(i11.anchor + t10.length, i11.head + t10.length) }; + var a10 = Y2(e20.doc, i11.head); + return !a10 || /\s/.test(a10) || r10.indexOf(a10) > -1 ? { changes: { insert: t10 + n10, from: i11.head }, effects: L2.of(i11.head + t10.length), range: $F.cursor(i11.head + t10.length) } : { range: o10 = i11 }; + }); + return o10 ? null : e20.update(i10, { scrollIntoView: true, userEvent: "input.type" }); + } + function Z2(e20, t10, n10) { + var r10 = null, o10 = e20.changeByRange(function(t11) { + return t11.empty && Y2(e20.doc, t11.head) == n10 ? { changes: { from: t11.head, to: t11.head + n10.length, insert: n10 }, range: $F.cursor(t11.head + n10.length) } : r10 = { range: t11 }; + }); + return r10 ? null : e20.update(o10, { scrollIntoView: true, userEvent: "input.type" }); + } + function e42(e20, t10, n10, r10) { + var o10 = r10.stringPrefixes || B2.stringPrefixes, i10 = null, a10 = e20.changeByRange(function(r11) { + if (!r11.empty) + return { changes: [{ insert: t10, from: r11.from }, { insert: t10, from: r11.to }], effects: L2.of(r11.to + t10.length), range: $F.range(r11.anchor + t10.length, r11.head + t10.length) }; + var a11, s10 = r11.head, c10 = Y2(e20.doc, s10); + if (c10 == t10) { + if (t4(e20, s10)) + return { changes: { insert: t10 + t10, from: s10 }, effects: L2.of(s10 + t10.length), range: $F.cursor(s10 + t10.length) }; + if (Q2(e20, s10)) { + var l10 = n10 && e20.sliceDoc(s10, s10 + 3 * t10.length) == t10 + t10 + t10 ? t10 + t10 + t10 : t10; + return { changes: { from: s10, to: s10 + l10.length, insert: l10 }, range: $F.cursor(s10 + l10.length) }; + } + } else { + if (n10 && e20.sliceDoc(s10 - 2 * t10.length, s10) == t10 + t10 && (a11 = n4(e20, s10 - 2 * t10.length, o10)) > -1 && t4(e20, a11)) + return { changes: { insert: t10 + t10 + t10 + t10, from: s10 }, effects: L2.of(s10 + t10.length), range: $F.cursor(s10 + t10.length) }; + if (e20.charCategorizer(s10)(c10) != hV.Word && n4(e20, s10, o10) > -1 && !function(e21, t11, n11, r12) { + for (var o11 = zQ(e21).resolveInner(t11, -1), i11 = r12.reduce(function(e23, t12) { + return Math.max(e23, t12.length); + }, 0), a12 = 0; a12 < 5; a12++) { + var s11 = e21.sliceDoc(o11.from, Math.min(o11.to, o11.from + n11.length + i11)), c11 = s11.indexOf(n11); + if (!c11 || c11 > -1 && r12.indexOf(s11.slice(0, c11)) > -1) { + for (var l11 = o11.firstChild; l11 && l11.from == o11.from && l11.to - l11.from > n11.length + c11; ) { + if (e21.sliceDoc(l11.to - n11.length, l11.to) == n11) + return false; + l11 = l11.firstChild; + } + return true; + } + var u10 = o11.to == t11 && o11.parent; + if (!u10) + break; + o11 = u10; + } + return false; + }(e20, s10, t10, o10)) + return { changes: { insert: t10 + t10, from: s10 }, effects: L2.of(s10 + t10.length), range: $F.cursor(s10 + t10.length) }; + } + return { range: i10 = r11 }; + }); + return i10 ? null : e20.update(a10, { scrollIntoView: true, userEvent: "input.type" }); + } + function t4(e20, t10) { + var n10 = zQ(e20).resolveInner(t10 + 1); + return n10.parent && n10.from == t10; + } + function n4(e20, t10, n10) { + var r10 = e20.charCategorizer(t10); + if (r10(e20.sliceDoc(t10 - 1, t10)) != hV.Word) + return t10; + var o10, i10 = bo(n10); + try { + for (i10.s(); !(o10 = i10.n()).done; ) { + var a10 = o10.value, s10 = t10 - a10.length; + if (e20.sliceDoc(s10, t10) == a10 && r10(e20.sliceDoc(s10 - 1, s10)) != hV.Word) + return s10; + } + } catch (e21) { + i10.e(e21); + } finally { + i10.f(); + } + return -1; + } + function r4() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return [T2, m2.of(e20), q2, i4, z2]; + } + var o4 = [{ key: "Ctrl-Space", run: function(e20) { + return !!e20.state.field(T2, false) && (e20.dispatch({ effects: h2.of(true) }), true); + } }, { key: "Escape", run: function(e20) { + var t10 = e20.state.field(T2, false); + return !(!t10 || !t10.active.some(function(e21) { + return 0 != e21.state; + })) && (e20.dispatch({ effects: v2.of(null) }), true); + } }, { key: "ArrowDown", run: I2(true) }, { key: "ArrowUp", run: I2(false) }, { key: "PageDown", run: I2(true, "page") }, { key: "PageUp", run: I2(false, "page") }, { key: "Enter", run: function(e20) { + var t10 = e20.state.field(T2, false); + return !(e20.state.readOnly || !t10 || !t10.open || t10.open.selected < 0 || t10.open.disabled || Date.now() - t10.open.timestamp < e20.state.facet(m2).interactionDelay) && R2(e20, t10.open.options[t10.open.selected]); + } }]; + var i4 = LF.highest(JJ.computeN([m2], function(e20) { + return e20.facet(m2).defaultKeymap ? [o4] : []; + })); + function a4(e20) { + mi(e20, "svelte-hhcn0f", '.jse-status-bar.svelte-hhcn0f.svelte-hhcn0f{background:var(--jse-panel-background, #ebebeb);color:var(--jse-panel-color-readonly, #b2b2b2);font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);margin:0;border-top:var(--jse-panel-border, var(--jse-main-border, 1px solid #d7d7d7));border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7);display:flex;gap:var(--jse-padding, 10px)}.jse-status-bar.svelte-hhcn0f.svelte-hhcn0f:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-status-bar.svelte-hhcn0f .jse-status-bar-info.svelte-hhcn0f{padding:2px}'); + } + function s4(e20) { + var t10, n10, r10; + return { c: function() { + t10 = ji("div"), n10 = Ci("Line: "), r10 = Ci(e20[0]), Ai(t10, "class", "jse-status-bar-info svelte-hhcn0f"); + }, m: function(e21, o10) { + ki(e21, t10, o10), pi(t10, n10), pi(t10, r10); + }, p: function(e21, t11) { + 1 & t11 && Ni(r10, e21[0]); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function c4(e20) { + var t10, n10, r10; + return { c: function() { + t10 = ji("div"), n10 = Ci("Column: "), r10 = Ci(e20[1]), Ai(t10, "class", "jse-status-bar-info svelte-hhcn0f"); + }, m: function(e21, o10) { + ki(e21, t10, o10), pi(t10, n10), pi(t10, r10); + }, p: function(e21, t11) { + 2 & t11 && Ni(r10, e21[1]); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function l4(e20) { + var t10, n10, r10, o10; + return { c: function() { + t10 = ji("div"), n10 = Ci("Selection: "), r10 = Ci(e20[2]), o10 = Ci(" characters"), Ai(t10, "class", "jse-status-bar-info svelte-hhcn0f"); + }, m: function(e21, i10) { + ki(e21, t10, i10), pi(t10, n10), pi(t10, r10), pi(t10, o10); + }, p: function(e21, t11) { + 4 & t11 && Ni(r10, e21[2]); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function u4(e20) { + var t10, n10, r10, o10 = void 0 !== e20[0] && s4(e20), i10 = void 0 !== e20[1] && c4(e20), a10 = void 0 !== e20[2] && e20[2] > 0 && l4(e20); + return { c: function() { + t10 = ji("div"), o10 && o10.c(), n10 = $i(), i10 && i10.c(), r10 = $i(), a10 && a10.c(), Ai(t10, "class", "jse-status-bar svelte-hhcn0f"); + }, m: function(e21, s10) { + ki(e21, t10, s10), o10 && o10.m(t10, null), pi(t10, n10), i10 && i10.m(t10, null), pi(t10, r10), a10 && a10.m(t10, null); + }, p: function(e21, s10) { + var c10 = jo(s10, 1)[0]; + void 0 !== e21[0] ? o10 ? o10.p(e21, c10) : ((o10 = s4(e21)).c(), o10.m(t10, n10)) : o10 && (o10.d(1), o10 = null), void 0 !== e21[1] ? i10 ? i10.p(e21, c10) : ((i10 = c4(e21)).c(), i10.m(t10, r10)) : i10 && (i10.d(1), i10 = null), void 0 !== e21[2] && e21[2] > 0 ? a10 ? a10.p(e21, c10) : ((a10 = l4(e21)).c(), a10.m(t10, null)) : a10 && (a10.d(1), a10 = null); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10), o10 && o10.d(), i10 && i10.d(), a10 && a10.d(); + } }; + } + function f4(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10 = t10.editorState; + return e20.$$set = function(e21) { + "editorState" in e21 && n10(3, c10 = e21.editorState); + }, e20.$$.update = function() { + var t11, l10, u10; + 8 & e20.$$.dirty && n10(4, r10 = null === (t11 = c10) || void 0 === t11 || null === (t11 = t11.selection) || void 0 === t11 || null === (t11 = t11.main) || void 0 === t11 ? void 0 : t11.head); + 24 & e20.$$.dirty && n10(5, o10 = r10 ? null === (l10 = c10) || void 0 === l10 || null === (l10 = l10.doc) || void 0 === l10 ? void 0 : l10.lineAt(r10) : void 0); + (32 & e20.$$.dirty && n10(0, i10 = o10 ? o10.number : void 0), 48 & e20.$$.dirty && n10(1, a10 = void 0 !== o10 && void 0 !== r10 ? r10 - o10.from + 1 : void 0), 8 & e20.$$.dirty) && n10(2, s10 = null === (u10 = c10) || void 0 === u10 || null === (u10 = u10.selection) || void 0 === u10 || null === (u10 = u10.ranges) || void 0 === u10 ? void 0 : u10.reduce(function(e21, t12) { + return e21 + t12.to - t12.from; + }, 0)); + }, [i10, a10, s10, c10, r10, o10]; + } + var d4 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, f4, u4, Xo, { editorState: 3 }, a4), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var h4 = PY.define([{ tag: TQ.propertyName, color: "var(--internal-key-color)" }, { tag: TQ.number, color: "var(--internal-value-color-number)" }, { tag: TQ.bool, color: "var(--internal-value-color-boolean)" }, { tag: TQ.string, color: "var(--internal-value-color-string)" }, { tag: TQ.keyword, color: "var(--internal-value-color-null)" }]); + var v4 = IY(h4); + var p4 = h4.style; + function m4(e20) { + var t10 = e20.selection.main.head; + return e20.doc.lineAt(t10); + } + function g4(e20, t10) { + var n10 = 0; + e: + for (var r10 = 0; r10 < e20.length; r10++) + switch (e20[r10]) { + case " ": + n10 += 1; + continue e; + case " ": + n10 += t10 - n10 % t10; + continue e; + case "\r": + continue e; + default: + break e; + } + return n10; + } + h4.style = function(e20) { + return p4(e20 || []); + }; + var y4 = MF.define({ combine: function(e20) { + return gV(e20, { highlightActiveBlock: true, hideFirstIndent: false, markerType: "fullScope", thickness: 1 }); + } }); + var b4 = function() { + function e20(t10, n10, r10, o10) { + No(this, e20), this.lines = t10, this.state = n10, this.map = /* @__PURE__ */ new Map(), this.unitWidth = r10, this.markerType = o10; + var i10, a10 = bo(this.lines); + try { + for (a10.s(); !(i10 = a10.n()).done; ) { + var s10 = i10.value; + this.add(s10); + } + } catch (e21) { + a10.e(e21); + } finally { + a10.f(); + } + this.state.facet(y4).highlightActiveBlock && this.findAndSetActiveLines(); + } + return Do(e20, [{ key: "has", value: function(e21) { + return this.map.has("number" == typeof e21 ? e21 : e21.number); + } }, { key: "get", value: function(e21) { + var t10 = this.map.get("number" == typeof e21 ? e21 : e21.number); + if (!t10) + throw new Error("Line not found in indentation map"); + return t10; + } }, { key: "set", value: function(e21, t10, n10) { + var r10 = !e21.text.trim().length, o10 = { line: e21, col: t10, level: n10, empty: r10 }; + return this.map.set(o10.line.number, o10), o10; + } }, { key: "add", value: function(e21) { + if (this.has(e21)) + return this.get(e21); + if (!e21.length || !e21.text.trim().length) { + if (1 === e21.number) + return this.set(e21, 0, 0); + if (e21.number === this.state.doc.lines) { + var t10 = this.closestNonEmpty(e21, -1); + return this.set(e21, 0, t10.level); + } + var n10 = this.closestNonEmpty(e21, -1), r10 = this.closestNonEmpty(e21, 1); + return n10.level >= r10.level && "codeOnly" !== this.markerType ? this.set(e21, 0, n10.level) : n10.empty && 0 === n10.level && 0 !== r10.level ? this.set(e21, 0, 0) : r10.level > n10.level ? this.set(e21, 0, n10.level + 1) : this.set(e21, 0, r10.level); + } + var o10 = g4(e21.text, this.state.tabSize), i10 = Math.floor(o10 / this.unitWidth); + return this.set(e21, o10, i10); + } }, { key: "closestNonEmpty", value: function(e21, t10) { + for (var n10 = e21.number + t10; -1 === t10 ? n10 >= 1 : n10 <= this.state.doc.lines; ) { + if (this.has(n10)) { + var r10 = this.get(n10); + if (!r10.empty) + return r10; + } + var o10 = this.state.doc.line(n10); + if (o10.text.trim().length) { + var i10 = g4(o10.text, this.state.tabSize), a10 = Math.floor(i10 / this.unitWidth); + return this.set(o10, i10, a10); + } + n10 += t10; + } + var s10 = this.state.doc.line(-1 === t10 ? 1 : this.state.doc.lines); + return this.set(s10, 0, 0); + } }, { key: "findAndSetActiveLines", value: function() { + var e21 = m4(this.state); + if (this.has(e21)) { + var t10 = this.get(e21); + if (this.has(t10.line.number + 1)) { + var n10 = this.get(t10.line.number + 1); + n10.level > t10.level && (t10 = n10); + } + if (this.has(t10.line.number - 1)) { + var r10 = this.get(t10.line.number - 1); + r10.level > t10.level && (t10 = r10); + } + if (0 !== t10.level) { + var o10, i10; + for (t10.active = t10.level, o10 = t10.line.number; o10 > 1; o10--) + if (this.has(o10 - 1)) { + var a10 = this.get(o10 - 1); + if (a10.level < t10.level) + break; + a10.active = t10.level; + } + for (i10 = t10.line.number; i10 < this.state.doc.lines; i10++) + if (this.has(i10 + 1)) { + var s10 = this.get(i10 + 1); + if (s10.level < t10.level) + break; + s10.active = t10.level; + } + } + } + } }]), e20; + }(); + function k4(e20) { + var t10 = { light: "#F0F1F2", dark: "#2B3245", activeLight: "#E4E5E6", activeDark: "#3C445C" }, n10 = t10; + return e20 && (n10 = Object.assign(Object.assign({}, t10), e20)), zJ.baseTheme({ "&light": { "--indent-marker-bg-color": n10.light, "--indent-marker-active-bg-color": n10.activeLight }, "&dark": { "--indent-marker-bg-color": n10.dark, "--indent-marker-active-bg-color": n10.activeDark }, ".cm-line": { position: "relative" }, ".cm-indent-markers::before": { content: '""', position: "absolute", top: 0, left: 0, right: 0, bottom: 0, background: "var(--indent-markers)", pointerEvents: "none", zIndex: "-1" } }); + } + function w4(e20, t10, n10, r10, o10) { + var i10 = "repeating-linear-gradient(to right, var(".concat(e20, ") 0 ").concat(t10, "px, transparent ").concat(t10, "px ").concat(n10, "ch)"); + return "".concat(i10, " ").concat(r10 * n10, ".5ch/calc(").concat(n10 * o10, "ch - 1px) no-repeat"); + } + function x4(e20, t10, n10, r10) { + var o10 = e20.level, i10 = e20.active; + if (n10 && 0 === o10) + return []; + var a10 = n10 ? 1 : 0, s10 = []; + if (void 0 !== i10) { + var c10 = i10 - a10 - 1; + c10 > 0 && s10.push(w4("--indent-marker-bg-color", r10, t10, a10, c10)), s10.push(w4("--indent-marker-active-bg-color", r10, t10, i10 - 1, 1)), i10 !== o10 && s10.push(w4("--indent-marker-bg-color", r10, t10, i10, o10 - i10)); + } else + s10.push(w4("--indent-marker-bg-color", r10, t10, a10, o10 - a10)); + return s10.join(","); + } + var j4 = function() { + function e20(t10) { + No(this, e20), this.view = t10, this.unitWidth = XQ(t10.state), this.currentLineNumber = m4(t10.state).number, this.generate(t10.state); + } + return Do(e20, [{ key: "update", value: function(e21) { + var t10 = XQ(e21.state), n10 = t10 !== this.unitWidth; + n10 && (this.unitWidth = t10); + var r10 = m4(e21.state).number, o10 = r10 !== this.currentLineNumber; + this.currentLineNumber = r10; + var i10 = e21.state.facet(y4).highlightActiveBlock && o10; + (e21.docChanged || e21.viewportChanged || n10 || i10) && this.generate(e21.state); + } }, { key: "generate", value: function(e21) { + var t10, n10 = new jV(), r10 = function(e23) { + var t11, n11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e23.state, r11 = /* @__PURE__ */ new Set(), o11 = bo(e23.visibleRanges); + try { + for (o11.s(); !(t11 = o11.n()).done; ) + for (var i11 = t11.value, a11 = i11.from, s11 = i11.to, c11 = a11; c11 <= s11; ) { + var l11 = n11.doc.lineAt(c11); + r11.has(l11) || r11.add(l11), c11 = l11.to + 1; + } + } catch (e24) { + o11.e(e24); + } finally { + o11.f(); + } + return r11; + }(this.view, e21), o10 = e21.facet(y4), i10 = o10.hideFirstIndent, a10 = o10.markerType, s10 = o10.thickness, c10 = new b4(r10, e21, this.unitWidth, a10), l10 = bo(r10); + try { + for (l10.s(); !(t10 = l10.n()).done; ) { + var u10 = t10.value, f10 = c10.get(u10.number); + if (null == f10 ? void 0 : f10.level) { + var d10 = x4(f10, this.unitWidth, i10, s10); + n10.add(u10.from, u10.from, KH.line({ class: "cm-indent-markers", attributes: { style: "--indent-markers: ".concat(d10) } })); + } + } + } catch (e23) { + l10.e(e23); + } finally { + l10.f(); + } + this.decorations = n10.finish(); + } }]), e20; + }(); + function S4() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + return [y4.of(e20), k4(e20.colors), FW.fromClass(j4, { decorations: function(e21) { + return e21.decorations; + } })]; + } + var C4 = function() { + function e20(t10) { + No(this, e20), this.view = t10, this.indentUnit = XQ(t10.state), this.initialPaddingLeft = null, this.generate(t10.state); + } + return Do(e20, [{ key: "update", value: function(e21) { + var t10 = XQ(e21.state); + (t10 !== this.indentUnit || e21.docChanged || e21.viewportChanged) && (this.indentUnit = t10, this.generate(e21.state)); + } }, { key: "generate", value: function(e21) { + var t10 = this, n10 = new jV(); + this.initialPaddingLeft ? this.addStyleToBuilder(n10, e21, this.initialPaddingLeft) : this.view.requestMeasure({ read: function(r10) { + var o10 = r10.contentDOM.querySelector(".cm-line"); + o10 && (t10.initialPaddingLeft = window.getComputedStyle(o10).getPropertyValue("padding-left"), t10.addStyleToBuilder(n10, e21, t10.initialPaddingLeft)), t10.decorations = n10.finish(); + } }), this.decorations = n10.finish(); + } }, { key: "addStyleToBuilder", value: function(e21, t10, n10) { + var r10, o10 = bo(this.getVisibleLines(t10)); + try { + for (o10.s(); !(r10 = o10.n()).done; ) { + var i10 = r10.value, a10 = this.getIndentSize(i10), s10 = "calc(".concat(a10 + this.indentUnit, "ch + ").concat(n10, ")"); + e21.add(i10.from, i10.from, KH.line({ attributes: { style: "padding-left: ".concat(s10, "; text-indent: -").concat(a10 + this.indentUnit, "ch;") } })); + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + } }, { key: "getVisibleLines", value: function(e21) { + var t10, n10 = /* @__PURE__ */ new Set(), r10 = null, o10 = bo(this.view.visibleRanges); + try { + for (o10.s(); !(t10 = o10.n()).done; ) + for (var i10 = t10.value, a10 = i10.from, s10 = i10.to, c10 = a10; c10 <= s10; ) { + var l10 = e21.doc.lineAt(c10); + r10 !== l10 && (n10.add(l10), r10 = l10), c10 = l10.to + 1; + } + } catch (e23) { + o10.e(e23); + } finally { + o10.f(); + } + return n10; + } }, { key: "getIndentSize", value: function(e21) { + return e21.text.length - e21.text.trimStart().length; + } }]), e20; + }(); + var $4 = [FW.fromClass(C4, { decorations: function(e20) { + return e20.decorations; + } })]; + function _4(e20) { + mi(e20, "svelte-a0poeb", '.jse-text-mode.svelte-a0poeb.svelte-a0poeb{--internal-key-color:var(--jse-key-color, #1a1a1a);--internal-value-color-number:var(--jse-value-color-number, #ee422e);--internal-value-color-boolean:var(--jse-value-color-boolean, #ff8c00);--internal-value-color-string:var(--jse-value-color-string, #008000);--internal-value-color-null:var(--jse-value-color-null, #004ed0);flex:1;box-sizing:border-box;display:flex;flex-direction:column;background:var(--jse-background-color, #fff)}.jse-text-mode.no-main-menu.svelte-a0poeb.svelte-a0poeb{border-top:var(--jse-main-border, 1px solid #d7d7d7)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb{flex:1;display:flex;position:relative;flex-direction:column;overflow:hidden;min-width:0;min-height:0;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-text-mode.svelte-a0poeb .jse-contents.jse-hidden.svelte-a0poeb{visibility:hidden;position:absolute;top:0;left:0}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor{flex:1;overflow:hidden}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-scroller{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);line-height:var(--jse-line-height, calc(1em + 4px));color:var(--jse-delimiter-color, rgba(0, 0, 0, 0.38))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-gutters{background:var(--jse-panel-background, #ebebeb);color:var(--jse-panel-color-readonly, #b2b2b2);border-right:var(--jse-panel-border, var(--jse-main-border, 1px solid #d7d7d7))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-activeLine,.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-activeLineGutter{background:var(--jse-active-line-background-color, rgba(0, 0, 0, 0.06))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-selectionBackground{background:var(--jse-selection-background-color, #d3d3d3)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-searchMatch{background-color:var(--jse-search-match-color, #ffe665);outline:var(--jse-search-match-outline, 1px solid #ffd700)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-searchMatch.cm-searchMatch-selected{background-color:var(--jse-search-match-active-color, #ffd700);outline:var(--jse-search-match-active-outline, 1px solid #e1be00)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-selectionMatch{background-color:var(--jse-search-match-background-color, rgba(153, 255, 119, 0.5019607843))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-foldPlaceholder{background:var(--jse-tag-background, rgba(0, 0, 0, 0.2));color:var(--jse-tag-color, var(--jse-text-color-inverse, #fff));border:none;padding:0 var(--jse-padding, 10px)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-tooltip{font-size:var(--jse-font-size, 16px);font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);color:var(--jse-tooltip-color, var(--jse-text-color, #4d4d4d));background:var(--jse-tooltip-background, var(--jse-modal-background, #f5f5f5));border:var(--jse-tooltip-border, var(--jse-main-border, 1px solid #d7d7d7))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-diagnosticAction{background:var(--jse-tooltip-action-button-color, var(--jse-text-color-inverse, #fff));background:var(--jse-tooltip-action-button-background, #4d4d4d)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-panels{border-bottom:var(--jse-panel-border, var(--jse-main-border, 1px solid #d7d7d7))}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search{background:var(--jse-panel-background, #ebebeb);color:var(--jse-panel-color, var(--jse-text-color, #4d4d4d));font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search input{font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size-text-mode-search, 80%);color:var(--jse-input-color, var(--jse-text-color, #4d4d4d));border:var(--jse-input-border, 1px solid #d8dbdf);background:var(--jse-input-background, var(--jse-background-color, #fff));margin-right:2px}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search button{font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size-text-mode-search, 80%);color:var(--jse-panel-button-color, inherit);background:var(--jse-panel-button-background, transparent);border:none;cursor:pointer;text-transform:capitalize;padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px);margin:0}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search button:hover{color:var(--panel-button-color-highlight, var(--jse-text-color, #4d4d4d));background:var(--jse-panel-button-background-highlight, #e0e0e0)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search label{font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size-text-mode-search, 80%);padding-left:var(--jse-padding, 10px)}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search label input{margin-right:2px}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-search button[name="close"]{width:32px;height:32px;font-size:24px;line-height:24px;padding:0;right:0;top:-4px}.jse-text-mode.svelte-a0poeb .jse-contents.svelte-a0poeb .cm-editor .cm-cursor-primary{border-color:var(--jse-text-color, #4d4d4d)}.jse-text-mode.svelte-a0poeb .jse-contents .jse-loading-space.svelte-a0poeb{flex:1}.jse-text-mode.svelte-a0poeb .jse-contents .jse-loading.svelte-a0poeb{flex:2;text-align:center;color:var(--jse-panel-color-readonly, #b2b2b2);box-sizing:border-box;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}.jse-text-mode.svelte-a0poeb .jse-contents.jse-preview.svelte-a0poeb{flex:1;font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:var(--jse-panel-color-readonly, #b2b2b2);overflow:auto;white-space:pre-wrap;word-break:break-word;padding:2px}'); + } + function O4(e20) { + var t10 = e20.slice(), n10 = 0 === t10[11].length; + return t10[98] = n10, t10; + } + function M4(e20) { + var t10, n10; + return t10 = new WL({ props: { readOnly: e20[1], onFormat: e20[17], onCompact: e20[18], onSort: e20[19], onTransform: e20[20], onToggleSearch: e20[21], onUndo: e20[22], onRedo: e20[23], canFormat: !e20[98], canCompact: !e20[98], canSort: !e20[98], canTransform: !e20[98], canUndo: e20[12], canRedo: e20[13], onRenderMenu: e20[4] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 2 & n11[0] && (r10.readOnly = e21[1]), 2048 & n11[0] && (r10.canFormat = !e21[98]), 2048 & n11[0] && (r10.canCompact = !e21[98]), 2048 & n11[0] && (r10.canSort = !e21[98]), 2048 & n11[0] && (r10.canTransform = !e21[98]), 4096 & n11[0] && (r10.canUndo = e21[12]), 8192 & n11[0] && (r10.canRedo = e21[13]), 16 & n11[0] && (r10.onRenderMenu = e21[4]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function E4(e20) { + var t10; + return { c: function() { + (t10 = ji("div")).innerHTML = '
loading...
', Ai(t10, "class", "jse-contents svelte-a0poeb"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function A4(e20) { + var t10, n10, r10, o10, i10, a10 = e20[97] && P4(e20), s10 = !e20[97] && T4(e20); + return { c: function() { + t10 = ji("div"), n10 = $i(), a10 && a10.c(), r10 = $i(), s10 && s10.c(), o10 = _i(), Ai(t10, "class", "jse-contents svelte-a0poeb"), zi(t10, "jse-hidden", e20[97]); + }, m: function(c10, l10) { + ki(c10, t10, l10), e20[52](t10), ki(c10, n10, l10), a10 && a10.m(c10, l10), ki(c10, r10, l10), s10 && s10.m(c10, l10), ki(c10, o10, l10), i10 = true; + }, p: function(e21, n11) { + (!i10 || 268438016 & n11[0]) && zi(t10, "jse-hidden", e21[97]), e21[97] ? a10 ? (a10.p(e21, n11), 2560 & n11[0] && wa(a10, 1)) : ((a10 = P4(e21)).c(), wa(a10, 1), a10.m(r10.parentNode, r10)) : a10 && (ba(), xa(a10, 1, 1, function() { + a10 = null; + }), ka()), e21[97] ? s10 && (ba(), xa(s10, 1, 1, function() { + s10 = null; + }), ka()) : s10 ? (s10.p(e21, n11), 2560 & n11[0] && wa(s10, 1)) : ((s10 = T4(e21)).c(), wa(s10, 1), s10.m(o10.parentNode, o10)); + }, i: function(e21) { + i10 || (wa(a10), wa(s10), i10 = true); + }, o: function(e21) { + xa(a10), xa(s10), i10 = false; + }, d: function(i11) { + i11 && (wi(t10), wi(n10), wi(r10), wi(o10)), e20[52](null), a10 && a10.d(i11), s10 && s10.d(i11); + } }; + } + function P4(e20) { + var t10, n10, r10, o10, i10, a10 = tM(e20[11] || "", fs) + ""; + return t10 = new IN({ props: { icon: TP, type: "error", message: "The JSON document is larger than ".concat(FL(ps, 1024), ", ") + "and may crash your browser when loading it in text mode. Actual size: ".concat(FL(e20[11].length, 1024), "."), actions: [{ text: "Open anyway", title: "Open the document in text mode. This may freeze or crash your browser.", onClick: e20[24] }, { text: "Open in tree mode", title: "Open the document in tree mode. Tree mode can handle large documents.", onClick: e20[25] }, { text: "Cancel", title: "Cancel opening this large document.", onClick: e20[26] }], onClose: e20[5] } }), { c: function() { + Pa(t10.$$.fragment), n10 = $i(), r10 = ji("div"), o10 = Ci(a10), Ai(r10, "class", "jse-contents jse-preview svelte-a0poeb"); + }, m: function(e21, a11) { + Ta(t10, e21, a11), ki(e21, n10, a11), ki(e21, r10, a11), pi(r10, o10), i10 = true; + }, p: function(e21, n11) { + var r11 = {}; + 2048 & n11[0] && (r11.message = "The JSON document is larger than ".concat(FL(ps, 1024), ", ") + "and may crash your browser when loading it in text mode. Actual size: ".concat(FL(e21[11].length, 1024), ".")), t10.$set(r11), (!i10 || 2048 & n11[0]) && a10 !== (a10 = tM(e21[11] || "", fs) + "") && Ni(o10, a10); + }, i: function(e21) { + i10 || (wa(t10.$$.fragment, e21), i10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), i10 = false; + }, d: function(e21) { + e21 && (wi(n10), wi(r10)), Ra(t10, e21); + } }; + } + function T4(e20) { + var t10, n10, r10, o10, i10, a10 = !e20[14] && e20[0] && oO(e20[11]), s10 = e20[3] && R4(e20), c10 = e20[14] && N4(e20), l10 = a10 && I4(e20); + return o10 = new JN({ props: { validationErrors: e20[10], selectError: e20[27] } }), { c: function() { + s10 && s10.c(), t10 = $i(), c10 && c10.c(), n10 = $i(), l10 && l10.c(), r10 = $i(), Pa(o10.$$.fragment); + }, m: function(e21, a11) { + s10 && s10.m(e21, a11), ki(e21, t10, a11), c10 && c10.m(e21, a11), ki(e21, n10, a11), l10 && l10.m(e21, a11), ki(e21, r10, a11), Ta(o10, e21, a11), i10 = true; + }, p: function(e21, i11) { + e21[3] ? s10 ? (s10.p(e21, i11), 8 & i11[0] && wa(s10, 1)) : ((s10 = R4(e21)).c(), wa(s10, 1), s10.m(t10.parentNode, t10)) : s10 && (ba(), xa(s10, 1, 1, function() { + s10 = null; + }), ka()), e21[14] ? c10 ? (c10.p(e21, i11), 16384 & i11[0] && wa(c10, 1)) : ((c10 = N4(e21)).c(), wa(c10, 1), c10.m(n10.parentNode, n10)) : c10 && (ba(), xa(c10, 1, 1, function() { + c10 = null; + }), ka()), 18433 & i11[0] && (a10 = !e21[14] && e21[0] && oO(e21[11])), a10 ? l10 ? (l10.p(e21, i11), 18433 & i11[0] && wa(l10, 1)) : ((l10 = I4(e21)).c(), wa(l10, 1), l10.m(r10.parentNode, r10)) : l10 && (ba(), xa(l10, 1, 1, function() { + l10 = null; + }), ka()); + var u10 = {}; + 1024 & i11[0] && (u10.validationErrors = e21[10]), o10.$set(u10); + }, i: function(e21) { + i10 || (wa(s10), wa(c10), wa(l10), wa(o10.$$.fragment, e21), i10 = true); + }, o: function(e21) { + xa(s10), xa(c10), xa(l10), xa(o10.$$.fragment, e21), i10 = false; + }, d: function(e21) { + e21 && (wi(t10), wi(n10), wi(r10)), s10 && s10.d(e21), c10 && c10.d(e21), l10 && l10.d(e21), Ra(o10, e21); + } }; + } + function R4(e20) { + var t10, n10; + return t10 = new d4({ props: { editorState: e20[8] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 256 & n11[0] && (r10.editorState = e21[8]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function N4(e20) { + var t10, n10; + return t10 = new IN({ props: { type: "error", icon: TP, message: e20[14].message, actions: e20[15], onClick: e20[29], onClose: e20[5] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 16384 & n11[0] && (r10.message = e21[14].message), 32768 & n11[0] && (r10.actions = e21[15]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function I4(e20) { + var t10, n10; + return t10 = new IN({ props: { type: "success", message: "Do you want to format the JSON?", actions: [{ icon: xz, text: "Format", title: "Format JSON: add proper indentation and new lines (Ctrl+I)", onClick: e20[17] }, { icon: MP, text: "No thanks", title: "Close this message", onClick: e20[53] }], onClose: e20[5] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11[0] && (r10.actions = [{ icon: xz, text: "Format", title: "Format JSON: add proper indentation and new lines (Ctrl+I)", onClick: e21[17] }, { icon: MP, text: "No thanks", title: "Close this message", onClick: e21[53] }]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function D4(e20) { + var t10, n10, r10, o10, i10, a10 = e20[2] && M4(O4(e20)), s10 = [A4, E4], c10 = []; + function l10(e21, t11) { + return 0 === t11 ? function(e23) { + var t12 = e23.slice(), n11 = t12[28](t12[11], t12[9]); + return t12[97] = n11, t12; + }(e21) : e21; + } + return r10 = function(e21, t11) { + return e21[16] ? 1 : 0; + }(e20), o10 = c10[r10] = s10[r10](l10(e20, r10)), { c: function() { + t10 = ji("div"), a10 && a10.c(), n10 = $i(), o10.c(), Ai(t10, "class", "jse-text-mode svelte-a0poeb"), zi(t10, "no-main-menu", !e20[2]); + }, m: function(o11, s11) { + ki(o11, t10, s11), a10 && a10.m(t10, null), pi(t10, n10), c10[r10].m(t10, null), e20[54](t10), i10 = true; + }, p: function(e21, s11) { + e21[2] ? a10 ? (a10.p(O4(e21), s11), 4 & s11[0] && wa(a10, 1)) : ((a10 = M4(O4(e21))).c(), wa(a10, 1), a10.m(t10, n10)) : a10 && (ba(), xa(a10, 1, 1, function() { + a10 = null; + }), ka()), o10.p(l10(e21, r10), s11), (!i10 || 4 & s11[0]) && zi(t10, "no-main-menu", !e21[2]); + }, i: function(e21) { + i10 || (wa(a10), wa(o10), i10 = true); + }, o: function(e21) { + xa(a10), xa(o10), i10 = false; + }, d: function(n11) { + n11 && wi(t10), a10 && a10.d(), c10[r10].d(), e20[54](null); + } }; + } + function q4(e20) { + return { from: e20.from || 0, to: e20.to || 0, message: e20.message || "", actions: e20.actions, severity: e20.severity }; + } + function z4(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10 = t10.readOnly, u10 = t10.mainMenuBar, f10 = t10.statusBar, d10 = t10.askToFormat, h10 = t10.externalContent, v10 = t10.externalSelection, p10 = t10.indentation, m10 = t10.tabSize, g10 = t10.escapeUnicodeCharacters, y10 = t10.parser, b10 = t10.validator, k10 = t10.validationParser, w10 = t10.onChange, x10 = t10.onChangeMode, j10 = t10.onSelect, S10 = t10.onError, C10 = t10.onFocus, $10 = t10.onBlur, _10 = t10.onRenderMenu, O10 = t10.onSortModal, M10 = t10.onTransformModal, E10 = Da("jsoneditor:TextMode"), A10 = { key: "Mod-i", run: Q10, shift: Y10, preventDefault: true }, P10 = "undefined" == typeof window; + E10("isSSR:", P10); + var T8 = false, R8 = [], N8 = new VF(), I10 = new VF(), D10 = new VF(), q10 = new VF(), z10 = new VF(), B10 = h10, L10 = Y_(B10, p10, y10), F10 = g10; + Gi(xo(ko().mark(function e21() { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (!P10) { + e23.next = 2; + break; + } + return e23.abrupt("return"); + case 2: + try { + s10 = re2({ target: i10, initialText: be2(L10, T8) ? "" : r10.escapeValue(L10), readOnly: l10, indentation: p10 }); + } catch (e24) { + console.error(e24); + } + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))), Qi(function() { + s10 && (E10("Destroy CodeMirror editor"), s10.destroy()); + }); + var V10 = false, H10 = false, W10 = A$(), U10 = A$(); + function J10() { + s10 && (E10("focus"), s10.focus()); + } + var K10 = false; + function G10(e21) { + E10("patch", e21); + var t11 = y10.parse(L10), n11 = rc(t11, e21), r11 = vc(t11, e21); + return se2({ text: y10.stringify(n11, null, p10) }), { json: n11, previousJson: t11, undo: r11, redo: e21 }; + } + function Q10() { + if (E10("format"), l10) + return false; + try { + var e21 = y10.parse(L10); + return se2({ text: y10.stringify(e21, null, p10) }), n10(0, d10 = true), true; + } catch (e23) { + S10(e23); + } + return false; + } + function Y10() { + if (E10("compact"), l10) + return false; + try { + var e21 = y10.parse(L10); + return se2({ text: y10.stringify(e21) }), n10(0, d10 = false), true; + } catch (e23) { + S10(e23); + } + return false; + } + function X10() { + if (E10("repair"), !l10) + try { + se2({ text: Hl(L10) }), n10(51, ke2 = $s), n10(14, we2 = null); + } catch (e21) { + S10(e21); + } + } + function Z10(e21) { + var t11 = e21.id, n11 = e21.rootPath, r11 = e21.onTransform, o11 = e21.onClose; + try { + var i11 = y10.parse(L10); + K10 = true, M10({ id: t11 || U10, json: i11, rootPath: n11 || [], onTransform: function(e23) { + r11 ? r11({ operations: e23, json: i11, transformedJson: rc(i11, e23) }) : (E10("onTransform", e23), G10(e23)); + }, onClose: function() { + K10 = false, J10(), o11 && o11(); + } }); + } catch (e23) { + S10(e23); + } + } + function ee2(e21, t11) { + E10("setSelection", { anchor: e21, head: t11 }), s10 && s10.dispatch(s10.state.update({ selection: { anchor: e21, head: t11 }, scrollIntoView: true })); + } + function te2(e21, t11) { + if (1 === t11.state.selection.ranges.length) { + var n11 = t11.state.selection.ranges[0], r11 = L10.slice(n11.from, n11.to); + if ("{" === r11 || "[" === r11) { + var o11 = bc.parse(L10), i11 = Object.keys(o11.pointers).find(function(e23) { + var t12; + return (null === (t12 = o11.pointers[e23].value) || void 0 === t12 ? void 0 : t12.pos) === n11.from; + }), a11 = o11.pointers[i11]; + if (i11 && a11 && a11.value && a11.valueEnd) + E10("pointer found, selecting inner contents of path:", i11, a11), ee2(a11.value.pos + 1, a11.valueEnd.pos - 1); + } + } + } + function ne2() { + return function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + return [u0.of({ source: e21, config: t11 }), l0, _0]; + }(xe2, { delay: 300 }); + } + function re2(e21) { + var t11 = e21.target, r11 = e21.initialText, o11 = e21.readOnly, i11 = e21.indentation; + E10("Create CodeMirror editor", { readOnly: o11, indentation: i11 }); + var a11, l11, u11 = mV.create({ doc: r11, selection: ce2(v10), extensions: [JJ.of([UZ, A10]), N8.of(ne2()), M0(), CG(), OG, CK(), $X(), EY(), cK(), [mK, gK], mV.allowMultipleSelections.of(true), mV.transactionFilter.of(function(e23) { + if (!e23.docChanged || !e23.isUserEvent("input.type") && !e23.isUserEvent("input.complete")) + return e23; + var t12 = e23.startState.languageDataAt("indentOnInput", e23.startState.selection.main.head); + if (!t12.length) + return e23; + var n11 = e23.newDoc, r12 = e23.newSelection.main.head, o12 = n11.lineAt(r12); + if (r12 > o12.from + lY) + return e23; + var i12 = n11.sliceString(o12.from, r12); + if (!t12.some(function(e24) { + return e24.test(i12); + })) + return e23; + var a12, s11 = e23.state, c11 = -1, l12 = [], u12 = bo(s11.selection.ranges); + try { + for (u12.s(); !(a12 = u12.n()).done; ) { + var f11 = a12.value.head, d11 = s11.doc.lineAt(f11); + if (d11.from != c11) { + c11 = d11.from; + var h11 = eY(s11, d11.from); + if (null != h11) { + var v11 = /^\s*/.exec(d11.text)[0], p11 = ZQ(s11, h11); + v11 != p11 && l12.push({ from: d11.from, to: d11.from + v11.length, insert: p11 }); + } + } + } + } catch (e24) { + u12.e(e24); + } finally { + u12.f(); + } + return l12.length ? [e23, { changes: l12, sequential: true }] : e23; + }), IY(zY, { fallback: true }), GY(), [K2, V2], r4(), RK(), DK(), EK, (l11 = [k1, b1], a11 && l11.push(p1.of(a11)), l11), JJ.of([].concat(G2, Bo(WZ), Q1, UX, wY, o4, c0)), v4, S4({ hideFirstIndent: true }), zJ.domEventHandlers({ dblclick: te2 }), zJ.updateListener.of(function(e23) { + n10(8, c10 = e23.state), e23.docChanged ? pe2() : e23.selectionSet && ye2(); + }), new GQ(e1), x1({ top: true }), I10.of(mV.readOnly.of(o11)), q10.of(mV.tabSize.of(m10)), D10.of(he2(i11)), z10.of(zJ.theme({}, { dark: oe2() })), zJ.lineWrapping, $4] }); + return s10 = new zJ({ state: u11, parent: t11 }); + } + function oe2() { + return !!i10 && getComputedStyle(i10).getPropertyValue("--jse-theme").includes("dark"); + } + function ie2(e21) { + var t11 = e21.path, n11 = e21.message, o11 = function(e23, t12) { + try { + var n12 = bc.parse(e23), r11 = Zs(t12), o12 = n12.pointers[r11]; + if (o12) + return { path: t12, line: o12.key ? o12.key.line : o12.value ? o12.value.line : 0, column: o12.key ? o12.key.column : o12.value ? o12.value.column : 0, from: o12.key ? o12.key.pos : o12.value ? o12.value.pos : 0, to: o12.keyEnd ? o12.keyEnd.pos : o12.valueEnd ? o12.valueEnd.pos : 0 }; + } catch (e24) { + console.error(e24); + } + return { path: t12, line: 0, column: 0, from: 0, to: 0 }; + }(r10.escapeValue(L10), t11); + return { path: t11, line: o11.line, column: o11.column, from: o11.from, to: o11.to, message: n11, severity: Za.warning, actions: [] }; + } + function ae2(e21, t11) { + var n11 = e21.line, r11 = e21.column, o11 = e21.position, i11 = e21.message; + return { path: [], line: n11, column: r11, from: o11, to: o11, severity: Za.error, message: i11, actions: t11 && !l10 ? [{ name: "Auto repair", apply: function() { + return X10(); + } }] : null }; + } + function se2(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], o11 = Y_(e21, p10, y10), i11 = !Ow(e21, B10), a11 = B10; + B10 = e21, n10(11, L10 = o11), E10("setCodeMirrorContent", { isChanged: i11, forceUpdate: t11 }), s10 && (i11 || t11) && (be2(L10, T8) || s10.dispatch({ changes: { from: 0, to: s10.state.doc.length, insert: r10.escapeValue(L10) } }), ve2(), i11 && ge2(B10, a11)); + } + function ce2(e21) { + return bE(e21) ? $F.fromJSON(e21) : void 0; + } + function le2() { + return (le2 = xo(ko().mark(function e21() { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return E10("refresh"), e23.next = 3, fe2(); + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function ue2() { + if (s10) { + var e21 = s10 ? r10.unescapeValue(s10.state.doc.toString()) : "", t11 = e21 !== L10; + if (E10("onChangeCodeMirrorValue", { isChanged: t11 }), t11) { + var o11 = B10; + n10(11, L10 = e21), B10 = { text: L10 }, ve2(), ge2(B10, o11), ca().then(ye2); + } + } + } + function fe2() { + return de2.apply(this, arguments); + } + function de2() { + return (de2 = xo(ko().mark(function e21() { + var t11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return e23.next = 2, ca(); + case 2: + s10 && (t11 = oe2(), E10("updateTheme", { dark: t11 }), s10.dispatch({ effects: [z10.reconfigure(zJ.theme({}, { dark: t11 }))] })); + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function he2(e21) { + return YQ.of("number" == typeof e21 ? " ".repeat(e21) : e21); + } + function ve2() { + n10(12, V10 = TX(s10.state) > 0), n10(13, H10 = RX(s10.state) > 0), E10({ canUndo: V10, canRedo: H10 }); + } + Qi(function() { + me2(); + }), ON({ onMount: Gi, onDestroy: Qi, getWindow: function() { + return SO(a10); + }, hasFocus: function() { + return K10 && document.hasFocus() || CO(a10); + }, onFocus: C10, onBlur: function() { + me2(), $10(); + } }); + var pe2 = Vy(ue2, 300); + function me2() { + pe2.flush(); + } + function ge2(e21, t11) { + w10 && w10(e21, t11, { contentErrors: je2(), patchResult: null }); + } + function ye2() { + j10(Ro({ type: Ya.text }, c10.selection.toJSON())); + } + function be2(e21, t11) { + return !!e21 && e21.length > ps && !t11; + } + var ke2 = $s, we2 = null; + function xe2() { + if (be2(L10, T8)) + return []; + var e21 = je2(); + return uI(e21) ? [q4(ae2(e21.parseError, e21.isRepairable))] : fI(e21) ? e21.validationErrors.map(ie2).map(q4) : []; + } + function je2() { + E10("validate:start"), me2(); + var e21 = Se2(r10.escapeValue(L10), b10, y10, k10); + return uI(e21) ? (n10(51, ke2 = e21.isRepairable ? _s : "invalid"), n10(14, we2 = e21.parseError), n10(10, R8 = [])) : (n10(51, ke2 = $s), n10(14, we2 = null), n10(10, R8 = (null == e21 ? void 0 : e21.validationErrors) || [])), E10("validate:end"), e21; + } + var Se2 = CB($N); + function Ce2() { + we2 && function(e21) { + E10("select parse error", e21); + var t11 = ae2(e21, false); + ee2(null != t11.from ? t11.from : 0, null != t11.to ? t11.to : 0), J10(); + }(we2); + } + var $e2 = { icon: fP, text: "Show me", title: "Move to the parse error location", onClick: Ce2 }; + return e20.$$set = function(e21) { + "readOnly" in e21 && n10(1, l10 = e21.readOnly), "mainMenuBar" in e21 && n10(2, u10 = e21.mainMenuBar), "statusBar" in e21 && n10(3, f10 = e21.statusBar), "askToFormat" in e21 && n10(0, d10 = e21.askToFormat), "externalContent" in e21 && n10(30, h10 = e21.externalContent), "externalSelection" in e21 && n10(31, v10 = e21.externalSelection), "indentation" in e21 && n10(32, p10 = e21.indentation), "tabSize" in e21 && n10(33, m10 = e21.tabSize), "escapeUnicodeCharacters" in e21 && n10(34, g10 = e21.escapeUnicodeCharacters), "parser" in e21 && n10(35, y10 = e21.parser), "validator" in e21 && n10(36, b10 = e21.validator), "validationParser" in e21 && n10(37, k10 = e21.validationParser), "onChange" in e21 && n10(38, w10 = e21.onChange), "onChangeMode" in e21 && n10(39, x10 = e21.onChangeMode), "onSelect" in e21 && n10(40, j10 = e21.onSelect), "onError" in e21 && n10(41, S10 = e21.onError), "onFocus" in e21 && n10(42, C10 = e21.onFocus), "onBlur" in e21 && n10(43, $10 = e21.onBlur), "onRenderMenu" in e21 && n10(4, _10 = e21.onRenderMenu), "onSortModal" in e21 && n10(44, O10 = e21.onSortModal), "onTransformModal" in e21 && n10(45, M10 = e21.onTransformModal); + }, e20.$$.update = function() { + 8 & e20.$$.dirty[1] && (r10 = aO({ escapeControlCharacters: false, escapeUnicodeCharacters: g10 })), 1073741824 & e20.$$.dirty[0] && se2(h10), 1 & e20.$$.dirty[1] && function(e21) { + if (bE(e21)) { + var t11 = ce2(e21); + !s10 || !t11 || c10 && c10.selection.eq(t11) || (E10("applyExternalSelection", t11), s10.dispatch({ selection: t11 })); + } + }(v10), 32 & e20.$$.dirty[1] && function(e21) { + E10("updateLinter", e21), s10 && s10.dispatch({ effects: N8.reconfigure(ne2()) }); + }(b10), 2 & e20.$$.dirty[1] && function(e21) { + s10 && (E10("updateIndentation", e21), s10.dispatch({ effects: D10.reconfigure(he2(e21)) })); + }(p10), 4 & e20.$$.dirty[1] && function(e21) { + s10 && (E10("updateTabSize", e21), s10.dispatch({ effects: q10.reconfigure(mV.tabSize.of(e21)) })); + }(m10), 2 & e20.$$.dirty[0] && function(e21) { + s10 && (E10("updateReadOnly", e21), s10.dispatch({ effects: [I10.reconfigure(mV.readOnly.of(e21))] })); + }(l10), 524296 & e20.$$.dirty[1] && F10 !== g10 && (n10(50, F10 = g10), E10("forceUpdateText", { escapeUnicodeCharacters: g10 }), s10 && s10.dispatch({ changes: { from: 0, to: s10.state.doc.length, insert: r10.escapeValue(L10) } })), 2 & e20.$$.dirty[0] | 1048576 & e20.$$.dirty[1] && n10(15, o10 = ke2 !== _s || l10 ? [$e2] : [{ icon: uP, text: "Auto repair", title: "Automatically repair JSON", onClick: X10 }, $e2]); + }, [d10, l10, u10, f10, _10, J10, i10, a10, c10, T8, R8, L10, V10, H10, we2, o10, P10, Q10, Y10, function() { + var e21; + if (!l10) + try { + var t11 = y10.parse(L10); + K10 = true, O10({ id: W10, json: t11, rootPath: [], onSort: (e21 = xo(ko().mark(function e23(t12) { + var n11; + return ko().wrap(function(e24) { + for (; ; ) + switch (e24.prev = e24.next) { + case 0: + n11 = t12.operations, E10("onSort", n11), G10(n11); + case 3: + case "end": + return e24.stop(); + } + }, e23); + })), function(t12) { + return e21.apply(this, arguments); + }), onClose: function() { + K10 = false, J10(); + } }); + } catch (e23) { + S10(e23); + } + }, function() { + l10 || Z10({ rootPath: [] }); + }, function() { + s10 && (i10 && i10.querySelector(".cm-search") ? G1(s10) : K1(s10)); + }, function() { + l10 || s10 && (OX(s10), J10()); + }, function() { + l10 || s10 && (MX(s10), J10()); + }, function() { + n10(9, T8 = true), se2(h10, true); + }, function() { + x10(Qa.tree); + }, function() { + ue2(); + }, function(e21) { + E10("select validation error", e21); + var t11 = ie2(e21), n11 = t11.from, r11 = t11.to; + null !== n11 && null !== r11 && (ee2(n11, r11), J10()); + }, be2, Ce2, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, O10, M10, G10, Z10, function() { + return le2.apply(this, arguments); + }, je2, F10, ke2, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(6, i10 = e21); + }); + }, function() { + return n10(0, d10 = false); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(7, a10 = e21); + }); + }]; + } + var B4 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, z4, D4, Zo, { readOnly: 1, mainMenuBar: 2, statusBar: 3, askToFormat: 0, externalContent: 30, externalSelection: 31, indentation: 32, tabSize: 33, escapeUnicodeCharacters: 34, parser: 35, validator: 36, validationParser: 37, onChange: 38, onChangeMode: 39, onSelect: 40, onError: 41, onFocus: 42, onBlur: 43, onRenderMenu: 4, onSortModal: 44, onTransformModal: 45, focus: 5, patch: 46, openTransformModal: 47, refresh: 48, validate: 49 }, _4, [-1, -1, -1, -1]), n10; + } + return Ao(t10, Ia), Do(t10, [{ key: "focus", get: function() { + return this.$$.ctx[5]; + } }, { key: "patch", get: function() { + return this.$$.ctx[46]; + } }, { key: "openTransformModal", get: function() { + return this.$$.ctx[47]; + } }, { key: "refresh", get: function() { + return this.$$.ctx[48]; + } }, { key: "validate", get: function() { + return this.$$.ctx[49]; + } }]), t10; + }(); + function L4(e20) { + var t10, n10; + return t10 = new EI({ props: { items: e20[0] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & jo(n11, 1)[0] && (r10.items = e21[0]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function F4(e20, t10, n10) { + var r10, o10, i10 = t10.json, a10 = t10.readOnly, s10 = t10.historyState, c10 = t10.onSort, l10 = t10.onTransform, u10 = t10.onContextMenu, f10 = t10.onUndo, d10 = t10.onRedo, h10 = t10.onRenderMenu; + return e20.$$set = function(e21) { + "json" in e21 && n10(1, i10 = e21.json), "readOnly" in e21 && n10(2, a10 = e21.readOnly), "historyState" in e21 && n10(3, s10 = e21.historyState), "onSort" in e21 && n10(4, c10 = e21.onSort), "onTransform" in e21 && n10(5, l10 = e21.onTransform), "onContextMenu" in e21 && n10(6, u10 = e21.onContextMenu), "onUndo" in e21 && n10(7, f10 = e21.onUndo), "onRedo" in e21 && n10(8, d10 = e21.onRedo), "onRenderMenu" in e21 && n10(9, h10 = e21.onRenderMenu); + }, e20.$$.update = function() { + 510 & e20.$$.dirty && n10(10, r10 = a10 ? [{ type: "space" }] : [{ type: "button", icon: kP, title: "Sort", className: "jse-sort", onClick: c10, disabled: a10 || void 0 === i10 }, { type: "button", icon: cP, title: "Transform contents (filter, sort, project)", className: "jse-transform", onClick: l10, disabled: a10 || void 0 === i10 }, { type: "button", icon: yP, title: xs, className: "jse-contextmenu", onClick: u10 }, { type: "separator" }, { type: "button", icon: vP, title: "Undo (Ctrl+Z)", className: "jse-undo", onClick: f10, disabled: !s10.canUndo }, { type: "button", icon: hP, title: "Redo (Ctrl+Shift+Z)", className: "jse-redo", onClick: d10, disabled: !s10.canRedo }, { type: "space" }]), 1536 & e20.$$.dirty && n10(0, o10 = h10(r10)); + }, [o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, r10]; + } + var V4 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, F4, L4, Zo, { json: 1, readOnly: 2, historyState: 3, onSort: 4, onTransform: 5, onContextMenu: 6, onUndo: 7, onRedo: 8, onRenderMenu: 9 }), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function H4(e20, t10, n10) { + var r10 = e20.slice(); + return r10[9] = t10[n10], r10; + } + function W4(e20) { + var t10, n10, r10, o10 = [e20[9].props], i10 = e20[9].component; + function a10(e21, t11) { + var n11 = {}; + if (void 0 !== t11 && 1 & t11) + n11 = Ma(o10, [Ea(e21[9].props)]); + else + for (var r11 = 0; r11 < o10.length; r11 += 1) + n11 = Jo(n11, o10[r11]); + return { props: n11 }; + } + return i10 && (t10 = Li(i10, a10(e20))), { c: function() { + t10 && Pa(t10.$$.fragment), n10 = _i(); + }, m: function(e21, o11) { + t10 && Ta(t10, e21, o11), ki(e21, n10, o11), r10 = true; + }, p: function(e21, r11) { + if (1 & r11 && i10 !== (i10 = e21[9].component)) { + if (t10) { + ba(); + var s10 = t10; + xa(s10.$$.fragment, 1, 0, function() { + Ra(s10, 1); + }), ka(); + } + i10 ? (Pa((t10 = Li(i10, a10(e21, r11))).$$.fragment), wa(t10.$$.fragment, 1), Ta(t10, n10.parentNode, n10)) : t10 = null; + } else if (i10) { + var c10 = 1 & r11 ? Ma(o10, [Ea(e21[9].props)]) : {}; + t10.$set(c10); + } + }, i: function(e21) { + r10 || (t10 && wa(t10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + t10 && xa(t10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(n10), t10 && Ra(t10, e21); + } }; + } + function U4(e20) { + var t10, n10, r10 = e20[9].component, o10 = W4(e20); + return { c: function() { + o10.c(), t10 = _i(); + }, m: function(e21, r11) { + o10.m(e21, r11), ki(e21, t10, r11), n10 = true; + }, p: function(e21, n11) { + 1 & n11 && Zo(r10, r10 = e21[9].component) ? (ba(), xa(o10, 1, 1, Wo), ka(), (o10 = W4(e21)).c(), wa(o10, 1), o10.m(t10.parentNode, t10)) : o10.p(e21, n11); + }, i: function(e21) { + n10 || (wa(o10), n10 = true); + }, o: function(e21) { + xa(o10), n10 = false; + }, d: function(e21) { + e21 && wi(t10), o10.d(e21); + } }; + } + function J4(e20) { + for (var t10, n10, r10 = Ca(e20[0]), o10 = [], i10 = 0; i10 < r10.length; i10 += 1) + o10[i10] = U4(H4(e20, r10, i10)); + var a10 = function(e21) { + return xa(o10[e21], 1, 1, function() { + o10[e21] = null; + }); + }; + return { c: function() { + for (var e21 = 0; e21 < o10.length; e21 += 1) + o10[e21].c(); + t10 = _i(); + }, m: function(e21, r11) { + for (var i11 = 0; i11 < o10.length; i11 += 1) + o10[i11] && o10[i11].m(e21, r11); + ki(e21, t10, r11), n10 = true; + }, p: function(e21, n11) { + var i11 = jo(n11, 1)[0]; + if (1 & i11) { + var s10; + for (r10 = Ca(e21[0]), s10 = 0; s10 < r10.length; s10 += 1) { + var c10 = H4(e21, r10, s10); + o10[s10] ? (o10[s10].p(c10, i11), wa(o10[s10], 1)) : (o10[s10] = U4(c10), o10[s10].c(), wa(o10[s10], 1), o10[s10].m(t10.parentNode, t10)); + } + for (ba(), s10 = r10.length; s10 < o10.length; s10 += 1) + a10(s10); + ka(); + } + }, i: function(e21) { + if (!n10) { + for (var t11 = 0; t11 < r10.length; t11 += 1) + wa(o10[t11]); + n10 = true; + } + }, o: function(e21) { + o10 = o10.filter(Boolean); + for (var t11 = 0; t11 < o10.length; t11 += 1) + xa(o10[t11]); + n10 = false; + }, d: function(e21) { + e21 && wi(t10), xi(o10, e21); + } }; + } + function K4(e20, t10, n10) { + var r10, o10, i10 = t10.path, a10 = t10.value, s10 = t10.context, c10 = t10.enforceString, l10 = t10.selection, u10 = t10.searchResultItems; + function f10(e21, t11) { + return s10.onPatch(function(e23, t12) { + return e23.flatMap(function(e24) { + if (Ds(e24)) { + var n11 = Xs(e24.path); + if (n11.length > 0) { + for (var r11 = [e24], o11 = Qk(n11); o11.length > 0 && !Ys(t12, o11); ) + r11.unshift({ op: "add", path: Zs(o11), value: {} }), o11 = Qk(o11); + return r11; + } + } + return e24; + }); + }(e21, s10.getJson()), t11); + } + return e20.$$set = function(e21) { + "path" in e21 && n10(1, i10 = e21.path), "value" in e21 && n10(2, a10 = e21.value), "context" in e21 && n10(3, s10 = e21.context), "enforceString" in e21 && n10(4, c10 = e21.enforceString), "selection" in e21 && n10(5, l10 = e21.selection), "searchResultItems" in e21 && n10(6, u10 = e21.searchResultItems); + }, e20.$$.update = function() { + 40 & e20.$$.dirty && n10(7, r10 = !s10.readOnly && pE(l10) && zE(l10)), 254 & e20.$$.dirty && n10(0, o10 = s10.onRenderValue({ path: i10, value: a10, readOnly: s10.readOnly, enforceString: c10, isEditing: r10, parser: s10.parser, normalization: s10.normalization, selection: l10, searchResultItems: u10, onPatch: f10, onPasteJson: s10.onPasteJson, onSelect: s10.onSelect, onFind: s10.onFind, findNextInside: s10.findNextInside, focus: s10.focus })); + }, [o10, i10, a10, s10, c10, l10, u10, r10]; + } + var G4 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, K4, J4, Zo, { path: 1, value: 2, context: 3, enforceString: 4, selection: 5, searchResultItems: 6 }), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function Q4(e20) { + mi(e20, "svelte-1o4m3u7", '.jse-inline-value.svelte-1o4m3u7{font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);line-height:var(--jse-line-height, calc(1em + 4px));border:none;padding:0 calc(0.5 * var(--jse-padding, 10px));background:transparent;color:inherit;cursor:pointer}.jse-inline-value.svelte-1o4m3u7:hover{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06))}.jse-inline-value.jse-selected.svelte-1o4m3u7{background:var(--jse-selection-background-color, #d3d3d3)}'); + } + function Y4(e20) { + var t10, n10, r10, o10, i10, a10 = tM(null !== (t10 = e20[2].stringify(e20[1])) && void 0 !== t10 ? t10 : "", 50) + ""; + return { c: function() { + n10 = ji("button"), r10 = Ci(a10), Ai(n10, "type", "button"), Ai(n10, "class", "jse-inline-value svelte-1o4m3u7"), zi(n10, "jse-selected", e20[3]); + }, m: function(t11, a11) { + ki(t11, n10, a11), pi(n10, r10), o10 || (i10 = Oi(n10, "dblclick", e20[5]), o10 = true); + }, p: function(e21, t11) { + var o11, i11 = jo(t11, 1)[0]; + 6 & i11 && a10 !== (a10 = tM(null !== (o11 = e21[2].stringify(e21[1])) && void 0 !== o11 ? o11 : "", 50) + "") && Ni(r10, a10), 8 & i11 && zi(n10, "jse-selected", e21[3]); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(n10), o10 = false, i10(); + } }; + } + function X4(e20, t10, n10) { + var r10 = t10.path, o10 = t10.value, i10 = t10.parser, a10 = t10.isSelected, s10 = t10.onEdit; + return e20.$$set = function(e21) { + "path" in e21 && n10(0, r10 = e21.path), "value" in e21 && n10(1, o10 = e21.value), "parser" in e21 && n10(2, i10 = e21.parser), "isSelected" in e21 && n10(3, a10 = e21.isSelected), "onEdit" in e21 && n10(4, s10 = e21.onEdit); + }, [r10, o10, i10, a10, s10, function() { + return s10(r10); + }]; + } + var Z4 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, X4, Y4, Zo, { path: 0, value: 1, parser: 2, isSelected: 3, onEdit: 4 }, Q4), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function e32(e20) { + mi(e20, "svelte-2v0aqj", ".jse-column-header.svelte-2v0aqj.svelte-2v0aqj{background:none;border:none;font-family:inherit;font-size:inherit;color:inherit;display:flex;gap:var(--jse-padding, 10px);padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px) calc(0.5 * var(--jse-padding, 10px)) calc(0.5 * var(--jse-padding, 10px));width:100%}.jse-column-header.svelte-2v0aqj.svelte-2v0aqj:hover{background:var(--jse-table-header-background-highlight, #e8e8e8)}.jse-column-header.svelte-2v0aqj.svelte-2v0aqj:not(.jse-column-header.jse-readonly){cursor:pointer}.jse-column-header.svelte-2v0aqj span.jse-column-sort-icon.svelte-2v0aqj{height:1em}"); + } + function t3(e20) { + var t10, n10, r10, o10; + return n10 = new jM({ props: { data: e20[1] === ts.asc ? gP : sP } }), { c: function() { + t10 = ji("span"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-column-sort-icon svelte-2v0aqj"), Ai(t10, "title", r10 = "Currently sorted in ".concat(e20[2], " order")); + }, m: function(e21, r11) { + ki(e21, t10, r11), Ta(n10, t10, null), o10 = true; + }, p: function(e21, i10) { + var a10 = {}; + 2 & i10 && (a10.data = e21[1] === ts.asc ? gP : sP), n10.$set(a10), (!o10 || 4 & i10 && r10 !== (r10 = "Currently sorted in ".concat(e21[2], " order"))) && Ai(t10, "title", r10); + }, i: function(e21) { + o10 || (wa(n10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function n3(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = tM(e20[3], 50) + "", u10 = void 0 !== e20[1] && t3(e20); + return { c: function() { + t10 = ji("button"), n10 = ji("span"), r10 = Ci(l10), o10 = $i(), u10 && u10.c(), Ai(n10, "class", "jse-column-name"), Ai(t10, "type", "button"), Ai(t10, "class", "jse-column-header svelte-2v0aqj"), Ai(t10, "title", i10 = e20[0] ? e20[3] : e20[3] + " (Click to sort the data by this column)"), zi(t10, "jse-readonly", e20[0]); + }, m: function(i11, l11) { + ki(i11, t10, l11), pi(t10, n10), pi(n10, r10), pi(t10, o10), u10 && u10.m(t10, null), a10 = true, s10 || (c10 = Oi(t10, "click", e20[4]), s10 = true); + }, p: function(e21, n11) { + var o11 = jo(n11, 1)[0]; + (!a10 || 8 & o11) && l10 !== (l10 = tM(e21[3], 50) + "") && Ni(r10, l10), void 0 !== e21[1] ? u10 ? (u10.p(e21, o11), 2 & o11 && wa(u10, 1)) : ((u10 = t3(e21)).c(), wa(u10, 1), u10.m(t10, null)) : u10 && (ba(), xa(u10, 1, 1, function() { + u10 = null; + }), ka()), (!a10 || 9 & o11 && i10 !== (i10 = e21[0] ? e21[3] : e21[3] + " (Click to sort the data by this column)")) && Ai(t10, "title", i10), (!a10 || 1 & o11) && zi(t10, "jse-readonly", e21[0]); + }, i: function(e21) { + a10 || (wa(u10), a10 = true); + }, o: function(e21) { + xa(u10), a10 = false; + }, d: function(e21) { + e21 && wi(t10), u10 && u10.d(), s10 = false, c10(); + } }; + } + function r3(e20, t10, n10) { + var r10, o10, i10, a10 = t10.path, s10 = t10.sortedColumn, c10 = t10.readOnly, l10 = t10.onSort; + return e20.$$set = function(e21) { + "path" in e21 && n10(5, a10 = e21.path), "sortedColumn" in e21 && n10(6, s10 = e21.sortedColumn), "readOnly" in e21 && n10(0, c10 = e21.readOnly), "onSort" in e21 && n10(7, l10 = e21.onSort); + }, e20.$$.update = function() { + var t11; + (32 & e20.$$.dirty && n10(3, r10 = _w(a10) ? "values" : JO(a10)), 96 & e20.$$.dirty) && n10(1, o10 = s10 && Ow(a10, null === (t11 = s10) || void 0 === t11 ? void 0 : t11.path) ? s10.sortDirection : void 0); + 2 & e20.$$.dirty && n10(2, i10 = o10 ? Es[o10] : void 0); + }, [c10, o10, i10, r10, function() { + c10 || l10({ path: a10, sortDirection: o10 === ts.asc ? ts.desc : ts.asc }); + }, a10, s10, l10]; + } + var o3; + var i3; + var a3 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, r3, n3, Zo, { path: 5, sortedColumn: 6, readOnly: 0, onSort: 7 }, e32), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function s3(e20, t10) { + return o3 || (i3 = /* @__PURE__ */ new WeakMap(), o3 = new ResizeObserver(function(e21) { + var t11, n10 = bo(e21); + try { + for (n10.s(); !(t11 = n10.n()).done; ) { + var r10 = t11.value, o10 = i3.get(r10.target); + o10 && o10(r10.target); + } + } catch (e23) { + n10.e(e23); + } finally { + n10.f(); + } + })), i3.set(e20, t10), o3.observe(e20), { destroy: function() { + i3.delete(e20), o3.unobserve(e20); + } }; + } + function c3(e20) { + var t10, n10; + return t10 = new qD({ props: { items: e20[2], onCloseContextMenu: e20[1], tip: e20[0] ? "Tip: you can open this context menu via right-click or with Ctrl+Q" : void 0 } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = jo(n11, 1)[0], o10 = {}; + 4 & r10 && (o10.items = e21[2]), 2 & r10 && (o10.onCloseContextMenu = e21[1]), 1 & r10 && (o10.tip = e21[0] ? "Tip: you can open this context menu via right-click or with Ctrl+Q" : void 0), t10.$set(o10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function l3(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10 = t10.json, v10 = t10.documentState, p10 = t10.parser, m10 = t10.showTip, g10 = t10.onCloseContextMenu, y10 = t10.onRenderContextMenu, b10 = t10.onEditValue, k10 = t10.onEditRow, w10 = t10.onToggleEnforceString, x10 = t10.onCut, j10 = t10.onCopy, S10 = t10.onPaste, C10 = t10.onRemove, $10 = t10.onDuplicateRow, _10 = t10.onInsertBeforeRow, O10 = t10.onInsertAfterRow, M10 = t10.onRemoveRow; + return e20.$$set = function(e21) { + "json" in e21 && n10(3, h10 = e21.json), "documentState" in e21 && n10(4, v10 = e21.documentState), "parser" in e21 && n10(5, p10 = e21.parser), "showTip" in e21 && n10(0, m10 = e21.showTip), "onCloseContextMenu" in e21 && n10(1, g10 = e21.onCloseContextMenu), "onRenderContextMenu" in e21 && n10(6, y10 = e21.onRenderContextMenu), "onEditValue" in e21 && n10(7, b10 = e21.onEditValue), "onEditRow" in e21 && n10(8, k10 = e21.onEditRow), "onToggleEnforceString" in e21 && n10(9, w10 = e21.onToggleEnforceString), "onCut" in e21 && n10(10, x10 = e21.onCut), "onCopy" in e21 && n10(11, j10 = e21.onCopy), "onPaste" in e21 && n10(12, S10 = e21.onPaste), "onRemove" in e21 && n10(13, C10 = e21.onRemove), "onDuplicateRow" in e21 && n10(14, $10 = e21.onDuplicateRow), "onInsertBeforeRow" in e21 && n10(15, _10 = e21.onInsertBeforeRow), "onInsertAfterRow" in e21 && n10(16, O10 = e21.onInsertAfterRow), "onRemoveRow" in e21 && n10(17, M10 = e21.onRemoveRow); + }, e20.$$.update = function() { + 16 & e20.$$.dirty && n10(24, r10 = v10.selection), 8 & e20.$$.dirty && n10(26, o10 = void 0 !== h10), 16777216 & e20.$$.dirty && n10(19, i10 = !!r10), 16777224 & e20.$$.dirty && n10(25, a10 = void 0 !== h10 && r10 ? Ws(h10, JE(r10)) : void 0), 83886080 & e20.$$.dirty && n10(20, s10 = o10 && (mE(r10) || vE(r10) || pE(r10))), 83886080 & e20.$$.dirty && n10(23, c10 = o10 && null != r10 && ME(r10)), 41943040 & e20.$$.dirty && n10(21, l10 = c10 && !Ql(a10)), 50331696 & e20.$$.dirty && n10(22, u10 = null != r10 && void 0 !== a10 && oE(a10, v10.enforceStringMap, Zs(JE(r10)), p10)), 16514944 & e20.$$.dirty && n10(18, d10 = [{ type: "separator" }, { type: "row", items: [{ type: "column", items: [{ type: "label", text: "Table cell:" }, { type: "dropdown-button", main: { type: "button", onClick: function() { + return b10(); + }, icon: dP, text: "Edit", title: "Edit the value (Double-click on the value)", disabled: !c10 }, width: "11em", items: [{ type: "button", icon: dP, text: "Edit", title: "Edit the value (Double-click on the value)", onClick: function() { + return b10(); + }, disabled: !c10 }, { type: "button", icon: u10 ? iM : aM, text: "Enforce string", title: "Enforce keeping the value as string when it contains a numeric value", onClick: function() { + return w10(); + }, disabled: !l10 }] }, { type: "dropdown-button", main: { type: "button", onClick: function() { + return x10(true); + }, icon: eP, text: "Cut", title: "Cut selected contents, formatted with indentation (Ctrl+X)", disabled: !s10 }, width: "10em", items: [{ type: "button", icon: eP, text: "Cut formatted", title: "Cut selected contents, formatted with indentation (Ctrl+X)", onClick: function() { + return x10(true); + }, disabled: !s10 }, { type: "button", icon: eP, text: "Cut compacted", title: "Cut selected contents, without indentation (Ctrl+Shift+X)", onClick: function() { + return x10(false); + }, disabled: !s10 }] }, { type: "dropdown-button", main: { type: "button", onClick: function() { + return j10(true); + }, icon: CP, text: "Copy", title: "Copy selected contents, formatted with indentation (Ctrl+C)", disabled: !s10 }, width: "12em", items: [{ type: "button", icon: CP, text: "Copy formatted", title: "Copy selected contents, formatted with indentation (Ctrl+C)", onClick: function() { + return j10(false); + }, disabled: !s10 }, { type: "button", icon: CP, text: "Copy compacted", title: "Copy selected contents, without indentation (Ctrl+Shift+C)", onClick: function() { + return j10(false); + }, disabled: !s10 }] }, { type: "button", onClick: function() { + return S10(); + }, icon: XA, text: "Paste", title: "Paste clipboard contents (Ctrl+V)", disabled: !i10 }, { type: "button", onClick: function() { + return C10(); + }, icon: QA, text: "Remove", title: "Remove selected contents (Delete)", disabled: !s10 }] }, { type: "column", items: [{ type: "label", text: "Table row:" }, { type: "button", onClick: function() { + return k10(); + }, icon: dP, text: "Edit row", title: "Edit the current row", disabled: !s10 }, { type: "button", onClick: function() { + return $10(); + }, icon: AP, text: "Duplicate row", title: "Duplicate the current row", disabled: !i10 }, { type: "button", onClick: function() { + return _10(); + }, icon: $P, text: "Insert before", title: "Insert a row before the current row", disabled: !i10 }, { type: "button", onClick: function() { + return O10(); + }, icon: $P, text: "Insert after", title: "Insert a row after the current row", disabled: !i10 }, { type: "button", onClick: function() { + return M10(); + }, icon: QA, text: "Remove row", title: "Remove current row", disabled: !i10 }] }] }]), 262208 & e20.$$.dirty && n10(2, f10 = y10(d10)); + }, [m10, g10, f10, h10, v10, p10, y10, b10, k10, w10, x10, j10, S10, C10, $10, _10, O10, M10, d10, i10, s10, l10, u10, c10, r10, a10, o10]; + } + var u3 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, l3, c3, Zo, { json: 3, documentState: 4, parser: 5, showTip: 0, onCloseContextMenu: 1, onRenderContextMenu: 6, onEditValue: 7, onEditRow: 8, onToggleEnforceString: 9, onCut: 10, onCopy: 11, onPaste: 12, onRemove: 13, onDuplicateRow: 14, onInsertBeforeRow: 15, onInsertAfterRow: 16, onRemoveRow: 17 }), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function f3(e20) { + mi(e20, "svelte-fxr3ye", '.jse-table-mode-welcome.svelte-fxr3ye.svelte-fxr3ye{flex:1;display:flex;flex-direction:column;overflow:auto;align-items:center;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode-welcome.svelte-fxr3ye.svelte-fxr3ye:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode-welcome.svelte-fxr3ye .jse-space.jse-before.svelte-fxr3ye{flex:1}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays.svelte-fxr3ye{display:flex;flex-direction:column;gap:var(--jse-padding, 10px);max-width:300px;margin:2em var(--jse-padding, 10px);font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays .jse-nested-arrays-info.svelte-fxr3ye{color:var(--jse-panel-color-readonly, #b2b2b2)}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays button.jse-nested-array-action.svelte-fxr3ye{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px;text-align:left}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays button.jse-nested-array-action.svelte-fxr3ye:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays button.jse-nested-array-action.svelte-fxr3ye:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}.jse-table-mode-welcome.svelte-fxr3ye .jse-nested-arrays button.jse-nested-array-action .jse-nested-array-count.svelte-fxr3ye{opacity:0.5;white-space:nowrap}.jse-table-mode-welcome.svelte-fxr3ye .jse-space.jse-after.svelte-fxr3ye{flex:2}'); + } + function d3(e20, t10, n10) { + var r10 = e20.slice(); + r10[14] = t10[n10]; + var o10 = r10[8](r10[14]); + return r10[15] = o10, r10; + } + function h3(e20) { + var t10, n10; + return { c: function() { + t10 = Ci(e20[6]), n10 = Ci(" cannot be opened in table mode."); + }, m: function(e21, r10) { + ki(e21, t10, r10), ki(e21, n10, r10); + }, p: function(e21, n11) { + 64 & n11 && Ni(t10, e21[6]); + }, d: function(e21) { + e21 && (wi(t10), wi(n10)); + } }; + } + function v3(e20) { + var t10; + return { c: function() { + t10 = Ci("An object cannot be opened in table mode. You can open a nested array instead, or open the\n document in tree mode."); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function p3(e20) { + var t10; + return { c: function() { + t10 = Ci("You can open the document in tree mode instead."); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function m3(e20) { + var t10, n10, r10; + return { c: function() { + t10 = Ci("You can open the document in tree mode instead, or paste a JSON Array using "), (n10 = ji("b")).textContent = "Ctrl+V", r10 = Ci("."); + }, m: function(e21, o10) { + ki(e21, t10, o10), ki(e21, n10, o10), ki(e21, r10, o10); + }, d: function(e21) { + e21 && (wi(t10), wi(n10), wi(r10)); + } }; + } + function g3(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10 = JO(e20[14]) + "", p10 = e20[15] + "", m10 = 1 !== e20[15] ? "items" : "item"; + function g10() { + return e20[12](e20[14]); + } + return { c: function() { + t10 = ji("button"), n10 = Ci(e20[7]), r10 = Ci(' "'), o10 = Ci(v10), i10 = Ci('"\n '), a10 = ji("span"), s10 = Ci("("), c10 = Ci(p10), l10 = $i(), u10 = Ci(m10), f10 = Ci(")"), Ai(a10, "class", "jse-nested-array-count svelte-fxr3ye"), Ai(t10, "type", "button"), Ai(t10, "class", "jse-nested-array-action svelte-fxr3ye"); + }, m: function(e21, v11) { + ki(e21, t10, v11), pi(t10, n10), pi(t10, r10), pi(t10, o10), pi(t10, i10), pi(t10, a10), pi(a10, s10), pi(a10, c10), pi(a10, l10), pi(a10, u10), pi(a10, f10), d10 || (h10 = Oi(t10, "click", g10), d10 = true); + }, p: function(t11, r11) { + e20 = t11, 128 & r11 && Ni(n10, e20[7]), 8 & r11 && v10 !== (v10 = JO(e20[14]) + "") && Ni(o10, v10), 8 & r11 && p10 !== (p10 = e20[15] + "") && Ni(c10, p10), 8 & r11 && m10 !== (m10 = 1 !== e20[15] ? "items" : "item") && Ni(u10, m10); + }, d: function(e21) { + e21 && wi(t10), d10 = false, h10(); + } }; + } + function y3(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10; + function b10(e21, t11) { + return e21[5] ? v3 : h3; + } + var k10 = b10(e20), w10 = k10(e20); + function x10(e21, t11) { + return e21[4] && !e21[0] ? m3 : p3; + } + for (var j10 = x10(e20), S10 = j10(e20), C10 = Ca(e20[3]), $10 = [], _10 = 0; _10 < C10.length; _10 += 1) + $10[_10] = g3(d3(e20, C10, _10)); + return { c: function() { + t10 = ji("div"), n10 = ji("div"), r10 = $i(), o10 = ji("div"), i10 = ji("div"), a10 = Ci(e20[6]), s10 = $i(), c10 = ji("div"), w10.c(), l10 = $i(), S10.c(), u10 = $i(); + for (var g11 = 0; g11 < $10.length; g11 += 1) + $10[g11].c(); + f10 = $i(), d10 = ji("button"), h10 = Ci(e20[7]), v10 = Ci(" in tree mode"), p10 = $i(), m10 = ji("div"), Ai(n10, "class", "jse-space jse-before svelte-fxr3ye"), Ai(i10, "class", "jse-nested-arrays-title"), Ai(c10, "class", "jse-nested-arrays-info svelte-fxr3ye"), Ai(d10, "type", "button"), Ai(d10, "class", "jse-nested-array-action svelte-fxr3ye"), Ai(o10, "class", "jse-nested-arrays svelte-fxr3ye"), Ai(m10, "class", "jse-space jse-after svelte-fxr3ye"), Ai(t10, "class", "jse-table-mode-welcome svelte-fxr3ye"); + }, m: function(b11, k11) { + ki(b11, t10, k11), pi(t10, n10), pi(t10, r10), pi(t10, o10), pi(o10, i10), pi(i10, a10), pi(o10, s10), pi(o10, c10), w10.m(c10, null), pi(c10, l10), S10.m(c10, null), pi(o10, u10); + for (var x11 = 0; x11 < $10.length; x11 += 1) + $10[x11] && $10[x11].m(o10, null); + pi(o10, f10), pi(o10, d10), pi(d10, h10), pi(d10, v10), pi(t10, p10), pi(t10, m10), g10 || (y10 = Oi(d10, "click", e20[13]), g10 = true); + }, p: function(e21, t11) { + var n11 = jo(t11, 1)[0]; + if (64 & n11 && Ni(a10, e21[6]), k10 === (k10 = b10(e21)) && w10 ? w10.p(e21, n11) : (w10.d(1), (w10 = k10(e21)) && (w10.c(), w10.m(c10, l10))), j10 !== (j10 = x10(e21)) && (S10.d(1), (S10 = j10(e21)) && (S10.c(), S10.m(c10, null))), 394 & n11) { + var r11; + for (C10 = Ca(e21[3]), r11 = 0; r11 < C10.length; r11 += 1) { + var i11 = d3(e21, C10, r11); + $10[r11] ? $10[r11].p(i11, n11) : ($10[r11] = g3(i11), $10[r11].c(), $10[r11].m(o10, f10)); + } + for (; r11 < $10.length; r11 += 1) + $10[r11].d(1); + $10.length = C10.length; + } + 128 & n11 && Ni(h10, e21[7]); + }, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10), w10.d(), S10.d(), xi($10, e21), g10 = false, y10(); + } }; + } + function b3(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10 = t10.text, l10 = t10.json, u10 = t10.readOnly, f10 = t10.parser, d10 = t10.openJSONEditorModal, h10 = t10.onChangeMode; + return e20.$$set = function(e21) { + "text" in e21 && n10(9, c10 = e21.text), "json" in e21 && n10(10, l10 = e21.json), "readOnly" in e21 && n10(0, u10 = e21.readOnly), "parser" in e21 && n10(11, f10 = e21.parser), "openJSONEditorModal" in e21 && n10(1, d10 = e21.openJSONEditorModal), "onChangeMode" in e21 && n10(2, h10 = e21.onChangeMode); + }, e20.$$.update = function() { + 1 & e20.$$.dirty && n10(7, r10 = u10 ? "View" : "Edit"), 1024 & e20.$$.dirty && n10(3, s10 = l10 ? function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2, n11 = []; + return function e23(r11, o11) { + Rs(r11) && o11.length < t11 && Object.keys(r11).forEach(function(t12) { + e23(r11[t12], o11.concat(t12)); + }), Ts(r11) && n11.push(o11); + }(e21, []), n11; + }(l10).slice(0, 99).filter(function(e21) { + return e21.length > 0; + }) : []), 8 & e20.$$.dirty && n10(5, o10 = !_w(s10)), 1536 & e20.$$.dirty && n10(4, i10 = void 0 === l10 && ("" === c10 || void 0 === c10)), 3120 & e20.$$.dirty && n10(6, a10 = o10 ? "Object with nested arrays" : i10 ? "An empty document" : Rs(l10) ? "An object" : Ts(l10) ? "An empty array" : "A ".concat(eu(l10, f10))); + }, [u10, d10, h10, s10, i10, o10, a10, r10, function(e21) { + return Ws(l10, e21).length; + }, c10, l10, f10, function(e21) { + return d10(e21); + }, function() { + return h10(Qa.tree); + }]; + } + var k3 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, b3, y3, Zo, { text: 9, json: 10, readOnly: 0, parser: 11, openJSONEditorModal: 1, onChangeMode: 2 }, f3), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function w3(e20) { + mi(e20, "svelte-1nml1r3", ".jse-column-header.svelte-1nml1r3{background:none;border:none;font-family:inherit;font-size:inherit;color:inherit;display:flex;gap:var(--jse-padding, 10px);padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px) calc(0.5 * var(--jse-padding, 10px)) calc(0.5 * var(--jse-padding, 10px));width:100%}.jse-column-header.svelte-1nml1r3:hover{background:var(--jse-table-header-background-highlight, #e8e8e8)}.jse-column-header.svelte-1nml1r3:not(.jse-column-header.jse-readonly){cursor:pointer}"); + } + function x3(e20) { + var t10, n10, r10, o10, i10, a10; + return n10 = new jM({ props: { data: EP } }), { c: function() { + t10 = ji("button"), Pa(n10.$$.fragment), Ai(t10, "type", "button"), Ai(t10, "class", "jse-column-header svelte-1nml1r3"), Ai(t10, "title", r10 = "The Columns are created by sampling ".concat(e20[1], " items out of ").concat(e20[0], ". ") + "If you're missing a column, click here to sample all of the items instead of a subset. This is slower."); + }, m: function(r11, s10) { + ki(r11, t10, s10), Ta(n10, t10, null), o10 = true, i10 || (a10 = Oi(t10, "click", e20[3]), i10 = true); + }, p: function(e21, n11) { + var i11 = jo(n11, 1)[0]; + (!o10 || 3 & i11 && r10 !== (r10 = "The Columns are created by sampling ".concat(e21[1], " items out of ").concat(e21[0], ". ") + "If you're missing a column, click here to sample all of the items instead of a subset. This is slower.")) && Ai(t10, "title", r10); + }, i: function(e21) { + o10 || (wa(n10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), i10 = false, a10(); + } }; + } + function j3(e20, t10, n10) { + var r10 = t10.count, o10 = t10.maxSampleCount, i10 = t10.onRefresh; + return e20.$$set = function(e21) { + "count" in e21 && n10(0, r10 = e21.count), "maxSampleCount" in e21 && n10(1, o10 = e21.maxSampleCount), "onRefresh" in e21 && n10(2, i10 = e21.onRefresh); + }, [r10, o10, i10, function() { + return i10(); + }]; + } + var S3 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, j3, x3, Zo, { count: 0, maxSampleCount: 1, onRefresh: 2 }, w3), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function C3(e20) { + mi(e20, "svelte-1bunebm", '.jse-table-mode.svelte-1bunebm.svelte-1bunebm{flex:1;display:flex;flex-direction:column;position:relative;background:var(--jse-background-color, #fff);min-width:0;min-height:0;font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:var(--jse-text-color, #4d4d4d);line-height:var(--jse-line-height, calc(1em + 4px))}.jse-table-mode.no-main-menu.svelte-1bunebm.svelte-1bunebm{border-top:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode.svelte-1bunebm .jse-hidden-input-label.svelte-1bunebm{position:fixed;right:0;top:0;width:0;height:0}.jse-table-mode.svelte-1bunebm .jse-hidden-input-label .jse-hidden-input.svelte-1bunebm{width:0;height:0;padding:0;border:0;outline:none}.jse-table-mode.svelte-1bunebm .jse-contents.svelte-1bunebm{flex:1;align-items:start;flex-direction:column;display:flex;overflow:auto;overflow-anchor:none;border-left:var(--jse-main-border, 1px solid #d7d7d7);border-right:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode.svelte-1bunebm .jse-contents.svelte-1bunebm:last-child{border-bottom:var(--jse-main-border, 1px solid #d7d7d7)}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main.svelte-1bunebm{border-collapse:collapse;border-spacing:0}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-invisible-start-section td.svelte-1bunebm,.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-invisible-end-section td.svelte-1bunebm{margin:0;padding:0}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-invisible-end-section td.svelte-1bunebm{padding-bottom:var(--jse-padding, 10px)}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row.svelte-1bunebm:hover{background-color:var(--jse-table-row-odd-background, rgba(0, 0, 0, 0.05))}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.svelte-1bunebm{padding:0 var(--jse-padding, 10px) 0 0;vertical-align:top;white-space:nowrap;height:var(--jse-line-height, calc(1em + 4px))}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-header.svelte-1bunebm,.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-gutter.svelte-1bunebm{font-weight:normal;text-align:left;color:var(--jse-text-readonly, #8d8d8d);background:var(--jse-table-header-background, #f5f5f5)}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-header.svelte-1bunebm{padding:0;position:sticky;top:0}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-header .jse-table-root-error.svelte-1bunebm{padding:calc(0.5 * var(--jse-padding, 10px)) var(--jse-padding, 10px) calc(0.5 * var(--jse-padding, 10px)) calc(0.5 * var(--jse-padding, 10px))}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-table-cell-gutter.svelte-1bunebm{padding:0 var(--jse-padding, 10px) 0 calc(0.5 * var(--jse-padding, 10px))}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.jse-selected-value.svelte-1bunebm>.jse-value{background:var(--jse-selection-background-color, #d3d3d3)}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.svelte-1bunebm div{display:inline-flex}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell.svelte-1bunebm div.jse-value{overflow-wrap:normal;white-space:nowrap;vertical-align:top;display:inline-block}.jse-table-mode.svelte-1bunebm .jse-contents table.jse-table-main .jse-table-row .jse-table-cell .jse-context-menu-anchor.svelte-1bunebm{position:relative;vertical-align:top}.jse-table-mode.svelte-1bunebm .jse-contents.jse-contents-loading.svelte-1bunebm{align-items:unset}.jse-table-mode.svelte-1bunebm .jse-contents.jse-contents-loading .jse-loading-space.svelte-1bunebm{flex:1}.jse-table-mode.svelte-1bunebm .jse-contents.jse-contents-loading .jse-loading.svelte-1bunebm{flex:2;text-align:center;color:var(--jse-panel-color-readonly, #b2b2b2);box-sizing:border-box;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px)}'); + } + function $3(e20, t10, n10) { + var r10, o10 = e20.slice(); + o10[123] = t10[n10], o10[128] = n10; + var i10 = o10[23].startIndex + o10[128]; + o10[124] = i10; + var a10 = o10[22].rows[o10[124]]; + o10[125] = a10; + var s10 = NB([String(o10[124])], null === (r10 = o10[125]) || void 0 === r10 ? void 0 : r10.row); + return o10[126] = s10, o10; + } + function _3(e20, t10, n10) { + var r10, o10 = e20.slice(); + o10[129] = t10[n10], o10[135] = n10; + var i10 = [String(o10[124])].concat(o10[129]); + o10[130] = i10; + var a10 = Ws(o10[123], o10[129]); + o10[131] = a10; + var s10 = pE(o10[11].selection) && AE(o10[11].selection.path, o10[130]); + o10[132] = s10; + var c10 = null === (r10 = o10[125]) || void 0 === r10 ? void 0 : r10.columns[o10[135]]; + o10[133] = c10; + var l10 = NB(o10[130], o10[133]); + return o10[126] = l10, o10; + } + function O3(e20, t10, n10) { + var r10 = e20.slice(); + return r10[129] = t10[n10], r10; + } + function M3(e20) { + var t10, n10 = e20.slice(), r10 = NB([], null === (t10 = n10[22]) || void 0 === t10 ? void 0 : t10.root); + return n10[126] = r10, n10; + } + function E3(e20) { + var t10, n10; + return t10 = new V4({ props: { json: e20[8], readOnly: e20[0], historyState: e20[20], onSort: e20[41], onTransform: e20[42], onUndo: e20[43], onRedo: e20[44], onContextMenu: e20[33], onRenderMenu: e20[5] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 256 & n11[0] && (r10.json = e21[8]), 1 & n11[0] && (r10.readOnly = e21[0]), 1048576 & n11[0] && (r10.historyState = e21[20]), 32 & n11[0] && (r10.onRenderMenu = e21[5]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function A3(e20) { + var t10; + return { c: function() { + (t10 = ji("div")).innerHTML = '
loading...
', Ai(t10, "class", "jse-contents jse-contents-loading svelte-1bunebm"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, p: Wo, i: Wo, o: Wo, d: function(e21) { + e21 && wi(t10); + } }; + } + function P3(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10 = [N3, R3, T3], f10 = []; + function d10(e21, t11) { + return e21[25] ? 0 : e21[17] && void 0 !== e21[16] && "" !== e21[16] ? 1 : 2; + } + return o10 = d10(e20), i10 = f10[o10] = u10[o10](e20), { c: function() { + t10 = ji("label"), n10 = ji("input"), r10 = $i(), i10.c(), a10 = _i(), Ai(n10, "type", "text"), n10.readOnly = true, Ai(n10, "tabindex", "-1"), Ai(n10, "class", "jse-hidden-input svelte-1bunebm"), Ai(t10, "class", "jse-hidden-input-label svelte-1bunebm"); + }, m: function(i11, u11) { + ki(i11, t10, u11), pi(t10, n10), e20[73](n10), ki(i11, r10, u11), f10[o10].m(i11, u11), ki(i11, a10, u11), s10 = true, c10 || (l10 = Oi(n10, "paste", e20[38]), c10 = true); + }, p: function(e21, t11) { + var n11 = o10; + (o10 = d10(e21)) === n11 ? f10[o10].p(e21, t11) : (ba(), xa(f10[n11], 1, 1, function() { + f10[n11] = null; + }), ka(), (i10 = f10[o10]) ? i10.p(e21, t11) : (i10 = f10[o10] = u10[o10](e21)).c(), wa(i10, 1), i10.m(a10.parentNode, a10)); + }, i: function(e21) { + s10 || (wa(i10), s10 = true); + }, o: function(e21) { + xa(i10), s10 = false; + }, d: function(n11) { + n11 && (wi(t10), wi(r10), wi(a10)), e20[73](null), f10[o10].d(n11), c10 = false, l10(); + } }; + } + function T3(e20) { + var t10, n10; + return t10 = new k3({ props: { text: e20[16], json: e20[8], readOnly: e20[0], parser: e20[2], openJSONEditorModal: e20[40], onChangeMode: e20[4] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 65536 & n11[0] && (r10.text = e21[16]), 256 & n11[0] && (r10.json = e21[8]), 1 & n11[0] && (r10.readOnly = e21[0]), 4 & n11[0] && (r10.parser = e21[2]), 16 & n11[0] && (r10.onChangeMode = e21[4]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function R3(e20) { + var t10, n10, r10, o10; + return t10 = new IN({ props: { type: "error", message: "The loaded JSON document is invalid and could not be repaired automatically.", actions: e20[0] ? [] : [{ icon: lP, text: "Repair manually", title: 'Open the document in "code" mode and repair it manually', onClick: e20[36] }] } }), r10 = new iL({ props: { text: e20[16], json: e20[8], indentation: e20[3], parser: e20[2] } }), { c: function() { + Pa(t10.$$.fragment), n10 = $i(), Pa(r10.$$.fragment); + }, m: function(e21, i10) { + Ta(t10, e21, i10), ki(e21, n10, i10), Ta(r10, e21, i10), o10 = true; + }, p: function(e21, n11) { + var o11 = {}; + 1 & n11[0] && (o11.actions = e21[0] ? [] : [{ icon: lP, text: "Repair manually", title: 'Open the document in "code" mode and repair it manually', onClick: e21[36] }]), t10.$set(o11); + var i10 = {}; + 65536 & n11[0] && (i10.text = e21[16]), 256 & n11[0] && (i10.json = e21[8]), 8 & n11[0] && (i10.indentation = e21[3]), 4 & n11[0] && (i10.parser = e21[2]), r10.$set(i10); + }, i: function(e21) { + o10 || (wa(t10.$$.fragment, e21), wa(r10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), xa(r10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(n10), Ra(t10, e21), Ra(r10, e21); + } }; + } + function N3(e20) { + for (var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10 = !_w(null === (t10 = e20[22]) || void 0 === t10 ? void 0 : t10.root), $10 = C10 && I3(M3(e20)), _10 = Ca(e20[10]), O10 = [], M10 = 0; M10 < _10.length; M10 += 1) + O10[M10] = q3(O3(e20, _10, M10)); + for (var E10 = function(e21) { + return xa(O10[e21], 1, 1, function() { + O10[e21] = null; + }); + }, A10 = e20[24] && z3(e20), P10 = Ca(e20[23].visibleItems), T8 = [], R8 = 0; R8 < P10.length; R8 += 1) + T8[R8] = K3($3(e20, P10, R8)); + var N8 = function(e21) { + return xa(T8[e21], 1, 1, function() { + T8[e21] = null; + }); + }, I10 = e20[18] && G3(e20), D10 = e20[19] && Q3(e20); + return w10 = new JN({ props: { validationErrors: e20[12], selectError: e20[39] } }), { c: function() { + n10 = ji("div"), r10 = ji("table"), o10 = ji("tbody"), i10 = ji("tr"), a10 = ji("th"), $10 && $10.c(), s10 = $i(); + for (var t11 = 0; t11 < O10.length; t11 += 1) + O10[t11].c(); + c10 = $i(), A10 && A10.c(), l10 = $i(), u10 = ji("tr"), f10 = ji("td"), h10 = $i(); + for (var x11 = 0; x11 < T8.length; x11 += 1) + T8[x11].c(); + v10 = $i(), p10 = ji("tr"), m10 = ji("td"), y10 = $i(), I10 && I10.c(), b10 = $i(), D10 && D10.c(), k10 = $i(), Pa(w10.$$.fragment), Ai(a10, "class", "jse-table-cell jse-table-cell-header svelte-1bunebm"), Ai(i10, "class", "jse-table-row jse-table-row-header svelte-1bunebm"), Ai(f10, "colspan", d10 = e20[10].length), Ai(f10, "class", "svelte-1bunebm"), Di(f10, "height", e20[23].startHeight + "px"), Ai(u10, "class", "jse-table-invisible-start-section"), Ai(m10, "colspan", g10 = e20[10].length), Ai(m10, "class", "svelte-1bunebm"), Di(m10, "height", e20[23].endHeight + "px"), Ai(p10, "class", "jse-table-invisible-end-section"), Ai(r10, "class", "jse-table-main svelte-1bunebm"), Ai(n10, "class", "jse-contents svelte-1bunebm"); + }, m: function(t11, d11) { + ki(t11, n10, d11), pi(n10, r10), pi(r10, o10), pi(o10, i10), pi(i10, a10), $10 && $10.m(a10, null), pi(i10, s10); + for (var g11 = 0; g11 < O10.length; g11 += 1) + O10[g11] && O10[g11].m(i10, null); + pi(i10, c10), A10 && A10.m(i10, null), pi(o10, l10), pi(o10, u10), pi(u10, f10), pi(o10, h10); + for (var C11 = 0; C11 < T8.length; C11 += 1) + T8[C11] && T8[C11].m(o10, null); + pi(o10, v10), pi(o10, p10), pi(p10, m10), e20[76](n10), ki(t11, y10, d11), I10 && I10.m(t11, d11), ki(t11, b10, d11), D10 && D10.m(t11, d11), ki(t11, k10, d11), Ta(w10, t11, d11), x10 = true, j10 || (S10 = [ci(s3.call(null, n10, e20[45])), Oi(n10, "scroll", e20[29])], j10 = true); + }, p: function(e21, t11) { + var n11; + if (4194304 & t11[0] && (C10 = !_w(null === (n11 = e21[22]) || void 0 === n11 ? void 0 : n11.root)), C10 ? $10 ? ($10.p(M3(e21), t11), 4194304 & t11[0] && wa($10, 1)) : (($10 = I3(M3(e21))).c(), wa($10, 1), $10.m(a10, null)) : $10 && (ba(), xa($10, 1, 1, function() { + $10 = null; + }), ka()), 268438529 & t11[0]) { + var r11; + for (_10 = Ca(e21[10]), r11 = 0; r11 < _10.length; r11 += 1) { + var s11 = O3(e21, _10, r11); + O10[r11] ? (O10[r11].p(s11, t11), wa(O10[r11], 1)) : (O10[r11] = q3(s11), O10[r11].c(), wa(O10[r11], 1), O10[r11].m(i10, c10)); + } + for (ba(), r11 = _10.length; r11 < O10.length; r11 += 1) + E10(r11); + ka(); + } + if (e21[24] ? A10 ? (A10.p(e21, t11), 16777216 & t11[0] && wa(A10, 1)) : ((A10 = z3(e21)).c(), wa(A10, 1), A10.m(i10, null)) : A10 && (ba(), xa(A10, 1, 1, function() { + A10 = null; + }), ka()), (!x10 || 1024 & t11[0] && d10 !== (d10 = e21[10].length)) && Ai(f10, "colspan", d10), 8388608 & t11[0] && Di(f10, "height", e21[23].startHeight + "px"), 165678085 & t11[0] | 33281 & t11[1]) { + var l11; + for (P10 = Ca(e21[23].visibleItems), l11 = 0; l11 < P10.length; l11 += 1) { + var u11 = $3(e21, P10, l11); + T8[l11] ? (T8[l11].p(u11, t11), wa(T8[l11], 1)) : (T8[l11] = K3(u11), T8[l11].c(), wa(T8[l11], 1), T8[l11].m(o10, v10)); + } + for (ba(), l11 = P10.length; l11 < T8.length; l11 += 1) + N8(l11); + ka(); + } + (!x10 || 1024 & t11[0] && g10 !== (g10 = e21[10].length)) && Ai(m10, "colspan", g10), 8388608 & t11[0] && Di(m10, "height", e21[23].endHeight + "px"), e21[18] ? I10 ? (I10.p(e21, t11), 262144 & t11[0] && wa(I10, 1)) : ((I10 = G3(e21)).c(), wa(I10, 1), I10.m(b10.parentNode, b10)) : I10 && (ba(), xa(I10, 1, 1, function() { + I10 = null; + }), ka()), e21[19] ? D10 ? (D10.p(e21, t11), 524288 & t11[0] && wa(D10, 1)) : ((D10 = Q3(e21)).c(), wa(D10, 1), D10.m(k10.parentNode, k10)) : D10 && (ba(), xa(D10, 1, 1, function() { + D10 = null; + }), ka()); + var h11 = {}; + 4096 & t11[0] && (h11.validationErrors = e21[12]), w10.$set(h11); + }, i: function(e21) { + if (!x10) { + wa($10); + for (var t11 = 0; t11 < _10.length; t11 += 1) + wa(O10[t11]); + wa(A10); + for (var n11 = 0; n11 < P10.length; n11 += 1) + wa(T8[n11]); + wa(I10), wa(D10), wa(w10.$$.fragment, e21), x10 = true; + } + }, o: function(e21) { + xa($10), O10 = O10.filter(Boolean); + for (var t11 = 0; t11 < O10.length; t11 += 1) + xa(O10[t11]); + xa(A10), T8 = T8.filter(Boolean); + for (var n11 = 0; n11 < T8.length; n11 += 1) + xa(T8[n11]); + xa(I10), xa(D10), xa(w10.$$.fragment, e21), x10 = false; + }, d: function(t11) { + t11 && (wi(n10), wi(y10), wi(b10), wi(k10)), $10 && $10.d(), xi(O10, t11), A10 && A10.d(), xi(T8, t11), e20[76](null), I10 && I10.d(t11), D10 && D10.d(t11), Ra(w10, t11), j10 = false, Qo(S10); + } }; + } + function I3(e20) { + var t10, n10, r10 = e20[126] && D3(e20); + return { c: function() { + r10 && r10.c(), t10 = _i(); + }, m: function(e21, o10) { + r10 && r10.m(e21, o10), ki(e21, t10, o10), n10 = true; + }, p: function(e21, n11) { + e21[126] ? r10 ? (r10.p(e21, n11), 4194304 & n11[0] && wa(r10, 1)) : ((r10 = D3(e21)).c(), wa(r10, 1), r10.m(t10.parentNode, t10)) : r10 && (ba(), xa(r10, 1, 1, function() { + r10 = null; + }), ka()); + }, i: function(e21) { + n10 || (wa(r10), n10 = true); + }, o: function(e21) { + xa(r10), n10 = false; + }, d: function(e21) { + e21 && wi(t10), r10 && r10.d(e21); + } }; + } + function D3(e20) { + var t10, n10, r10; + return n10 = new wq({ props: { validationError: e20[126], onExpand: LL } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-table-root-error svelte-1bunebm"); + }, m: function(e21, o10) { + ki(e21, t10, o10), Ta(n10, t10, null), r10 = true; + }, p: function(e21, t11) { + var r11 = {}; + 4194304 & t11[0] && (r11.validationError = e21[126]), n10.$set(r11); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function q3(e20) { + var t10, n10, r10; + return n10 = new a3({ props: { path: e20[129], sortedColumn: e20[11].sortedColumn, readOnly: e20[0], onSort: e20[28] } }), { c: function() { + t10 = ji("th"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-table-cell jse-table-cell-header svelte-1bunebm"); + }, m: function(e21, o10) { + ki(e21, t10, o10), Ta(n10, t10, null), r10 = true; + }, p: function(e21, t11) { + var r11 = {}; + 1024 & t11[0] && (r11.path = e21[129]), 2048 & t11[0] && (r11.sortedColumn = e21[11].sortedColumn), 1 & t11[0] && (r11.readOnly = e21[0]), n10.$set(r11); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function z3(e20) { + var t10, n10, r10; + return n10 = new S3({ props: { count: Array.isArray(e20[8]) ? e20[8].length : 0, maxSampleCount: e20[9], onRefresh: e20[74] } }), { c: function() { + t10 = ji("th"), Pa(n10.$$.fragment), Ai(t10, "class", "jse-table-cell jse-table-cell-header svelte-1bunebm"); + }, m: function(e21, o10) { + ki(e21, t10, o10), Ta(n10, t10, null), r10 = true; + }, p: function(e21, t11) { + var r11 = {}; + 256 & t11[0] && (r11.count = Array.isArray(e21[8]) ? e21[8].length : 0), 512 & t11[0] && (r11.maxSampleCount = e21[9]), 512 & t11[0] && (r11.onRefresh = e21[74]), n10.$set(r11); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10); + } }; + } + function B3(e20) { + var t10, n10; + return t10 = new wq({ props: { validationError: e20[126], onExpand: LL } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 12582912 & n11[0] && (r10.validationError = e21[126]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function L3(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10 = e20[124] + "", l10 = e20[126] && B3(e20); + function u10() { + for (var t11, n11 = arguments.length, r11 = new Array(n11), o11 = 0; o11 < n11; o11++) + r11[o11] = arguments[o11]; + return (t11 = e20)[75].apply(t11, [e20[124]].concat(r11)); + } + return { c: function() { + t10 = ji("th"), n10 = Ci(c10), r10 = $i(), l10 && l10.c(), Ai(t10, "class", "jse-table-cell jse-table-cell-gutter svelte-1bunebm"); + }, m: function(e21, c11) { + ki(e21, t10, c11), pi(t10, n10), pi(t10, r10), l10 && l10.m(t10, null), i10 = true, a10 || (s10 = ci(o10 = s3.call(null, t10, u10)), a10 = true); + }, p: function(r11, a11) { + e20 = r11, (!i10 || 8388608 & a11[0]) && c10 !== (c10 = e20[124] + "") && Ni(n10, c10), e20[126] ? l10 ? (l10.p(e20, a11), 12582912 & a11[0] && wa(l10, 1)) : ((l10 = B3(e20)).c(), wa(l10, 1), l10.m(t10, null)) : l10 && (ba(), xa(l10, 1, 1, function() { + l10 = null; + }), ka()), o10 && Yo(o10.update) && 8388608 & a11[0] && o10.update.call(null, u10); + }, i: function(e21) { + i10 || (wa(l10), i10 = true); + }, o: function(e21) { + xa(l10), i10 = false; + }, d: function(e21) { + e21 && wi(t10), l10 && l10.d(), a10 = false, s10(); + } }; + } + function F3(e20) { + var t10, n10; + return t10 = new G4({ props: { path: e20[130], value: void 0 !== e20[131] ? e20[131] : "", enforceString: oE(e20[131], e20[11].enforceStringMap, Zs(e20[130]), e20[21].parser), selection: e20[132] ? e20[11].selection : null, searchResultItems: e20[27], context: e20[21] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 8389632 & n11[0] && (r10.path = e21[130]), 8389632 & n11[0] && (r10.value = void 0 !== e21[131] ? e21[131] : ""), 10488832 & n11[0] && (r10.enforceString = oE(e21[131], e21[11].enforceStringMap, Zs(e21[130]), e21[21].parser)), 8391680 & n11[0] && (r10.selection = e21[132] ? e21[11].selection : null), 2097152 & n11[0] && (r10.context = e21[21]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function V3(e20) { + var t10, n10; + return t10 = new Z4({ props: { path: e20[130], value: e20[131], parser: e20[2], isSelected: e20[132], onEdit: e20[40] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 8389632 & n11[0] && (r10.path = e21[130]), 8389632 & n11[0] && (r10.value = e21[131]), 4 & n11[0] && (r10.parser = e21[2]), 8391680 & n11[0] && (r10.isSelected = e21[132]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function H3(e20) { + var t10, n10, r10, o10; + return n10 = new XD({ props: { selected: true, onContextMenu: e20[31] } }), { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), r10 = $i(), Ai(t10, "class", "jse-context-menu-anchor svelte-1bunebm"); + }, m: function(e21, i10) { + ki(e21, t10, i10), Ta(n10, t10, null), ki(e21, r10, i10), o10 = true; + }, p: Wo, i: function(e21) { + o10 || (wa(n10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && (wi(t10), wi(r10)), Ra(n10); + } }; + } + function W3(e20) { + var t10, n10; + return t10 = new wq({ props: { validationError: e20[126], onExpand: LL } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 12583936 & n11[0] && (r10.validationError = e21[126]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function U3(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10 = !e20[0] && e20[132] && !zE(e20[11].selection), u10 = [V3, F3], f10 = []; + function d10(e21, t11) { + return 8389632 & t11[0] && (n10 = null), null == n10 && (n10 = !!Ql(e21[131])), n10 ? 0 : 1; + } + r10 = d10(e20, [-1, -1, -1, -1, -1]), o10 = f10[r10] = u10[r10](e20); + var h10 = l10 && H3(e20), v10 = e20[126] && W3(e20); + return { c: function() { + t10 = ji("td"), o10.c(), i10 = _i(), h10 && h10.c(), a10 = _i(), v10 && v10.c(), Ai(t10, "class", "jse-table-cell svelte-1bunebm"), Ai(t10, "data-path", s10 = OO(e20[130])), zi(t10, "jse-selected-value", e20[132]); + }, m: function(e21, n11) { + ki(e21, t10, n11), f10[r10].m(t10, null), pi(t10, i10), h10 && h10.m(t10, null), pi(t10, a10), v10 && v10.m(t10, null), c10 = true; + }, p: function(e21, n11) { + var p10 = r10; + (r10 = d10(e21, n11)) === p10 ? f10[r10].p(e21, n11) : (ba(), xa(f10[p10], 1, 1, function() { + f10[p10] = null; + }), ka(), (o10 = f10[r10]) ? o10.p(e21, n11) : (o10 = f10[r10] = u10[r10](e21)).c(), wa(o10, 1), o10.m(t10, i10)), 8391681 & n11[0] && (l10 = !e21[0] && e21[132] && !zE(e21[11].selection)), l10 ? h10 ? (h10.p(e21, n11), 8391681 & n11[0] && wa(h10, 1)) : ((h10 = H3(e21)).c(), wa(h10, 1), h10.m(t10, a10)) : h10 && (ba(), xa(h10, 1, 1, function() { + h10 = null; + }), ka()), e21[126] ? v10 ? (v10.p(e21, n11), 12583936 & n11[0] && wa(v10, 1)) : ((v10 = W3(e21)).c(), wa(v10, 1), v10.m(t10, null)) : v10 && (ba(), xa(v10, 1, 1, function() { + v10 = null; + }), ka()), (!c10 || 8389632 & n11[0] && s10 !== (s10 = OO(e21[130]))) && Ai(t10, "data-path", s10), (!c10 || 8391680 & n11[0]) && zi(t10, "jse-selected-value", e21[132]); + }, i: function(e21) { + c10 || (wa(o10), wa(h10), wa(v10), c10 = true); + }, o: function(e21) { + xa(o10), xa(h10), xa(v10), c10 = false; + }, d: function(e21) { + e21 && wi(t10), f10[r10].d(), h10 && h10.d(), v10 && v10.d(); + } }; + } + function J3(e20) { + var t10; + return { c: function() { + Ai(t10 = ji("td"), "class", "jse-table-cell svelte-1bunebm"); + }, m: function(e21, n10) { + ki(e21, t10, n10); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function K3(e20) { + for (var t10, n10, r10, o10, i10 = e20[124], a10 = L3(e20), s10 = Ca(e20[10]), c10 = [], l10 = 0; l10 < s10.length; l10 += 1) + c10[l10] = U3(_3(e20, s10, l10)); + var u10 = function(e21) { + return xa(c10[e21], 1, 1, function() { + c10[e21] = null; + }); + }, f10 = e20[24] && J3(); + return { c: function() { + t10 = ji("tr"), a10.c(), n10 = $i(); + for (var e21 = 0; e21 < c10.length; e21 += 1) + c10[e21].c(); + r10 = $i(), f10 && f10.c(), Ai(t10, "class", "jse-table-row svelte-1bunebm"); + }, m: function(e21, i11) { + ki(e21, t10, i11), a10.m(t10, null), pi(t10, n10); + for (var s11 = 0; s11 < c10.length; s11 += 1) + c10[s11] && c10[s11].m(t10, null); + pi(t10, r10), f10 && f10.m(t10, null), o10 = true; + }, p: function(e21, o11) { + if (8388608 & o11[0] && Zo(i10, i10 = e21[124]) ? (ba(), xa(a10, 1, 1, Wo), ka(), (a10 = L3(e21)).c(), wa(a10, 1), a10.m(t10, n10)) : a10.p(e21, o11), 148900869 & o11[0] | 513 & o11[1]) { + var l11; + for (s10 = Ca(e21[10]), l11 = 0; l11 < s10.length; l11 += 1) { + var d10 = _3(e21, s10, l11); + c10[l11] ? (c10[l11].p(d10, o11), wa(c10[l11], 1)) : (c10[l11] = U3(d10), c10[l11].c(), wa(c10[l11], 1), c10[l11].m(t10, r10)); + } + for (ba(), l11 = s10.length; l11 < c10.length; l11 += 1) + u10(l11); + ka(); + } + e21[24] ? f10 || ((f10 = J3()).c(), f10.m(t10, null)) : f10 && (f10.d(1), f10 = null); + }, i: function(e21) { + if (!o10) { + wa(a10); + for (var t11 = 0; t11 < s10.length; t11 += 1) + wa(c10[t11]); + o10 = true; + } + }, o: function(e21) { + xa(a10), c10 = c10.filter(Boolean); + for (var t11 = 0; t11 < c10.length; t11 += 1) + xa(c10[t11]); + o10 = false; + }, d: function(e21) { + e21 && wi(t10), a10.d(e21), xi(c10, e21), f10 && f10.d(); + } }; + } + function G3(e20) { + var t10, n10; + return t10 = new IN({ props: { type: "info", message: "You pasted a JSON ".concat(Array.isArray(e20[18].contents) ? "array" : "object", " as text"), actions: [{ icon: uP, text: "Paste as JSON instead", title: "Paste the text as JSON instead of a single value", onMouseDown: e20[34] }, { text: "Leave as is", title: "Keep the pasted content as a single value", onClick: e20[35] }] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 262144 & n11[0] && (r10.message = "You pasted a JSON ".concat(Array.isArray(e21[18].contents) ? "array" : "object", " as text")), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function Q3(e20) { + var t10, n10; + return t10 = new IN({ props: { type: "success", message: "The loaded JSON document was invalid but is successfully repaired.", actions: e20[0] ? [] : [{ icon: PP, text: "Ok", title: "Accept the repaired document", onClick: e20[7] }, { icon: lP, text: "Repair manually instead", title: "Leave the document unchanged and repair it manually instead", onClick: e20[36] }], onClose: e20[6] } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 1 & n11[0] && (r10.actions = e21[0] ? [] : [{ icon: PP, text: "Ok", title: "Accept the repaired document", onClick: e21[7] }, { icon: lP, text: "Repair manually instead", title: "Leave the document unchanged and repair it manually instead", onClick: e21[36] }]), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function Y3(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10 = e20[1] && E3(e20), l10 = [P3, A3], u10 = []; + return r10 = function(e21, t11) { + return e21[26] ? 1 : 0; + }(e20), o10 = u10[r10] = l10[r10](e20), { c: function() { + t10 = ji("div"), c10 && c10.c(), n10 = $i(), o10.c(), Ai(t10, "role", "table"), Ai(t10, "class", "jse-table-mode svelte-1bunebm"), zi(t10, "no-main-menu", !e20[1]); + }, m: function(o11, l11) { + ki(o11, t10, l11), c10 && c10.m(t10, null), pi(t10, n10), u10[r10].m(t10, null), e20[77](t10), i10 = true, a10 || (s10 = [Oi(t10, "mousedown", e20[30]), Oi(t10, "keydown", e20[37]), Oi(t10, "contextmenu", e20[32])], a10 = true); + }, p: function(e21, r11) { + e21[1] ? c10 ? (c10.p(e21, r11), 2 & r11[0] && wa(c10, 1)) : ((c10 = E3(e21)).c(), wa(c10, 1), c10.m(t10, n10)) : c10 && (ba(), xa(c10, 1, 1, function() { + c10 = null; + }), ka()), o10.p(e21, r11), (!i10 || 2 & r11[0]) && zi(t10, "no-main-menu", !e21[1]); + }, i: function(e21) { + i10 || (wa(c10), wa(o10), i10 = true); + }, o: function(e21) { + xa(c10), xa(o10), i10 = false; + }, d: function(n11) { + n11 && wi(t10), c10 && c10.d(), u10[r10].d(), e20[77](null), a10 = false, Qo(s10); + } }; + } + var X3 = 18; + function Z3(e20, t10, n10) { + var r10, o10, i10, a10, s10 = Da("jsoneditor:TableMode"), c10 = Zi("simple-modal").open, l10 = Zi("absolute-popup"), u10 = l10.openAbsolutePopup, f10 = l10.closeAbsolutePopup, d10 = bN(), h10 = A$(), v10 = A$(), p10 = "undefined" == typeof window; + s10("isSSR:", p10); + var m10, g10, y10, b10, k10, w10, x10 = t10.readOnly, j10 = t10.externalContent, S10 = t10.externalSelection, C10 = t10.mainMenuBar, $10 = t10.escapeControlCharacters, _10 = t10.escapeUnicodeCharacters, O10 = t10.flattenColumns, M10 = t10.parser, E10 = t10.parseMemoizeOne, A10 = t10.validator, P10 = t10.validationParser, T8 = t10.indentation, R8 = t10.onChange, N8 = t10.onChangeMode, I10 = t10.onSelect, D10 = t10.onRenderValue, q10 = t10.onRenderMenu, z10 = t10.onRenderContextMenu, B10 = t10.onFocus, L10 = t10.onBlur, F10 = t10.onSortModal, V10 = t10.onTransformModal, H10 = t10.onJSONEditorModal; + ON({ onMount: Gi, onDestroy: Qi, getWindow: function() { + return SO(g10); + }, hasFocus: function() { + return G10 && document.hasFocus() || CO(g10); + }, onFocus: function() { + true, B10 && B10(); + }, onBlur: function() { + false, L10 && L10(); + } }); + var W10, U10 = void 0, J10 = 1e4, K10 = [], G10 = false, Q10 = {}, Y10 = 600, X10 = 0; + function Z10(e21) { + s10("updateSelection", e21); + var t11 = "function" == typeof e21 ? e21(te2.selection) || null : e21; + Ow(t11, te2.selection) || (n10(11, te2 = Ro(Ro({}, te2), {}, { selection: t11 })), I10(t11)); + } + function ee2(e21) { + te2.selection && void 0 !== e21 && (Ys(e21, KE(te2.selection)) && Ys(e21, JE(te2.selection)) || (s10("clearing selection: path does not exist anymore", te2.selection), n10(11, te2 = Ro(Ro({}, te2), {}, { selection: null })))); + } + var te2 = BM(), ne2 = false; + var re2, oe2 = xN({ onChange: function(e21) { + n10(20, ie2 = e21); + } }), ie2 = oe2.getState(); + function ae2(e21) { + var t11 = k10, r11 = J_(e21) ? e21.text !== w10 : !Ow(t11, e21.json); + if (s10("update external content", { isChanged: r11 }), r11) { + var o11 = { json: k10, text: w10 }, i11 = k10, a11 = te2, c11 = w10, l11 = ne2; + if (J_(e21)) + try { + n10(8, k10 = E10(e21.text)), n10(16, w10 = e21.text), n10(19, ne2 = false), n10(17, U10 = void 0); + } catch (t12) { + try { + n10(8, k10 = E10(Hl(e21.text))), n10(16, w10 = e21.text), n10(19, ne2 = true), n10(17, U10 = void 0); + } catch (r12) { + n10(8, k10 = void 0), n10(16, w10 = e21.text), n10(19, ne2 = false), n10(17, U10 = "" !== w10 ? H_(w10, t12.message || String(t12)) : void 0); + } + } + else + n10(8, k10 = e21.json), n10(16, w10 = void 0), n10(19, ne2 = false), n10(17, U10 = void 0); + ee2(k10), te2.sortedColumn && n10(11, te2 = Ro(Ro({}, te2), {}, { sortedColumn: null })), se2({ previousJson: i11, previousState: a11, previousText: c11, previousTextIsRepaired: l11 }); + ve2(o11, null); + } + } + function se2(e21) { + var t11 = e21.previousJson, n11 = e21.previousState, r11 = e21.previousText, o11 = e21.previousTextIsRepaired; + void 0 === t11 && void 0 === r11 || (void 0 !== k10 ? void 0 !== t11 ? oe2.add({ undo: { patch: [{ op: "replace", path: "", value: t11 }], state: PE(n11), json: void 0, text: r11, textIsRepaired: o11 }, redo: { patch: [{ op: "replace", path: "", value: k10 }], state: PE(te2), json: void 0, text: w10, textIsRepaired: ne2 } }) : oe2.add({ undo: { patch: void 0, json: void 0, text: r11, state: PE(n11), textIsRepaired: o11 }, redo: { patch: void 0, json: k10, state: PE(te2), text: w10, textIsRepaired: ne2 } }) : void 0 !== t11 && oe2.add({ undo: { patch: void 0, json: t11, state: PE(n11), text: r11, textIsRepaired: o11 }, redo: { patch: void 0, json: void 0, text: w10, textIsRepaired: ne2, state: PE(te2) } })); + } + var ce2 = [], le2 = CB(CN); + function ue2(e21, t11, r11, o11) { + jN(function() { + var i11; + try { + i11 = le2(e21, t11, r11, o11); + } catch (e23) { + i11 = [{ path: [], message: "Failed to validate: " + e23.message, severity: Za.warning }]; + } + Ow(i11, ce2) || (s10("validationErrors changed:", i11), n10(12, ce2 = i11)); + }, function(e23) { + return s10("validationErrors updated in ".concat(e23, " ms")); + }); + } + function fe2() { + return s10("validate"), U10 ? { parseError: U10, isRepairable: false } : (ue2(k10, A10, M10, P10), _w(ce2) ? null : { validationErrors: ce2 }); + } + function de2(e21, t11) { + if (s10("patch", e21, t11), void 0 === k10) + throw new Error("Cannot apply patch: no JSON"); + var r11 = { json: k10 }, o11 = k10, i11 = te2, a11 = ne2, c11 = hA(k10, e21), l11 = JM(k10, te2, e21).json, u11 = DB(te2, e21, K10), f11 = "function" == typeof t11 ? t11(l11, u11) : void 0; + n10(8, k10 = f11 && void 0 !== f11.json ? f11.json : l11); + var d11 = f11 && void 0 !== f11.state ? f11.state : u11; + n10(11, te2 = d11), n10(16, w10 = void 0), n10(19, ne2 = false), n10(18, W10 = void 0), n10(17, U10 = void 0), oe2.add({ undo: { patch: c11, json: void 0, text: void 0, state: PE(i11), textIsRepaired: a11 }, redo: { patch: e21, json: void 0, state: PE(d11), text: void 0, textIsRepaired: ne2 } }); + var h11 = { json: k10, previousJson: o11, undo: c11, redo: e21 }; + return ve2(r11, h11), h11; + } + function he2(e21, t11) { + return x10 ? { json: k10, previousJson: k10, redo: [], undo: [] } : de2(e21, t11); + } + function ve2(e21, t11) { + if ((void 0 !== e21.json || void 0 !== (null == e21 ? void 0 : e21.text)) && R8) { + if (void 0 !== w10) + R8({ text: w10, json: void 0 }, e21, { contentErrors: fe2(), patchResult: t11 }); + else if (void 0 !== k10) { + R8({ text: void 0, json: k10 }, e21, { contentErrors: fe2(), patchResult: t11 }); + } + } + } + function pe2(e21) { + s10("handleFind", e21); + } + function me2(e21) { + s10("pasted json as text", e21), n10(18, W10 = e21); + } + function ge2(e21) { + var t11 = parseInt(e21[0], 10), n11 = [String(t11 + 1)].concat(Bo(e21.slice(1))); + return Ys(k10, n11) ? RE(n11, false) : RE(e21, false); + } + function ye2() { + s10("focus"), b10 && (b10.focus(), b10.select()); + } + function be2() { + te2.selection || Z10(!Ts(k10) || _w(k10) || _w(K10) ? null : RE(["0"].concat(Bo(K10[0])), false)); + } + function ke2(e21) { + var t11 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n11 = AB(e21, K10, Q10, X3), r11 = n11 - X10, o11 = je2(e21); + if (s10("scrollTo", { path: e21, top: n11, scrollTop: X10, elem: o11 }), !y10) + return Promise.resolve(); + var i11 = y10.getBoundingClientRect(); + if (o11 && !t11) { + var a11 = o11.getBoundingClientRect(); + if (a11.bottom > i11.top && a11.top < i11.bottom) + return Promise.resolve(); + } + var c11 = -i11.height / 4; + return new Promise(o11 ? function(t12) { + d10(o11, { container: y10, offset: c11, duration: 300, callback: function() { + we2(e21), t12(); + } }); + } : function(o12) { + var i12; + d10(r11, { container: y10, offset: c11, duration: 300, callback: (i12 = xo(ko().mark(function r12() { + return ko().wrap(function(r13) { + for (; ; ) + switch (r13.prev = r13.next) { + case 0: + return r13.next = 2, ca(); + case 2: + if (AB(e21, K10, Q10, X3) === n11) { + r13.next = 8; + break; + } + return r13.next = 6, ke2(e21, t11); + case 6: + r13.next = 9; + break; + case 8: + we2(e21); + case 9: + o12(); + case 10: + case "end": + return r13.stop(); + } + }, r12); + })), function() { + return i12.apply(this, arguments); + }) }); + }); + } + function we2(e21) { + var t11 = je2(e21); + if (t11 && y10) { + var r11 = y10.getBoundingClientRect(), o11 = t11.getBoundingClientRect(); + if (o11.right > r11.right) { + var i11 = o11.right - r11.right; + n10(14, y10.scrollLeft += i11, y10); + } + if (o11.left < r11.left) { + var a11 = r11.left - o11.left; + n10(14, y10.scrollLeft -= a11, y10); + } + } + } + function xe2(e21) { + !function(e23) { + if (y10) { + var t11 = PB(e23, K10).rowIndex, r11 = AB(e23, K10, Q10, X3), o11 = r11 + (Q10[t11] || X3), i11 = y10.getBoundingClientRect(), a11 = X10, s11 = X10 + i11.height - 18; + if (o11 > s11) { + var c11 = o11 - s11; + n10(14, y10.scrollTop += c11, y10); + } + if (r11 < a11) { + var l11 = a11 - r11; + n10(14, y10.scrollTop -= l11, y10); + } + } + }(e21), we2(e21); + } + function je2(e21) { + return y10 ? y10.querySelector('td[data-path="'.concat(OO(e21), '"]')) : null; + } + function Se2(e21) { + var t11 = e21.anchor, n11 = e21.left, r11 = e21.top, o11 = e21.width, i11 = e21.height, a11 = e21.offsetTop, s11 = e21.offsetLeft, c11 = e21.showTip; + G10 = true; + var l11 = u10(u3, { json: k10, documentState: te2, parser: M10, showTip: c11, onEditValue: $e2, onEditRow: _e2, onToggleEnforceString: Oe2, onCut: Ae2, onCopy: Te2, onPaste: Ee2, onRemove: Ne2, onDuplicateRow: Ie2, onInsertBeforeRow: De2, onInsertAfterRow: qe2, onRemoveRow: ze2, onRenderContextMenu: z10, onCloseContextMenu: function() { + f10(l11), ye2(); + } }, { left: n11, top: r11, offsetTop: a11, offsetLeft: s11, width: o11, height: i11, anchor: t11, closeOnOuterClick: true, onClose: function() { + G10 = false, ye2(); + } }); + } + function Ce2(e21) { + if (!x10 && !zE(te2.selection)) { + if (e21 && (e21.stopPropagation(), e21.preventDefault()), e21 && "contextmenu" === e21.type && e21.target !== b10) + Se2({ left: e21.clientX, top: e21.clientY, width: Ms, height: Os, showTip: false }); + else { + var t11, n11 = null === (t11 = y10) || void 0 === t11 ? void 0 : t11.querySelector(".jse-table-cell.jse-selected-value"); + if (n11) + Se2({ anchor: n11, offsetTop: 2, width: Ms, height: Os, showTip: false }); + else { + var r11, o11 = null === (r11 = y10) || void 0 === r11 ? void 0 : r11.getBoundingClientRect(); + o11 && Se2({ top: o11.top + 2, left: o11.left + 2, width: Ms, height: Os, showTip: false }); + } + } + return false; + } + } + function $e2() { + if (!x10 && te2.selection) { + var e21 = JE(te2.selection); + Ql(Ws(k10, e21)) ? He2(e21) : Z10(RE(e21, true)); + } + } + function _e2() { + !x10 && te2.selection && He2(JE(te2.selection).slice(0, 1)); + } + function Oe2() { + if (!x10 && pE(te2.selection)) { + var e21 = te2.selection.path, t11 = Zs(e21), n11 = Ws(k10, e21), r11 = !oE(n11, te2.enforceStringMap, t11, M10), o11 = r11 ? String(n11) : ru(String(n11), M10); + s10("handleToggleEnforceString", { enforceString: r11, value: n11, updatedValue: o11 }), he2([{ op: "replace", path: t11, value: o11 }], function(e23, n12) { + return { state: UM(n12, t11, r11) }; + }); + } + } + function Me2() { + return (Me2 = xo(ko().mark(function e21() { + var t11, n11, r11, o11, i11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (s10("apply pasted json", W10), W10) { + e23.next = 3; + break; + } + return e23.abrupt("return"); + case 3: + r11 = (n11 = W10).path, o11 = n11.contents, AO(i11 = (null === (t11 = y10) || void 0 === t11 ? void 0 : t11.querySelector(".jse-editable-div")) || null) && i11.cancel(), he2([{ op: "replace", path: Zs(r11), value: o11 }]), setTimeout(ye2); + case 9: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function Ee2() { + c10(nI, {}, Ro(Ro({}, gs), {}, { styleWindow: { width: "450px" } }), { onClose: function() { + return ye2(); + } }); + } + function Ae2(e21) { + return Pe2.apply(this, arguments); + } + function Pe2() { + return (Pe2 = xo(ko().mark(function e21(t11) { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return e23.next = 2, zB({ json: k10, documentState: te2, indentation: t11 ? T8 : void 0, readOnly: x10, parser: M10, onPatch: he2 }); + case 2: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function Te2() { + return Re2.apply(this, arguments); + } + function Re2() { + return Re2 = xo(ko().mark(function e21() { + var t11, n11 = arguments; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (t11 = !(n11.length > 0 && void 0 !== n11[0]) || n11[0], void 0 !== k10) { + e23.next = 3; + break; + } + return e23.abrupt("return"); + case 3: + return e23.next = 5, LB({ json: k10, documentState: te2, indentation: t11 ? T8 : void 0, parser: M10 }); + case 5: + case "end": + return e23.stop(); + } + }, e21); + })), Re2.apply(this, arguments); + } + function Ne2() { + HB({ json: k10, text: w10, documentState: te2, keepSelection: true, readOnly: x10, onChange: R8, onPatch: he2 }); + } + function Ie2() { + WB({ json: k10, documentState: te2, columns: K10, readOnly: x10, onPatch: he2 }); + } + function De2() { + UB({ json: k10, documentState: te2, columns: K10, readOnly: x10, onPatch: he2 }); + } + function qe2() { + JB({ json: k10, documentState: te2, columns: K10, readOnly: x10, onPatch: he2 }); + } + function ze2() { + KB({ json: k10, documentState: te2, columns: K10, readOnly: x10, onPatch: he2 }); + } + function Be2() { + return (Be2 = xo(ko().mark(function e21(t11) { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return e23.next = 2, QB({ char: t11, selectInside: false, refJsonEditor: g10, json: k10, selection: te2.selection, readOnly: x10, parser: M10, onPatch: he2, onReplaceJson: Le2, onSelect: Z10 }); + case 2: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function Le2(e21, t11) { + var r11 = te2, o11 = k10, i11 = w10, a11 = { json: k10, text: w10 }, s11 = ne2, c11 = HM(k10, te2, [], uE), l11 = "function" == typeof t11 ? t11(e21, c11) : void 0; + n10(8, k10 = l11 && void 0 !== l11.json ? l11.json : e21), n10(11, te2 = l11 && void 0 !== l11.state ? l11.state : c11), n10(16, w10 = void 0), n10(19, ne2 = false), n10(17, U10 = void 0), ee2(k10), se2({ previousJson: o11, previousState: r11, previousText: i11, previousTextIsRepaired: s11 }); + ve2(a11, null); + } + function Fe2(e21, t11) { + s10("handleChangeText"); + var r11 = te2, o11 = k10, i11 = w10, a11 = { json: k10, text: w10 }, c11 = ne2; + try { + n10(8, k10 = E10(e21)), n10(11, te2 = HM(k10, te2, [], uE)), n10(16, w10 = void 0), n10(19, ne2 = false), n10(17, U10 = void 0); + } catch (t12) { + try { + n10(8, k10 = E10(Hl(e21))), n10(11, te2 = HM(k10, te2, [], uE)), n10(16, w10 = e21), n10(19, ne2 = true), n10(17, U10 = void 0); + } catch (r12) { + n10(8, k10 = void 0), n10(11, te2 = BM({ json: k10, expand: uE })), n10(16, w10 = e21), n10(19, ne2 = false), n10(17, U10 = "" !== w10 ? H_(w10, t12.message || String(t12)) : void 0); + } + } + if ("function" == typeof t11) { + var l11 = t11(k10, te2); + n10(8, k10 = l11 && l11.json ? l11.json : k10), n10(11, te2 = l11 && l11.state ? l11.state : te2); + } + ee2(k10), se2({ previousJson: o11, previousState: r11, previousText: i11, previousTextIsRepaired: c11 }); + ve2(a11, null); + } + function Ve2(e21) { + if (void 0 !== k10) { + var t11 = e21.id, n11 = e21.onTransform, r11 = e21.onClose, o11 = e21.rootPath || []; + G10 = true, V10({ id: t11 || v10, json: k10, rootPath: o11 || [], onTransform: function(e23) { + n11 ? n11({ operations: e23, json: k10, transformedJson: rc(k10, e23) }) : (s10("onTransform", o11, e23), he2(e23)); + }, onClose: function() { + G10 = false, ye2(), r11 && r11(); + } }); + } + } + function He2(e21) { + s10("openJSONEditorModal", { path: e21 }), G10 = true, H10({ content: { json: Ws(k10, e21) }, path: e21, onPatch: re2.onPatch, onClose: function() { + G10 = false, ye2(); + } }); + } + function We2(e21, t11) { + c10(HI, { text: e21, onParse: function(e23) { + return L_(e23, function(e24) { + return z_(e24, M10); + }); + }, onRepair: F_, onApply: t11 }, Ro(Ro({}, gs), {}, { styleWindow: { width: "600px", height: "500px" }, styleContent: { padding: 0, height: "100%" } }), { onClose: function() { + return ye2(); + } }); + } + function Ue2() { + if (!x10 && oe2.getState().canUndo) { + var e21 = oe2.undo(); + if (e21) { + var t11 = { json: k10, text: w10 }; + n10(8, k10 = e21.undo.patch ? rc(k10, e21.undo.patch) : e21.undo.json), n10(11, te2 = e21.undo.state), n10(16, w10 = e21.undo.text), n10(19, ne2 = e21.undo.textIsRepaired), n10(17, U10 = void 0), s10("undo", { item: e21, json: k10 }), ve2(t11, e21.undo.patch && e21.redo.patch ? { json: k10, previousJson: t11.json, redo: e21.undo.patch, undo: e21.redo.patch } : null), ye2(), te2.selection && ke2(JE(te2.selection), false); + } + } + } + function Je2() { + if (!x10 && oe2.getState().canRedo) { + var e21 = oe2.redo(); + if (e21) { + var t11 = { json: k10, text: w10 }; + n10(8, k10 = e21.redo.patch ? rc(k10, e21.redo.patch) : e21.redo.json), n10(11, te2 = e21.redo.state), n10(16, w10 = e21.redo.text), n10(19, ne2 = e21.redo.textIsRepaired), n10(17, U10 = void 0), s10("redo", { item: e21, json: k10 }), ve2(t11, e21.undo.patch && e21.redo.patch ? { json: k10, previousJson: t11.json, redo: e21.redo.patch, undo: e21.undo.patch } : null), ye2(), te2.selection && ke2(JE(te2.selection), false); + } + } + } + function Ke2(e21, t11) { + n10(70, Q10[t11] = e21.getBoundingClientRect().height, Q10); + } + return e20.$$set = function(e21) { + "readOnly" in e21 && n10(0, x10 = e21.readOnly), "externalContent" in e21 && n10(47, j10 = e21.externalContent), "externalSelection" in e21 && n10(48, S10 = e21.externalSelection), "mainMenuBar" in e21 && n10(1, C10 = e21.mainMenuBar), "escapeControlCharacters" in e21 && n10(49, $10 = e21.escapeControlCharacters), "escapeUnicodeCharacters" in e21 && n10(50, _10 = e21.escapeUnicodeCharacters), "flattenColumns" in e21 && n10(51, O10 = e21.flattenColumns), "parser" in e21 && n10(2, M10 = e21.parser), "parseMemoizeOne" in e21 && n10(52, E10 = e21.parseMemoizeOne), "validator" in e21 && n10(53, A10 = e21.validator), "validationParser" in e21 && n10(54, P10 = e21.validationParser), "indentation" in e21 && n10(3, T8 = e21.indentation), "onChange" in e21 && n10(55, R8 = e21.onChange), "onChangeMode" in e21 && n10(4, N8 = e21.onChangeMode), "onSelect" in e21 && n10(56, I10 = e21.onSelect), "onRenderValue" in e21 && n10(57, D10 = e21.onRenderValue), "onRenderMenu" in e21 && n10(5, q10 = e21.onRenderMenu), "onRenderContextMenu" in e21 && n10(58, z10 = e21.onRenderContextMenu), "onFocus" in e21 && n10(59, B10 = e21.onFocus), "onBlur" in e21 && n10(60, L10 = e21.onBlur), "onSortModal" in e21 && n10(61, F10 = e21.onSortModal), "onTransformModal" in e21 && n10(62, V10 = e21.onTransformModal), "onJSONEditorModal" in e21 && n10(63, H10 = e21.onJSONEditorModal); + }, e20.$$.update = function() { + 786432 & e20.$$.dirty[1] && n10(69, m10 = aO({ escapeControlCharacters: $10, escapeUnicodeCharacters: _10 })), 65536 & e20.$$.dirty[1] && ae2(j10), 131072 & e20.$$.dirty[1] && function(e21) { + Ow(te2.selection, e21) || (s10("applyExternalSelection", e21), (yE(e21) || null === e21) && Z10(e21)); + }(S10), 1792 & e20.$$.dirty[0] | 1048576 & e20.$$.dirty[1] && n10(10, K10 = Ts(k10) ? function(e21, t11) { + var n11, r11 = new Set(t11.map(Zs)), o11 = new Set(e21.map(Zs)), i11 = bo(r11); + try { + for (i11.s(); !(n11 = i11.n()).done; ) { + var a11 = n11.value; + o11.has(a11) || r11.delete(a11); + } + } catch (e23) { + i11.e(e23); + } finally { + i11.f(); + } + var s11, c11 = bo(o11); + try { + for (c11.s(); !(s11 = c11.n()).done; ) { + var l11 = s11.value; + r11.has(l11) || r11.add(l11); + } + } catch (e23) { + c11.e(e23); + } finally { + c11.f(); + } + return Bo(r11).map(Xs); + }(_B(k10, O10, J10), K10) : []), 1280 & e20.$$.dirty[0] && n10(25, r10 = k10 && !_w(K10)), 768 & e20.$$.dirty[0] && n10(24, o10 = Array.isArray(k10) && k10.length > J10), 256 & e20.$$.dirty[0] | 1792 & e20.$$.dirty[2] && n10(23, i10 = EB(X10, Y10, k10, Q10, X3)), 256 & e20.$$.dirty[0] && y10 && y10.scrollTo({ top: y10.scrollTop, left: y10.scrollLeft }), 2309 & e20.$$.dirty[0] | 67108864 & e20.$$.dirty[1] | 128 & e20.$$.dirty[2] && n10(21, re2 = { readOnly: x10, parser: M10, normalization: m10, getJson: function() { + return k10; + }, getDocumentState: function() { + return te2; + }, findElement: je2, findNextInside: ge2, focus: ye2, onPatch: he2, onSelect: Z10, onFind: pe2, onPasteJson: me2, onRenderValue: D10 }), 260 & e20.$$.dirty[0] | 12582912 & e20.$$.dirty[1] && ue2(k10, A10, M10, P10), 5120 & e20.$$.dirty[0] && n10(22, a10 = RB(ce2, K10)); + }, [x10, C10, M10, T8, N8, q10, ye2, function() { + if (ne2 && void 0 !== k10) { + var e21 = te2, t11 = k10, r11 = w10, o11 = { json: k10, text: w10 }, i11 = ne2; + n10(16, w10 = void 0), n10(19, ne2 = false), ee2(k10), se2({ previousJson: t11, previousState: e21, previousText: r11, previousTextIsRepaired: i11 }); + ve2(o11, null); + } + return { json: k10, text: w10 }; + }, k10, J10, K10, te2, ce2, g10, y10, b10, w10, U10, W10, ne2, ie2, re2, a10, i10, o10, r10, p10, void 0, function(e21) { + if (!x10) { + s10("onSortByHeader", e21); + var t11 = e21.sortDirection === ts.desc ? -1 : 1; + he2(Iz(k10, [], e21.path, t11), function(t12, n11) { + return { state: Ro(Ro({}, n11), {}, { sortedColumn: e21 }) }; + }); + } + }, function(e21) { + n10(72, X10 = e21.target.scrollTop); + }, function(e21) { + var t11 = e21.target, n11 = MO(t11); + if (n11) { + if (zE(te2.selection) && WE(k10, te2.selection, n11)) + return; + Z10(RE(n11, false)), e21.preventDefault(); + } + yO(t11, "BUTTON") || t11.isContentEditable || ye2(); + }, Se2, Ce2, function(e21) { + x10 || Se2({ anchor: $O(e21.target, "BUTTON"), offsetTop: 0, width: Ms, height: Os, showTip: true }); + }, function() { + return Me2.apply(this, arguments); + }, function() { + s10("clear pasted json"), n10(18, W10 = void 0), ye2(); + }, function() { + N8(Qa.text); + }, function(e21) { + var t11 = PO(e21); + if (s10("keydown", { combo: t11, key: e21.key }), "Ctrl+X" === t11 && (e21.preventDefault(), Ae2(true)), "Ctrl+Shift+X" === t11 && (e21.preventDefault(), Ae2(false)), "Ctrl+C" === t11 && (e21.preventDefault(), Te2(true)), "Ctrl+Shift+C" === t11 && (e21.preventDefault(), Te2(false)), "Ctrl+D" === t11 && e21.preventDefault(), "Delete" !== t11 && "Backspace" !== t11 || (e21.preventDefault(), Ne2()), "Insert" === t11 && e21.preventDefault(), "Ctrl+A" === t11 && e21.preventDefault(), "Ctrl+Q" === t11 && Ce2(e21), "ArrowLeft" === t11 && (e21.preventDefault(), be2(), te2.selection)) { + var n11 = function(e23, t12) { + var n12 = PB(JE(t12), e23), r12 = n12.rowIndex, o12 = n12.columnIndex; + return o12 > 0 ? RE(TB({ rowIndex: r12, columnIndex: o12 - 1 }, e23), false) : t12; + }(K10, te2.selection); + Z10(n11), xe2(JE(n11)); + } + if ("ArrowRight" === t11 && (e21.preventDefault(), be2(), te2.selection)) { + var r11 = function(e23, t12) { + var n12 = PB(JE(t12), e23), r12 = n12.rowIndex, o12 = n12.columnIndex; + return o12 < e23.length - 1 ? RE(TB({ rowIndex: r12, columnIndex: o12 + 1 }, e23), false) : t12; + }(K10, te2.selection); + Z10(r11), xe2(JE(r11)); + } + if ("ArrowUp" === t11 && (e21.preventDefault(), be2(), te2.selection)) { + var o11 = function(e23, t12) { + var n12 = PB(JE(t12), e23), r12 = n12.rowIndex, o12 = n12.columnIndex; + return r12 > 0 ? RE(TB({ rowIndex: r12 - 1, columnIndex: o12 }, e23), false) : t12; + }(K10, te2.selection); + Z10(o11), xe2(JE(o11)); + } + if ("ArrowDown" === t11 && (e21.preventDefault(), be2(), te2.selection)) { + var i11 = function(e23, t12, n12) { + var r12 = PB(JE(n12), t12), o12 = r12.rowIndex, i12 = r12.columnIndex; + return o12 < e23.length - 1 ? RE(TB({ rowIndex: o12 + 1, columnIndex: i12 }, t12), false) : n12; + }(k10, K10, te2.selection); + Z10(i11), xe2(JE(i11)); + } + if ("Enter" === t11 && te2.selection && pE(te2.selection)) { + e21.preventDefault(); + var a11 = te2.selection.path; + Ql(Ws(k10, a11)) ? He2(a11) : x10 || Z10(Ro(Ro({}, te2.selection), {}, { edit: true })); + } + if (1 === t11.replace(/^Shift\+/, "").length && te2.selection) + return e21.preventDefault(), void function(e23) { + Be2.apply(this, arguments); + }(e21.key); + if ("Ctrl+Enter" === t11 && pE(te2.selection)) { + var c11 = Ws(k10, te2.selection.path); + nu(c11) && window.open(String(c11), "_blank"); + } + "Escape" === t11 && te2.selection && (e21.preventDefault(), Z10(null)), "Ctrl+F" === t11 && e21.preventDefault(), "Ctrl+H" === t11 && e21.preventDefault(), "Ctrl+Z" === t11 && (e21.preventDefault(), Ue2()), "Ctrl+Shift+Z" === t11 && (e21.preventDefault(), Je2()); + }, function(e21) { + var t11; + e21.preventDefault(); + var n11 = null === (t11 = e21.clipboardData) || void 0 === t11 ? void 0 : t11.getData("text/plain"); + void 0 !== n11 && VB({ clipboardText: n11, json: k10, selection: te2.selection, readOnly: x10, parser: M10, onPatch: he2, onChangeText: Fe2, openRepairModal: We2 }); + }, function(e21) { + s10("select validation error", e21), Z10(RE(e21.path, false)), ke2(e21.path); + }, He2, function() { + !function(e21) { + x10 || void 0 === k10 || (G10 = true, F10({ id: h10, json: k10, rootPath: e21, onSort: function(t11) { + var n11 = t11.operations, r11 = t11.itemPath, o11 = t11.direction; + s10("onSort", n11, e21, r11, o11), he2(n11, function(e23, t12) { + return { state: Ro(Ro({}, t12), {}, { sortedColumn: { path: r11, sortDirection: -1 === o11 ? ts.desc : ts.asc } }) }; + }); + }, onClose: function() { + G10 = false, ye2(); + } })); + }([]); + }, function() { + Ve2({ rootPath: [] }); + }, Ue2, Je2, function(e21) { + n10(71, Y10 = e21.getBoundingClientRect().height); + }, Ke2, j10, S10, $10, _10, O10, E10, A10, P10, R8, I10, D10, z10, B10, L10, F10, V10, H10, fe2, de2, ke2, je2, Ve2, m10, Q10, Y10, X10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(15, b10 = e21); + }); + }, function() { + return n10(9, J10 = 1 / 0); + }, function(e21, t11) { + return Ke2(t11, e21); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(14, y10 = e21); + }); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(13, g10 = e21); + }); + }]; + } + var e82 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, Z3, Y3, Zo, { readOnly: 0, externalContent: 47, externalSelection: 48, mainMenuBar: 1, escapeControlCharacters: 49, escapeUnicodeCharacters: 50, flattenColumns: 51, parser: 2, parseMemoizeOne: 52, validator: 53, validationParser: 54, indentation: 3, onChange: 55, onChangeMode: 4, onSelect: 56, onRenderValue: 57, onRenderMenu: 5, onRenderContextMenu: 58, onFocus: 59, onBlur: 60, onSortModal: 61, onTransformModal: 62, onJSONEditorModal: 63, validate: 64, patch: 65, focus: 6, acceptAutoRepair: 7, scrollTo: 66, findElement: 67, openTransformModal: 68 }, C3, [-1, -1, -1, -1, -1]), n10; + } + return Ao(t10, Ia), Do(t10, [{ key: "validate", get: function() { + return this.$$.ctx[64]; + } }, { key: "patch", get: function() { + return this.$$.ctx[65]; + } }, { key: "focus", get: function() { + return this.$$.ctx[6]; + } }, { key: "acceptAutoRepair", get: function() { + return this.$$.ctx[7]; + } }, { key: "scrollTo", get: function() { + return this.$$.ctx[66]; + } }, { key: "findElement", get: function() { + return this.$$.ctx[67]; + } }, { key: "openTransformModal", get: function() { + return this.$$.ctx[68]; + } }]), t10; + }(); + function t8(e20) { + var t10, n10, r10 = { externalContent: e20[0], externalSelection: e20[1], readOnly: e20[2], indentation: e20[3], mainMenuBar: e20[6], navigationBar: e20[7], escapeControlCharacters: e20[10], escapeUnicodeCharacters: e20[11], parser: e20[13], parseMemoizeOne: e20[14], validator: e20[15], validationParser: e20[16], pathParser: e20[17], onError: e20[23], onChange: e20[18], onChangeMode: e20[19], onSelect: e20[20], onRenderValue: e20[21], onClassName: e20[22], onFocus: e20[24], onBlur: e20[25], onRenderMenu: e20[32], onRenderContextMenu: e20[33], onSortModal: e20[26], onTransformModal: e20[27], onJSONEditorModal: e20[28] }; + return t10 = new kL({ props: r10 }), e20[49](t10), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r11) { + Ta(t10, e21, r11), n10 = true; + }, p: function(e21, n11) { + var r11 = {}; + 1 & n11[0] && (r11.externalContent = e21[0]), 2 & n11[0] && (r11.externalSelection = e21[1]), 4 & n11[0] && (r11.readOnly = e21[2]), 8 & n11[0] && (r11.indentation = e21[3]), 64 & n11[0] && (r11.mainMenuBar = e21[6]), 128 & n11[0] && (r11.navigationBar = e21[7]), 1024 & n11[0] && (r11.escapeControlCharacters = e21[10]), 2048 & n11[0] && (r11.escapeUnicodeCharacters = e21[11]), 8192 & n11[0] && (r11.parser = e21[13]), 16384 & n11[0] && (r11.parseMemoizeOne = e21[14]), 32768 & n11[0] && (r11.validator = e21[15]), 65536 & n11[0] && (r11.validationParser = e21[16]), 131072 & n11[0] && (r11.pathParser = e21[17]), 8388608 & n11[0] && (r11.onError = e21[23]), 262144 & n11[0] && (r11.onChange = e21[18]), 524288 & n11[0] && (r11.onChangeMode = e21[19]), 1048576 & n11[0] && (r11.onSelect = e21[20]), 2097152 & n11[0] && (r11.onRenderValue = e21[21]), 4194304 & n11[0] && (r11.onClassName = e21[22]), 16777216 & n11[0] && (r11.onFocus = e21[24]), 33554432 & n11[0] && (r11.onBlur = e21[25]), 2 & n11[1] && (r11.onRenderMenu = e21[32]), 4 & n11[1] && (r11.onRenderContextMenu = e21[33]), 67108864 & n11[0] && (r11.onSortModal = e21[26]), 134217728 & n11[0] && (r11.onTransformModal = e21[27]), 268435456 & n11[0] && (r11.onJSONEditorModal = e21[28]), t10.$set(r11); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(n11) { + e20[49](null), Ra(t10, n11); + } }; + } + function n8(e20) { + var t10, n10, r10 = { externalContent: e20[0], externalSelection: e20[1], readOnly: e20[2], mainMenuBar: e20[6], escapeControlCharacters: e20[10], escapeUnicodeCharacters: e20[11], flattenColumns: e20[12], parser: e20[13], parseMemoizeOne: e20[14], validator: e20[15], validationParser: e20[16], indentation: e20[3], onChange: e20[18], onChangeMode: e20[19], onSelect: e20[20], onRenderValue: e20[21], onFocus: e20[24], onBlur: e20[25], onRenderMenu: e20[32], onRenderContextMenu: e20[33], onSortModal: e20[26], onTransformModal: e20[27], onJSONEditorModal: e20[28] }; + return t10 = new e82({ props: r10 }), e20[48](t10), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r11) { + Ta(t10, e21, r11), n10 = true; + }, p: function(e21, n11) { + var r11 = {}; + 1 & n11[0] && (r11.externalContent = e21[0]), 2 & n11[0] && (r11.externalSelection = e21[1]), 4 & n11[0] && (r11.readOnly = e21[2]), 64 & n11[0] && (r11.mainMenuBar = e21[6]), 1024 & n11[0] && (r11.escapeControlCharacters = e21[10]), 2048 & n11[0] && (r11.escapeUnicodeCharacters = e21[11]), 4096 & n11[0] && (r11.flattenColumns = e21[12]), 8192 & n11[0] && (r11.parser = e21[13]), 16384 & n11[0] && (r11.parseMemoizeOne = e21[14]), 32768 & n11[0] && (r11.validator = e21[15]), 65536 & n11[0] && (r11.validationParser = e21[16]), 8 & n11[0] && (r11.indentation = e21[3]), 262144 & n11[0] && (r11.onChange = e21[18]), 524288 & n11[0] && (r11.onChangeMode = e21[19]), 1048576 & n11[0] && (r11.onSelect = e21[20]), 2097152 & n11[0] && (r11.onRenderValue = e21[21]), 16777216 & n11[0] && (r11.onFocus = e21[24]), 33554432 & n11[0] && (r11.onBlur = e21[25]), 2 & n11[1] && (r11.onRenderMenu = e21[32]), 4 & n11[1] && (r11.onRenderContextMenu = e21[33]), 67108864 & n11[0] && (r11.onSortModal = e21[26]), 134217728 & n11[0] && (r11.onTransformModal = e21[27]), 268435456 & n11[0] && (r11.onJSONEditorModal = e21[28]), t10.$set(r11); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(n11) { + e20[48](null), Ra(t10, n11); + } }; + } + function r8(e20) { + var t10, n10, r10 = { externalContent: e20[0], externalSelection: e20[1], readOnly: e20[2], indentation: e20[3], tabSize: e20[4], mainMenuBar: e20[6], statusBar: e20[8], askToFormat: e20[9], escapeUnicodeCharacters: e20[11], parser: e20[13], validator: e20[15], validationParser: e20[16], onChange: e20[18], onSelect: e20[20], onChangeMode: e20[19], onError: e20[23], onFocus: e20[24], onBlur: e20[25], onRenderMenu: e20[32], onSortModal: e20[26], onTransformModal: e20[27] }; + return t10 = new B4({ props: r10 }), e20[47](t10), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r11) { + Ta(t10, e21, r11), n10 = true; + }, p: function(e21, n11) { + var r11 = {}; + 1 & n11[0] && (r11.externalContent = e21[0]), 2 & n11[0] && (r11.externalSelection = e21[1]), 4 & n11[0] && (r11.readOnly = e21[2]), 8 & n11[0] && (r11.indentation = e21[3]), 16 & n11[0] && (r11.tabSize = e21[4]), 64 & n11[0] && (r11.mainMenuBar = e21[6]), 256 & n11[0] && (r11.statusBar = e21[8]), 512 & n11[0] && (r11.askToFormat = e21[9]), 2048 & n11[0] && (r11.escapeUnicodeCharacters = e21[11]), 8192 & n11[0] && (r11.parser = e21[13]), 32768 & n11[0] && (r11.validator = e21[15]), 65536 & n11[0] && (r11.validationParser = e21[16]), 262144 & n11[0] && (r11.onChange = e21[18]), 1048576 & n11[0] && (r11.onSelect = e21[20]), 524288 & n11[0] && (r11.onChangeMode = e21[19]), 8388608 & n11[0] && (r11.onError = e21[23]), 16777216 & n11[0] && (r11.onFocus = e21[24]), 33554432 & n11[0] && (r11.onBlur = e21[25]), 2 & n11[1] && (r11.onRenderMenu = e21[32]), 67108864 & n11[0] && (r11.onSortModal = e21[26]), 134217728 & n11[0] && (r11.onTransformModal = e21[27]), t10.$set(r11); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(n11) { + e20[47](null), Ra(t10, n11); + } }; + } + function o8(e20) { + var t10, n10, r10, o10, i10, a10 = [r8, n8, t8], s10 = []; + function c10(e21, n11) { + return 32 & n11[0] && (t10 = null), null == t10 && (t10 = !(e21[5] !== Qa.text && "code" !== String(e21[5]))), t10 ? 0 : e21[5] === Qa.table ? 1 : 2; + } + return n10 = c10(e20, [-1, -1]), r10 = s10[n10] = a10[n10](e20), { c: function() { + r10.c(), o10 = _i(); + }, m: function(e21, t11) { + s10[n10].m(e21, t11), ki(e21, o10, t11), i10 = true; + }, p: function(e21, t11) { + var i11 = n10; + (n10 = c10(e21, t11)) === i11 ? s10[n10].p(e21, t11) : (ba(), xa(s10[i11], 1, 1, function() { + s10[i11] = null; + }), ka(), (r10 = s10[n10]) ? r10.p(e21, t11) : (r10 = s10[n10] = a10[n10](e21)).c(), wa(r10, 1), r10.m(o10.parentNode, o10)); + }, i: function(e21) { + i10 || (wa(r10), i10 = true); + }, o: function(e21) { + xa(r10), i10 = false; + }, d: function(e21) { + e21 && wi(o10), s10[n10].d(e21); + } }; + } + function i8(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10, l10 = t10.content, u10 = t10.selection, f10 = t10.readOnly, d10 = t10.indentation, h10 = t10.tabSize, v10 = t10.mode, p10 = t10.mainMenuBar, m10 = t10.navigationBar, g10 = t10.statusBar, y10 = t10.askToFormat, b10 = t10.escapeControlCharacters, k10 = t10.escapeUnicodeCharacters, w10 = t10.flattenColumns, x10 = t10.parser, j10 = t10.parseMemoizeOne, S10 = t10.validator, C10 = t10.validationParser, $10 = t10.pathParser, _10 = t10.insideModal, O10 = t10.onChange, M10 = t10.onChangeMode, E10 = t10.onSelect, A10 = t10.onRenderValue, P10 = t10.onClassName, T8 = t10.onRenderMenu, R8 = t10.onRenderContextMenu, N8 = t10.onError, I10 = t10.onFocus, D10 = t10.onBlur, q10 = t10.onSortModal, z10 = t10.onTransformModal, B10 = t10.onJSONEditorModal, L10 = { type: "separator" }; + function F10() { + return (F10 = xo(ko().mark(function e21() { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (!i10) { + e23.next = 3; + break; + } + return e23.next = 3, i10.refresh(); + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + return e20.$$set = function(e21) { + "content" in e21 && n10(0, l10 = e21.content), "selection" in e21 && n10(1, u10 = e21.selection), "readOnly" in e21 && n10(2, f10 = e21.readOnly), "indentation" in e21 && n10(3, d10 = e21.indentation), "tabSize" in e21 && n10(4, h10 = e21.tabSize), "mode" in e21 && n10(5, v10 = e21.mode), "mainMenuBar" in e21 && n10(6, p10 = e21.mainMenuBar), "navigationBar" in e21 && n10(7, m10 = e21.navigationBar), "statusBar" in e21 && n10(8, g10 = e21.statusBar), "askToFormat" in e21 && n10(9, y10 = e21.askToFormat), "escapeControlCharacters" in e21 && n10(10, b10 = e21.escapeControlCharacters), "escapeUnicodeCharacters" in e21 && n10(11, k10 = e21.escapeUnicodeCharacters), "flattenColumns" in e21 && n10(12, w10 = e21.flattenColumns), "parser" in e21 && n10(13, x10 = e21.parser), "parseMemoizeOne" in e21 && n10(14, j10 = e21.parseMemoizeOne), "validator" in e21 && n10(15, S10 = e21.validator), "validationParser" in e21 && n10(16, C10 = e21.validationParser), "pathParser" in e21 && n10(17, $10 = e21.pathParser), "insideModal" in e21 && n10(34, _10 = e21.insideModal), "onChange" in e21 && n10(18, O10 = e21.onChange), "onChangeMode" in e21 && n10(19, M10 = e21.onChangeMode), "onSelect" in e21 && n10(20, E10 = e21.onSelect), "onRenderValue" in e21 && n10(21, A10 = e21.onRenderValue), "onClassName" in e21 && n10(22, P10 = e21.onClassName), "onRenderMenu" in e21 && n10(35, T8 = e21.onRenderMenu), "onRenderContextMenu" in e21 && n10(36, R8 = e21.onRenderContextMenu), "onError" in e21 && n10(23, N8 = e21.onError), "onFocus" in e21 && n10(24, I10 = e21.onFocus), "onBlur" in e21 && n10(25, D10 = e21.onBlur), "onSortModal" in e21 && n10(26, q10 = e21.onSortModal), "onTransformModal" in e21 && n10(27, z10 = e21.onTransformModal), "onJSONEditorModal" in e21 && n10(28, B10 = e21.onJSONEditorModal); + }, e20.$$.update = function() { + 524320 & e20.$$.dirty[0] && n10(46, a10 = [{ type: "button", text: "text", title: "Switch to text mode (current mode: ".concat(v10, ")"), className: "jse-group-button jse-first" + (v10 === Qa.text || "code" === v10 ? " jse-selected" : ""), onClick: function() { + return M10(Qa.text); + } }, { type: "button", text: "tree", title: "Switch to tree mode (current mode: ".concat(v10, ")"), className: "jse-group-button " + (v10 === Qa.tree ? " jse-selected" : ""), onClick: function() { + return M10(Qa.tree); + } }, { type: "button", text: "table", title: "Switch to table mode (current mode: ".concat(v10, ")"), className: "jse-group-button jse-last" + (v10 === Qa.table ? " jse-selected" : ""), onClick: function() { + return M10(Qa.table); + } }]), 32 & e20.$$.dirty[0] | 32792 & e20.$$.dirty[1] && n10(32, s10 = function(e21) { + var t11 = rI(e21[0]) ? a10.concat(e21) : a10.concat(L10, e21); + return T8(t11, { mode: v10, modal: _10 }) || t11; + }), 34 & e20.$$.dirty[0] | 40 & e20.$$.dirty[1] && n10(33, c10 = function(e21) { + return R8(e21, { mode: v10, modal: _10, selection: u10 }) || e21; + }); + }, [l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, O10, M10, E10, A10, P10, N8, I10, D10, q10, z10, B10, r10, o10, i10, s10, c10, _10, T8, R8, function(e21) { + if (r10) + return r10.patch(e21); + if (o10) + return o10.patch(e21); + if (i10) + return i10.patch(e21); + throw new Error('Method patch is not available in mode "'.concat(v10, '"')); + }, function(e21) { + if (r10) + return r10.expand(e21); + throw new Error('Method expand is not available in mode "'.concat(v10, '"')); + }, function(e21) { + if (i10) + i10.openTransformModal(e21); + else if (r10) + r10.openTransformModal(e21); + else { + if (!o10) + throw new Error('Method transform is not available in mode "'.concat(v10, '"')); + o10.openTransformModal(e21); + } + }, function() { + if (i10) + return i10.validate(); + if (r10) + return r10.validate(); + if (o10) + return o10.validate(); + throw new Error('Method validate is not available in mode "'.concat(v10, '"')); + }, function() { + return r10 ? r10.acceptAutoRepair() : l10; + }, function(e21) { + if (r10) + return r10.scrollTo(e21); + if (o10) + return o10.scrollTo(e21); + throw new Error('Method scrollTo is not available in mode "'.concat(v10, '"')); + }, function(e21) { + if (r10) + return r10.findElement(e21); + if (o10) + return o10.findElement(e21); + throw new Error('Method findElement is not available in mode "'.concat(v10, '"')); + }, function() { + i10 ? i10.focus() : r10 ? r10.focus() : o10 && o10.focus(); + }, function() { + return F10.apply(this, arguments); + }, a10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(31, i10 = e21); + }); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(30, o10 = e21); + }); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(29, r10 = e21); + }); + }]; + } + var a8 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, i8, o8, Xo, { content: 0, selection: 1, readOnly: 2, indentation: 3, tabSize: 4, mode: 5, mainMenuBar: 6, navigationBar: 7, statusBar: 8, askToFormat: 9, escapeControlCharacters: 10, escapeUnicodeCharacters: 11, flattenColumns: 12, parser: 13, parseMemoizeOne: 14, validator: 15, validationParser: 16, pathParser: 17, insideModal: 34, onChange: 18, onChangeMode: 19, onSelect: 20, onRenderValue: 21, onClassName: 22, onRenderMenu: 35, onRenderContextMenu: 36, onError: 23, onFocus: 24, onBlur: 25, onSortModal: 26, onTransformModal: 27, onJSONEditorModal: 28, patch: 37, expand: 38, transform: 39, validate: 40, acceptAutoRepair: 41, scrollTo: 42, findElement: 43, focus: 44, refresh: 45 }, null, [-1, -1]), n10; + } + return Ao(t10, Ia), Do(t10, [{ key: "patch", get: function() { + return this.$$.ctx[37]; + } }, { key: "expand", get: function() { + return this.$$.ctx[38]; + } }, { key: "transform", get: function() { + return this.$$.ctx[39]; + } }, { key: "validate", get: function() { + return this.$$.ctx[40]; + } }, { key: "acceptAutoRepair", get: function() { + return this.$$.ctx[41]; + } }, { key: "scrollTo", get: function() { + return this.$$.ctx[42]; + } }, { key: "findElement", get: function() { + return this.$$.ctx[43]; + } }, { key: "focus", get: function() { + return this.$$.ctx[44]; + } }, { key: "refresh", get: function() { + return this.$$.ctx[45]; + } }]), t10; + }(); + function s8(e20) { + mi(e20, "svelte-1m3nfgb", '.jse-modal.svelte-1m3nfgb.svelte-1m3nfgb{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;background:var(--jse-modal-background, #f5f5f5);color:var(--jse-text-color, #4d4d4d)}.jse-modal.svelte-1m3nfgb .svelte-select{--border:var(--jse-svelte-select-border, 1px solid #d8dbdf);--item-is-active-bg:var(--jse-item-is-active-bg, #3883fa);--border-radius:var(--jse-svelte-select-border-radius, 3px);--background:var(--jse-svelte-select-background, #fff);--padding:var(--jse-svelte-select-padding, 0 10px);--multi-select-padding:var(--jse-svelte-select-multi-select-padding, 0 10px);--font-size:var(--jse-svelte-select-font-size, var(--jse-font-size, 16px));--height:36px;--multi-item-height:28px;--multi-item-margin:2px;--multi-item-padding:2px 8px;--multi-item-border-radius:6px;--indicator-top:8px}.jse-modal.svelte-1m3nfgb .jse-modal-contents.svelte-1m3nfgb{flex:1;display:flex;flex-direction:column;padding:20px;overflow:auto;min-width:0;min-height:0}.jse-modal.svelte-1m3nfgb .jse-modal-contents .jse-actions.svelte-1m3nfgb{display:flex;flex-direction:row;justify-content:flex-end;padding-top:var(--jse-padding, 10px)}.jse-modal.svelte-1m3nfgb .jse-modal-contents .jse-actions button.jse-primary.svelte-1m3nfgb{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-primary-background, var(--jse-theme-color, #3883fa));color:var(--jse-button-primary-color, #fff);padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-modal.svelte-1m3nfgb .jse-modal-contents .jse-actions button.jse-primary.svelte-1m3nfgb:hover{background:var(--jse-button-primary-background-highlight, var(--jse-theme-color-highlight, #5f9dff))}.jse-modal.svelte-1m3nfgb .jse-modal-contents .jse-actions button.jse-primary.svelte-1m3nfgb:disabled{background:var(--jse-button-primary-background-disabled, #9d9d9d)}.bg.jse-modal-bg{width:100%;height:100%;top:0;left:0;background:var(--jse-overlay-background, rgba(0, 0, 0, 0.3))}.bg.jse-modal-bg .jse-modal-window-wrap{margin:0}.bg.jse-modal-bg .jse-modal-window{max-width:90%;margin:4rem auto 2rem auto;border-radius:2px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-sort{width:400px}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-transform{width:1200px;height:1200px;max-height:80%;display:flex}.bg.jse-modal-bg .jse-modal-window.jse-modal-window-jsoneditor{width:800px;height:auto;min-height:500px;max-height:calc(100vh - 6rem);display:flex}.bg.jse-modal-bg .jse-modal-container{flex:1;display:flex;flex-direction:column;padding:0}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-modal-contents.svelte-1m3nfgb{padding-top:0}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-modal-contents .jse-label.svelte-1m3nfgb{font-weight:bold;display:block;box-sizing:border-box}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-modal-contents .jse-label .jse-label-inner.svelte-1m3nfgb{margin-top:calc(2 * var(--jse-padding, 10px));margin-bottom:calc(0.5 * var(--jse-padding, 10px));box-sizing:border-box}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-modal-contents .jse-label .jse-label-inner button.svelte-1m3nfgb{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;font-weight:bold;padding:0}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-modal-contents .jse-modal-inline-editor.svelte-1m3nfgb{flex:1;min-height:150px;min-width:0;display:flex;--jse-theme-color:var(--jse-modal-editor-theme-color, var(--jse-modal-theme-color, #707070));--jse-theme-color-highlight:var(--jse-modal-editor-theme-color-highlight, var(--jse-modal-theme-color-highlight, #646464))}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-actions.svelte-1m3nfgb{gap:var(--jse-padding, 10px);align-items:center}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-actions .jse-error.svelte-1m3nfgb{flex:1;color:var(--jse-error-color, #ee5341)}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-actions button.jse-secondary.svelte-1m3nfgb{border:none;background:transparent;color:inherit;cursor:pointer;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);padding:5px;margin:0;background:var(--jse-button-secondary-background, #d3d3d3);color:var(--jse-button-secondary-color, var(--jse-text-color, #4d4d4d));padding:var(--jse-padding, 10px) calc(2 * var(--jse-padding, 10px));border-radius:3px}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-actions button.jse-secondary.svelte-1m3nfgb:hover{background:var(--jse-button-secondary-background-highlight, #e1e1e1)}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb .jse-actions button.jse-secondary.svelte-1m3nfgb:disabled{background:var(--jse-button-secondary-background-disabled, #9d9d9d)}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb input.svelte-1m3nfgb{border:var(--jse-input-border, 1px solid #d8dbdf);outline:none;box-sizing:border-box;padding:calc(0.5 * var(--jse-padding, 10px));font-family:var(--jse-font-family-mono, consolas, menlo, monaco, "Ubuntu Mono", "source-code-pro", monospace);font-size:var(--jse-font-size-mono, 14px);color:inherit;background:var(--jse-input-background, var(--jse-background-color, #fff))}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb input.svelte-1m3nfgb:focus{border:var(--jse-input-border-focus, 1px solid var(--jse-input-border-focus, var(--jse-theme-color, #3883fa)))}.jse-modal.jse-jsoneditor-modal.svelte-1m3nfgb input.svelte-1m3nfgb:read-only{background:var(--jse-input-background-readonly, transparent)}'); + } + function c8(e20) { + var t10, n10; + return { c: function() { + t10 = ji("div"), n10 = Ci(e20[22]), Ai(t10, "class", "jse-error svelte-1m3nfgb"); + }, m: function(e21, r10) { + ki(e21, t10, r10), pi(t10, n10); + }, p: function(e21, t11) { + 4194304 & t11[0] && Ni(n10, e21[22]); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function l8(e20) { + var t10, n10, r10, o10, i10, a10; + return n10 = new jM({ props: { data: nP } }), { c: function() { + t10 = ji("button"), Pa(n10.$$.fragment), r10 = Ci(" Back"), Ai(t10, "type", "button"), Ai(t10, "class", "jse-secondary svelte-1m3nfgb"); + }, m: function(s10, c10) { + ki(s10, t10, c10), Ta(n10, t10, null), pi(t10, r10), o10 = true, i10 || (a10 = Oi(t10, "click", e20[27]), i10 = true); + }, p: Wo, i: function(e21) { + o10 || (wa(n10.$$.fragment, e21), o10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), o10 = false; + }, d: function(e21) { + e21 && wi(t10), Ra(n10), i10 = false, a10(); + } }; + } + function u8(e20) { + var t10, n10, r10; + return { c: function() { + (t10 = ji("button")).textContent = "Close", Ai(t10, "type", "button"), Ai(t10, "class", "jse-primary svelte-1m3nfgb"); + }, m: function(o10, i10) { + ki(o10, t10, i10), n10 || (r10 = [Oi(t10, "click", e20[27]), ci(h8.call(null, t10))], n10 = true); + }, p: Wo, d: function(e21) { + e21 && wi(t10), n10 = false, Qo(r10); + } }; + } + function f8(e20) { + var t10, n10, r10; + return { c: function() { + (t10 = ji("button")).textContent = "Apply", Ai(t10, "type", "button"), Ai(t10, "class", "jse-primary svelte-1m3nfgb"); + }, m: function(o10, i10) { + ki(o10, t10, i10), n10 || (r10 = [Oi(t10, "click", e20[26]), ci(h8.call(null, t10))], n10 = true); + }, p: Wo, d: function(e21) { + e21 && wi(t10), n10 = false, Qo(r10); + } }; + } + function d8(e20) { + var t10, n10, r10, o10, i10, a10, s10, c10, l10, u10, f10, d10, h10, v10, p10, m10, g10, y10, b10; + n10 = new XN({ props: { title: "Edit nested content " + (e20[20].length > 1 ? " (".concat(e20[20].length, ")") : ""), onClose: e20[27] } }); + var k10 = { mode: e20[23].mode, content: e20[23].content, selection: e20[23].selection, readOnly: e20[0], indentation: e20[1], tabSize: e20[2], statusBar: e20[5], askToFormat: e20[6], mainMenuBar: e20[3], navigationBar: e20[4], escapeControlCharacters: e20[7], escapeUnicodeCharacters: e20[8], flattenColumns: e20[9], parser: e20[10], parseMemoizeOne: e20[24], validator: e20[11], validationParser: e20[12], pathParser: e20[13], insideModal: true, onError: e20[31], onChange: e20[28], onChangeMode: e20[30], onSelect: e20[29], onRenderValue: e20[14], onClassName: e20[15], onFocus: LL, onBlur: LL, onRenderMenu: e20[16], onRenderContextMenu: e20[17], onSortModal: e20[18], onTransformModal: e20[19], onJSONEditorModal: e20[32] }; + d10 = new a8({ props: k10 }), e20[37](d10); + var w10 = e20[22] && c8(e20), x10 = e20[20].length > 1 && l8(e20); + function j10(e21, t11) { + return e21[0] ? u8 : f8; + } + var S10 = j10(e20), C10 = S10(e20); + return { c: function() { + t10 = ji("div"), Pa(n10.$$.fragment), r10 = $i(), o10 = ji("div"), (i10 = ji("div")).innerHTML = '
Path
', a10 = $i(), s10 = ji("input"), c10 = $i(), (l10 = ji("div")).innerHTML = '
Contents
', u10 = $i(), f10 = ji("div"), Pa(d10.$$.fragment), h10 = $i(), v10 = ji("div"), w10 && w10.c(), p10 = $i(), x10 && x10.c(), m10 = $i(), C10.c(), Ai(i10, "class", "jse-label svelte-1m3nfgb"), Ai(s10, "class", "jse-path svelte-1m3nfgb"), Ai(s10, "type", "text"), s10.readOnly = true, Ai(s10, "title", "Selected path"), s10.value = e20[25], Ai(l10, "class", "jse-label svelte-1m3nfgb"), Ai(f10, "class", "jse-modal-inline-editor svelte-1m3nfgb"), Ai(v10, "class", "jse-actions svelte-1m3nfgb"), Ai(o10, "class", "jse-modal-contents svelte-1m3nfgb"), Ai(t10, "class", "jse-modal jse-jsoneditor-modal svelte-1m3nfgb"); + }, m: function(k11, j11) { + ki(k11, t10, j11), Ta(n10, t10, null), pi(t10, r10), pi(t10, o10), pi(o10, i10), pi(o10, a10), pi(o10, s10), pi(o10, c10), pi(o10, l10), pi(o10, u10), pi(o10, f10), Ta(d10, f10, null), pi(o10, h10), pi(o10, v10), w10 && w10.m(v10, null), pi(v10, p10), x10 && x10.m(v10, null), pi(v10, m10), C10.m(v10, null), g10 = true, y10 || (b10 = ci(BI.call(null, t10, e20[27])), y10 = true); + }, p: function(e21, t11) { + var r11 = {}; + 1048576 & t11[0] && (r11.title = "Edit nested content " + (e21[20].length > 1 ? " (".concat(e21[20].length, ")") : "")), n10.$set(r11), (!g10 || 33554432 & t11[0] && s10.value !== e21[25]) && (s10.value = e21[25]); + var o11 = {}; + 8388608 & t11[0] && (o11.mode = e21[23].mode), 8388608 & t11[0] && (o11.content = e21[23].content), 8388608 & t11[0] && (o11.selection = e21[23].selection), 1 & t11[0] && (o11.readOnly = e21[0]), 2 & t11[0] && (o11.indentation = e21[1]), 4 & t11[0] && (o11.tabSize = e21[2]), 32 & t11[0] && (o11.statusBar = e21[5]), 64 & t11[0] && (o11.askToFormat = e21[6]), 8 & t11[0] && (o11.mainMenuBar = e21[3]), 16 & t11[0] && (o11.navigationBar = e21[4]), 128 & t11[0] && (o11.escapeControlCharacters = e21[7]), 256 & t11[0] && (o11.escapeUnicodeCharacters = e21[8]), 512 & t11[0] && (o11.flattenColumns = e21[9]), 1024 & t11[0] && (o11.parser = e21[10]), 16777216 & t11[0] && (o11.parseMemoizeOne = e21[24]), 2048 & t11[0] && (o11.validator = e21[11]), 4096 & t11[0] && (o11.validationParser = e21[12]), 8192 & t11[0] && (o11.pathParser = e21[13]), 16384 & t11[0] && (o11.onRenderValue = e21[14]), 32768 & t11[0] && (o11.onClassName = e21[15]), 65536 & t11[0] && (o11.onRenderMenu = e21[16]), 131072 & t11[0] && (o11.onRenderContextMenu = e21[17]), 262144 & t11[0] && (o11.onSortModal = e21[18]), 524288 & t11[0] && (o11.onTransformModal = e21[19]), d10.$set(o11), e21[22] ? w10 ? w10.p(e21, t11) : ((w10 = c8(e21)).c(), w10.m(v10, p10)) : w10 && (w10.d(1), w10 = null), e21[20].length > 1 ? x10 ? (x10.p(e21, t11), 1048576 & t11[0] && wa(x10, 1)) : ((x10 = l8(e21)).c(), wa(x10, 1), x10.m(v10, m10)) : x10 && (ba(), xa(x10, 1, 1, function() { + x10 = null; + }), ka()), S10 === (S10 = j10(e21)) && C10 ? C10.p(e21, t11) : (C10.d(1), (C10 = S10(e21)) && (C10.c(), C10.m(v10, null))); + }, i: function(e21) { + g10 || (wa(n10.$$.fragment, e21), wa(d10.$$.fragment, e21), wa(x10), g10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), xa(d10.$$.fragment, e21), xa(x10), g10 = false; + }, d: function(r11) { + r11 && wi(t10), Ra(n10), e20[37](null), Ra(d10), w10 && w10.d(), x10 && x10.d(), C10.d(), y10 = false, b10(); + } }; + } + function h8(e20) { + e20.focus(); + } + function v8(e20, t10, n10) { + var r10, o10, i10, a10, s10, c10 = Da("jsoneditor:JSONEditorModal"), l10 = t10.content, u10 = t10.path, f10 = t10.onPatch, d10 = t10.readOnly, h10 = t10.indentation, v10 = t10.tabSize, p10 = t10.mainMenuBar, m10 = t10.navigationBar, g10 = t10.statusBar, y10 = t10.askToFormat, b10 = t10.escapeControlCharacters, k10 = t10.escapeUnicodeCharacters, w10 = t10.flattenColumns, x10 = t10.parser, j10 = t10.validator, S10 = t10.validationParser, C10 = t10.pathParser, $10 = t10.onRenderValue, _10 = t10.onClassName, O10 = t10.onRenderMenu, M10 = t10.onRenderContextMenu, E10 = t10.onSortModal, A10 = t10.onTransformModal, P10 = Zi("simple-modal").close, T8 = { mode: I10(l10), content: l10, selection: null, relativePath: u10 }, R8 = [T8], N8 = void 0; + function I10(e21) { + return K_(e21) && Ts(e21.json) ? Qa.table : Qa.tree; + } + function D10() { + var e21, t11 = (null === (e21 = vb(R8)) || void 0 === e21 ? void 0 : e21.selection) || null; + yE(t11) && s10.scrollTo(JE(t11)); + } + return e20.$$set = function(e21) { + "content" in e21 && n10(33, l10 = e21.content), "path" in e21 && n10(34, u10 = e21.path), "onPatch" in e21 && n10(35, f10 = e21.onPatch), "readOnly" in e21 && n10(0, d10 = e21.readOnly), "indentation" in e21 && n10(1, h10 = e21.indentation), "tabSize" in e21 && n10(2, v10 = e21.tabSize), "mainMenuBar" in e21 && n10(3, p10 = e21.mainMenuBar), "navigationBar" in e21 && n10(4, m10 = e21.navigationBar), "statusBar" in e21 && n10(5, g10 = e21.statusBar), "askToFormat" in e21 && n10(6, y10 = e21.askToFormat), "escapeControlCharacters" in e21 && n10(7, b10 = e21.escapeControlCharacters), "escapeUnicodeCharacters" in e21 && n10(8, k10 = e21.escapeUnicodeCharacters), "flattenColumns" in e21 && n10(9, w10 = e21.flattenColumns), "parser" in e21 && n10(10, x10 = e21.parser), "validator" in e21 && n10(11, j10 = e21.validator), "validationParser" in e21 && n10(12, S10 = e21.validationParser), "pathParser" in e21 && n10(13, C10 = e21.pathParser), "onRenderValue" in e21 && n10(14, $10 = e21.onRenderValue), "onClassName" in e21 && n10(15, _10 = e21.onClassName), "onRenderMenu" in e21 && n10(16, O10 = e21.onRenderMenu), "onRenderContextMenu" in e21 && n10(17, M10 = e21.onRenderContextMenu), "onSortModal" in e21 && n10(18, E10 = e21.onSortModal), "onTransformModal" in e21 && n10(19, A10 = e21.onTransformModal); + }, e20.$$.update = function() { + 1048576 & e20.$$.dirty[0] && n10(23, r10 = vb(R8) || T8), 1048576 & e20.$$.dirty[0] && n10(36, o10 = R8.flatMap(function(e21) { + return e21.relativePath; + })), 32 & e20.$$.dirty[1] && n10(25, i10 = _w(o10) ? "(document root)" : JO(o10)), 1024 & e20.$$.dirty[0] && n10(24, a10 = CB(x10.parse)); + }, [d10, h10, v10, p10, m10, g10, y10, b10, k10, w10, x10, j10, S10, C10, $10, _10, O10, M10, E10, A10, R8, s10, N8, r10, a10, i10, function() { + if (c10("handleApply"), !d10) + try { + n10(22, N8 = void 0); + var e21 = r10.relativePath, t11 = r10.content, o11 = [{ op: "replace", path: Zs(e21), value: Q_(t11, x10).json }]; + if (R8.length > 1) { + var i11 = { json: rc(Q_(R8[R8.length - 2].content, x10).json, o11) }, a11 = Ro(Ro({}, R8[R8.length - 2] || T8), {}, { content: i11 }); + n10(20, R8 = [].concat(Bo(R8.slice(0, R8.length - 2)), [a11])), ca().then(D10); + } else + f10(o11), P10(); + } catch (e23) { + n10(22, N8 = String(e23)); + } + }, function() { + c10("handleClose"), R8.length > 1 ? (n10(20, R8 = Qk(R8)), ca().then(D10), n10(22, N8 = void 0)) : P10(); + }, function(e21) { + c10("handleChange", e21); + var t11 = Ro(Ro({}, r10), {}, { content: e21 }); + n10(20, R8 = [].concat(Bo(Qk(R8)), [t11])); + }, function(e21) { + c10("handleChangeSelection", e21); + var t11 = Ro(Ro({}, r10), {}, { selection: e21 }); + n10(20, R8 = [].concat(Bo(Qk(R8)), [t11])); + }, function(e21) { + c10("handleChangeMode", e21); + var t11 = Ro(Ro({}, r10), {}, { mode: e21 }); + n10(20, R8 = [].concat(Bo(Qk(R8)), [t11])); + }, function(e21) { + n10(22, N8 = e21.toString()), console.error(e21); + }, function(e21) { + var t11 = e21.content, r11 = e21.path; + c10("handleJSONEditorModal", { content: t11, path: r11 }); + var o11 = { mode: I10(t11), content: t11, selection: null, relativePath: r11 }; + n10(20, R8 = [].concat(Bo(R8), [o11])); + }, l10, u10, f10, o10, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(21, s10 = e21); + }); + }]; + } + var p8 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, v8, d8, Zo, { content: 33, path: 34, onPatch: 35, readOnly: 0, indentation: 1, tabSize: 2, mainMenuBar: 3, navigationBar: 4, statusBar: 5, askToFormat: 6, escapeControlCharacters: 7, escapeUnicodeCharacters: 8, flattenColumns: 9, parser: 10, validator: 11, validationParser: 12, pathParser: 13, onRenderValue: 14, onClassName: 15, onRenderMenu: 16, onRenderContextMenu: 17, onSortModal: 18, onTransformModal: 19 }, s8, [-1, -1]), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + function m8(e20, t10, n10) { + var r10 = Zi("simple-modal"); + return [r10.open, r10.close]; + } + var g8 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, m8, null, Zo, { open: 0, close: 1 }), n10; + } + return Ao(t10, Ia), Do(t10, [{ key: "open", get: function() { + return this.$$.ctx[0]; + } }, { key: "close", get: function() { + return this.$$.ctx[1]; + } }]), t10; + }(); + function y8(e20) { + mi(e20, "svelte-ybuk0j", '.jse-main.svelte-ybuk0j{width:100%;height:100%;min-width:0;min-height:150px;font-family:var(--jse-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);font-size:var(--jse-font-size, 16px);line-height:normal;position:relative;display:flex;flex-direction:row}'); + } + function b8(e20) { + var t10, n10, r10 = { mode: e20[1], content: e20[0], selection: e20[2], readOnly: e20[3], indentation: e20[4], tabSize: e20[5], statusBar: e20[8], askToFormat: e20[9], mainMenuBar: e20[6], navigationBar: e20[7], escapeControlCharacters: e20[10], escapeUnicodeCharacters: e20[11], flattenColumns: e20[12], parser: e20[13], parseMemoizeOne: e20[27], validator: e20[14], validationParser: e20[15], pathParser: e20[16], insideModal: false, onError: e20[21], onChange: e20[28], onChangeMode: e20[32], onSelect: e20[29], onRenderValue: e20[17], onClassName: e20[18], onFocus: e20[30], onBlur: e20[31], onRenderMenu: e20[19], onRenderContextMenu: e20[20], onSortModal: e20[34], onTransformModal: e20[33], onJSONEditorModal: e20[35] }; + return t10 = new a8({ props: r10 }), e20[62](t10), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r11) { + Ta(t10, e21, r11), n10 = true; + }, p: function(e21, n11) { + var r11 = {}; + 2 & n11[0] && (r11.mode = e21[1]), 1 & n11[0] && (r11.content = e21[0]), 4 & n11[0] && (r11.selection = e21[2]), 8 & n11[0] && (r11.readOnly = e21[3]), 16 & n11[0] && (r11.indentation = e21[4]), 32 & n11[0] && (r11.tabSize = e21[5]), 256 & n11[0] && (r11.statusBar = e21[8]), 512 & n11[0] && (r11.askToFormat = e21[9]), 64 & n11[0] && (r11.mainMenuBar = e21[6]), 128 & n11[0] && (r11.navigationBar = e21[7]), 1024 & n11[0] && (r11.escapeControlCharacters = e21[10]), 2048 & n11[0] && (r11.escapeUnicodeCharacters = e21[11]), 4096 & n11[0] && (r11.flattenColumns = e21[12]), 8192 & n11[0] && (r11.parser = e21[13]), 134217728 & n11[0] && (r11.parseMemoizeOne = e21[27]), 16384 & n11[0] && (r11.validator = e21[14]), 32768 & n11[0] && (r11.validationParser = e21[15]), 65536 & n11[0] && (r11.pathParser = e21[16]), 2097152 & n11[0] && (r11.onError = e21[21]), 131072 & n11[0] && (r11.onRenderValue = e21[17]), 262144 & n11[0] && (r11.onClassName = e21[18]), 524288 & n11[0] && (r11.onRenderMenu = e21[19]), 1048576 & n11[0] && (r11.onRenderContextMenu = e21[20]), t10.$set(r11); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(n11) { + e20[62](null), Ra(t10, n11); + } }; + } + function k8(e20) { + var t10, n10, r10, o10, i10, a10 = e20[22]; + function s10(t11) { + e20[61](t11); + } + var c10 = {}; + void 0 !== e20[25] && (c10.open = e20[25]), t10 = new g8({ props: c10 }), na.push(function() { + return Aa(t10, "open", s10); + }); + var l10 = b8(e20); + return { c: function() { + Pa(t10.$$.fragment), r10 = $i(), o10 = ji("div"), l10.c(), Ai(o10, "class", "jse-main svelte-ybuk0j"), zi(o10, "jse-focus", e20[23]); + }, m: function(e21, n11) { + Ta(t10, e21, n11), ki(e21, r10, n11), ki(e21, o10, n11), l10.m(o10, null), i10 = true; + }, p: function(e21, r11) { + var s11 = {}; + !n10 && 33554432 & r11[0] && (n10 = true, s11.open = e21[25], ua(function() { + return n10 = false; + })), t10.$set(s11), 4194304 & r11[0] && Zo(a10, a10 = e21[22]) ? (ba(), xa(l10, 1, 1, Wo), ka(), (l10 = b8(e21)).c(), wa(l10, 1), l10.m(o10, null)) : l10.p(e21, r11), (!i10 || 8388608 & r11[0]) && zi(o10, "jse-focus", e21[23]); + }, i: function(e21) { + i10 || (wa(t10.$$.fragment, e21), wa(l10), i10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), xa(l10), i10 = false; + }, d: function(e21) { + e21 && (wi(r10), wi(o10)), Ra(t10, e21), l10.d(e21); + } }; + } + function w8(e20) { + var t10, n10; + return t10 = new rs({ props: { closeOnEsc: false, $$slots: { default: [k8] }, $$scope: { ctx: e20 } } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 201326591 & n11[0] | 8 & n11[2] && (r10.$$scope = { dirty: n11, ctx: e21 }), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function x8(e20) { + for (var t10, n10, r10, o10 = [{ show: null === (t10 = e20[26]) || void 0 === t10 ? void 0 : t10.component }, ks, { closeOnEsc: false }], i10 = { $$slots: { default: [w8] }, $$scope: { ctx: e20 } }, a10 = 0; a10 < o10.length; a10 += 1) + i10 = Jo(i10, o10[a10]); + return (n10 = new rs({ props: i10 })).$on("close", e20[36]), { c: function() { + Pa(n10.$$.fragment); + }, m: function(e21, t11) { + Ta(n10, e21, t11), r10 = true; + }, p: function(e21, t11) { + var r11, i11 = 67108864 & t11[0] ? Ma(o10, [{ show: null === (r11 = e21[26]) || void 0 === r11 ? void 0 : r11.component }, o10[1], o10[2]]) : {}; + 201326591 & t11[0] | 8 & t11[2] && (i11.$$scope = { dirty: t11, ctx: e21 }), n10.$set(i11); + }, i: function(e21) { + r10 || (wa(n10.$$.fragment, e21), r10 = true); + }, o: function(e21) { + xa(n10.$$.fragment, e21), r10 = false; + }, d: function(e21) { + Ra(n10, e21); + } }; + } + function j8(e20) { + var t10, n10; + return t10 = new UO({ props: { $$slots: { default: [x8] }, $$scope: { ctx: e20 } } }), { c: function() { + Pa(t10.$$.fragment); + }, m: function(e21, r10) { + Ta(t10, e21, r10), n10 = true; + }, p: function(e21, n11) { + var r10 = {}; + 268435455 & n11[0] | 8 & n11[2] && (r10.$$scope = { dirty: n11, ctx: e21 }), t10.$set(r10); + }, i: function(e21) { + n10 || (wa(t10.$$.fragment, e21), n10 = true); + }, o: function(e21) { + xa(t10.$$.fragment, e21), n10 = false; + }, d: function(e21) { + Ra(t10, e21); + } }; + } + function S8(e20, t10, n10) { + var r10, o10, i10, a10 = Da("jsoneditor:JSONEditor"), s10 = t10.content, c10 = void 0 === s10 ? { text: "" } : s10, l10 = t10.selection, u10 = void 0 === l10 ? null : l10, f10 = t10.readOnly, d10 = void 0 !== f10 && f10, h10 = t10.indentation, v10 = void 0 === h10 ? 2 : h10, p10 = t10.tabSize, m10 = void 0 === p10 ? 4 : p10, g10 = t10.mode, y10 = void 0 === g10 ? Qa.tree : g10, b10 = t10.mainMenuBar, k10 = void 0 === b10 || b10, w10 = t10.navigationBar, x10 = void 0 === w10 || w10, j10 = t10.statusBar, S10 = void 0 === j10 || j10, C10 = t10.askToFormat, $10 = void 0 === C10 || C10, _10 = t10.escapeControlCharacters, O10 = void 0 !== _10 && _10, M10 = t10.escapeUnicodeCharacters, E10 = void 0 !== M10 && M10, A10 = t10.flattenColumns, P10 = void 0 === A10 || A10, T8 = t10.parser, R8 = void 0 === T8 ? JSON : T8, N8 = t10.validator, I10 = void 0 === N8 ? null : N8, D10 = t10.validationParser, q10 = void 0 === D10 ? JSON : D10, z10 = t10.pathParser, B10 = void 0 === z10 ? { parse: KO, stringify: JO } : z10, L10 = t10.queryLanguages, F10 = void 0 === L10 ? [rM] : L10, V10 = t10.queryLanguageId, H10 = void 0 === V10 ? F10[0].id : V10, W10 = t10.onChangeQueryLanguage, U10 = void 0 === W10 ? LL : W10, J10 = t10.onChange, K10 = void 0 === J10 ? null : J10, G10 = t10.onSelect, Q10 = void 0 === G10 ? LL : G10, Y10 = t10.onRenderValue, X10 = void 0 === Y10 ? GA : Y10, Z10 = t10.onClassName, ee2 = void 0 === Z10 ? function() { + } : Z10, te2 = t10.onRenderMenu, ne2 = void 0 === te2 ? LL : te2, re2 = t10.onRenderContextMenu, oe2 = void 0 === re2 ? LL : re2, ie2 = t10.onChangeMode, ae2 = void 0 === ie2 ? LL : ie2, se2 = t10.onError, ce2 = void 0 === se2 ? function(e21) { + console.error(e21), alert(e21.toString()); + } : se2, le2 = t10.onFocus, ue2 = void 0 === le2 ? LL : le2, fe2 = t10.onBlur, de2 = void 0 === fe2 ? LL : fe2, he2 = Ps(), ve2 = false, pe2 = null, me2 = R8; + function ge2() { + return (ge2 = xo(ko().mark(function e21(t11) { + var r11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (a10("set"), !(r11 = W_(t11))) { + e23.next = 4; + break; + } + throw new Error(r11); + case 4: + return n10(22, he2 = Ps()), e23.next = 7, ca(); + case 7: + n10(0, c10 = t11); + case 8: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function ye2() { + return (ye2 = xo(ko().mark(function e21(t11) { + var r11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (a10("update"), !(r11 = W_(t11))) { + e23.next = 4; + break; + } + throw new Error(r11); + case 4: + return n10(0, c10 = t11), e23.next = 7, ca(); + case 7: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function be2() { + return be2 = xo(ko().mark(function e21(t11) { + var r11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (!J_(c10)) { + e23.next = 8; + break; + } + e23.prev = 1, n10(0, c10 = { json: R8.parse(c10.text), text: void 0 }), e23.next = 8; + break; + case 5: + throw e23.prev = 5, e23.t0 = e23.catch(1), new Error("Cannot apply patch: current document contains invalid JSON"); + case 8: + return r11 = o10.patch(t11), e23.next = 11, ca(); + case 11: + return e23.abrupt("return", r11); + case 12: + case "end": + return e23.stop(); + } + }, e21, null, [[1, 5]]); + })), be2.apply(this, arguments); + } + function ke2() { + return (ke2 = xo(ko().mark(function e21(t11) { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return n10(2, u10 = t11), e23.next = 3, ca(); + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function we2() { + return (we2 = xo(ko().mark(function e21(t11) { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return o10.expand(t11), e23.next = 3, ca(); + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function xe2() { + return xe2 = xo(ko().mark(function e21() { + var t11; + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return t11 = o10.acceptAutoRepair(), e23.next = 3, ca(); + case 3: + return e23.abrupt("return", t11); + case 4: + case "end": + return e23.stop(); + } + }, e21); + })), xe2.apply(this, arguments); + } + function je2() { + return (je2 = xo(ko().mark(function e21(t11) { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return e23.next = 2, o10.scrollTo(t11); + case 2: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function Se2() { + return Ce2.apply(this, arguments); + } + function Ce2() { + return (Ce2 = xo(ko().mark(function e21() { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return o10.focus(), e23.next = 3, ca(); + case 3: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function $e2() { + return ($e2 = xo(ko().mark(function e21() { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return e23.next = 2, o10.refresh(); + case 2: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function _e2() { + return (_e2 = xo(ko().mark(function e21(t11) { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return this.$set(t11), e23.next = 3, ca(); + case 3: + case "end": + return e23.stop(); + } + }, e21, this); + }))).apply(this, arguments); + } + function Oe2() { + return (Oe2 = xo(ko().mark(function e21() { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + return this.$destroy(), e23.next = 3, ca(); + case 3: + case "end": + return e23.stop(); + } + }, e21, this); + }))).apply(this, arguments); + } + function Me2() { + return (Me2 = xo(ko().mark(function e21(t11) { + return ko().wrap(function(e23) { + for (; ; ) + switch (e23.prev = e23.next) { + case 0: + if (y10 !== t11) { + e23.next = 2; + break; + } + return e23.abrupt("return"); + case 2: + return n10(1, y10 = t11), e23.next = 5, ca(); + case 5: + return e23.next = 7, Se2(); + case 7: + ae2(t11); + case 8: + case "end": + return e23.stop(); + } + }, e21); + }))).apply(this, arguments); + } + function Ee2(e21) { + a10("handleChangeQueryLanguage", e21), n10(37, H10 = e21), U10(e21); + } + function Ae2(e21) { + var t11 = e21.id, n11 = e21.json, o11 = e21.rootPath, a11 = e21.onTransform, s11 = e21.onClose; + d10 || i10(PL, { id: t11, json: n11, rootPath: o11, indentation: v10, escapeControlCharacters: O10, escapeUnicodeCharacters: E10, parser: R8, parseMemoizeOne: r10, validationParser: q10, pathParser: B10, queryLanguages: F10, queryLanguageId: H10, onChangeQueryLanguage: Ee2, onRenderValue: X10, onRenderMenu: ne2, onRenderContextMenu: oe2, onClassName: ee2, onTransform: a11 }, bs, { onClose: s11 }); + } + function Pe2(e21) { + var t11 = e21.id, n11 = e21.json, r11 = e21.rootPath, o11 = e21.onSort, a11 = e21.onClose; + d10 || i10(BL, { id: t11, json: n11, rootPath: r11, onSort: o11 }, ys, { onClose: a11 }); + } + return e20.$$set = function(e21) { + "content" in e21 && n10(0, c10 = e21.content), "selection" in e21 && n10(2, u10 = e21.selection), "readOnly" in e21 && n10(3, d10 = e21.readOnly), "indentation" in e21 && n10(4, v10 = e21.indentation), "tabSize" in e21 && n10(5, m10 = e21.tabSize), "mode" in e21 && n10(1, y10 = e21.mode), "mainMenuBar" in e21 && n10(6, k10 = e21.mainMenuBar), "navigationBar" in e21 && n10(7, x10 = e21.navigationBar), "statusBar" in e21 && n10(8, S10 = e21.statusBar), "askToFormat" in e21 && n10(9, $10 = e21.askToFormat), "escapeControlCharacters" in e21 && n10(10, O10 = e21.escapeControlCharacters), "escapeUnicodeCharacters" in e21 && n10(11, E10 = e21.escapeUnicodeCharacters), "flattenColumns" in e21 && n10(12, P10 = e21.flattenColumns), "parser" in e21 && n10(13, R8 = e21.parser), "validator" in e21 && n10(14, I10 = e21.validator), "validationParser" in e21 && n10(15, q10 = e21.validationParser), "pathParser" in e21 && n10(16, B10 = e21.pathParser), "queryLanguages" in e21 && n10(38, F10 = e21.queryLanguages), "queryLanguageId" in e21 && n10(37, H10 = e21.queryLanguageId), "onChangeQueryLanguage" in e21 && n10(39, U10 = e21.onChangeQueryLanguage), "onChange" in e21 && n10(40, K10 = e21.onChange), "onSelect" in e21 && n10(41, Q10 = e21.onSelect), "onRenderValue" in e21 && n10(17, X10 = e21.onRenderValue), "onClassName" in e21 && n10(18, ee2 = e21.onClassName), "onRenderMenu" in e21 && n10(19, ne2 = e21.onRenderMenu), "onRenderContextMenu" in e21 && n10(20, oe2 = e21.onRenderContextMenu), "onChangeMode" in e21 && n10(42, ae2 = e21.onChangeMode), "onError" in e21 && n10(21, ce2 = e21.onError), "onFocus" in e21 && n10(43, ue2 = e21.onFocus), "onBlur" in e21 && n10(44, de2 = e21.onBlur); + }, e20.$$.update = function() { + if (8193 & e20.$$.dirty[0] | 536870912 & e20.$$.dirty[1] && !rO(R8, me2)) { + if (a10("parser changed, recreate editor"), K_(c10)) { + var t11 = me2.stringify(c10.json); + n10(0, c10 = { json: void 0 !== t11 ? R8.parse(t11) : void 0 }); + } + n10(60, me2 = R8), n10(22, he2 = Ps()); + } + if (1 & e20.$$.dirty[0]) { + var o11 = W_(c10); + o11 && console.error("Error: " + o11); + } + 8192 & e20.$$.dirty[0] && n10(27, r10 = CB(R8.parse)), 2 & e20.$$.dirty[0] && (a10("mode changed to", y10), "code" === y10 && console.warn('Deprecation warning: "code" mode is renamed to "text". Please use mode="text" instead.')); + }, [c10, y10, u10, d10, v10, m10, k10, x10, S10, $10, O10, E10, P10, R8, I10, q10, B10, X10, ee2, ne2, oe2, ce2, he2, ve2, o10, i10, pe2, r10, function(e21, t11, r11) { + n10(0, c10 = e21), K10 && K10(e21, t11, r11); + }, function(e21) { + n10(2, u10 = e21), Q10(e21); + }, function() { + n10(23, ve2 = true), ue2 && ue2(); + }, function() { + n10(23, ve2 = false), de2 && de2(); + }, function(e21) { + return Me2.apply(this, arguments); + }, Ae2, Pe2, function(e21) { + var t11 = e21.content, r11 = e21.path, o11 = e21.onPatch, i11 = e21.onClose; + a10("onJSONEditorModal", { content: t11, path: r11 }), n10(26, pe2 = { component: Ka(p8, { content: t11, path: r11, onPatch: o11, readOnly: d10, indentation: v10, tabSize: m10, mainMenuBar: k10, navigationBar: x10, statusBar: S10, askToFormat: $10, escapeControlCharacters: O10, escapeUnicodeCharacters: E10, flattenColumns: P10, parser: R8, validator: void 0, validationParser: q10, pathParser: B10, onRenderValue: X10, onClassName: ee2, onRenderMenu: ne2, onRenderContextMenu: oe2, onSortModal: Pe2, onTransformModal: Ae2 }), callbacks: { onClose: i11 } }); + }, function() { + var e21, t11; + null === (e21 = pe2) || void 0 === e21 || null === (e21 = e21.callbacks) || void 0 === e21 || null === (t11 = e21.onClose) || void 0 === t11 || t11.call(e21), n10(26, pe2 = null); + }, H10, F10, U10, K10, Q10, ae2, ue2, de2, function() { + return c10; + }, function(e21) { + return ge2.apply(this, arguments); + }, function(e21) { + return ye2.apply(this, arguments); + }, function(e21) { + return be2.apply(this, arguments); + }, function(e21) { + return ke2.apply(this, arguments); + }, function(e21) { + return we2.apply(this, arguments); + }, function(e21) { + o10.transform(e21); + }, function() { + return o10.validate(); + }, function() { + return xe2.apply(this, arguments); + }, function(e21) { + return je2.apply(this, arguments); + }, function(e21) { + return o10.findElement(e21); + }, Se2, function() { + return $e2.apply(this, arguments); + }, function(e21) { + return _e2.apply(this, arguments); + }, function() { + return Oe2.apply(this, arguments); + }, me2, function(e21) { + n10(25, i10 = e21); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(24, o10 = e21); + }); + }]; + } + var C8 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, S8, j8, Zo, { content: 0, selection: 2, readOnly: 3, indentation: 4, tabSize: 5, mode: 1, mainMenuBar: 6, navigationBar: 7, statusBar: 8, askToFormat: 9, escapeControlCharacters: 10, escapeUnicodeCharacters: 11, flattenColumns: 12, parser: 13, validator: 14, validationParser: 15, pathParser: 16, queryLanguages: 38, queryLanguageId: 37, onChangeQueryLanguage: 39, onChange: 40, onSelect: 41, onRenderValue: 17, onClassName: 18, onRenderMenu: 19, onRenderContextMenu: 20, onChangeMode: 42, onError: 21, onFocus: 43, onBlur: 44, get: 45, set: 46, update: 47, patch: 48, select: 49, expand: 50, transform: 51, validate: 52, acceptAutoRepair: 53, scrollTo: 54, findElement: 55, focus: 56, refresh: 57, updateProps: 58, destroy: 59 }, y8, [-1, -1, -1]), n10; + } + return Ao(t10, Ia), Do(t10, [{ key: "get", get: function() { + return this.$$.ctx[45]; + } }, { key: "set", get: function() { + return this.$$.ctx[46]; + } }, { key: "update", get: function() { + return this.$$.ctx[47]; + } }, { key: "patch", get: function() { + return this.$$.ctx[48]; + } }, { key: "select", get: function() { + return this.$$.ctx[49]; + } }, { key: "expand", get: function() { + return this.$$.ctx[50]; + } }, { key: "transform", get: function() { + return this.$$.ctx[51]; + } }, { key: "validate", get: function() { + return this.$$.ctx[52]; + } }, { key: "acceptAutoRepair", get: function() { + return this.$$.ctx[53]; + } }, { key: "scrollTo", get: function() { + return this.$$.ctx[54]; + } }, { key: "findElement", get: function() { + return this.$$.ctx[55]; + } }, { key: "focus", get: function() { + return this.$$.ctx[56]; + } }, { key: "refresh", get: function() { + return this.$$.ctx[57]; + } }, { key: "updateProps", get: function() { + return this.$$.ctx[58]; + } }, { key: "destroy", get: function() { + return this.$$.ctx[59]; + } }]), t10; + }(); + function $8(e20) { + mi(e20, "svelte-9wp3tj", ".jse-value.jse-string.svelte-9wp3tj{color:var(--jse-value-color-string, #008000)}.jse-value.jse-object.svelte-9wp3tj,.jse-value.jse-array.svelte-9wp3tj{min-width:16px;color:var(--jse-delimiter-color, rgba(0, 0, 0, 0.38))}.jse-value.jse-number.svelte-9wp3tj{color:var(--jse-value-color-number, #ee422e)}.jse-value.jse-boolean.svelte-9wp3tj{color:var(--jse-value-color-boolean, #ff8c00)}.jse-value.jse-null.svelte-9wp3tj{color:var(--jse-value-color-null, #004ed0)}.jse-value.jse-invalid.svelte-9wp3tj{color:var(--jse-text-color, #4d4d4d)}.jse-value.jse-url.svelte-9wp3tj{color:var(--jse-value-color-url, #008000);text-decoration:underline}.jse-enum-value.svelte-9wp3tj{background:var(--jse-hover-background-color, rgba(0, 0, 0, 0.06));border:none;padding:0;font-family:inherit;font-size:inherit;cursor:pointer;outline:none}.jse-enum-value.jse-selected.svelte-9wp3tj{background:var(--jse-selection-background-color, #d3d3d3);color:inherit}.jse-enum-value.jse-value.svelte-9wp3tj:focus{color:var(--jse-text-color, #4d4d4d)}.jse-json-node.jse-selected .jse-enum-value.svelte-9wp3tj{background:transparent}"); + } + function _8(e20, t10, n10) { + var r10 = e20.slice(); + return r10[13] = t10[n10], r10; + } + function O8(e20) { + var t10, n10, r10, o10 = e20[13].text + ""; + return { c: function() { + t10 = ji("option"), n10 = Ci(o10), t10.__value = r10 = e20[13].value, Ii(t10, t10.__value); + }, m: function(e21, r11) { + ki(e21, t10, r11), pi(t10, n10); + }, p: function(e21, i10) { + 4 & i10 && o10 !== (o10 = e21[13].text + "") && Ni(n10, o10), 4 & i10 && r10 !== (r10 = e21[13].value) && (t10.__value = r10, Ii(t10, t10.__value)); + }, d: function(e21) { + e21 && wi(t10); + } }; + } + function M8(e20) { + for (var t10, n10, r10, o10, i10 = Ca(e20[2]), a10 = [], s10 = 0; s10 < i10.length; s10 += 1) + a10[s10] = O8(_8(e20, i10, s10)); + return { c: function() { + t10 = ji("select"); + for (var r11 = 0; r11 < a10.length; r11 += 1) + a10[r11].c(); + Ai(t10, "class", n10 = si("jse-enum-value ".concat(QE(e20[4], e20[0]))) + " svelte-9wp3tj"), void 0 === e20[4] && la(function() { + return e20[10].call(t10); + }), zi(t10, "jse-selected", pE(e20[1])); + }, m: function(n11, i11) { + ki(n11, t10, i11); + for (var s11 = 0; s11 < a10.length; s11 += 1) + a10[s11] && a10[s11].m(t10, null); + qi(t10, e20[4], true), e20[11](t10), r10 || (o10 = [Oi(t10, "change", e20[10]), Oi(t10, "change", e20[5]), Oi(t10, "mousedown", E8)], r10 = true); + }, p: function(e21, r11) { + var o11 = jo(r11, 1)[0]; + if (4 & o11) { + var s11; + for (i10 = Ca(e21[2]), s11 = 0; s11 < i10.length; s11 += 1) { + var c10 = _8(e21, i10, s11); + a10[s11] ? a10[s11].p(c10, o11) : (a10[s11] = O8(c10), a10[s11].c(), a10[s11].m(t10, null)); + } + for (; s11 < a10.length; s11 += 1) + a10[s11].d(1); + a10.length = i10.length; + } + 17 & o11 && n10 !== (n10 = si("jse-enum-value ".concat(QE(e21[4], e21[0]))) + " svelte-9wp3tj") && Ai(t10, "class", n10), 16 & o11 && qi(t10, e21[4]), 19 & o11 && zi(t10, "jse-selected", pE(e21[1])); + }, i: Wo, o: Wo, d: function(n11) { + n11 && wi(t10), xi(a10, n11), e20[11](null), r10 = false, Qo(o10); + } }; + } + function E8(e20) { + e20.stopPropagation(); + } + function A8(e20, t10, n10) { + var r10, o10 = t10.path, i10 = t10.value, a10 = t10.parser, s10 = t10.readOnly, c10 = t10.selection, l10 = t10.onPatch, u10 = t10.options, f10 = i10; + return e20.$$set = function(e21) { + "path" in e21 && n10(6, o10 = e21.path), "value" in e21 && n10(7, i10 = e21.value), "parser" in e21 && n10(0, a10 = e21.parser), "readOnly" in e21 && n10(8, s10 = e21.readOnly), "selection" in e21 && n10(1, c10 = e21.selection), "onPatch" in e21 && n10(9, l10 = e21.onPatch), "options" in e21 && n10(2, u10 = e21.options); + }, e20.$$.update = function() { + 128 & e20.$$.dirty && n10(4, f10 = i10), 2 & e20.$$.dirty && function(e21) { + e21 && r10 && r10.focus(); + }(c10); + }, [a10, c10, u10, r10, f10, function(e21) { + e21.stopPropagation(), s10 || l10([{ op: "replace", path: Zs(o10), value: f10 }]); + }, o10, i10, s10, l10, function() { + var e21; + e21 = this.querySelector(":checked"), f10 = e21 && e21.__value, n10(4, f10), n10(7, i10); + }, function(e21) { + na[e21 ? "unshift" : "push"](function() { + n10(3, r10 = e21), n10(2, u10); + }); + }]; + } + var P8 = function(e20) { + function t10(e21) { + var n10; + return No(this, t10), Na(Eo(n10 = _o(this, t10)), e21, A8, M8, Zo, { path: 6, value: 7, parser: 0, readOnly: 8, selection: 1, onPatch: 9, options: 2 }, $8), n10; + } + return Ao(t10, Ia), Do(t10); + }(); + var I8; + var D8 = { exports: {} }; + var q8 = {}; + var z8 = {}; + var B8 = {}; + var L8 = {}; + var F8 = {}; + var V8 = {}; + function H8() { + return I8 || (I8 = 1, function(n10) { + Object.defineProperty(n10, "__esModule", { value: true }), n10.regexpCode = n10.getEsmExportName = n10.getProperty = n10.safeStringify = n10.stringify = n10.strConcat = n10.addCodeArg = n10.str = n10._ = n10.nil = n10._Code = n10.Name = n10.IDENTIFIER = n10._CodeOrName = void 0; + var r10 = Do(function e20() { + No(this, e20); + }); + n10._CodeOrName = r10, n10.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; + var o10 = function(e20) { + function t10(e21) { + var r11; + if (No(this, t10), r11 = _o(this, t10), !n10.IDENTIFIER.test(e21)) + throw new Error("CodeGen: name must be a valid identifier"); + return r11.str = e21, r11; + } + return Ao(t10, e20), Do(t10, [{ key: "toString", value: function() { + return this.str; + } }, { key: "emptyStr", value: function() { + return false; + } }, { key: "names", get: function() { + return qo({}, this.str, 1); + } }]), t10; + }(r10); + n10.Name = o10; + var i10 = function(e20) { + function t10(e21) { + var n11; + return No(this, t10), (n11 = _o(this, t10))._items = "string" == typeof e21 ? [e21] : e21, n11; + } + return Ao(t10, e20), Do(t10, [{ key: "toString", value: function() { + return this.str; + } }, { key: "emptyStr", value: function() { + if (this._items.length > 1) + return false; + var e21 = this._items[0]; + return "" === e21 || '""' === e21; + } }, { key: "str", get: function() { + var e21; + return null !== (e21 = this._str) && void 0 !== e21 ? e21 : this._str = this._items.reduce(function(e23, t11) { + return "".concat(e23).concat(t11); + }, ""); + } }, { key: "names", get: function() { + var e21; + return null !== (e21 = this._names) && void 0 !== e21 ? e21 : this._names = this._items.reduce(function(e23, t11) { + return t11 instanceof o10 && (e23[t11.str] = (e23[t11.str] || 0) + 1), e23; + }, {}); + } }]), t10; + }(r10); + function a10(e20) { + for (var t10 = [e20[0]], n11 = 0, r11 = arguments.length, o11 = new Array(r11 > 1 ? r11 - 1 : 0), a11 = 1; a11 < r11; a11++) + o11[a11 - 1] = arguments[a11]; + for (; n11 < o11.length; ) + l10(t10, o11[n11]), t10.push(e20[++n11]); + return new i10(t10); + } + n10._Code = i10, n10.nil = new i10(""), n10._ = a10; + var s10 = new i10("+"); + function c10(e20) { + for (var t10 = [f10(e20[0])], n11 = 0, r11 = arguments.length, o11 = new Array(r11 > 1 ? r11 - 1 : 0), a11 = 1; a11 < r11; a11++) + o11[a11 - 1] = arguments[a11]; + for (; n11 < o11.length; ) + t10.push(s10), l10(t10, o11[n11]), t10.push(s10, f10(e20[++n11])); + return function(e21) { + var t11 = 1; + for (; t11 < e21.length - 1; ) { + if (e21[t11] === s10) { + var n12 = u10(e21[t11 - 1], e21[t11 + 1]); + if (void 0 !== n12) { + e21.splice(t11 - 1, 3, n12); + continue; + } + e21[t11++] = "+"; + } + t11++; + } + }(t10), new i10(t10); + } + function l10(e20, t10) { + var n11; + t10 instanceof i10 ? e20.push.apply(e20, Bo(t10._items)) : t10 instanceof o10 ? e20.push(t10) : e20.push("number" == typeof (n11 = t10) || "boolean" == typeof n11 || null === n11 ? n11 : f10(Array.isArray(n11) ? n11.join(",") : n11)); + } + function u10(e20, t10) { + if ('""' === t10) + return e20; + if ('""' === e20) + return t10; + if ("string" == typeof e20) { + if (t10 instanceof o10 || '"' !== e20[e20.length - 1]) + return; + return "string" != typeof t10 ? "".concat(e20.slice(0, -1)).concat(t10, '"') : '"' === t10[0] ? e20.slice(0, -1) + t10.slice(1) : void 0; + } + return "string" != typeof t10 || '"' !== t10[0] || e20 instanceof o10 ? void 0 : '"'.concat(e20).concat(t10.slice(1)); + } + function f10(e20) { + return JSON.stringify(e20).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); + } + n10.str = c10, n10.addCodeArg = l10, n10.strConcat = function(t10, n11) { + return n11.emptyStr() ? t10 : t10.emptyStr() ? n11 : c10(e || (e = mo(["", "", ""])), t10, n11); + }, n10.stringify = function(e20) { + return new i10(f10(e20)); + }, n10.safeStringify = f10, n10.getProperty = function(e20) { + return "string" == typeof e20 && n10.IDENTIFIER.test(e20) ? new i10(".".concat(e20)) : a10(t || (t = mo(["[", "]"])), e20); + }, n10.getEsmExportName = function(e20) { + if ("string" == typeof e20 && n10.IDENTIFIER.test(e20)) + return new i10("".concat(e20)); + throw new Error("CodeGen: invalid export name: ".concat(e20, ", use explicit $id name mapping")); + }, n10.regexpCode = function(e20) { + return new i10(e20.toString()); + }; + }(V8)), V8; + } + var W8; + var U8; + var J8 = {}; + function K8() { + return W8 || (W8 = 1, function(e20) { + Object.defineProperty(e20, "__esModule", { value: true }), e20.ValueScope = e20.ValueScopeName = e20.Scope = e20.varKinds = e20.UsedValueState = void 0; + var t10, s10 = H8(), c10 = function(e21) { + function t11(e23) { + var n10; + return No(this, t11), (n10 = _o(this, t11, ['CodeGen: "code" for '.concat(e23, " not defined")])).value = e23.value, n10; + } + return Ao(t11, $o(Error)), Do(t11); + }(); + !function(e21) { + e21[e21.Started = 0] = "Started", e21[e21.Completed = 1] = "Completed"; + }(t10 = e20.UsedValueState || (e20.UsedValueState = {})), e20.varKinds = { const: new s10.Name("const"), let: new s10.Name("let"), var: new s10.Name("var") }; + var l10 = function() { + function e21() { + var t11 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n10 = t11.prefixes, r10 = t11.parent; + No(this, e21), this._names = {}, this._prefixes = n10, this._parent = r10; + } + return Do(e21, [{ key: "toName", value: function(e23) { + return e23 instanceof s10.Name ? e23 : this.name(e23); + } }, { key: "name", value: function(e23) { + return new s10.Name(this._newName(e23)); + } }, { key: "_newName", value: function(e23) { + var t11 = this._names[e23] || this._nameGroup(e23); + return "".concat(e23).concat(t11.index++); + } }, { key: "_nameGroup", value: function(e23) { + var t11, n10; + if ((null === (n10 = null === (t11 = this._parent) || void 0 === t11 ? void 0 : t11._prefixes) || void 0 === n10 ? void 0 : n10.has(e23)) || this._prefixes && !this._prefixes.has(e23)) + throw new Error('CodeGen: prefix "'.concat(e23, '" is not allowed in this scope')); + return this._names[e23] = { prefix: e23, index: 0 }; + } }]), e21; + }(); + e20.Scope = l10; + var u10 = function(e21) { + function t11(e23, n10) { + var r10; + return No(this, t11), (r10 = _o(this, t11, [n10])).prefix = e23, r10; + } + return Ao(t11, e21), Do(t11, [{ key: "setValue", value: function(e23, t12) { + var r10 = t12.property, o10 = t12.itemIndex; + this.value = e23, this.scopePath = (0, s10._)(n || (n = mo([".", "[", "]"])), new s10.Name(r10), o10); + } }]), t11; + }(s10.Name); + e20.ValueScopeName = u10; + var f10 = (0, s10._)(r || (r = mo(["\n"], ["\\n"]))), d10 = function(n10) { + function r10(e21) { + var t11; + return No(this, r10), (t11 = _o(this, r10, [e21]))._values = {}, t11._scope = e21.scope, t11.opts = Ro(Ro({}, e21), {}, { _n: e21.lines ? f10 : s10.nil }), t11; + } + return Ao(r10, n10), Do(r10, [{ key: "get", value: function() { + return this._scope; + } }, { key: "name", value: function(e21) { + return new u10(e21, this._newName(e21)); + } }, { key: "value", value: function(e21, t11) { + var n11; + if (void 0 === t11.ref) + throw new Error("CodeGen: ref must be passed in value"); + var r11 = this.toName(e21), o10 = r11.prefix, i10 = null !== (n11 = t11.key) && void 0 !== n11 ? n11 : t11.ref, a10 = this._values[o10]; + if (a10) { + var s11 = a10.get(i10); + if (s11) + return s11; + } else + a10 = this._values[o10] = /* @__PURE__ */ new Map(); + a10.set(i10, r11); + var c11 = this._scope[o10] || (this._scope[o10] = []), l11 = c11.length; + return c11[l11] = t11.ref, r11.setValue(t11, { property: o10, itemIndex: l11 }), r11; + } }, { key: "getValue", value: function(e21, t11) { + var n11 = this._values[e21]; + if (n11) + return n11.get(t11); + } }, { key: "scopeRefs", value: function(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this._values; + return this._reduceValues(t11, function(t12) { + if (void 0 === t12.scopePath) + throw new Error('CodeGen: name "'.concat(t12, '" has no value')); + return (0, s10._)(o || (o = mo(["", "", ""])), e21, t12.scopePath); + }); + } }, { key: "scopeCode", value: function() { + var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this._values, t11 = arguments.length > 1 ? arguments[1] : void 0, n11 = arguments.length > 2 ? arguments[2] : void 0; + return this._reduceValues(e21, function(e23) { + if (void 0 === e23.value) + throw new Error('CodeGen: name "'.concat(e23, '" has no value')); + return e23.value.code; + }, t11, n11); + } }, { key: "_reduceValues", value: function(n11, r11) { + var o10 = this, l11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, u11 = arguments.length > 3 ? arguments[3] : void 0, f11 = s10.nil, d11 = function() { + var d12 = n11[h10]; + if (!d12) + return 1; + var v10 = l11[h10] = l11[h10] || /* @__PURE__ */ new Map(); + d12.forEach(function(n12) { + if (!v10.has(n12)) { + v10.set(n12, t10.Started); + var l12 = r11(n12); + if (l12) { + var d13 = o10.opts.es5 ? e20.varKinds.var : e20.varKinds.const; + f11 = (0, s10._)(i || (i = mo(["", "", " ", " = ", ";", ""])), f11, d13, n12, l12, o10.opts._n); + } else { + if (!(l12 = null == u11 ? void 0 : u11(n12))) + throw new c10(n12); + f11 = (0, s10._)(a || (a = mo(["", "", "", ""])), f11, l12, o10.opts._n); + } + v10.set(n12, t10.Completed); + } + }); + }; + for (var h10 in n11) + d11(); + return f11; + } }]), r10; + }(l10); + e20.ValueScope = d10; + }(J8)), J8; + } + function G8() { + return U8 || (U8 = 1, function(e20) { + Object.defineProperty(e20, "__esModule", { value: true }), e20.or = e20.and = e20.not = e20.CodeGen = e20.operators = e20.varKinds = e20.ValueScopeName = e20.ValueScope = e20.Scope = e20.Name = e20.regexpCode = e20.stringify = e20.getProperty = e20.nil = e20.strConcat = e20.str = e20._ = void 0; + var t10 = H8(), n10 = K8(), r10 = H8(); + Object.defineProperty(e20, "_", { enumerable: true, get: function() { + return r10._; + } }), Object.defineProperty(e20, "str", { enumerable: true, get: function() { + return r10.str; + } }), Object.defineProperty(e20, "strConcat", { enumerable: true, get: function() { + return r10.strConcat; + } }), Object.defineProperty(e20, "nil", { enumerable: true, get: function() { + return r10.nil; + } }), Object.defineProperty(e20, "getProperty", { enumerable: true, get: function() { + return r10.getProperty; + } }), Object.defineProperty(e20, "stringify", { enumerable: true, get: function() { + return r10.stringify; + } }), Object.defineProperty(e20, "regexpCode", { enumerable: true, get: function() { + return r10.regexpCode; + } }), Object.defineProperty(e20, "Name", { enumerable: true, get: function() { + return r10.Name; + } }); + var o10 = K8(); + Object.defineProperty(e20, "Scope", { enumerable: true, get: function() { + return o10.Scope; + } }), Object.defineProperty(e20, "ValueScope", { enumerable: true, get: function() { + return o10.ValueScope; + } }), Object.defineProperty(e20, "ValueScopeName", { enumerable: true, get: function() { + return o10.ValueScopeName; + } }), Object.defineProperty(e20, "varKinds", { enumerable: true, get: function() { + return o10.varKinds; + } }), e20.operators = { GT: new t10._Code(">"), GTE: new t10._Code(">="), LT: new t10._Code("<"), LTE: new t10._Code("<="), EQ: new t10._Code("==="), NEQ: new t10._Code("!=="), NOT: new t10._Code("!"), OR: new t10._Code("||"), AND: new t10._Code("&&"), ADD: new t10._Code("+") }; + var i10 = function() { + function e21() { + No(this, e21); + } + return Do(e21, [{ key: "optimizeNodes", value: function() { + return this; + } }, { key: "optimizeNames", value: function(e23, t11) { + return this; + } }]), e21; + }(), a10 = function(e21) { + function r11(e23, t11, n11) { + var o11; + return No(this, r11), (o11 = _o(this, r11)).varKind = e23, o11.name = t11, o11.rhs = n11, o11; + } + return Ao(r11, e21), Do(r11, [{ key: "render", value: function(e23) { + var t11 = e23.es5, r12 = e23._n, o11 = t11 ? n10.varKinds.var : this.varKind, i11 = void 0 === this.rhs ? "" : " = ".concat(this.rhs); + return "".concat(o11, " ").concat(this.name).concat(i11, ";") + r12; + } }, { key: "optimizeNames", value: function(e23, t11) { + if (e23[this.name.str]) + return this.rhs && (this.rhs = I10(this.rhs, e23, t11)), this; + } }, { key: "names", get: function() { + return this.rhs instanceof t10._CodeOrName ? this.rhs.names : {}; + } }]), r11; + }(i10), h10 = function(e21) { + function n11(e23, t11, r11) { + var o11; + return No(this, n11), (o11 = _o(this, n11)).lhs = e23, o11.rhs = t11, o11.sideEffects = r11, o11; + } + return Ao(n11, e21), Do(n11, [{ key: "render", value: function(e23) { + var t11 = e23._n; + return "".concat(this.lhs, " = ").concat(this.rhs, ";") + t11; + } }, { key: "optimizeNames", value: function(e23, n12) { + if (!(this.lhs instanceof t10.Name) || e23[this.lhs.str] || this.sideEffects) + return this.rhs = I10(this.rhs, e23, n12), this; + } }, { key: "names", get: function() { + return N8(this.lhs instanceof t10.Name ? {} : Ro({}, this.lhs.names), this.rhs); + } }]), n11; + }(i10), v10 = function(e21) { + function t11(e23, n11, r11, o11) { + var i11; + return No(this, t11), (i11 = _o(this, t11, [e23, r11, o11])).op = n11, i11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + var t12 = e23._n; + return "".concat(this.lhs, " ").concat(this.op, "= ").concat(this.rhs, ";") + t12; + } }]), t11; + }(h10), p10 = function(e21) { + function t11(e23) { + var n11; + return No(this, t11), (n11 = _o(this, t11)).label = e23, n11.names = {}, n11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + var t12 = e23._n; + return "".concat(this.label, ":") + t12; + } }]), t11; + }(i10), m10 = function(e21) { + function t11(e23) { + var n11; + return No(this, t11), (n11 = _o(this, t11)).label = e23, n11.names = {}, n11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + var t12 = e23._n, n11 = this.label ? " ".concat(this.label) : ""; + return "break".concat(n11, ";") + t12; + } }]), t11; + }(i10), g10 = function(e21) { + function t11(e23) { + var n11; + return No(this, t11), (n11 = _o(this, t11)).error = e23, n11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + var t12 = e23._n; + return "throw ".concat(this.error, ";") + t12; + } }, { key: "names", get: function() { + return this.error.names; + } }]), t11; + }(i10), y10 = function(e21) { + function n11(e23) { + var t11; + return No(this, n11), (t11 = _o(this, n11)).code = e23, t11; + } + return Ao(n11, e21), Do(n11, [{ key: "render", value: function(e23) { + var t11 = e23._n; + return "".concat(this.code, ";") + t11; + } }, { key: "optimizeNodes", value: function() { + return "".concat(this.code) ? this : void 0; + } }, { key: "optimizeNames", value: function(e23, t11) { + return this.code = I10(this.code, e23, t11), this; + } }, { key: "names", get: function() { + return this.code instanceof t10._CodeOrName ? this.code.names : {}; + } }]), n11; + }(i10), b10 = function(e21) { + function t11() { + var e23, n11 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return No(this, t11), (e23 = _o(this, t11)).nodes = n11, e23; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + return this.nodes.reduce(function(t12, n11) { + return t12 + n11.render(e23); + }, ""); + } }, { key: "optimizeNodes", value: function() { + for (var e23 = this.nodes, t12 = e23.length; t12--; ) { + var n11 = e23[t12].optimizeNodes(); + Array.isArray(n11) ? e23.splice.apply(e23, [t12, 1].concat(Bo(n11))) : n11 ? e23[t12] = n11 : e23.splice(t12, 1); + } + return e23.length > 0 ? this : void 0; + } }, { key: "optimizeNames", value: function(e23, t12) { + for (var n11 = this.nodes, r11 = n11.length; r11--; ) { + var o11 = n11[r11]; + o11.optimizeNames(e23, t12) || (D10(e23, o11.names), n11.splice(r11, 1)); + } + return n11.length > 0 ? this : void 0; + } }, { key: "names", get: function() { + return this.nodes.reduce(function(e23, t12) { + return R8(e23, t12.names); + }, {}); + } }]), t11; + }(i10), k10 = function(e21) { + function t11() { + return No(this, t11), _o(this, t11, arguments); + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + return "{" + e23._n + go(Mo(t11.prototype), "render", this).call(this, e23) + "}" + e23._n; + } }]), t11; + }(b10), w10 = function(e21) { + function t11() { + return No(this, t11), _o(this, t11, arguments); + } + return Ao(t11, e21), Do(t11); + }(b10), x10 = function(e21) { + function t11() { + return No(this, t11), _o(this, t11, arguments); + } + return Ao(t11, e21), Do(t11); + }(k10); + x10.kind = "else"; + var j10 = function(e21) { + function t11(e23, n11) { + var r11; + return No(this, t11), (r11 = _o(this, t11, [n11])).condition = e23, r11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + var n11 = "if(".concat(this.condition, ")") + go(Mo(t11.prototype), "render", this).call(this, e23); + return this.else && (n11 += "else " + this.else.render(e23)), n11; + } }, { key: "optimizeNodes", value: function() { + go(Mo(t11.prototype), "optimizeNodes", this).call(this); + var e23 = this.condition; + if (true === e23) + return this.nodes; + var n11 = this.else; + if (n11) { + var r11 = n11.optimizeNodes(); + n11 = this.else = Array.isArray(r11) ? new x10(r11) : r11; + } + return n11 ? false === e23 ? n11 instanceof t11 ? n11 : n11.nodes : this.nodes.length ? this : new t11(q10(e23), n11 instanceof t11 ? [n11] : n11.nodes) : false !== e23 && this.nodes.length ? this : void 0; + } }, { key: "optimizeNames", value: function(e23, n11) { + var r11; + if (this.else = null === (r11 = this.else) || void 0 === r11 ? void 0 : r11.optimizeNames(e23, n11), go(Mo(t11.prototype), "optimizeNames", this).call(this, e23, n11) || this.else) + return this.condition = I10(this.condition, e23, n11), this; + } }, { key: "names", get: function() { + var e23 = go(Mo(t11.prototype), "names", this); + return N8(e23, this.condition), this.else && R8(e23, this.else.names), e23; + } }]), t11; + }(k10); + j10.kind = "if"; + var S10 = function(e21) { + function t11() { + return No(this, t11), _o(this, t11, arguments); + } + return Ao(t11, e21), Do(t11); + }(k10); + S10.kind = "for"; + var C10 = function(e21) { + function t11(e23) { + var n11; + return No(this, t11), (n11 = _o(this, t11)).iteration = e23, n11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + return "for(".concat(this.iteration, ")") + go(Mo(t11.prototype), "render", this).call(this, e23); + } }, { key: "optimizeNames", value: function(e23, n11) { + if (go(Mo(t11.prototype), "optimizeNames", this).call(this, e23, n11)) + return this.iteration = I10(this.iteration, e23, n11), this; + } }, { key: "names", get: function() { + return R8(go(Mo(t11.prototype), "names", this), this.iteration.names); + } }]), t11; + }(S10), $10 = function(e21) { + function t11(e23, n11, r11, o11) { + var i11; + return No(this, t11), (i11 = _o(this, t11)).varKind = e23, i11.name = n11, i11.from = r11, i11.to = o11, i11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + var r11 = e23.es5 ? n10.varKinds.var : this.varKind, o11 = this.name, i11 = this.from, a11 = this.to; + return "for(".concat(r11, " ").concat(o11, "=").concat(i11, "; ").concat(o11, "<").concat(a11, "; ").concat(o11, "++)") + go(Mo(t11.prototype), "render", this).call(this, e23); + } }, { key: "names", get: function() { + var e23 = N8(go(Mo(t11.prototype), "names", this), this.from); + return N8(e23, this.to); + } }]), t11; + }(S10), _10 = function(e21) { + function t11(e23, n11, r11, o11) { + var i11; + return No(this, t11), (i11 = _o(this, t11)).loop = e23, i11.varKind = n11, i11.name = r11, i11.iterable = o11, i11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + return "for(".concat(this.varKind, " ").concat(this.name, " ").concat(this.loop, " ").concat(this.iterable, ")") + go(Mo(t11.prototype), "render", this).call(this, e23); + } }, { key: "optimizeNames", value: function(e23, n11) { + if (go(Mo(t11.prototype), "optimizeNames", this).call(this, e23, n11)) + return this.iterable = I10(this.iterable, e23, n11), this; + } }, { key: "names", get: function() { + return R8(go(Mo(t11.prototype), "names", this), this.iterable.names); + } }]), t11; + }(S10), O10 = function(e21) { + function t11(e23, n11, r11) { + var o11; + return No(this, t11), (o11 = _o(this, t11)).name = e23, o11.args = n11, o11.async = r11, o11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + var n11 = this.async ? "async " : ""; + return "".concat(n11, "function ").concat(this.name, "(").concat(this.args, ")") + go(Mo(t11.prototype), "render", this).call(this, e23); + } }]), t11; + }(k10); + O10.kind = "func"; + var M10 = function(e21) { + function t11() { + return No(this, t11), _o(this, t11, arguments); + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + return "return " + go(Mo(t11.prototype), "render", this).call(this, e23); + } }]), t11; + }(b10); + M10.kind = "return"; + var E10 = function(e21) { + function t11() { + return No(this, t11), _o(this, t11, arguments); + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + var n11 = "try" + go(Mo(t11.prototype), "render", this).call(this, e23); + return this.catch && (n11 += this.catch.render(e23)), this.finally && (n11 += this.finally.render(e23)), n11; + } }, { key: "optimizeNodes", value: function() { + var e23, n11; + return go(Mo(t11.prototype), "optimizeNodes", this).call(this), null === (e23 = this.catch) || void 0 === e23 || e23.optimizeNodes(), null === (n11 = this.finally) || void 0 === n11 || n11.optimizeNodes(), this; + } }, { key: "optimizeNames", value: function(e23, n11) { + var r11, o11; + return go(Mo(t11.prototype), "optimizeNames", this).call(this, e23, n11), null === (r11 = this.catch) || void 0 === r11 || r11.optimizeNames(e23, n11), null === (o11 = this.finally) || void 0 === o11 || o11.optimizeNames(e23, n11), this; + } }, { key: "names", get: function() { + var e23 = go(Mo(t11.prototype), "names", this); + return this.catch && R8(e23, this.catch.names), this.finally && R8(e23, this.finally.names), e23; + } }]), t11; + }(k10), A10 = function(e21) { + function t11(e23) { + var n11; + return No(this, t11), (n11 = _o(this, t11)).error = e23, n11; + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + return "catch(".concat(this.error, ")") + go(Mo(t11.prototype), "render", this).call(this, e23); + } }]), t11; + }(k10); + A10.kind = "catch"; + var P10 = function(e21) { + function t11() { + return No(this, t11), _o(this, t11, arguments); + } + return Ao(t11, e21), Do(t11, [{ key: "render", value: function(e23) { + return "finally" + go(Mo(t11.prototype), "render", this).call(this, e23); + } }]), t11; + }(k10); + P10.kind = "finally"; + var T8 = function() { + function r11(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + No(this, r11), this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = Ro(Ro({}, t11), {}, { _n: t11.lines ? "\n" : "" }), this._extScope = e21, this._scope = new n10.Scope({ parent: e21 }), this._nodes = [new w10()]; + } + return Do(r11, [{ key: "toString", value: function() { + return this._root.render(this.opts); + } }, { key: "name", value: function(e21) { + return this._scope.name(e21); + } }, { key: "scopeName", value: function(e21) { + return this._extScope.name(e21); + } }, { key: "scopeValue", value: function(e21, t11) { + var n11 = this._extScope.value(e21, t11); + return (this._values[n11.prefix] || (this._values[n11.prefix] = /* @__PURE__ */ new Set())).add(n11), n11; + } }, { key: "getScopeValue", value: function(e21, t11) { + return this._extScope.getValue(e21, t11); + } }, { key: "scopeRefs", value: function(e21) { + return this._extScope.scopeRefs(e21, this._values); + } }, { key: "scopeCode", value: function() { + return this._extScope.scopeCode(this._values); + } }, { key: "_def", value: function(e21, t11, n11, r12) { + var o11 = this._scope.toName(t11); + return void 0 !== n11 && r12 && (this._constants[o11.str] = n11), this._leafNode(new a10(e21, o11, n11)), o11; + } }, { key: "const", value: function(e21, t11, r12) { + return this._def(n10.varKinds.const, e21, t11, r12); + } }, { key: "let", value: function(e21, t11, r12) { + return this._def(n10.varKinds.let, e21, t11, r12); + } }, { key: "var", value: function(e21, t11, r12) { + return this._def(n10.varKinds.var, e21, t11, r12); + } }, { key: "assign", value: function(e21, t11, n11) { + return this._leafNode(new h10(e21, t11, n11)); + } }, { key: "add", value: function(t11, n11) { + return this._leafNode(new v10(t11, e20.operators.ADD, n11)); + } }, { key: "code", value: function(e21) { + return "function" == typeof e21 ? e21() : e21 !== t10.nil && this._leafNode(new y10(e21)), this; + } }, { key: "object", value: function() { + for (var e21 = ["{"], n11 = arguments.length, r12 = new Array(n11), o11 = 0; o11 < n11; o11++) + r12[o11] = arguments[o11]; + for (var i11 = 0, a11 = r12; i11 < a11.length; i11++) { + var s10 = jo(a11[i11], 2), c10 = s10[0], l10 = s10[1]; + e21.length > 1 && e21.push(","), e21.push(c10), (c10 !== l10 || this.opts.es5) && (e21.push(":"), (0, t10.addCodeArg)(e21, l10)); + } + return e21.push("}"), new t10._Code(e21); + } }, { key: "if", value: function(e21, t11, n11) { + if (this._blockNode(new j10(e21)), t11 && n11) + this.code(t11).else().code(n11).endIf(); + else if (t11) + this.code(t11).endIf(); + else if (n11) + throw new Error('CodeGen: "else" body without "then" body'); + return this; + } }, { key: "elseIf", value: function(e21) { + return this._elseNode(new j10(e21)); + } }, { key: "else", value: function() { + return this._elseNode(new x10()); + } }, { key: "endIf", value: function() { + return this._endBlockNode(j10, x10); + } }, { key: "_for", value: function(e21, t11) { + return this._blockNode(e21), t11 && this.code(t11).endFor(), this; + } }, { key: "for", value: function(e21, t11) { + return this._for(new C10(e21), t11); + } }, { key: "forRange", value: function(e21, t11, r12, o11) { + var i11 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : this.opts.es5 ? n10.varKinds.var : n10.varKinds.let, a11 = this._scope.toName(e21); + return this._for(new $10(i11, a11, t11, r12), function() { + return o11(a11); + }); + } }, { key: "forOf", value: function(e21, r12, o11) { + var i11 = this, a11 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : n10.varKinds.const, l10 = this._scope.toName(e21); + if (this.opts.es5) { + var u10 = r12 instanceof t10.Name ? r12 : this.var("_arr", r12); + return this.forRange("_i", 0, (0, t10._)(s || (s = mo(["", ".length"])), u10), function(e23) { + i11.var(l10, (0, t10._)(c || (c = mo(["", "[", "]"])), u10, e23)), o11(l10); + }); + } + return this._for(new _10("of", a11, l10, r12), function() { + return o11(l10); + }); + } }, { key: "forIn", value: function(e21, r12, o11) { + var i11 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : this.opts.es5 ? n10.varKinds.var : n10.varKinds.const; + if (this.opts.ownProperties) + return this.forOf(e21, (0, t10._)(l || (l = mo(["Object.keys(", ")"])), r12), o11); + var a11 = this._scope.toName(e21); + return this._for(new _10("in", i11, a11, r12), function() { + return o11(a11); + }); + } }, { key: "endFor", value: function() { + return this._endBlockNode(S10); + } }, { key: "label", value: function(e21) { + return this._leafNode(new p10(e21)); + } }, { key: "break", value: function(e21) { + return this._leafNode(new m10(e21)); + } }, { key: "return", value: function(e21) { + var t11 = new M10(); + if (this._blockNode(t11), this.code(e21), 1 !== t11.nodes.length) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(M10); + } }, { key: "try", value: function(e21, t11, n11) { + if (!t11 && !n11) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + var r12 = new E10(); + if (this._blockNode(r12), this.code(e21), t11) { + var o11 = this.name("e"); + this._currNode = r12.catch = new A10(o11), t11(o11); + } + return n11 && (this._currNode = r12.finally = new P10(), this.code(n11)), this._endBlockNode(A10, P10); + } }, { key: "throw", value: function(e21) { + return this._leafNode(new g10(e21)); + } }, { key: "block", value: function(e21, t11) { + return this._blockStarts.push(this._nodes.length), e21 && this.code(e21).endBlock(t11), this; + } }, { key: "endBlock", value: function(e21) { + var t11 = this._blockStarts.pop(); + if (void 0 === t11) + throw new Error("CodeGen: not in self-balancing block"); + var n11 = this._nodes.length - t11; + if (n11 < 0 || void 0 !== e21 && n11 !== e21) + throw new Error("CodeGen: wrong number of nodes: ".concat(n11, " vs ").concat(e21, " expected")); + return this._nodes.length = t11, this; + } }, { key: "func", value: function(e21) { + var n11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : t10.nil, r12 = arguments.length > 2 ? arguments[2] : void 0, o11 = arguments.length > 3 ? arguments[3] : void 0; + return this._blockNode(new O10(e21, n11, r12)), o11 && this.code(o11).endFunc(), this; + } }, { key: "endFunc", value: function() { + return this._endBlockNode(O10); + } }, { key: "optimize", value: function() { + for (var e21 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1; e21-- > 0; ) + this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants); + } }, { key: "_leafNode", value: function(e21) { + return this._currNode.nodes.push(e21), this; + } }, { key: "_blockNode", value: function(e21) { + this._currNode.nodes.push(e21), this._nodes.push(e21); + } }, { key: "_endBlockNode", value: function(e21, t11) { + var n11 = this._currNode; + if (n11 instanceof e21 || t11 && n11 instanceof t11) + return this._nodes.pop(), this; + throw new Error('CodeGen: not in block "'.concat(t11 ? "".concat(e21.kind, "/").concat(t11.kind) : e21.kind, '"')); + } }, { key: "_elseNode", value: function(e21) { + var t11 = this._currNode; + if (!(t11 instanceof j10)) + throw new Error('CodeGen: "else" without "if"'); + return this._currNode = t11.else = e21, this; + } }, { key: "_root", get: function() { + return this._nodes[0]; + } }, { key: "_currNode", get: function() { + var e21 = this._nodes; + return e21[e21.length - 1]; + }, set: function(e21) { + var t11 = this._nodes; + t11[t11.length - 1] = e21; + } }]), r11; + }(); + function R8(e21, t11) { + for (var n11 in t11) + e21[n11] = (e21[n11] || 0) + (t11[n11] || 0); + return e21; + } + function N8(e21, n11) { + return n11 instanceof t10._CodeOrName ? R8(e21, n11.names) : e21; + } + function I10(e21, n11, r11) { + return e21 instanceof t10.Name ? i11(e21) : (o11 = e21) instanceof t10._Code && o11._items.some(function(e23) { + return e23 instanceof t10.Name && 1 === n11[e23.str] && void 0 !== r11[e23.str]; + }) ? new t10._Code(e21._items.reduce(function(e23, n12) { + return n12 instanceof t10.Name && (n12 = i11(n12)), n12 instanceof t10._Code ? e23.push.apply(e23, Bo(n12._items)) : e23.push(n12), e23; + }, [])) : e21; + var o11; + function i11(e23) { + var t11 = r11[e23.str]; + return void 0 === t11 || 1 !== n11[e23.str] ? e23 : (delete n11[e23.str], t11); + } + } + function D10(e21, t11) { + for (var n11 in t11) + e21[n11] = (e21[n11] || 0) - (t11[n11] || 0); + } + function q10(e21) { + return "boolean" == typeof e21 || "number" == typeof e21 || null === e21 ? !e21 : (0, t10._)(u || (u = mo(["!", ""])), F10(e21)); + } + e20.CodeGen = T8, e20.not = q10; + var z10 = L10(e20.operators.AND); + e20.and = function() { + for (var e21 = arguments.length, t11 = new Array(e21), n11 = 0; n11 < e21; n11++) + t11[n11] = arguments[n11]; + return t11.reduce(z10); + }; + var B10 = L10(e20.operators.OR); + function L10(e21) { + return function(n11, r11) { + return n11 === t10.nil ? r11 : r11 === t10.nil ? n11 : (0, t10._)(f || (f = mo(["", " ", " ", ""])), F10(n11), e21, F10(r11)); + }; + } + function F10(e21) { + return e21 instanceof t10.Name ? e21 : (0, t10._)(d || (d = mo(["(", ")"])), e21); + } + e20.or = function() { + for (var e21 = arguments.length, t11 = new Array(e21), n11 = 0; n11 < e21; n11++) + t11[n11] = arguments[n11]; + return t11.reduce(B10); + }; + }(F8)), F8; + } + var Q8 = {}; + !function(e20) { + Object.defineProperty(e20, "__esModule", { value: true }), e20.checkStrictMode = e20.getErrorPath = e20.Type = e20.useFunc = e20.setEvaluated = e20.evaluatedPropsToName = e20.mergeEvaluated = e20.eachItem = e20.unescapeJsonPointer = e20.escapeJsonPointer = e20.escapeFragment = e20.unescapeFragment = e20.schemaRefOrVal = e20.schemaHasRulesButRef = e20.schemaHasRules = e20.checkUnknownRules = e20.alwaysValidSchema = e20.toHash = void 0; + var t10 = G8(), n10 = H8(); + function r10(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21.schema, n11 = e21.opts, r11 = e21.self; + if (n11.strictSchema && "boolean" != typeof t11) { + var o11 = r11.RULES.keywords; + for (var i11 in t11) + o11[i11] || d10(e21, 'unknown keyword: "'.concat(i11, '"')); + } + } + function o10(e21, t11) { + if ("boolean" == typeof e21) + return !e21; + for (var n11 in e21) + if (t11[n11]) + return true; + return false; + } + function i10(e21) { + return "number" == typeof e21 ? "".concat(e21) : e21.replace(/~/g, "~0").replace(/\//g, "~1"); + } + function a10(e21) { + return e21.replace(/~1/g, "/").replace(/~0/g, "~"); + } + function s10(e21) { + var n11 = e21.mergeNames, r11 = e21.mergeToName, o11 = e21.mergeValues, i11 = e21.resultToName; + return function(e23, a11, s11, c11) { + var l11 = void 0 === s11 ? a11 : s11 instanceof t10.Name ? (a11 instanceof t10.Name ? n11(e23, a11, s11) : r11(e23, a11, s11), s11) : a11 instanceof t10.Name ? (r11(e23, s11, a11), a11) : o11(a11, s11); + return c11 !== t10.Name || l11 instanceof t10.Name ? l11 : i11(e23, l11); + }; + } + function c10(e21, n11) { + if (true === n11) + return e21.var("props", true); + var r11 = e21.var("props", (0, t10._)(C || (C = mo(["{}"])))); + return void 0 !== n11 && l10(e21, r11, n11), r11; + } + function l10(e21, n11, r11) { + Object.keys(r11).forEach(function(r12) { + return e21.assign((0, t10._)($ || ($ = mo(["", "", ""])), n11, (0, t10.getProperty)(r12)), true); + }); + } + e20.toHash = function(e21) { + var t11, n11 = {}, r11 = bo(e21); + try { + for (r11.s(); !(t11 = r11.n()).done; ) { + n11[t11.value] = true; + } + } catch (e23) { + r11.e(e23); + } finally { + r11.f(); + } + return n11; + }, e20.alwaysValidSchema = function(e21, t11) { + return "boolean" == typeof t11 ? t11 : 0 === Object.keys(t11).length || (r10(e21, t11), !o10(t11, e21.self.RULES.all)); + }, e20.checkUnknownRules = r10, e20.schemaHasRules = o10, e20.schemaHasRulesButRef = function(e21, t11) { + if ("boolean" == typeof e21) + return !e21; + for (var n11 in e21) + if ("$ref" !== n11 && t11.all[n11]) + return true; + return false; + }, e20.schemaRefOrVal = function(e21, n11, r11, o11) { + var i11 = e21.topSchemaRef, a11 = e21.schemaPath; + if (!o11) { + if ("number" == typeof n11 || "boolean" == typeof n11) + return n11; + if ("string" == typeof n11) + return (0, t10._)(h || (h = mo(["", ""])), n11); + } + return (0, t10._)(v || (v = mo(["", "", "", ""])), i11, a11, (0, t10.getProperty)(r11)); + }, e20.unescapeFragment = function(e21) { + return a10(decodeURIComponent(e21)); + }, e20.escapeFragment = function(e21) { + return encodeURIComponent(i10(e21)); + }, e20.escapeJsonPointer = i10, e20.unescapeJsonPointer = a10, e20.eachItem = function(e21, t11) { + if (Array.isArray(e21)) { + var n11, r11 = bo(e21); + try { + for (r11.s(); !(n11 = r11.n()).done; ) { + t11(n11.value); + } + } catch (e23) { + r11.e(e23); + } finally { + r11.f(); + } + } else + t11(e21); + }, e20.mergeEvaluated = { props: s10({ mergeNames: function(e21, n11, r11) { + return e21.if((0, t10._)(p || (p = mo(["", " !== true && ", " !== undefined"])), r11, n11), function() { + e21.if((0, t10._)(m || (m = mo(["", " === true"])), n11), function() { + return e21.assign(r11, true); + }, function() { + return e21.assign(r11, (0, t10._)(g || (g = mo(["", " || {}"])), r11)).code((0, t10._)(y || (y = mo(["Object.assign(", ", ", ")"])), r11, n11)); + }); + }); + }, mergeToName: function(e21, n11, r11) { + return e21.if((0, t10._)(b || (b = mo(["", " !== true"])), r11), function() { + true === n11 ? e21.assign(r11, true) : (e21.assign(r11, (0, t10._)(k || (k = mo(["", " || {}"])), r11)), l10(e21, r11, n11)); + }); + }, mergeValues: function(e21, t11) { + return true === e21 || Ro(Ro({}, e21), t11); + }, resultToName: c10 }), items: s10({ mergeNames: function(e21, n11, r11) { + return e21.if((0, t10._)(w || (w = mo(["", " !== true && ", " !== undefined"])), r11, n11), function() { + return e21.assign(r11, (0, t10._)(x || (x = mo(["", " === true ? true : ", " > ", " ? ", " : ", ""])), n11, r11, n11, r11, n11)); + }); + }, mergeToName: function(e21, n11, r11) { + return e21.if((0, t10._)(j || (j = mo(["", " !== true"])), r11), function() { + return e21.assign(r11, true === n11 || (0, t10._)(S || (S = mo(["", " > ", " ? ", " : ", ""])), r11, n11, r11, n11)); + }); + }, mergeValues: function(e21, t11) { + return true === e21 || Math.max(e21, t11); + }, resultToName: function(e21, t11) { + return e21.var("items", t11); + } }) }, e20.evaluatedPropsToName = c10, e20.setEvaluated = l10; + var u10, f10 = {}; + function d10(e21, t11) { + var n11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : e21.opts.strictSchema; + if (n11) { + if (t11 = "strict mode: ".concat(t11), true === n11) + throw new Error(t11); + e21.self.logger.warn(t11); + } + } + e20.useFunc = function(e21, t11) { + return e21.scopeValue("func", { ref: t11, code: f10[t11.code] || (f10[t11.code] = new n10._Code(t11.code)) }); + }, function(e21) { + e21[e21.Num = 0] = "Num", e21[e21.Str = 1] = "Str"; + }(u10 = e20.Type || (e20.Type = {})), e20.getErrorPath = function(e21, n11, r11) { + if (e21 instanceof t10.Name) { + var o11 = n11 === u10.Num; + return r11 ? o11 ? (0, t10._)(_ || (_ = mo(['"[" + ', ' + "]"'])), e21) : (0, t10._)(O || (O = mo([`"['" + `, ` + "']"`])), e21) : o11 ? (0, t10._)(M || (M = mo(['"/" + ', ""])), e21) : (0, t10._)(E || (E = mo(['"/" + ', '.replace(/~/g, "~0").replace(/\\//g, "~1")'], ['"/" + ', '.replace(/~/g, "~0").replace(/\\\\//g, "~1")'])), e21); + } + return r11 ? (0, t10.getProperty)(e21).toString() : "/" + i10(e21); + }, e20.checkStrictMode = d10; + }(Q8); + var Y8; + var X8; + var Z8; + var e52 = {}; + function t5() { + if (Y8) + return e52; + Y8 = 1, Object.defineProperty(e52, "__esModule", { value: true }); + var e20 = G8(), t10 = { data: new e20.Name("data"), valCxt: new e20.Name("valCxt"), instancePath: new e20.Name("instancePath"), parentData: new e20.Name("parentData"), parentDataProperty: new e20.Name("parentDataProperty"), rootData: new e20.Name("rootData"), dynamicAnchors: new e20.Name("dynamicAnchors"), vErrors: new e20.Name("vErrors"), errors: new e20.Name("errors"), this: new e20.Name("this"), self: new e20.Name("self"), scope: new e20.Name("scope"), json: new e20.Name("json"), jsonPos: new e20.Name("jsonPos"), jsonLen: new e20.Name("jsonLen"), jsonPart: new e20.Name("jsonPart") }; + return e52.default = t10, e52; + } + function n5() { + return X8 || (X8 = 1, function(e20) { + Object.defineProperty(e20, "__esModule", { value: true }), e20.extendErrors = e20.resetErrorsCount = e20.reportExtraError = e20.reportError = e20.keyword$DataError = e20.keywordError = void 0; + var t10 = G8(), n10 = Q8, r10 = t5(); + function o10(e21, n11) { + var o11 = e21.const("err", n11); + e21.if((0, t10._)(H || (H = mo(["", " === null"])), r10.default.vErrors), function() { + return e21.assign(r10.default.vErrors, (0, t10._)(W || (W = mo(["[", "]"])), o11)); + }, (0, t10._)(U || (U = mo(["", ".push(", ")"])), r10.default.vErrors, o11)), e21.code((0, t10._)(J || (J = mo(["", "++"])), r10.default.errors)); + } + function i10(e21, n11) { + var r11 = e21.gen, o11 = e21.validateName; + e21.schemaEnv.$async ? r11.throw((0, t10._)(K || (K = mo(["new ", "(", ")"])), e21.ValidationError, n11)) : (r11.assign((0, t10._)(G || (G = mo(["", ".errors"])), o11), n11), r11.return(false)); + } + e20.keywordError = { message: function(e21) { + var n11 = e21.keyword; + return (0, t10.str)(A || (A = mo(['must pass "', '" keyword validation'])), n11); + } }, e20.keyword$DataError = { message: function(e21) { + var n11 = e21.keyword, r11 = e21.schemaType; + return r11 ? (0, t10.str)(P || (P = mo(['"', '" keyword must be ', " ($data)"])), n11, r11) : (0, t10.str)(T || (T = mo(['"', '" keyword is invalid ($data)'])), n11); + } }, e20.reportError = function(n11) { + var r11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e20.keywordError, a11 = arguments.length > 2 ? arguments[2] : void 0, c11 = arguments.length > 3 ? arguments[3] : void 0, l11 = n11.it, u10 = l11.gen, f10 = l11.compositeRule, d10 = l11.allErrors, h10 = s10(n11, r11, a11); + (null != c11 ? c11 : f10 || d10) ? o10(u10, h10) : i10(l11, (0, t10._)(R || (R = mo(["[", "]"])), h10)); + }, e20.reportExtraError = function(t11) { + var n11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e20.keywordError, a11 = arguments.length > 2 ? arguments[2] : void 0, c11 = t11.it, l11 = c11.gen, u10 = c11.compositeRule, f10 = c11.allErrors; + o10(l11, s10(t11, n11, a11)), u10 || f10 || i10(c11, r10.default.vErrors); + }, e20.resetErrorsCount = function(e21, n11) { + e21.assign(r10.default.errors, n11), e21.if((0, t10._)(N || (N = mo(["", " !== null"])), r10.default.vErrors), function() { + return e21.if(n11, function() { + return e21.assign((0, t10._)(I || (I = mo(["", ".length"])), r10.default.vErrors), n11); + }, function() { + return e21.assign(r10.default.vErrors, null); + }); + }); + }, e20.extendErrors = function(e21) { + var n11 = e21.gen, o11 = e21.keyword, i11 = e21.schemaValue, a11 = e21.data, s11 = e21.errsCount, c11 = e21.it; + if (void 0 === s11) + throw new Error("ajv implementation error"); + var l11 = n11.name("err"); + n11.forRange("i", s11, r10.default.errors, function(e23) { + n11.const(l11, (0, t10._)(D || (D = mo(["", "[", "]"])), r10.default.vErrors, e23)), n11.if((0, t10._)(q || (q = mo(["", ".instancePath === undefined"])), l11), function() { + return n11.assign((0, t10._)(z || (z = mo(["", ".instancePath"])), l11), (0, t10.strConcat)(r10.default.instancePath, c11.errorPath)); + }), n11.assign((0, t10._)(B || (B = mo(["", ".schemaPath"])), l11), (0, t10.str)(L || (L = mo(["", "/", ""])), c11.errSchemaPath, o11)), c11.opts.verbose && (n11.assign((0, t10._)(F || (F = mo(["", ".schema"])), l11), i11), n11.assign((0, t10._)(V || (V = mo(["", ".data"])), l11), a11)); + }); + }; + var a10 = { keyword: new t10.Name("keyword"), schemaPath: new t10.Name("schemaPath"), params: new t10.Name("params"), propertyName: new t10.Name("propertyName"), message: new t10.Name("message"), schema: new t10.Name("schema"), parentSchema: new t10.Name("parentSchema") }; + function s10(e21, n11, o11) { + return false === e21.it.createErrors ? (0, t10._)(Q || (Q = mo(["{}"]))) : function(e23, n12) { + var o12 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, i11 = e23.gen, s11 = e23.it, u10 = [c10(s11, o12), l10(e23, o12)]; + return function(e24, n13, o13) { + var i12 = n13.params, s12 = n13.message, c11 = e24.keyword, l11 = e24.data, u11 = e24.schemaValue, f10 = e24.it, d10 = f10.opts, h10 = f10.propertyName, v10 = f10.topSchemaRef, p10 = f10.schemaPath; + o13.push([a10.keyword, c11], [a10.params, "function" == typeof i12 ? i12(e24) : i12 || (0, t10._)(ee || (ee = mo(["{}"])))]), d10.messages && o13.push([a10.message, "function" == typeof s12 ? s12(e24) : s12]); + d10.verbose && o13.push([a10.schema, u11], [a10.parentSchema, (0, t10._)(te || (te = mo(["", "", ""])), v10, p10)], [r10.default.data, l11]); + h10 && o13.push([a10.propertyName, h10]); + }(e23, n12, u10), i11.object.apply(i11, u10); + }(e21, n11, o11); + } + function c10(e21, o11) { + var i11 = e21.errorPath, a11 = o11.instancePath, s11 = a11 ? (0, t10.str)(Y || (Y = mo(["", "", ""])), i11, (0, n10.getErrorPath)(a11, n10.Type.Str)) : i11; + return [r10.default.instancePath, (0, t10.strConcat)(r10.default.instancePath, s11)]; + } + function l10(e21, r11) { + var o11 = e21.keyword, i11 = e21.it.errSchemaPath, s11 = r11.schemaPath, c11 = r11.parentSchema ? i11 : (0, t10.str)(X || (X = mo(["", "/", ""])), i11, o11); + return s11 && (c11 = (0, t10.str)(Z || (Z = mo(["", "", ""])), c11, (0, n10.getErrorPath)(s11, n10.Type.Str))), [a10.schemaPath, c11]; + } + }(L8)), L8; + } + var r5 = {}; + var o5 = {}; + Object.defineProperty(o5, "__esModule", { value: true }), o5.getRules = o5.isJSONType = void 0; + var i5 = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null", "object", "array"]); + o5.isJSONType = function(e20) { + return "string" == typeof e20 && i5.has(e20); + }, o5.getRules = function() { + var e20 = { number: { type: "number", rules: [] }, string: { type: "string", rules: [] }, array: { type: "array", rules: [] }, object: { type: "object", rules: [] } }; + return { types: Ro(Ro({}, e20), {}, { integer: true, boolean: true, null: true }), rules: [{ rules: [] }, e20.number, e20.string, e20.array, e20.object], post: { rules: [] }, all: {}, keywords: {} }; + }; + var a5; + var s5 = {}; + function c5() { + if (a5) + return s5; + function e20(e21, n10) { + return n10.rules.some(function(n11) { + return t10(e21, n11); + }); + } + function t10(e21, t11) { + var n10; + return void 0 !== e21[t11.keyword] || (null === (n10 = t11.definition.implements) || void 0 === n10 ? void 0 : n10.some(function(t12) { + return void 0 !== e21[t12]; + })); + } + return a5 = 1, Object.defineProperty(s5, "__esModule", { value: true }), s5.shouldUseRule = s5.shouldUseGroup = s5.schemaHasRulesForType = void 0, s5.schemaHasRulesForType = function(t11, n10) { + var r10 = t11.schema, o10 = t11.self.RULES.types[n10]; + return o10 && true !== o10 && e20(r10, o10); + }, s5.shouldUseGroup = e20, s5.shouldUseRule = t10, s5; + } + !function(e20) { + Object.defineProperty(e20, "__esModule", { value: true }), e20.reportTypeError = e20.checkDataTypes = e20.checkDataType = e20.coerceAndCheckDataType = e20.getJSONTypes = e20.getSchemaTypes = e20.DataType = void 0; + var t10, n10 = o5, r10 = c5(), o10 = n5(), i10 = G8(), a10 = Q8; + function s10(e21) { + var t11 = Array.isArray(e21) ? e21 : e21 ? [e21] : []; + if (t11.every(n10.isJSONType)) + return t11; + throw new Error("type must be JSONType or JSONType[]: " + t11.join(",")); + } + !function(e21) { + e21[e21.Correct = 0] = "Correct", e21[e21.Wrong = 1] = "Wrong"; + }(t10 = e20.DataType || (e20.DataType = {})), e20.getSchemaTypes = function(e21) { + var t11 = s10(e21.type); + if (t11.includes("null")) { + if (false === e21.nullable) + throw new Error("type: null contradicts nullable: false"); + } else { + if (!t11.length && void 0 !== e21.nullable) + throw new Error('"nullable" cannot be used without "type"'); + true === e21.nullable && t11.push("null"); + } + return t11; + }, e20.getJSONTypes = s10, e20.coerceAndCheckDataType = function(e21, n11) { + var o11 = e21.gen, a11 = e21.data, s11 = e21.opts, l11 = function(e23, t11) { + return t11 ? e23.filter(function(e24) { + return c10.has(e24) || "array" === t11 && "array" === e24; + }) : []; + }(n11, s11.coerceTypes), f11 = n11.length > 0 && !(0 === l11.length && 1 === n11.length && (0, r10.schemaHasRulesForType)(e21, n11[0])); + if (f11) { + var h10 = u10(n11, a11, s11.strictNumbers, t10.Wrong); + o11.if(h10, function() { + l11.length ? function(e23, t11, n12) { + var r11 = e23.gen, o12 = e23.data, a12 = e23.opts, s12 = r11.let("dataType", (0, i10._)(re || (re = mo(["typeof ", ""])), o12)), l12 = r11.let("coerced", (0, i10._)(oe || (oe = mo(["undefined"])))); + "array" === a12.coerceTypes && r11.if((0, i10._)(ie || (ie = mo(["", " == 'object' && Array.isArray(", ") && ", ".length == 1"])), s12, o12, o12), function() { + return r11.assign(o12, (0, i10._)(ae || (ae = mo(["", "[0]"])), o12)).assign(s12, (0, i10._)(se || (se = mo(["typeof ", ""])), o12)).if(u10(t11, o12, a12.strictNumbers), function() { + return r11.assign(l12, o12); + }); + }); + r11.if((0, i10._)(ce || (ce = mo(["", " !== undefined"])), l12)); + var f12, h11 = bo(n12); + try { + for (h11.s(); !(f12 = h11.n()).done; ) { + var v10 = f12.value; + (c10.has(v10) || "array" === v10 && "array" === a12.coerceTypes) && p10(v10); + } + } catch (e24) { + h11.e(e24); + } finally { + h11.f(); + } + function p10(e24) { + switch (e24) { + case "string": + return void r11.elseIf((0, i10._)(ue || (ue = mo(["", ' == "number" || ', ' == "boolean"'])), s12, s12)).assign(l12, (0, i10._)(fe || (fe = mo(['"" + ', ""])), o12)).elseIf((0, i10._)(de || (de = mo(["", " === null"])), o12)).assign(l12, (0, i10._)(he || (he = mo(['""'])))); + case "number": + return void r11.elseIf((0, i10._)(ve || (ve = mo(["", ' == "boolean" || ', " === null\n || (", ' == "string" && ', " && ", " == +", ")"])), s12, o12, s12, o12, o12, o12)).assign(l12, (0, i10._)(pe || (pe = mo(["+", ""])), o12)); + case "integer": + return void r11.elseIf((0, i10._)(me || (me = mo(["", ' === "boolean" || ', " === null\n || (", ' === "string" && ', " && ", " == +", " && !(", " % 1))"])), s12, o12, s12, o12, o12, o12, o12)).assign(l12, (0, i10._)(ge || (ge = mo(["+", ""])), o12)); + case "boolean": + return void r11.elseIf((0, i10._)(ye || (ye = mo(["", ' === "false" || ', " === 0 || ", " === null"])), o12, o12, o12)).assign(l12, false).elseIf((0, i10._)(be || (be = mo(["", ' === "true" || ', " === 1"])), o12, o12)).assign(l12, true); + case "null": + return r11.elseIf((0, i10._)(ke || (ke = mo(["", ' === "" || ', " === 0 || ", " === false"])), o12, o12, o12)), void r11.assign(l12, null); + case "array": + r11.elseIf((0, i10._)(we || (we = mo(["", ' === "string" || ', ' === "number"\n || ', ' === "boolean" || ', " === null"])), s12, s12, s12, o12)).assign(l12, (0, i10._)(xe || (xe = mo(["[", "]"])), o12)); + } + } + r11.else(), d10(e23), r11.endIf(), r11.if((0, i10._)(le || (le = mo(["", " !== undefined"])), l12), function() { + r11.assign(o12, l12), function(e24, t12) { + var n13 = e24.gen, r12 = e24.parentData, o13 = e24.parentDataProperty; + n13.if((0, i10._)(je || (je = mo(["", " !== undefined"])), r12), function() { + return n13.assign((0, i10._)(Se || (Se = mo(["", "[", "]"])), r12, o13), t12); + }); + }(e23, l12); + }); + }(e21, n11, l11) : d10(e21); + }); + } + return f11; + }; + var c10 = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]); + function l10(e21, n11, r11) { + var o11, a11 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : t10.Correct, s11 = a11 === t10.Correct ? i10.operators.EQ : i10.operators.NEQ; + switch (e21) { + case "null": + return (0, i10._)(Ce || (Ce = mo(["", " ", " null"])), n11, s11); + case "array": + o11 = (0, i10._)($e || ($e = mo(["Array.isArray(", ")"])), n11); + break; + case "object": + o11 = (0, i10._)(_e || (_e = mo(["", " && typeof ", ' == "object" && !Array.isArray(', ")"])), n11, n11, n11); + break; + case "integer": + o11 = c11((0, i10._)(Oe || (Oe = mo(["!(", " % 1) && !isNaN(", ")"])), n11, n11)); + break; + case "number": + o11 = c11(); + break; + default: + return (0, i10._)(Me || (Me = mo(["typeof ", " ", " ", ""])), n11, s11, e21); + } + return a11 === t10.Correct ? o11 : (0, i10.not)(o11); + function c11() { + var e23 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : i10.nil; + return (0, i10.and)((0, i10._)(Ee || (Ee = mo(["typeof ", ' == "number"'])), n11), e23, r11 ? (0, i10._)(Ae || (Ae = mo(["isFinite(", ")"])), n11) : i10.nil); + } + } + function u10(e21, t11, n11, r11) { + if (1 === e21.length) + return l10(e21[0], t11, n11, r11); + var o11, s11 = (0, a10.toHash)(e21); + if (s11.array && s11.object) { + var c11 = (0, i10._)(Pe || (Pe = mo(["typeof ", ' != "object"'])), t11); + o11 = s11.null ? c11 : (0, i10._)(Te || (Te = mo(["!", " || ", ""])), t11, c11), delete s11.null, delete s11.array, delete s11.object; + } else + o11 = i10.nil; + for (var u11 in s11.number && delete s11.integer, s11) + o11 = (0, i10.and)(o11, l10(u11, t11, n11, r11)); + return o11; + } + e20.checkDataType = l10, e20.checkDataTypes = u10; + var f10 = { message: function(e21) { + var t11 = e21.schema; + return "must be ".concat(t11); + }, params: function(e21) { + var t11 = e21.schema, n11 = e21.schemaValue; + return "string" == typeof t11 ? (0, i10._)(Re || (Re = mo(["{type: ", "}"])), t11) : (0, i10._)(Ne || (Ne = mo(["{type: ", "}"])), n11); + } }; + function d10(e21) { + var t11 = function(e23) { + var t12 = e23.gen, n11 = e23.data, r11 = e23.schema, o11 = (0, a10.schemaRefOrVal)(e23, r11, "type"); + return { gen: t12, keyword: "type", data: n11, schema: r11.type, schemaCode: o11, schemaValue: o11, parentSchema: r11, params: {}, it: e23 }; + }(e21); + (0, o10.reportError)(t11, f10); + } + e20.reportTypeError = d10; + }(r5); + var l5; + var u5 = {}; + var f5; + var d5; + var h5 = {}; + var v5 = {}; + function p5() { + if (f5) + return v5; + f5 = 1, Object.defineProperty(v5, "__esModule", { value: true }), v5.validateUnion = v5.validateArray = v5.usePattern = v5.callValidateCode = v5.schemaProperties = v5.allSchemaProperties = v5.noPropertyInData = v5.propertyInData = v5.isOwnProperty = v5.hasPropFunc = v5.reportMissingProp = v5.checkMissingProp = v5.checkReportMissingProp = void 0; + var e20 = G8(), t10 = Q8, n10 = t5(), r10 = Q8; + function o10(t11) { + return t11.scopeValue("func", { ref: Object.prototype.hasOwnProperty, code: (0, e20._)(Fe || (Fe = mo(["Object.prototype.hasOwnProperty"]))) }); + } + function i10(t11, n11, r11) { + return (0, e20._)(Ve || (Ve = mo(["", ".call(", ", ", ")"])), o10(t11), n11, r11); + } + function a10(t11, n11, r11, o11) { + var a11 = (0, e20._)(Ue || (Ue = mo(["", "", " === undefined"])), n11, (0, e20.getProperty)(r11)); + return o11 ? (0, e20.or)(a11, (0, e20.not)(i10(t11, n11, r11))) : a11; + } + function s10(e21) { + return e21 ? Object.keys(e21).filter(function(e23) { + return "__proto__" !== e23; + }) : []; + } + v5.checkReportMissingProp = function(t11, n11) { + var r11 = t11.gen, o11 = t11.data, i11 = t11.it; + r11.if(a10(r11, o11, n11, i11.opts.ownProperties), function() { + t11.setParams({ missingProperty: (0, e20._)(Be || (Be = mo(["", ""])), n11) }, true), t11.error(); + }); + }, v5.checkMissingProp = function(t11, n11, r11) { + var o11 = t11.gen, i11 = t11.data, s11 = t11.it.opts; + return e20.or.apply(void 0, Bo(n11.map(function(t12) { + return (0, e20.and)(a10(o11, i11, t12, s11.ownProperties), (0, e20._)(Le || (Le = mo(["", " = ", ""])), r11, t12)); + }))); + }, v5.reportMissingProp = function(e21, t11) { + e21.setParams({ missingProperty: t11 }, true), e21.error(); + }, v5.hasPropFunc = o10, v5.isOwnProperty = i10, v5.propertyInData = function(t11, n11, r11, o11) { + var a11 = (0, e20._)(He || (He = mo(["", "", " !== undefined"])), n11, (0, e20.getProperty)(r11)); + return o11 ? (0, e20._)(We || (We = mo(["", " && ", ""])), a11, i10(t11, n11, r11)) : a11; + }, v5.noPropertyInData = a10, v5.allSchemaProperties = s10, v5.schemaProperties = function(e21, n11) { + return s10(n11).filter(function(r11) { + return !(0, t10.alwaysValidSchema)(e21, n11[r11]); + }); + }, v5.callValidateCode = function(t11, r11, o11, i11) { + var a11 = t11.schemaCode, s11 = t11.data, c11 = t11.it, l10 = c11.gen, u10 = c11.topSchemaRef, f10 = c11.schemaPath, d10 = c11.errorPath, h10 = t11.it, v10 = i11 ? (0, e20._)(Je || (Je = mo(["", ", ", ", ", "", ""])), a11, s11, u10, f10) : s11, p10 = [[n10.default.instancePath, (0, e20.strConcat)(n10.default.instancePath, d10)], [n10.default.parentData, h10.parentData], [n10.default.parentDataProperty, h10.parentDataProperty], [n10.default.rootData, n10.default.rootData]]; + h10.opts.dynamicRef && p10.push([n10.default.dynamicAnchors, n10.default.dynamicAnchors]); + var m10 = (0, e20._)(Ke || (Ke = mo(["", ", ", ""])), v10, l10.object.apply(l10, p10)); + return o11 !== e20.nil ? (0, e20._)(Ge || (Ge = mo(["", ".call(", ", ", ")"])), r11, o11, m10) : (0, e20._)(Qe || (Qe = mo(["", "(", ")"])), r11, m10); + }; + var c10 = (0, e20._)(Ye || (Ye = mo(["new RegExp"]))); + return v5.usePattern = function(t11, n11) { + var o11 = t11.gen, i11 = t11.it.opts, a11 = i11.unicodeRegExp ? "u" : "", s11 = i11.code.regExp, l10 = s11(n11, a11); + return o11.scopeValue("pattern", { key: l10.toString(), ref: l10, code: (0, e20._)(Xe || (Xe = mo(["", "(", ", ", ")"])), "new RegExp" === s11.code ? c10 : (0, r10.useFunc)(o11, s11), n11, a11) }); + }, v5.validateArray = function(n11) { + var r11 = n11.gen, o11 = n11.data, i11 = n11.keyword, a11 = n11.it, s11 = r11.name("valid"); + if (a11.allErrors) { + var c11 = r11.let("valid", true); + return l10(function() { + return r11.assign(c11, false); + }), c11; + } + return r11.var(s11, true), l10(function() { + return r11.break(); + }), s11; + function l10(a12) { + var c12 = r11.const("len", (0, e20._)(Ze || (Ze = mo(["", ".length"])), o11)); + r11.forRange("i", 0, c12, function(o12) { + n11.subschema({ keyword: i11, dataProp: o12, dataPropType: t10.Type.Num }, s11), r11.if((0, e20.not)(s11), a12); + }); + } + }, v5.validateUnion = function(n11) { + var r11 = n11.gen, o11 = n11.schema, i11 = n11.keyword, a11 = n11.it; + if (!Array.isArray(o11)) + throw new Error("ajv implementation error"); + if (!o11.some(function(e21) { + return (0, t10.alwaysValidSchema)(a11, e21); + }) || a11.opts.unevaluated) { + var s11 = r11.let("valid", false), c11 = r11.name("_valid"); + r11.block(function() { + return o11.forEach(function(t11, o12) { + var a12 = n11.subschema({ keyword: i11, schemaProp: o12, compositeRule: true }, c11); + r11.assign(s11, (0, e20._)(et || (et = mo(["", " || ", ""])), s11, c11)), n11.mergeValidEvaluated(a12, c11) || r11.if((0, e20.not)(s11)); + }); + }), n11.result(s11, function() { + return n11.reset(); + }, function() { + return n11.error(true); + }); + } + }, v5; + } + function m5() { + if (d5) + return h5; + d5 = 1, Object.defineProperty(h5, "__esModule", { value: true }), h5.validateKeywordUsage = h5.validSchemaType = h5.funcKeywordCode = h5.macroKeywordCode = void 0; + var e20 = G8(), t10 = t5(), n10 = p5(), r10 = n5(); + function o10(t11) { + var n11 = t11.gen, r11 = t11.data, o11 = t11.it; + n11.if(o11.parentData, function() { + return n11.assign(r11, (0, e20._)(st || (st = mo(["", "[", "]"])), o11.parentData, o11.parentDataProperty)); + }); + } + function i10(t11, n11, r11) { + if (void 0 === r11) + throw new Error('keyword "'.concat(n11, '" failed to compile')); + return t11.scopeValue("keyword", "function" == typeof r11 ? { ref: r11 } : { ref: r11, code: (0, e20.stringify)(r11) }); + } + return h5.macroKeywordCode = function(t11, n11) { + var r11 = t11.gen, o11 = t11.keyword, a10 = t11.schema, s10 = t11.parentSchema, c10 = t11.it, l10 = n11.macro.call(c10.self, a10, s10, c10), u10 = i10(r11, o11, l10); + false !== c10.opts.validateSchema && c10.self.validateSchema(l10, true); + var f10 = r11.name("valid"); + t11.subschema({ schema: l10, schemaPath: e20.nil, errSchemaPath: "".concat(c10.errSchemaPath, "/").concat(o11), topSchemaRef: u10, compositeRule: true }, f10), t11.pass(f10, function() { + return t11.error(true); + }); + }, h5.funcKeywordCode = function(a10, s10) { + var c10, l10 = a10.gen, u10 = a10.keyword, f10 = a10.schema, d10 = a10.parentSchema, h10 = a10.$data, v10 = a10.it; + !function(e21, t11) { + var n11 = e21.schemaEnv; + if (t11.async && !n11.$async) + throw new Error("async keyword in sync schema"); + }(v10, s10); + var p10 = !h10 && s10.compile ? s10.compile.call(v10.self, f10, d10, v10) : s10.validate, m10 = i10(l10, u10, p10), g10 = l10.let("valid"); + function y10() { + var r11 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : s10.async ? (0, e20._)(it || (it = mo(["await "]))) : e20.nil, o11 = v10.opts.passContext ? t10.default.this : t10.default.self, i11 = !("compile" in s10 && !h10 || false === s10.schema); + l10.assign(g10, (0, e20._)(at || (at = mo(["", "", ""])), r11, (0, n10.callValidateCode)(a10, m10, o11, i11)), s10.modifying); + } + function b10(t11) { + var n11; + l10.if((0, e20.not)(null !== (n11 = s10.valid) && void 0 !== n11 ? n11 : g10), t11); + } + a10.block$data(g10, function() { + if (false === s10.errors) + y10(), s10.modifying && o10(a10), b10(function() { + return a10.error(); + }); + else { + var n11 = s10.async ? function() { + var t11 = l10.let("ruleErrs", null); + return l10.try(function() { + return y10((0, e20._)(tt || (tt = mo(["await "])))); + }, function(n12) { + return l10.assign(g10, false).if((0, e20._)(nt || (nt = mo(["", " instanceof ", ""])), n12, v10.ValidationError), function() { + return l10.assign(t11, (0, e20._)(rt || (rt = mo(["", ".errors"])), n12)); + }, function() { + return l10.throw(n12); + }); + }), t11; + }() : (i11 = (0, e20._)(ot || (ot = mo(["", ".errors"])), m10), l10.assign(i11, null), y10(e20.nil), i11); + s10.modifying && o10(a10), b10(function() { + return function(n12, o11) { + var i12 = n12.gen; + i12.if((0, e20._)(ct || (ct = mo(["Array.isArray(", ")"])), o11), function() { + i12.assign(t10.default.vErrors, (0, e20._)(lt || (lt = mo(["", " === null ? ", " : ", ".concat(", ")"])), t10.default.vErrors, o11, t10.default.vErrors, o11)).assign(t10.default.errors, (0, e20._)(ut || (ut = mo(["", ".length"])), t10.default.vErrors)), (0, r10.extendErrors)(n12); + }, function() { + return n12.error(); + }); + }(a10, n11); + }); + } + var i11; + }), a10.ok(null !== (c10 = s10.valid) && void 0 !== c10 ? c10 : g10); + }, h5.validSchemaType = function(e21, t11) { + var n11 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; + return !t11.length || t11.some(function(t12) { + return "array" === t12 ? Array.isArray(e21) : "object" === t12 ? e21 && "object" == Ho(e21) && !Array.isArray(e21) : Ho(e21) == t12 || n11 && void 0 === e21; + }); + }, h5.validateKeywordUsage = function(e21, t11, n11) { + var r11 = e21.schema, o11 = e21.opts, i11 = e21.self, a10 = e21.errSchemaPath; + if (Array.isArray(t11.keyword) ? !t11.keyword.includes(n11) : t11.keyword !== n11) + throw new Error("ajv implementation error"); + var s10 = t11.dependencies; + if (null == s10 ? void 0 : s10.some(function(e23) { + return !Object.prototype.hasOwnProperty.call(r11, e23); + })) + throw new Error("parent schema must have dependencies of ".concat(n11, ": ").concat(s10.join(","))); + if (t11.validateSchema && !t11.validateSchema(r11[n11])) { + var c10 = 'keyword "'.concat(n11, '" value is invalid at path "').concat(a10, '": ') + i11.errorsText(t11.validateSchema.errors); + if ("log" !== o11.validateSchema) + throw new Error(c10); + i11.logger.error(c10); + } + }, h5; + } + var g5; + var y5 = {}; + var b5 = {}; + var k5 = function e18(t10, n10) { + if (t10 === n10) + return true; + if (t10 && n10 && "object" == Ho(t10) && "object" == Ho(n10)) { + if (t10.constructor !== n10.constructor) + return false; + var r10, o10, i10; + if (Array.isArray(t10)) { + if ((r10 = t10.length) != n10.length) + return false; + for (o10 = r10; 0 != o10--; ) + if (!e18(t10[o10], n10[o10])) + return false; + return true; + } + if (t10.constructor === RegExp) + return t10.source === n10.source && t10.flags === n10.flags; + if (t10.valueOf !== Object.prototype.valueOf) + return t10.valueOf() === n10.valueOf(); + if (t10.toString !== Object.prototype.toString) + return t10.toString() === n10.toString(); + if ((r10 = (i10 = Object.keys(t10)).length) !== Object.keys(n10).length) + return false; + for (o10 = r10; 0 != o10--; ) + if (!Object.prototype.hasOwnProperty.call(n10, i10[o10])) + return false; + for (o10 = r10; 0 != o10--; ) { + var a10 = i10[o10]; + if (!e18(t10[a10], n10[a10])) + return false; + } + return true; + } + return t10 != t10 && n10 != n10; + }; + var w5 = { exports: {} }; + var x5 = w5.exports = function(e20, t10, n10) { + "function" == typeof t10 && (n10 = t10, t10 = {}), j5(t10, "function" == typeof (n10 = t10.cb || n10) ? n10 : n10.pre || function() { + }, n10.post || function() { + }, e20, "", e20); + }; + function j5(e20, t10, n10, r10, o10, i10, a10, s10, c10, l10) { + if (r10 && "object" == Ho(r10) && !Array.isArray(r10)) { + for (var u10 in t10(r10, o10, i10, a10, s10, c10, l10), r10) { + var f10 = r10[u10]; + if (Array.isArray(f10)) { + if (u10 in x5.arrayKeywords) + for (var d10 = 0; d10 < f10.length; d10++) + j5(e20, t10, n10, f10[d10], o10 + "/" + u10 + "/" + d10, i10, o10, u10, r10, d10); + } else if (u10 in x5.propsKeywords) { + if (f10 && "object" == Ho(f10)) + for (var h10 in f10) + j5(e20, t10, n10, f10[h10], o10 + "/" + u10 + "/" + h10.replace(/~/g, "~0").replace(/\//g, "~1"), i10, o10, u10, r10, h10); + } else + (u10 in x5.keywords || e20.allKeys && !(u10 in x5.skipKeywords)) && j5(e20, t10, n10, f10, o10 + "/" + u10, i10, o10, u10, r10); + } + n10(r10, o10, i10, a10, s10, c10, l10); + } + } + x5.keywords = { additionalItems: true, items: true, contains: true, additionalProperties: true, propertyNames: true, not: true, if: true, then: true, else: true }, x5.arrayKeywords = { items: true, allOf: true, anyOf: true, oneOf: true }, x5.propsKeywords = { $defs: true, definitions: true, properties: true, patternProperties: true, dependencies: true }, x5.skipKeywords = { default: true, enum: true, const: true, required: true, maximum: true, minimum: true, exclusiveMaximum: true, exclusiveMinimum: true, multipleOf: true, maxLength: true, minLength: true, pattern: true, format: true, maxItems: true, minItems: true, uniqueItems: true, maxProperties: true, minProperties: true }; + var S5 = w5.exports; + Object.defineProperty(b5, "__esModule", { value: true }), b5.getSchemaRefs = b5.resolveUrl = b5.normalizeId = b5._getFullPath = b5.getFullPath = b5.inlineRef = void 0; + var C5 = Q8; + var $5 = k5; + var _5 = S5; + var O5 = /* @__PURE__ */ new Set(["type", "format", "pattern", "maxLength", "minLength", "maxProperties", "minProperties", "maxItems", "minItems", "maximum", "minimum", "uniqueItems", "multipleOf", "required", "enum", "const"]); + b5.inlineRef = function(e20) { + var t10 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]; + return "boolean" == typeof e20 || (true === t10 ? !E5(e20) : !!t10 && A5(e20) <= t10); + }; + var M5 = /* @__PURE__ */ new Set(["$ref", "$recursiveRef", "$recursiveAnchor", "$dynamicRef", "$dynamicAnchor"]); + function E5(e20) { + for (var t10 in e20) { + if (M5.has(t10)) + return true; + var n10 = e20[t10]; + if (Array.isArray(n10) && n10.some(E5)) + return true; + if ("object" == Ho(n10) && E5(n10)) + return true; + } + return false; + } + function A5(e20) { + var t10 = 0; + for (var n10 in e20) { + if ("$ref" === n10) + return 1 / 0; + if (t10++, !O5.has(n10) && ("object" == Ho(e20[n10]) && (0, C5.eachItem)(e20[n10], function(e21) { + return t10 += A5(e21); + }), t10 === 1 / 0)) + return 1 / 0; + } + return t10; + } + function P5(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ""; + false !== (arguments.length > 2 ? arguments[2] : void 0) && (t10 = N5(t10)); + var n10 = e20.parse(t10); + return T5(e20, n10); + } + function T5(e20, t10) { + return e20.serialize(t10).split("#")[0] + "#"; + } + b5.getFullPath = P5, b5._getFullPath = T5; + var R5 = /#\/?$/; + function N5(e20) { + return e20 ? e20.replace(R5, "") : ""; + } + b5.normalizeId = N5, b5.resolveUrl = function(e20, t10, n10) { + return n10 = N5(n10), e20.resolve(t10, n10); + }; + var I5; + var D5 = /^[a-z_][-a-z0-9._]*$/i; + function q5() { + if (I5) + return z8; + I5 = 1, Object.defineProperty(z8, "__esModule", { value: true }), z8.getData = z8.KeywordCxt = z8.validateFunctionCode = void 0; + var e20 = function() { + if (Z8) + return B8; + Z8 = 1, Object.defineProperty(B8, "__esModule", { value: true }), B8.boolOrEmptySchema = B8.topBoolOrEmptySchema = void 0; + var e21 = n5(), t11 = G8(), n11 = t5(), r11 = { message: "boolean schema is false" }; + function o11(t12, n12) { + var o12 = { gen: t12.gen, keyword: "false schema", data: t12.data, schema: false, schemaCode: false, schemaValue: false, params: {}, it: t12 }; + (0, e21.reportError)(o12, r11, void 0, n12); + } + return B8.topBoolOrEmptySchema = function(e23) { + var r12 = e23.gen, i11 = e23.schema, a11 = e23.validateName; + false === i11 ? o11(e23, false) : "object" == Ho(i11) && true === i11.$async ? r12.return(n11.default.data) : (r12.assign((0, t11._)(ne || (ne = mo(["", ".errors"])), a11), null), r12.return(true)); + }, B8.boolOrEmptySchema = function(e23, t12) { + var n12 = e23.gen; + false === e23.schema ? (n12.var(t12, false), o11(e23)) : n12.var(t12, true); + }, B8; + }(), t10 = r5, n10 = c5(), r10 = r5, o10 = function() { + if (l5) + return u5; + l5 = 1, Object.defineProperty(u5, "__esModule", { value: true }), u5.assignDefaults = void 0; + var e21 = G8(), t11 = Q8; + function n11(n12, r11, o11) { + var i11 = n12.gen, a11 = n12.compositeRule, s11 = n12.data, c11 = n12.opts; + if (void 0 !== o11) { + var l11 = (0, e21._)(Ie || (Ie = mo(["", "", ""])), s11, (0, e21.getProperty)(r11)); + if (a11) + (0, t11.checkStrictMode)(n12, "default is ignored for: ".concat(l11)); + else { + var u11 = (0, e21._)(De || (De = mo(["", " === undefined"])), l11); + "empty" === c11.useDefaults && (u11 = (0, e21._)(qe || (qe = mo(["", " || ", " === null || ", ' === ""'])), u11, l11, l11)), i11.if(u11, (0, e21._)(ze || (ze = mo(["", " = ", ""])), l11, (0, e21.stringify)(o11))); + } + } + } + return u5.assignDefaults = function(e23, t12) { + var r11 = e23.schema, o11 = r11.properties, i11 = r11.items; + if ("object" === t12 && o11) + for (var a11 in o11) + n11(e23, a11, o11[a11].default); + else + "array" === t12 && Array.isArray(i11) && i11.forEach(function(t13, r12) { + return n11(e23, r12, t13.default); + }); + }, u5; + }(), i10 = m5(), a10 = function() { + if (g5) + return y5; + g5 = 1, Object.defineProperty(y5, "__esModule", { value: true }), y5.extendSubschemaMode = y5.extendSubschemaData = y5.getSubschema = void 0; + var e21 = G8(), t11 = Q8; + return y5.getSubschema = function(n11, r11) { + var o11 = r11.keyword, i11 = r11.schemaProp, a11 = r11.schema, s11 = r11.schemaPath, c11 = r11.errSchemaPath, l11 = r11.topSchemaRef; + if (void 0 !== o11 && void 0 !== a11) + throw new Error('both "keyword" and "schema" passed, only one allowed'); + if (void 0 !== o11) { + var u11 = n11.schema[o11]; + return void 0 === i11 ? { schema: u11, schemaPath: (0, e21._)(ft || (ft = mo(["", "", ""])), n11.schemaPath, (0, e21.getProperty)(o11)), errSchemaPath: "".concat(n11.errSchemaPath, "/").concat(o11) } : { schema: u11[i11], schemaPath: (0, e21._)(dt || (dt = mo(["", "", "", ""])), n11.schemaPath, (0, e21.getProperty)(o11), (0, e21.getProperty)(i11)), errSchemaPath: "".concat(n11.errSchemaPath, "/").concat(o11, "/").concat((0, t11.escapeFragment)(i11)) }; + } + if (void 0 !== a11) { + if (void 0 === s11 || void 0 === c11 || void 0 === l11) + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); + return { schema: a11, schemaPath: s11, topSchemaRef: l11, errSchemaPath: c11 }; + } + throw new Error('either "keyword" or "schema" must be passed'); + }, y5.extendSubschemaData = function(n11, r11, o11) { + var i11 = o11.dataProp, a11 = o11.dataPropType, s11 = o11.data, c11 = o11.dataTypes, l11 = o11.propertyName; + if (void 0 !== s11 && void 0 !== i11) + throw new Error('both "data" and "dataProp" passed, only one allowed'); + var u11 = r11.gen; + if (void 0 !== i11) { + var f11 = r11.errorPath, d11 = r11.dataPathArr, h11 = r11.opts; + v11(u11.let("data", (0, e21._)(ht || (ht = mo(["", "", ""])), r11.data, (0, e21.getProperty)(i11)), true)), n11.errorPath = (0, e21.str)(vt || (vt = mo(["", "", ""])), f11, (0, t11.getErrorPath)(i11, a11, h11.jsPropertySyntax)), n11.parentDataProperty = (0, e21._)(pt || (pt = mo(["", ""])), i11), n11.dataPathArr = [].concat(Bo(d11), [n11.parentDataProperty]); + } + function v11(e23) { + n11.data = e23, n11.dataLevel = r11.dataLevel + 1, n11.dataTypes = [], r11.definedProperties = /* @__PURE__ */ new Set(), n11.parentData = r11.data, n11.dataNames = [].concat(Bo(r11.dataNames), [e23]); + } + void 0 !== s11 && (v11(s11 instanceof e21.Name ? s11 : u11.let("data", s11, true)), void 0 !== l11 && (n11.propertyName = l11)), c11 && (n11.dataTypes = c11); + }, y5.extendSubschemaMode = function(e23, t12) { + var n11 = t12.jtdDiscriminator, r11 = t12.jtdMetadata, o11 = t12.compositeRule, i11 = t12.createErrors, a11 = t12.allErrors; + void 0 !== o11 && (e23.compositeRule = o11), void 0 !== i11 && (e23.createErrors = i11), void 0 !== a11 && (e23.allErrors = a11), e23.jtdDiscriminator = n11, e23.jtdMetadata = r11; + }, y5; + }(), s10 = G8(), c10 = t5(), l10 = b5, u10 = Q8, f10 = n5(); + function d10(e21, t11) { + var n11 = e21.gen, r11 = e21.validateName, o11 = e21.schema, i11 = e21.schemaEnv, a11 = e21.opts; + a11.code.es5 ? n11.func(r11, (0, s10._)(mt || (mt = mo(["", ", ", ""])), c10.default.data, c10.default.valCxt), i11.$async, function() { + n11.code((0, s10._)(gt || (gt = mo(['"use strict"; ', ""])), h10(o11, a11))), function(e23, t12) { + e23.if(c10.default.valCxt, function() { + e23.var(c10.default.instancePath, (0, s10._)(wt || (wt = mo(["", ".", ""])), c10.default.valCxt, c10.default.instancePath)), e23.var(c10.default.parentData, (0, s10._)(xt || (xt = mo(["", ".", ""])), c10.default.valCxt, c10.default.parentData)), e23.var(c10.default.parentDataProperty, (0, s10._)(jt || (jt = mo(["", ".", ""])), c10.default.valCxt, c10.default.parentDataProperty)), e23.var(c10.default.rootData, (0, s10._)(St || (St = mo(["", ".", ""])), c10.default.valCxt, c10.default.rootData)), t12.dynamicRef && e23.var(c10.default.dynamicAnchors, (0, s10._)(Ct || (Ct = mo(["", ".", ""])), c10.default.valCxt, c10.default.dynamicAnchors)); + }, function() { + e23.var(c10.default.instancePath, (0, s10._)($t || ($t = mo(['""'])))), e23.var(c10.default.parentData, (0, s10._)(_t || (_t = mo(["undefined"])))), e23.var(c10.default.parentDataProperty, (0, s10._)(Ot || (Ot = mo(["undefined"])))), e23.var(c10.default.rootData, c10.default.data), t12.dynamicRef && e23.var(c10.default.dynamicAnchors, (0, s10._)(Mt || (Mt = mo(["{}"])))); + }); + }(n11, a11), n11.code(t11); + }) : n11.func(r11, (0, s10._)(yt || (yt = mo(["", ", ", ""])), c10.default.data, function(e23) { + return (0, s10._)(bt || (bt = mo(["{", '="", ', ", ", ", ", "=", "", "}={}"])), c10.default.instancePath, c10.default.parentData, c10.default.parentDataProperty, c10.default.rootData, c10.default.data, e23.dynamicRef ? (0, s10._)(kt || (kt = mo([", ", "={}"])), c10.default.dynamicAnchors) : s10.nil); + }(a11)), i11.$async, function() { + return n11.code(h10(o11, a11)).code(t11); + }); + } + function h10(e21, t11) { + var n11 = "object" == Ho(e21) && e21[t11.schemaId]; + return n11 && (t11.code.source || t11.code.process) ? (0, s10._)(Dt || (Dt = mo(["/*# sourceURL=", " */"])), n11) : s10.nil; + } + function v10(t11, n11) { + m10(t11) && (g10(t11), p10(t11)) ? function(e21, t12) { + var n12 = e21.schema, r11 = e21.gen, o11 = e21.opts; + o11.$comment && n12.$comment && b10(e21); + (function(e23) { + var t13 = e23.schema[e23.opts.schemaId]; + t13 && (e23.baseId = (0, l10.resolveUrl)(e23.opts.uriResolver, e23.baseId, t13)); + })(e21), function(e23) { + if (e23.schema.$async && !e23.schemaEnv.$async) + throw new Error("async schema in sync schema"); + }(e21); + var i11 = r11.const("_errs", c10.default.errors); + y10(e21, i11), r11.var(t12, (0, s10._)(qt || (qt = mo(["", " === ", ""])), i11, c10.default.errors)); + }(t11, n11) : (0, e20.boolOrEmptySchema)(t11, n11); + } + function p10(e21) { + var t11 = e21.schema, n11 = e21.self; + if ("boolean" == typeof t11) + return !t11; + for (var r11 in t11) + if (n11.RULES.all[r11]) + return true; + return false; + } + function m10(e21) { + return "boolean" != typeof e21.schema; + } + function g10(e21) { + (0, u10.checkUnknownRules)(e21), function(e23) { + var t11 = e23.schema, n11 = e23.errSchemaPath, r11 = e23.opts, o11 = e23.self; + t11.$ref && r11.ignoreKeywordsWithRef && (0, u10.schemaHasRulesButRef)(t11, o11.RULES) && o11.logger.warn('$ref: keywords ignored in schema at path "'.concat(n11, '"')); + }(e21); + } + function y10(e21, n11) { + if (e21.opts.jtd) + return k10(e21, [], false, n11); + var r11 = (0, t10.getSchemaTypes)(e21.schema); + k10(e21, r11, !(0, t10.coerceAndCheckDataType)(e21, r11), n11); + } + function b10(e21) { + var t11 = e21.gen, n11 = e21.schemaEnv, r11 = e21.schema, o11 = e21.errSchemaPath, i11 = e21.opts, a11 = r11.$comment; + if (true === i11.$comment) + t11.code((0, s10._)(zt || (zt = mo(["", ".logger.log(", ")"])), c10.default.self, a11)); + else if ("function" == typeof i11.$comment) { + var l11 = (0, s10.str)(Bt || (Bt = mo(["", "/$comment"])), o11), u11 = t11.scopeValue("root", { ref: n11.root }); + t11.code((0, s10._)(Lt || (Lt = mo(["", ".opts.$comment(", ", ", ", ", ".schema)"])), c10.default.self, a11, l11, u11)); + } + } + function k10(e21, t11, o11, i11) { + var a11 = e21.gen, l11 = e21.schema, f11 = e21.data, d11 = e21.allErrors, h11 = e21.opts, v11 = e21.self.RULES; + function p11(u11) { + (0, n10.shouldUseGroup)(l11, u11) && (u11.type ? (a11.if((0, r10.checkDataType)(u11.type, f11, h11.strictNumbers)), w10(e21, u11), 1 === t11.length && t11[0] === u11.type && o11 && (a11.else(), (0, r10.reportTypeError)(e21)), a11.endIf()) : w10(e21, u11), d11 || a11.if((0, s10._)(Kt || (Kt = mo(["", " === ", ""])), c10.default.errors, i11 || 0))); + } + !l11.$ref || !h11.ignoreKeywordsWithRef && (0, u10.schemaHasRulesButRef)(l11, v11) ? (h11.jtd || function(e23, t12) { + if (e23.schemaEnv.meta || !e23.opts.strictTypes) + return; + (function(e24, t13) { + if (!t13.length) + return; + if (!e24.dataTypes.length) + return void (e24.dataTypes = t13); + t13.forEach(function(t14) { + j10(e24.dataTypes, t14) || S10(e24, 'type "'.concat(t14, '" not allowed by context "').concat(e24.dataTypes.join(","), '"')); + }), function(e25, t14) { + var n11, r11 = [], o12 = bo(e25.dataTypes); + try { + for (o12.s(); !(n11 = o12.n()).done; ) { + var i12 = n11.value; + j10(t14, i12) ? r11.push(i12) : t14.includes("integer") && "number" === i12 && r11.push("integer"); + } + } catch (e26) { + o12.e(e26); + } finally { + o12.f(); + } + e25.dataTypes = r11; + }(e24, t13); + })(e23, t12), e23.opts.allowUnionTypes || function(e24, t13) { + t13.length > 1 && (2 !== t13.length || !t13.includes("null")) && S10(e24, "use allowUnionTypes to allow union type keyword"); + }(e23, t12); + !function(e24, t13) { + var r11 = e24.self.RULES.all; + for (var o12 in r11) { + var i12 = r11[o12]; + if ("object" == Ho(i12) && (0, n10.shouldUseRule)(e24.schema, i12)) { + var a12 = i12.definition.type; + a12.length && !a12.some(function(e25) { + return x10(t13, e25); + }) && S10(e24, 'missing type "'.concat(a12.join(","), '" for keyword "').concat(o12, '"')); + } + } + }(e23, e23.dataTypes); + }(e21, t11), a11.block(function() { + var e23, t12 = bo(v11.rules); + try { + for (t12.s(); !(e23 = t12.n()).done; ) { + p11(e23.value); + } + } catch (e24) { + t12.e(e24); + } finally { + t12.f(); + } + p11(v11.post); + })) : a11.block(function() { + return $10(e21, "$ref", v11.all.$ref.definition); + }); + } + function w10(e21, t11) { + var r11 = e21.gen, i11 = e21.schema; + e21.opts.useDefaults && (0, o10.assignDefaults)(e21, t11.type), r11.block(function() { + var r12, o11 = bo(t11.rules); + try { + for (o11.s(); !(r12 = o11.n()).done; ) { + var a11 = r12.value; + (0, n10.shouldUseRule)(i11, a11) && $10(e21, a11.keyword, a11.definition, t11.type); + } + } catch (e23) { + o11.e(e23); + } finally { + o11.f(); + } + }); + } + function x10(e21, t11) { + return e21.includes(t11) || "number" === t11 && e21.includes("integer"); + } + function j10(e21, t11) { + return e21.includes(t11) || "integer" === t11 && e21.includes("number"); + } + function S10(e21, t11) { + var n11 = e21.schemaEnv.baseId + e21.errSchemaPath; + t11 += ' at "'.concat(n11, '" (strictTypes)'), (0, u10.checkStrictMode)(e21, t11, e21.opts.strictTypes); + } + z8.validateFunctionCode = function(t11) { + m10(t11) && (g10(t11), p10(t11)) ? function(e21) { + var t12 = e21.schema, n11 = e21.opts, r11 = e21.gen; + d10(e21, function() { + n11.$comment && t12.$comment && b10(e21), function(e23) { + var t13 = e23.schema, n12 = e23.opts; + void 0 !== t13.default && n12.useDefaults && n12.strictSchema && (0, u10.checkStrictMode)(e23, "default is ignored in the schema root"); + }(e21), r11.let(c10.default.vErrors, null), r11.let(c10.default.errors, 0), n11.unevaluated && function(e23) { + var t13 = e23.gen, n12 = e23.validateName; + e23.evaluated = t13.const("evaluated", (0, s10._)(Et || (Et = mo(["", ".evaluated"])), n12)), t13.if((0, s10._)(At || (At = mo(["", ".dynamicProps"])), e23.evaluated), function() { + return t13.assign((0, s10._)(Pt || (Pt = mo(["", ".props"])), e23.evaluated), (0, s10._)(Tt || (Tt = mo(["undefined"])))); + }), t13.if((0, s10._)(Rt || (Rt = mo(["", ".dynamicItems"])), e23.evaluated), function() { + return t13.assign((0, s10._)(Nt || (Nt = mo(["", ".items"])), e23.evaluated), (0, s10._)(It || (It = mo(["undefined"])))); + }); + }(e21), y10(e21), function(e23) { + var t13 = e23.gen, n12 = e23.schemaEnv, r12 = e23.validateName, o11 = e23.ValidationError, i11 = e23.opts; + n12.$async ? t13.if((0, s10._)(Ft || (Ft = mo(["", " === 0"])), c10.default.errors), function() { + return t13.return(c10.default.data); + }, function() { + return t13.throw((0, s10._)(Vt || (Vt = mo(["new ", "(", ")"])), o11, c10.default.vErrors)); + }) : (t13.assign((0, s10._)(Ht || (Ht = mo(["", ".errors"])), r12), c10.default.vErrors), i11.unevaluated && function(e24) { + var t14 = e24.gen, n13 = e24.evaluated, r13 = e24.props, o12 = e24.items; + r13 instanceof s10.Name && t14.assign((0, s10._)(Ut || (Ut = mo(["", ".props"])), n13), r13); + o12 instanceof s10.Name && t14.assign((0, s10._)(Jt || (Jt = mo(["", ".items"])), n13), o12); + }(e23), t13.return((0, s10._)(Wt || (Wt = mo(["", " === 0"])), c10.default.errors))); + }(e21); + }); + }(t11) : d10(t11, function() { + return (0, e20.topBoolOrEmptySchema)(t11); + }); + }; + var C10 = function() { + function e21(t11, n11, r11) { + if (No(this, e21), (0, i10.validateKeywordUsage)(t11, n11, r11), this.gen = t11.gen, this.allErrors = t11.allErrors, this.keyword = r11, this.data = t11.data, this.schema = t11.schema[r11], this.$data = n11.$data && t11.opts.$data && this.schema && this.schema.$data, this.schemaValue = (0, u10.schemaRefOrVal)(t11, this.schema, r11, this.$data), this.schemaType = n11.schemaType, this.parentSchema = t11.schema, this.params = {}, this.it = t11, this.def = n11, this.$data) + this.schemaCode = t11.gen.const("vSchema", M10(this.$data, t11)); + else if (this.schemaCode = this.schemaValue, !(0, i10.validSchemaType)(this.schema, n11.schemaType, n11.allowUndefined)) + throw new Error("".concat(r11, " value must be ").concat(JSON.stringify(n11.schemaType))); + ("code" in n11 ? n11.trackErrors : false !== n11.errors) && (this.errsCount = t11.gen.const("_errs", c10.default.errors)); + } + return Do(e21, [{ key: "result", value: function(e23, t11, n11) { + this.failResult((0, s10.not)(e23), t11, n11); + } }, { key: "failResult", value: function(e23, t11, n11) { + this.gen.if(e23), n11 ? n11() : this.error(), t11 ? (this.gen.else(), t11(), this.allErrors && this.gen.endIf()) : this.allErrors ? this.gen.endIf() : this.gen.else(); + } }, { key: "pass", value: function(e23, t11) { + this.failResult((0, s10.not)(e23), void 0, t11); + } }, { key: "fail", value: function(e23) { + if (void 0 === e23) + return this.error(), void (this.allErrors || this.gen.if(false)); + this.gen.if(e23), this.error(), this.allErrors ? this.gen.endIf() : this.gen.else(); + } }, { key: "fail$data", value: function(e23) { + if (!this.$data) + return this.fail(e23); + var t11 = this.schemaCode; + this.fail((0, s10._)(Gt || (Gt = mo(["", " !== undefined && (", ")"])), t11, (0, s10.or)(this.invalid$data(), e23))); + } }, { key: "error", value: function(e23, t11, n11) { + if (t11) + return this.setParams(t11), this._error(e23, n11), void this.setParams({}); + this._error(e23, n11); + } }, { key: "_error", value: function(e23, t11) { + (e23 ? f10.reportExtraError : f10.reportError)(this, this.def.error, t11); + } }, { key: "$dataError", value: function() { + (0, f10.reportError)(this, this.def.$dataError || f10.keyword$DataError); + } }, { key: "reset", value: function() { + if (void 0 === this.errsCount) + throw new Error('add "trackErrors" to keyword definition'); + (0, f10.resetErrorsCount)(this.gen, this.errsCount); + } }, { key: "ok", value: function(e23) { + this.allErrors || this.gen.if(e23); + } }, { key: "setParams", value: function(e23, t11) { + t11 ? Object.assign(this.params, e23) : this.params = e23; + } }, { key: "block$data", value: function(e23, t11) { + var n11 = this, r11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : s10.nil; + this.gen.block(function() { + n11.check$data(e23, r11), t11(); + }); + } }, { key: "check$data", value: function() { + var e23 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : s10.nil, t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : s10.nil; + if (this.$data) { + var n11 = this.gen, r11 = this.schemaCode, o11 = this.schemaType, i11 = this.def; + n11.if((0, s10.or)((0, s10._)(Qt || (Qt = mo(["", " === undefined"])), r11), t11)), e23 !== s10.nil && n11.assign(e23, true), (o11.length || i11.validateSchema) && (n11.elseIf(this.invalid$data()), this.$dataError(), e23 !== s10.nil && n11.assign(e23, false)), n11.else(); + } + } }, { key: "invalid$data", value: function() { + var e23 = this.gen, t11 = this.schemaCode, n11 = this.schemaType, o11 = this.def, i11 = this.it; + return (0, s10.or)(function() { + if (n11.length) { + if (!(t11 instanceof s10.Name)) + throw new Error("ajv implementation error"); + var e24 = Array.isArray(n11) ? n11 : [n11]; + return (0, s10._)(Yt || (Yt = mo(["", ""])), (0, r10.checkDataTypes)(e24, t11, i11.opts.strictNumbers, r10.DataType.Wrong)); + } + return s10.nil; + }(), function() { + if (o11.validateSchema) { + var n12 = e23.scopeValue("validate$data", { ref: o11.validateSchema }); + return (0, s10._)(Xt || (Xt = mo(["!", "(", ")"])), n12, t11); + } + return s10.nil; + }()); + } }, { key: "subschema", value: function(e23, t11) { + var n11 = (0, a10.getSubschema)(this.it, e23); + (0, a10.extendSubschemaData)(n11, this.it, e23), (0, a10.extendSubschemaMode)(n11, e23); + var r11 = Ro(Ro(Ro({}, this.it), n11), {}, { items: void 0, props: void 0 }); + return v10(r11, t11), r11; + } }, { key: "mergeEvaluated", value: function(e23, t11) { + var n11 = this.it, r11 = this.gen; + n11.opts.unevaluated && (true !== n11.props && void 0 !== e23.props && (n11.props = u10.mergeEvaluated.props(r11, e23.props, n11.props, t11)), true !== n11.items && void 0 !== e23.items && (n11.items = u10.mergeEvaluated.items(r11, e23.items, n11.items, t11))); + } }, { key: "mergeValidEvaluated", value: function(e23, t11) { + var n11 = this, r11 = this.it, o11 = this.gen; + if (r11.opts.unevaluated && (true !== r11.props || true !== r11.items)) + return o11.if(t11, function() { + return n11.mergeEvaluated(e23, s10.Name); + }), true; + } }]), e21; + }(); + function $10(e21, t11, n11, r11) { + var o11 = new C10(e21, n11, t11); + "code" in n11 ? n11.code(o11, r11) : o11.$data && n11.validate ? (0, i10.funcKeywordCode)(o11, n11) : "macro" in n11 ? (0, i10.macroKeywordCode)(o11, n11) : (n11.compile || n11.validate) && (0, i10.funcKeywordCode)(o11, n11); + } + z8.KeywordCxt = C10; + var _10 = /^\/(?:[^~]|~0|~1)*$/, O10 = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; + function M10(e21, t11) { + var n11, r11, o11 = t11.dataLevel, i11 = t11.dataNames, a11 = t11.dataPathArr; + if ("" === e21) + return c10.default.rootData; + if ("/" === e21[0]) { + if (!_10.test(e21)) + throw new Error("Invalid JSON-pointer: ".concat(e21)); + n11 = e21, r11 = c10.default.rootData; + } else { + var l11 = O10.exec(e21); + if (!l11) + throw new Error("Invalid JSON-pointer: ".concat(e21)); + var f11 = +l11[1]; + if ("#" === (n11 = l11[2])) { + if (f11 >= o11) + throw new Error(m11("property/index", f11)); + return a11[o11 - f11]; + } + if (f11 > o11) + throw new Error(m11("data", f11)); + if (r11 = i11[o11 - f11], !n11) + return r11; + } + var d11, h11 = r11, v11 = bo(n11.split("/")); + try { + for (v11.s(); !(d11 = v11.n()).done; ) { + var p11 = d11.value; + p11 && (r11 = (0, s10._)(Zt || (Zt = mo(["", "", ""])), r11, (0, s10.getProperty)((0, u10.unescapeJsonPointer)(p11))), h11 = (0, s10._)(en || (en = mo(["", " && ", ""])), h11, r11)); + } + } catch (e23) { + v11.e(e23); + } finally { + v11.f(); + } + return h11; + function m11(e23, t12) { + return "Cannot access ".concat(e23, " ").concat(t12, " levels up, current level is ").concat(o11); + } + } + return z8.getData = M10, z8; + } + b5.getSchemaRefs = function(e20, t10) { + var n10 = this; + if ("boolean" == typeof e20) + return {}; + var r10 = this.opts, o10 = r10.schemaId, i10 = r10.uriResolver, a10 = N5(e20[o10] || t10), s10 = { "": a10 }, c10 = P5(i10, a10, false), l10 = {}, u10 = /* @__PURE__ */ new Set(); + return _5(e20, { allKeys: true }, function(e21, t11, r11, i11) { + if (void 0 !== i11) { + var a11 = c10 + t11, h10 = s10[i11]; + "string" == typeof e21[o10] && (h10 = v10.call(n10, e21[o10])), p10.call(n10, e21.$anchor), p10.call(n10, e21.$dynamicAnchor), s10[t11] = h10; + } + function v10(t12) { + var n11 = this.opts.uriResolver.resolve; + if (t12 = N5(h10 ? n11(h10, t12) : t12), u10.has(t12)) + throw d10(t12); + u10.add(t12); + var r12 = this.refs[t12]; + return "string" == typeof r12 && (r12 = this.refs[r12]), "object" == Ho(r12) ? f10(e21, r12.schema, t12) : t12 !== N5(a11) && ("#" === t12[0] ? (f10(e21, l10[t12], t12), l10[t12] = e21) : this.refs[t12] = a11), t12; + } + function p10(e23) { + if ("string" == typeof e23) { + if (!D5.test(e23)) + throw new Error('invalid anchor "'.concat(e23, '"')); + v10.call(this, "#".concat(e23)); + } + } + }), l10; + function f10(e21, t11, n11) { + if (void 0 !== t11 && !$5(e21, t11)) + throw d10(n11); + } + function d10(e21) { + return new Error('reference "'.concat(e21, '" resolves to more than one schema')); + } + }; + var z5; + var B5 = {}; + function L5() { + if (z5) + return B5; + z5 = 1, Object.defineProperty(B5, "__esModule", { value: true }); + var e20 = function(e21) { + function t10(e23) { + var n10; + return No(this, t10), (n10 = _o(this, t10, ["validation failed"])).errors = e23, n10.ajv = n10.validation = true, n10; + } + return Ao(t10, $o(Error)), Do(t10); + }(); + return B5.default = e20, B5; + } + var F5; + var V5 = {}; + function H5() { + if (F5) + return V5; + F5 = 1, Object.defineProperty(V5, "__esModule", { value: true }); + var e20 = b5, t10 = function(t11) { + function n10(t12, r10, o10, i10) { + var a10; + return No(this, n10), (a10 = _o(this, n10, [i10 || "can't resolve reference ".concat(o10, " from id ").concat(r10)])).missingRef = (0, e20.resolveUrl)(t12, r10, o10), a10.missingSchema = (0, e20.normalizeId)((0, e20.getFullPath)(t12, a10.missingRef)), a10; + } + return Ao(n10, $o(Error)), Do(n10); + }(); + return V5.default = t10, V5; + } + var W5 = {}; + Object.defineProperty(W5, "__esModule", { value: true }), W5.resolveSchema = W5.getCompilingSchema = W5.resolveRef = W5.compileSchema = W5.SchemaEnv = void 0; + var U5 = G8(); + var J5 = L5(); + var K5 = t5(); + var G5 = b5; + var Q5 = Q8; + var Y5 = q5(); + var X5 = Do(function e19(t10) { + var n10, r10; + No(this, e19), this.refs = {}, this.dynamicAnchors = {}, "object" == Ho(t10.schema) && (r10 = t10.schema), this.schema = t10.schema, this.schemaId = t10.schemaId, this.root = t10.root || this, this.baseId = null !== (n10 = t10.baseId) && void 0 !== n10 ? n10 : (0, G5.normalizeId)(null == r10 ? void 0 : r10[t10.schemaId || "$id"]), this.schemaPath = t10.schemaPath, this.localRefs = t10.localRefs, this.meta = t10.meta, this.$async = null == r10 ? void 0 : r10.$async, this.refs = {}; + }); + function Z5(e20) { + var t10 = t6.call(this, e20); + if (t10) + return t10; + var n10, r10 = (0, G5.getFullPath)(this.opts.uriResolver, e20.root.baseId), o10 = this.opts.code, i10 = o10.es5, a10 = o10.lines, s10 = this.opts.ownProperties, c10 = new U5.CodeGen(this.scope, { es5: i10, lines: a10, ownProperties: s10 }); + e20.$async && (n10 = c10.scopeValue("Error", { ref: J5.default, code: (0, U5._)(tn || (tn = mo(['require("ajv/dist/runtime/validation_error").default']))) })); + var l10 = c10.scopeName("validate"); + e20.validateName = l10; + var u10, f10 = { gen: c10, allErrors: this.opts.allErrors, data: K5.default.data, parentData: K5.default.parentData, parentDataProperty: K5.default.parentDataProperty, dataNames: [K5.default.data], dataPathArr: [U5.nil], dataLevel: 0, dataTypes: [], definedProperties: /* @__PURE__ */ new Set(), topSchemaRef: c10.scopeValue("schema", true === this.opts.code.source ? { ref: e20.schema, code: (0, U5.stringify)(e20.schema) } : { ref: e20.schema }), validateName: l10, ValidationError: n10, schema: e20.schema, schemaEnv: e20, rootId: r10, baseId: e20.baseId || r10, schemaPath: U5.nil, errSchemaPath: e20.schemaPath || (this.opts.jtd ? "" : "#"), errorPath: (0, U5._)(nn || (nn = mo(['""']))), opts: this.opts, self: this }; + try { + this._compilations.add(e20), (0, Y5.validateFunctionCode)(f10), c10.optimize(this.opts.code.optimize); + var d10 = c10.toString(); + u10 = "".concat(c10.scopeRefs(K5.default.scope), "return ").concat(d10), this.opts.code.process && (u10 = this.opts.code.process(u10, e20)); + var h10 = new Function("".concat(K5.default.self), "".concat(K5.default.scope), u10)(this, this.scope.get()); + if (this.scope.value(l10, { ref: h10 }), h10.errors = null, h10.schema = e20.schema, h10.schemaEnv = e20, e20.$async && (h10.$async = true), true === this.opts.code.source && (h10.source = { validateName: l10, validateCode: d10, scopeValues: c10._values }), this.opts.unevaluated) { + var v10 = f10.props, p10 = f10.items; + h10.evaluated = { props: v10 instanceof U5.Name ? void 0 : v10, items: p10 instanceof U5.Name ? void 0 : p10, dynamicProps: v10 instanceof U5.Name, dynamicItems: p10 instanceof U5.Name }, h10.source && (h10.source.evaluated = (0, U5.stringify)(h10.evaluated)); + } + return e20.validate = h10, e20; + } catch (t11) { + throw delete e20.validate, delete e20.validateName, u10 && this.logger.error("Error compiling schema, function code:", u10), t11; + } finally { + this._compilations.delete(e20); + } + } + function e62(e20) { + return (0, G5.inlineRef)(e20.schema, this.opts.inlineRefs) ? e20.schema : e20.validate ? e20 : Z5.call(this, e20); + } + function t6(e20) { + var t10, n10, r10, o10 = bo(this._compilations); + try { + for (o10.s(); !(t10 = o10.n()).done; ) { + var i10 = t10.value; + if (r10 = e20, (n10 = i10).schema === r10.schema && n10.root === r10.root && n10.baseId === r10.baseId) + return i10; + } + } catch (e21) { + o10.e(e21); + } finally { + o10.f(); + } + } + function n6(e20, t10) { + for (var n10; "string" == typeof (n10 = this.refs[t10]); ) + t10 = n10; + return n10 || this.schemas[t10] || r6.call(this, e20, t10); + } + function r6(e20, t10) { + var n10 = this.opts.uriResolver.parse(t10), r10 = (0, G5._getFullPath)(this.opts.uriResolver, n10), o10 = (0, G5.getFullPath)(this.opts.uriResolver, e20.baseId, void 0); + if (Object.keys(e20.schema).length > 0 && r10 === o10) + return i6.call(this, n10, e20); + var i10 = (0, G5.normalizeId)(r10), a10 = this.refs[i10] || this.schemas[i10]; + if ("string" == typeof a10) { + var s10 = r6.call(this, e20, a10); + if ("object" !== Ho(null == s10 ? void 0 : s10.schema)) + return; + return i6.call(this, n10, s10); + } + if ("object" === Ho(null == a10 ? void 0 : a10.schema)) { + if (a10.validate || Z5.call(this, a10), i10 === (0, G5.normalizeId)(t10)) { + var c10 = a10.schema, l10 = this.opts.schemaId, u10 = c10[l10]; + return u10 && (o10 = (0, G5.resolveUrl)(this.opts.uriResolver, o10, u10)), new X5({ schema: c10, schemaId: l10, root: e20, baseId: o10 }); + } + return i6.call(this, n10, a10); + } + } + W5.SchemaEnv = X5, W5.compileSchema = Z5, W5.resolveRef = function(e20, t10, n10) { + var r10; + n10 = (0, G5.resolveUrl)(this.opts.uriResolver, t10, n10); + var o10 = e20.refs[n10]; + if (o10) + return o10; + var i10 = n6.call(this, e20, n10); + if (void 0 === i10) { + var a10 = null === (r10 = e20.localRefs) || void 0 === r10 ? void 0 : r10[n10], s10 = this.opts.schemaId; + a10 && (i10 = new X5({ schema: a10, schemaId: s10, root: e20, baseId: t10 })); + } + return void 0 !== i10 ? e20.refs[n10] = e62.call(this, i10) : void 0; + }, W5.getCompilingSchema = t6, W5.resolveSchema = r6; + var o6 = /* @__PURE__ */ new Set(["properties", "patternProperties", "enum", "dependencies", "definitions"]); + function i6(e20, t10) { + var n10, r10 = t10.baseId, o10 = t10.schema, i10 = t10.root; + if ("/" === (null === (n10 = e20.fragment) || void 0 === n10 ? void 0 : n10[0])) { + var a10, s10, c10 = bo(e20.fragment.slice(1).split("/")); + try { + for (c10.s(); !(a10 = c10.n()).done; ) { + var l10 = a10.value; + if ("boolean" == typeof o10) + return; + var u10 = o10[(0, Q5.unescapeFragment)(l10)]; + if (void 0 === u10) + return; + var f10 = "object" === Ho(o10 = u10) && o10[this.opts.schemaId]; + !o6.has(l10) && f10 && (r10 = (0, G5.resolveUrl)(this.opts.uriResolver, r10, f10)); + } + } catch (e21) { + c10.e(e21); + } finally { + c10.f(); + } + if ("boolean" != typeof o10 && o10.$ref && !(0, Q5.schemaHasRulesButRef)(o10, this.RULES)) { + var d10 = (0, G5.resolveUrl)(this.opts.uriResolver, r10, o10.$ref); + s10 = r6.call(this, i10, d10); + } + var h10 = this.opts.schemaId; + return (s10 = s10 || new X5({ schema: o10, schemaId: h10, root: i10, baseId: r10 })).schema !== s10.root.schema ? s10 : void 0; + } + } + var a6 = { $id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", description: "Meta-schema for $data reference (JSON AnySchema extension proposal)", type: "object", required: ["$data"], properties: { $data: { type: "string", anyOf: [{ format: "relative-json-pointer" }, { format: "json-pointer" }] } }, additionalProperties: false }; + var s6 = {}; + var c6 = { exports: {} }; + !function(e20) { + function t10() { + for (var e21 = arguments.length, t11 = Array(e21), n11 = 0; n11 < e21; n11++) + t11[n11] = arguments[n11]; + if (t11.length > 1) { + t11[0] = t11[0].slice(0, -1); + for (var r11 = t11.length - 1, o11 = 1; o11 < r11; ++o11) + t11[o11] = t11[o11].slice(1, -1); + return t11[r11] = t11[r11].slice(1), t11.join(""); + } + return t11[0]; + } + function n10(e21) { + return "(?:" + e21 + ")"; + } + function r10(e21) { + return void 0 === e21 ? "undefined" : null === e21 ? "null" : Object.prototype.toString.call(e21).split(" ").pop().split("]").shift().toLowerCase(); + } + function o10(e21) { + return e21.toUpperCase(); + } + function i10(e21) { + return null != e21 ? e21 instanceof Array ? e21 : "number" != typeof e21.length || e21.split || e21.setInterval || e21.call ? [e21] : Array.prototype.slice.call(e21) : []; + } + function a10(e21, t11) { + var n11 = e21; + if (t11) + for (var r11 in t11) + n11[r11] = t11[r11]; + return n11; + } + function s10(e21) { + var r11 = "[A-Za-z]", o11 = "[0-9]", i11 = t10(o11, "[A-Fa-f]"), a11 = n10(n10("%[EFef]" + i11 + "%" + i11 + i11 + "%" + i11 + i11) + "|" + n10("%[89A-Fa-f]" + i11 + "%" + i11 + i11) + "|" + n10("%" + i11 + i11)), s11 = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", c11 = t10("[\\:\\/\\?\\#\\[\\]\\@]", s11), l11 = e21 ? "[\\uE000-\\uF8FF]" : "[]", u11 = t10(r11, o11, "[\\-\\.\\_\\~]", e21 ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]"); + n10(r11 + t10(r11, o11, "[\\+\\-\\.]") + "*"), n10(n10(a11 + "|" + t10(u11, s11, "[\\:]")) + "*"); + var f11 = n10(n10("25[0-5]") + "|" + n10("2[0-4]" + o11) + "|" + n10("1" + o11 + o11) + "|" + n10("0?[1-9]" + o11) + "|0?0?" + o11), d11 = n10(f11 + "\\." + f11 + "\\." + f11 + "\\." + f11), h11 = n10(i11 + "{1,4}"), v11 = n10(n10(h11 + "\\:" + h11) + "|" + d11), p11 = n10(n10(h11 + "\\:") + "{6}" + v11), m11 = n10("\\:\\:" + n10(h11 + "\\:") + "{5}" + v11), g11 = n10(n10(h11) + "?\\:\\:" + n10(h11 + "\\:") + "{4}" + v11), y11 = n10(n10(n10(h11 + "\\:") + "{0,1}" + h11) + "?\\:\\:" + n10(h11 + "\\:") + "{3}" + v11), b11 = n10(n10(n10(h11 + "\\:") + "{0,2}" + h11) + "?\\:\\:" + n10(h11 + "\\:") + "{2}" + v11), k11 = n10(n10(n10(h11 + "\\:") + "{0,3}" + h11) + "?\\:\\:" + h11 + "\\:" + v11), w11 = n10(n10(n10(h11 + "\\:") + "{0,4}" + h11) + "?\\:\\:" + v11), x11 = n10(n10(n10(h11 + "\\:") + "{0,5}" + h11) + "?\\:\\:" + h11), j11 = n10(n10(n10(h11 + "\\:") + "{0,6}" + h11) + "?\\:\\:"), S11 = n10([p11, m11, g11, y11, b11, k11, w11, x11, j11].join("|")), C11 = n10(n10(u11 + "|" + a11) + "+"); + n10("[vV]" + i11 + "+\\." + t10(u11, s11, "[\\:]") + "+"), n10(n10(a11 + "|" + t10(u11, s11)) + "*"); + var $11 = n10(a11 + "|" + t10(u11, s11, "[\\:\\@]")); + return n10(n10(a11 + "|" + t10(u11, s11, "[\\@]")) + "+"), n10(n10($11 + "|" + t10("[\\/\\?]", l11)) + "*"), { NOT_SCHEME: new RegExp(t10("[^]", r11, o11, "[\\+\\-\\.]"), "g"), NOT_USERINFO: new RegExp(t10("[^\\%\\:]", u11, s11), "g"), NOT_HOST: new RegExp(t10("[^\\%\\[\\]\\:]", u11, s11), "g"), NOT_PATH: new RegExp(t10("[^\\%\\/\\:\\@]", u11, s11), "g"), NOT_PATH_NOSCHEME: new RegExp(t10("[^\\%\\/\\@]", u11, s11), "g"), NOT_QUERY: new RegExp(t10("[^\\%]", u11, s11, "[\\:\\@\\/\\?]", l11), "g"), NOT_FRAGMENT: new RegExp(t10("[^\\%]", u11, s11, "[\\:\\@\\/\\?]"), "g"), ESCAPE: new RegExp(t10("[^]", u11, s11), "g"), UNRESERVED: new RegExp(u11, "g"), OTHER_CHARS: new RegExp(t10("[^\\%]", u11, c11), "g"), PCT_ENCODED: new RegExp(a11, "g"), IPV4ADDRESS: new RegExp("^(" + d11 + ")$"), IPV6ADDRESS: new RegExp("^\\[?(" + S11 + ")" + n10(n10("\\%25|\\%(?!" + i11 + "{2})") + "(" + C11 + ")") + "?\\]?$") }; + } + var c10 = s10(false), l10 = s10(true), u10 = /* @__PURE__ */ function() { + function e21(e23, t11) { + var n11 = [], r11 = true, o11 = false, i11 = void 0; + try { + for (var a11, s11 = e23[Symbol.iterator](); !(r11 = (a11 = s11.next()).done) && (n11.push(a11.value), !t11 || n11.length !== t11); r11 = true) + ; + } catch (e24) { + o11 = true, i11 = e24; + } finally { + try { + !r11 && s11.return && s11.return(); + } finally { + if (o11) + throw i11; + } + } + return n11; + } + return function(t11, n11) { + if (Array.isArray(t11)) + return t11; + if (Symbol.iterator in Object(t11)) + return e21(t11, n11); + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + }; + }(), f10 = function(e21) { + if (Array.isArray(e21)) { + for (var t11 = 0, n11 = Array(e21.length); t11 < e21.length; t11++) + n11[t11] = e21[t11]; + return n11; + } + return Array.from(e21); + }, d10 = 2147483647, h10 = 36, v10 = 1, p10 = 26, m10 = 38, g10 = 700, y10 = 72, b10 = 128, k10 = "-", w10 = /^xn--/, x10 = /[^\0-\x7E]/, j10 = /[\x2E\u3002\uFF0E\uFF61]/g, S10 = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, C10 = h10 - v10, $10 = Math.floor, _10 = String.fromCharCode; + function O10(e21) { + throw new RangeError(S10[e21]); + } + function M10(e21, t11) { + for (var n11 = [], r11 = e21.length; r11--; ) + n11[r11] = t11(e21[r11]); + return n11; + } + function E10(e21, t11) { + var n11 = e21.split("@"), r11 = ""; + return n11.length > 1 && (r11 = n11[0] + "@", e21 = n11[1]), r11 + M10((e21 = e21.replace(j10, ".")).split("."), t11).join("."); + } + function A10(e21) { + for (var t11 = [], n11 = 0, r11 = e21.length; n11 < r11; ) { + var o11 = e21.charCodeAt(n11++); + if (o11 >= 55296 && o11 <= 56319 && n11 < r11) { + var i11 = e21.charCodeAt(n11++); + 56320 == (64512 & i11) ? t11.push(((1023 & o11) << 10) + (1023 & i11) + 65536) : (t11.push(o11), n11--); + } else + t11.push(o11); + } + return t11; + } + var P10 = function(e21) { + return String.fromCodePoint.apply(String, f10(e21)); + }, T8 = function(e21) { + return e21 - 48 < 10 ? e21 - 22 : e21 - 65 < 26 ? e21 - 65 : e21 - 97 < 26 ? e21 - 97 : h10; + }, R8 = function(e21, t11) { + return e21 + 22 + 75 * (e21 < 26) - ((0 != t11) << 5); + }, N8 = function(e21, t11, n11) { + var r11 = 0; + for (e21 = n11 ? $10(e21 / g10) : e21 >> 1, e21 += $10(e21 / t11); e21 > C10 * p10 >> 1; r11 += h10) + e21 = $10(e21 / C10); + return $10(r11 + (C10 + 1) * e21 / (e21 + m10)); + }, I10 = function(e21) { + var t11 = [], n11 = e21.length, r11 = 0, o11 = b10, i11 = y10, a11 = e21.lastIndexOf(k10); + a11 < 0 && (a11 = 0); + for (var s11 = 0; s11 < a11; ++s11) + e21.charCodeAt(s11) >= 128 && O10("not-basic"), t11.push(e21.charCodeAt(s11)); + for (var c11 = a11 > 0 ? a11 + 1 : 0; c11 < n11; ) { + for (var l11 = r11, u11 = 1, f11 = h10; ; f11 += h10) { + c11 >= n11 && O10("invalid-input"); + var m11 = T8(e21.charCodeAt(c11++)); + (m11 >= h10 || m11 > $10((d10 - r11) / u11)) && O10("overflow"), r11 += m11 * u11; + var g11 = f11 <= i11 ? v10 : f11 >= i11 + p10 ? p10 : f11 - i11; + if (m11 < g11) + break; + var w11 = h10 - g11; + u11 > $10(d10 / w11) && O10("overflow"), u11 *= w11; + } + var x11 = t11.length + 1; + i11 = N8(r11 - l11, x11, 0 == l11), $10(r11 / x11) > d10 - o11 && O10("overflow"), o11 += $10(r11 / x11), r11 %= x11, t11.splice(r11++, 0, o11); + } + return String.fromCodePoint.apply(String, t11); + }, D10 = function(e21) { + var t11 = [], n11 = (e21 = A10(e21)).length, r11 = b10, o11 = 0, i11 = y10, a11 = true, s11 = false, c11 = void 0; + try { + for (var l11, u11 = e21[Symbol.iterator](); !(a11 = (l11 = u11.next()).done); a11 = true) { + var f11 = l11.value; + f11 < 128 && t11.push(_10(f11)); + } + } catch (e23) { + s11 = true, c11 = e23; + } finally { + try { + !a11 && u11.return && u11.return(); + } finally { + if (s11) + throw c11; + } + } + var m11 = t11.length, g11 = m11; + for (m11 && t11.push(k10); g11 < n11; ) { + var w11 = d10, x11 = true, j11 = false, S11 = void 0; + try { + for (var C11, M11 = e21[Symbol.iterator](); !(x11 = (C11 = M11.next()).done); x11 = true) { + var E11 = C11.value; + E11 >= r11 && E11 < w11 && (w11 = E11); + } + } catch (e23) { + j11 = true, S11 = e23; + } finally { + try { + !x11 && M11.return && M11.return(); + } finally { + if (j11) + throw S11; + } + } + var P11 = g11 + 1; + w11 - r11 > $10((d10 - o11) / P11) && O10("overflow"), o11 += (w11 - r11) * P11, r11 = w11; + var T10 = true, I11 = false, D11 = void 0; + try { + for (var q11, z11 = e21[Symbol.iterator](); !(T10 = (q11 = z11.next()).done); T10 = true) { + var B11 = q11.value; + if (B11 < r11 && ++o11 > d10 && O10("overflow"), B11 == r11) { + for (var L11 = o11, F11 = h10; ; F11 += h10) { + var V11 = F11 <= i11 ? v10 : F11 >= i11 + p10 ? p10 : F11 - i11; + if (L11 < V11) + break; + var H11 = L11 - V11, W11 = h10 - V11; + t11.push(_10(R8(V11 + H11 % W11, 0))), L11 = $10(H11 / W11); + } + t11.push(_10(R8(L11, 0))), i11 = N8(o11, P11, g11 == m11), o11 = 0, ++g11; + } + } + } catch (e23) { + I11 = true, D11 = e23; + } finally { + try { + !T10 && z11.return && z11.return(); + } finally { + if (I11) + throw D11; + } + } + ++o11, ++r11; + } + return t11.join(""); + }, q10 = function(e21) { + return E10(e21, function(e23) { + return w10.test(e23) ? I10(e23.slice(4).toLowerCase()) : e23; + }); + }, z10 = function(e21) { + return E10(e21, function(e23) { + return x10.test(e23) ? "xn--" + D10(e23) : e23; + }); + }, B10 = { version: "2.1.0", ucs2: { decode: A10, encode: P10 }, decode: I10, encode: D10, toASCII: z10, toUnicode: q10 }, L10 = {}; + function F10(e21) { + var t11 = e21.charCodeAt(0); + return t11 < 16 ? "%0" + t11.toString(16).toUpperCase() : t11 < 128 ? "%" + t11.toString(16).toUpperCase() : t11 < 2048 ? "%" + (t11 >> 6 | 192).toString(16).toUpperCase() + "%" + (63 & t11 | 128).toString(16).toUpperCase() : "%" + (t11 >> 12 | 224).toString(16).toUpperCase() + "%" + (t11 >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (63 & t11 | 128).toString(16).toUpperCase(); + } + function V10(e21) { + for (var t11 = "", n11 = 0, r11 = e21.length; n11 < r11; ) { + var o11 = parseInt(e21.substr(n11 + 1, 2), 16); + if (o11 < 128) + t11 += String.fromCharCode(o11), n11 += 3; + else if (o11 >= 194 && o11 < 224) { + if (r11 - n11 >= 6) { + var i11 = parseInt(e21.substr(n11 + 4, 2), 16); + t11 += String.fromCharCode((31 & o11) << 6 | 63 & i11); + } else + t11 += e21.substr(n11, 6); + n11 += 6; + } else if (o11 >= 224) { + if (r11 - n11 >= 9) { + var a11 = parseInt(e21.substr(n11 + 4, 2), 16), s11 = parseInt(e21.substr(n11 + 7, 2), 16); + t11 += String.fromCharCode((15 & o11) << 12 | (63 & a11) << 6 | 63 & s11); + } else + t11 += e21.substr(n11, 9); + n11 += 9; + } else + t11 += e21.substr(n11, 3), n11 += 3; + } + return t11; + } + function H10(e21, t11) { + function n11(e23) { + var n12 = V10(e23); + return n12.match(t11.UNRESERVED) ? n12 : e23; + } + return e21.scheme && (e21.scheme = String(e21.scheme).replace(t11.PCT_ENCODED, n11).toLowerCase().replace(t11.NOT_SCHEME, "")), void 0 !== e21.userinfo && (e21.userinfo = String(e21.userinfo).replace(t11.PCT_ENCODED, n11).replace(t11.NOT_USERINFO, F10).replace(t11.PCT_ENCODED, o10)), void 0 !== e21.host && (e21.host = String(e21.host).replace(t11.PCT_ENCODED, n11).toLowerCase().replace(t11.NOT_HOST, F10).replace(t11.PCT_ENCODED, o10)), void 0 !== e21.path && (e21.path = String(e21.path).replace(t11.PCT_ENCODED, n11).replace(e21.scheme ? t11.NOT_PATH : t11.NOT_PATH_NOSCHEME, F10).replace(t11.PCT_ENCODED, o10)), void 0 !== e21.query && (e21.query = String(e21.query).replace(t11.PCT_ENCODED, n11).replace(t11.NOT_QUERY, F10).replace(t11.PCT_ENCODED, o10)), void 0 !== e21.fragment && (e21.fragment = String(e21.fragment).replace(t11.PCT_ENCODED, n11).replace(t11.NOT_FRAGMENT, F10).replace(t11.PCT_ENCODED, o10)), e21; + } + function W10(e21) { + return e21.replace(/^0*(.*)/, "$1") || "0"; + } + function U10(e21, t11) { + var n11 = e21.match(t11.IPV4ADDRESS) || [], r11 = u10(n11, 2)[1]; + return r11 ? r11.split(".").map(W10).join(".") : e21; + } + function J10(e21, t11) { + var n11 = e21.match(t11.IPV6ADDRESS) || [], r11 = u10(n11, 3), o11 = r11[1], i11 = r11[2]; + if (o11) { + for (var a11 = o11.toLowerCase().split("::").reverse(), s11 = u10(a11, 2), c11 = s11[0], l11 = s11[1], f11 = l11 ? l11.split(":").map(W10) : [], d11 = c11.split(":").map(W10), h11 = t11.IPV4ADDRESS.test(d11[d11.length - 1]), v11 = h11 ? 7 : 8, p11 = d11.length - v11, m11 = Array(v11), g11 = 0; g11 < v11; ++g11) + m11[g11] = f11[g11] || d11[p11 + g11] || ""; + h11 && (m11[v11 - 1] = U10(m11[v11 - 1], t11)); + var y11 = m11.reduce(function(e23, t12, n12) { + if (!t12 || "0" === t12) { + var r12 = e23[e23.length - 1]; + r12 && r12.index + r12.length === n12 ? r12.length++ : e23.push({ index: n12, length: 1 }); + } + return e23; + }, []).sort(function(e23, t12) { + return t12.length - e23.length; + })[0], b11 = void 0; + if (y11 && y11.length > 1) { + var k11 = m11.slice(0, y11.index), w11 = m11.slice(y11.index + y11.length); + b11 = k11.join(":") + "::" + w11.join(":"); + } else + b11 = m11.join(":"); + return i11 && (b11 += "%" + i11), b11; + } + return e21; + } + var K10 = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, G10 = void 0 === "".match(/(){0}/)[1]; + function Q10(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n11 = {}, r11 = false !== t11.iri ? l10 : c10; + "suffix" === t11.reference && (e21 = (t11.scheme ? t11.scheme + ":" : "") + "//" + e21); + var o11 = e21.match(K10); + if (o11) { + G10 ? (n11.scheme = o11[1], n11.userinfo = o11[3], n11.host = o11[4], n11.port = parseInt(o11[5], 10), n11.path = o11[6] || "", n11.query = o11[7], n11.fragment = o11[8], isNaN(n11.port) && (n11.port = o11[5])) : (n11.scheme = o11[1] || void 0, n11.userinfo = -1 !== e21.indexOf("@") ? o11[3] : void 0, n11.host = -1 !== e21.indexOf("//") ? o11[4] : void 0, n11.port = parseInt(o11[5], 10), n11.path = o11[6] || "", n11.query = -1 !== e21.indexOf("?") ? o11[7] : void 0, n11.fragment = -1 !== e21.indexOf("#") ? o11[8] : void 0, isNaN(n11.port) && (n11.port = e21.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? o11[4] : void 0)), n11.host && (n11.host = J10(U10(n11.host, r11), r11)), void 0 !== n11.scheme || void 0 !== n11.userinfo || void 0 !== n11.host || void 0 !== n11.port || n11.path || void 0 !== n11.query ? void 0 === n11.scheme ? n11.reference = "relative" : void 0 === n11.fragment ? n11.reference = "absolute" : n11.reference = "uri" : n11.reference = "same-document", t11.reference && "suffix" !== t11.reference && t11.reference !== n11.reference && (n11.error = n11.error || "URI is not a " + t11.reference + " reference."); + var i11 = L10[(t11.scheme || n11.scheme || "").toLowerCase()]; + if (t11.unicodeSupport || i11 && i11.unicodeSupport) + H10(n11, r11); + else { + if (n11.host && (t11.domainHost || i11 && i11.domainHost)) + try { + n11.host = B10.toASCII(n11.host.replace(r11.PCT_ENCODED, V10).toLowerCase()); + } catch (e23) { + n11.error = n11.error || "Host's domain name can not be converted to ASCII via punycode: " + e23; + } + H10(n11, c10); + } + i11 && i11.parse && i11.parse(n11, t11); + } else + n11.error = n11.error || "URI can not be parsed."; + return n11; + } + function Y10(e21, t11) { + var n11 = false !== t11.iri ? l10 : c10, r11 = []; + return void 0 !== e21.userinfo && (r11.push(e21.userinfo), r11.push("@")), void 0 !== e21.host && r11.push(J10(U10(String(e21.host), n11), n11).replace(n11.IPV6ADDRESS, function(e23, t12, n12) { + return "[" + t12 + (n12 ? "%25" + n12 : "") + "]"; + })), "number" != typeof e21.port && "string" != typeof e21.port || (r11.push(":"), r11.push(String(e21.port))), r11.length ? r11.join("") : void 0; + } + var X10 = /^\.\.?\//, Z10 = /^\/\.(\/|$)/, ee2 = /^\/\.\.(\/|$)/, te2 = /^\/?(?:.|\n)*?(?=\/|$)/; + function ne2(e21) { + for (var t11 = []; e21.length; ) + if (e21.match(X10)) + e21 = e21.replace(X10, ""); + else if (e21.match(Z10)) + e21 = e21.replace(Z10, "/"); + else if (e21.match(ee2)) + e21 = e21.replace(ee2, "/"), t11.pop(); + else if ("." === e21 || ".." === e21) + e21 = ""; + else { + var n11 = e21.match(te2); + if (!n11) + throw new Error("Unexpected dot segment condition"); + var r11 = n11[0]; + e21 = e21.slice(r11.length), t11.push(r11); + } + return t11.join(""); + } + function re2(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n11 = t11.iri ? l10 : c10, r11 = [], o11 = L10[(t11.scheme || e21.scheme || "").toLowerCase()]; + if (o11 && o11.serialize && o11.serialize(e21, t11), e21.host) { + if (n11.IPV6ADDRESS.test(e21.host)) + ; + else if (t11.domainHost || o11 && o11.domainHost) + try { + e21.host = t11.iri ? B10.toUnicode(e21.host) : B10.toASCII(e21.host.replace(n11.PCT_ENCODED, V10).toLowerCase()); + } catch (n12) { + e21.error = e21.error || "Host's domain name can not be converted to " + (t11.iri ? "Unicode" : "ASCII") + " via punycode: " + n12; + } + } + H10(e21, n11), "suffix" !== t11.reference && e21.scheme && (r11.push(e21.scheme), r11.push(":")); + var i11 = Y10(e21, t11); + if (void 0 !== i11 && ("suffix" !== t11.reference && r11.push("//"), r11.push(i11), e21.path && "/" !== e21.path.charAt(0) && r11.push("/")), void 0 !== e21.path) { + var a11 = e21.path; + t11.absolutePath || o11 && o11.absolutePath || (a11 = ne2(a11)), void 0 === i11 && (a11 = a11.replace(/^\/\//, "/%2F")), r11.push(a11); + } + return void 0 !== e21.query && (r11.push("?"), r11.push(e21.query)), void 0 !== e21.fragment && (r11.push("#"), r11.push(e21.fragment)), r11.join(""); + } + function oe2(e21, t11) { + var n11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, r11 = {}; + return arguments[3] || (e21 = Q10(re2(e21, n11), n11), t11 = Q10(re2(t11, n11), n11)), !(n11 = n11 || {}).tolerant && t11.scheme ? (r11.scheme = t11.scheme, r11.userinfo = t11.userinfo, r11.host = t11.host, r11.port = t11.port, r11.path = ne2(t11.path || ""), r11.query = t11.query) : (void 0 !== t11.userinfo || void 0 !== t11.host || void 0 !== t11.port ? (r11.userinfo = t11.userinfo, r11.host = t11.host, r11.port = t11.port, r11.path = ne2(t11.path || ""), r11.query = t11.query) : (t11.path ? ("/" === t11.path.charAt(0) ? r11.path = ne2(t11.path) : (void 0 === e21.userinfo && void 0 === e21.host && void 0 === e21.port || e21.path ? e21.path ? r11.path = e21.path.slice(0, e21.path.lastIndexOf("/") + 1) + t11.path : r11.path = t11.path : r11.path = "/" + t11.path, r11.path = ne2(r11.path)), r11.query = t11.query) : (r11.path = e21.path, void 0 !== t11.query ? r11.query = t11.query : r11.query = e21.query), r11.userinfo = e21.userinfo, r11.host = e21.host, r11.port = e21.port), r11.scheme = e21.scheme), r11.fragment = t11.fragment, r11; + } + function ie2(e21, t11, n11) { + var r11 = a10({ scheme: "null" }, n11); + return re2(oe2(Q10(e21, r11), Q10(t11, r11), r11, true), r11); + } + function ae2(e21, t11) { + return "string" == typeof e21 ? e21 = re2(Q10(e21, t11), t11) : "object" === r10(e21) && (e21 = Q10(re2(e21, t11), t11)), e21; + } + function se2(e21, t11, n11) { + return "string" == typeof e21 ? e21 = re2(Q10(e21, n11), n11) : "object" === r10(e21) && (e21 = re2(e21, n11)), "string" == typeof t11 ? t11 = re2(Q10(t11, n11), n11) : "object" === r10(t11) && (t11 = re2(t11, n11)), e21 === t11; + } + function ce2(e21, t11) { + return e21 && e21.toString().replace(t11 && t11.iri ? l10.ESCAPE : c10.ESCAPE, F10); + } + function le2(e21, t11) { + return e21 && e21.toString().replace(t11 && t11.iri ? l10.PCT_ENCODED : c10.PCT_ENCODED, V10); + } + var ue2 = { scheme: "http", domainHost: true, parse: function(e21, t11) { + return e21.host || (e21.error = e21.error || "HTTP URIs must have a host."), e21; + }, serialize: function(e21, t11) { + var n11 = "https" === String(e21.scheme).toLowerCase(); + return e21.port !== (n11 ? 443 : 80) && "" !== e21.port || (e21.port = void 0), e21.path || (e21.path = "/"), e21; + } }, fe2 = { scheme: "https", domainHost: ue2.domainHost, parse: ue2.parse, serialize: ue2.serialize }; + function de2(e21) { + return "boolean" == typeof e21.secure ? e21.secure : "wss" === String(e21.scheme).toLowerCase(); + } + var he2 = { scheme: "ws", domainHost: true, parse: function(e21, t11) { + var n11 = e21; + return n11.secure = de2(n11), n11.resourceName = (n11.path || "/") + (n11.query ? "?" + n11.query : ""), n11.path = void 0, n11.query = void 0, n11; + }, serialize: function(e21, t11) { + if (e21.port !== (de2(e21) ? 443 : 80) && "" !== e21.port || (e21.port = void 0), "boolean" == typeof e21.secure && (e21.scheme = e21.secure ? "wss" : "ws", e21.secure = void 0), e21.resourceName) { + var n11 = e21.resourceName.split("?"), r11 = u10(n11, 2), o11 = r11[0], i11 = r11[1]; + e21.path = o11 && "/" !== o11 ? o11 : void 0, e21.query = i11, e21.resourceName = void 0; + } + return e21.fragment = void 0, e21; + } }, ve2 = { scheme: "wss", domainHost: he2.domainHost, parse: he2.parse, serialize: he2.serialize }, pe2 = {}, me2 = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", ge2 = "[0-9A-Fa-f]", ye2 = n10(n10("%[EFef]" + ge2 + "%" + ge2 + ge2 + "%" + ge2 + ge2) + "|" + n10("%[89A-Fa-f]" + ge2 + "%" + ge2 + ge2) + "|" + n10("%" + ge2 + ge2)), be2 = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", ke2 = t10("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", '[\\"\\\\]'), we2 = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", xe2 = new RegExp(me2, "g"), je2 = new RegExp(ye2, "g"), Se2 = new RegExp(t10("[^]", be2, "[\\.]", '[\\"]', ke2), "g"), Ce2 = new RegExp(t10("[^]", me2, we2), "g"), $e2 = Ce2; + function _e2(e21) { + var t11 = V10(e21); + return t11.match(xe2) ? t11 : e21; + } + var Oe2 = { scheme: "mailto", parse: function(e21, t11) { + var n11 = e21, r11 = n11.to = n11.path ? n11.path.split(",") : []; + if (n11.path = void 0, n11.query) { + for (var o11 = false, i11 = {}, a11 = n11.query.split("&"), s11 = 0, c11 = a11.length; s11 < c11; ++s11) { + var l11 = a11[s11].split("="); + switch (l11[0]) { + case "to": + for (var u11 = l11[1].split(","), f11 = 0, d11 = u11.length; f11 < d11; ++f11) + r11.push(u11[f11]); + break; + case "subject": + n11.subject = le2(l11[1], t11); + break; + case "body": + n11.body = le2(l11[1], t11); + break; + default: + o11 = true, i11[le2(l11[0], t11)] = le2(l11[1], t11); + } + } + o11 && (n11.headers = i11); + } + n11.query = void 0; + for (var h11 = 0, v11 = r11.length; h11 < v11; ++h11) { + var p11 = r11[h11].split("@"); + if (p11[0] = le2(p11[0]), t11.unicodeSupport) + p11[1] = le2(p11[1], t11).toLowerCase(); + else + try { + p11[1] = B10.toASCII(le2(p11[1], t11).toLowerCase()); + } catch (e23) { + n11.error = n11.error || "Email address's domain name can not be converted to ASCII via punycode: " + e23; + } + r11[h11] = p11.join("@"); + } + return n11; + }, serialize: function(e21, t11) { + var n11 = e21, r11 = i10(e21.to); + if (r11) { + for (var a11 = 0, s11 = r11.length; a11 < s11; ++a11) { + var c11 = String(r11[a11]), l11 = c11.lastIndexOf("@"), u11 = c11.slice(0, l11).replace(je2, _e2).replace(je2, o10).replace(Se2, F10), f11 = c11.slice(l11 + 1); + try { + f11 = t11.iri ? B10.toUnicode(f11) : B10.toASCII(le2(f11, t11).toLowerCase()); + } catch (e23) { + n11.error = n11.error || "Email address's domain name can not be converted to " + (t11.iri ? "Unicode" : "ASCII") + " via punycode: " + e23; + } + r11[a11] = u11 + "@" + f11; + } + n11.path = r11.join(","); + } + var d11 = e21.headers = e21.headers || {}; + e21.subject && (d11.subject = e21.subject), e21.body && (d11.body = e21.body); + var h11 = []; + for (var v11 in d11) + d11[v11] !== pe2[v11] && h11.push(v11.replace(je2, _e2).replace(je2, o10).replace(Ce2, F10) + "=" + d11[v11].replace(je2, _e2).replace(je2, o10).replace($e2, F10)); + return h11.length && (n11.query = h11.join("&")), n11; + } }, Me2 = /^([^\:]+)\:(.*)/, Ee2 = { scheme: "urn", parse: function(e21, t11) { + var n11 = e21.path && e21.path.match(Me2), r11 = e21; + if (n11) { + var o11 = t11.scheme || r11.scheme || "urn", i11 = n11[1].toLowerCase(), a11 = n11[2], s11 = o11 + ":" + (t11.nid || i11), c11 = L10[s11]; + r11.nid = i11, r11.nss = a11, r11.path = void 0, c11 && (r11 = c11.parse(r11, t11)); + } else + r11.error = r11.error || "URN can not be parsed."; + return r11; + }, serialize: function(e21, t11) { + var n11 = t11.scheme || e21.scheme || "urn", r11 = e21.nid, o11 = n11 + ":" + (t11.nid || r11), i11 = L10[o11]; + i11 && (e21 = i11.serialize(e21, t11)); + var a11 = e21, s11 = e21.nss; + return a11.path = (r11 || t11.nid) + ":" + s11, a11; + } }, Ae2 = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Pe2 = { scheme: "urn:uuid", parse: function(e21, t11) { + var n11 = e21; + return n11.uuid = n11.nss, n11.nss = void 0, t11.tolerant || n11.uuid && n11.uuid.match(Ae2) || (n11.error = n11.error || "UUID is not valid."), n11; + }, serialize: function(e21, t11) { + var n11 = e21; + return n11.nss = (e21.uuid || "").toLowerCase(), n11; + } }; + L10[ue2.scheme] = ue2, L10[fe2.scheme] = fe2, L10[he2.scheme] = he2, L10[ve2.scheme] = ve2, L10[Oe2.scheme] = Oe2, L10[Ee2.scheme] = Ee2, L10[Pe2.scheme] = Pe2, e20.SCHEMES = L10, e20.pctEncChar = F10, e20.pctDecChars = V10, e20.parse = Q10, e20.removeDotSegments = ne2, e20.serialize = re2, e20.resolveComponents = oe2, e20.resolve = ie2, e20.normalize = ae2, e20.equal = se2, e20.escapeComponent = ce2, e20.unescapeComponent = le2, Object.defineProperty(e20, "__esModule", { value: true }); + }(c6.exports); + var l6 = c6.exports; + Object.defineProperty(s6, "__esModule", { value: true }); + var u6 = l6; + u6.code = 'require("ajv/dist/runtime/uri").default', s6.default = u6, function(e20) { + Object.defineProperty(e20, "__esModule", { value: true }), e20.CodeGen = e20.Name = e20.nil = e20.stringify = e20.str = e20._ = e20.KeywordCxt = void 0; + var t10 = q5(); + Object.defineProperty(e20, "KeywordCxt", { enumerable: true, get: function() { + return t10.KeywordCxt; + } }); + var n10 = G8(); + Object.defineProperty(e20, "_", { enumerable: true, get: function() { + return n10._; + } }), Object.defineProperty(e20, "str", { enumerable: true, get: function() { + return n10.str; + } }), Object.defineProperty(e20, "stringify", { enumerable: true, get: function() { + return n10.stringify; + } }), Object.defineProperty(e20, "nil", { enumerable: true, get: function() { + return n10.nil; + } }), Object.defineProperty(e20, "Name", { enumerable: true, get: function() { + return n10.Name; + } }), Object.defineProperty(e20, "CodeGen", { enumerable: true, get: function() { + return n10.CodeGen; + } }); + var r10 = L5(), o10 = H5(), i10 = o5, a10 = W5, s10 = G8(), c10 = b5, l10 = r5, u10 = Q8, f10 = a6, d10 = s6, h10 = function(e21, t11) { + return new RegExp(e21, t11); + }; + h10.code = "new RegExp"; + var v10 = ["removeAdditional", "useDefaults", "coerceTypes"], p10 = /* @__PURE__ */ new Set(["validate", "serialize", "parse", "wrapper", "root", "schema", "keyword", "pattern", "formats", "validate$data", "func", "obj", "Error"]), m10 = { errorDataPath: "", format: "`validateFormats: false` can be used instead.", nullable: '"nullable" keyword is supported by default.', jsonPointers: "Deprecated jsPropertySyntax can be used instead.", extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", sourceCode: "Use option `code: {source: true}`", strictDefaults: "It is default now, see option `strict`.", strictKeywords: "It is default now, see option `strict`.", uniqueItems: '"uniqueItems" keyword is always validated.', unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", cache: "Map is used as cache, schema object as key.", serialize: "Map is used as cache, schema object as key.", ajvErrors: "It is default now." }, g10 = { ignoreKeywordsWithRef: "", jsPropertySyntax: "", unicode: '"minLength"/"maxLength" account for unicode characters by default.' }; + var y10 = function() { + function e21() { + var t11 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + No(this, e21), this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), t11 = this.opts = Ro(Ro({}, t11), function(e23) { + var t12, n12, r12, o12, i11, a12, s11, c11, l11, u11, f11, v11, p11, m11, g11, y11, b11, k11, w11, x11, j11, S11, C11, $11, _11, O11 = e23.strict, M11 = null === (t12 = e23.code) || void 0 === t12 ? void 0 : t12.optimize, E11 = true === M11 || void 0 === M11 ? 1 : M11 || 0, A11 = null !== (r12 = null === (n12 = e23.code) || void 0 === n12 ? void 0 : n12.regExp) && void 0 !== r12 ? r12 : h10, P11 = null !== (o12 = e23.uriResolver) && void 0 !== o12 ? o12 : d10.default; + return { strictSchema: null === (a12 = null !== (i11 = e23.strictSchema) && void 0 !== i11 ? i11 : O11) || void 0 === a12 || a12, strictNumbers: null === (c11 = null !== (s11 = e23.strictNumbers) && void 0 !== s11 ? s11 : O11) || void 0 === c11 || c11, strictTypes: null !== (u11 = null !== (l11 = e23.strictTypes) && void 0 !== l11 ? l11 : O11) && void 0 !== u11 ? u11 : "log", strictTuples: null !== (v11 = null !== (f11 = e23.strictTuples) && void 0 !== f11 ? f11 : O11) && void 0 !== v11 ? v11 : "log", strictRequired: null !== (m11 = null !== (p11 = e23.strictRequired) && void 0 !== p11 ? p11 : O11) && void 0 !== m11 && m11, code: e23.code ? Ro(Ro({}, e23.code), {}, { optimize: E11, regExp: A11 }) : { optimize: E11, regExp: A11 }, loopRequired: null !== (g11 = e23.loopRequired) && void 0 !== g11 ? g11 : 200, loopEnum: null !== (y11 = e23.loopEnum) && void 0 !== y11 ? y11 : 200, meta: null === (b11 = e23.meta) || void 0 === b11 || b11, messages: null === (k11 = e23.messages) || void 0 === k11 || k11, inlineRefs: null === (w11 = e23.inlineRefs) || void 0 === w11 || w11, schemaId: null !== (x11 = e23.schemaId) && void 0 !== x11 ? x11 : "$id", addUsedSchema: null === (j11 = e23.addUsedSchema) || void 0 === j11 || j11, validateSchema: null === (S11 = e23.validateSchema) || void 0 === S11 || S11, validateFormats: null === (C11 = e23.validateFormats) || void 0 === C11 || C11, unicodeRegExp: null === ($11 = e23.unicodeRegExp) || void 0 === $11 || $11, int32range: null === (_11 = e23.int32range) || void 0 === _11 || _11, uriResolver: P11 }; + }(t11)); + var n11 = this.opts.code, r11 = n11.es5, o11 = n11.lines; + this.scope = new s10.ValueScope({ scope: {}, prefixes: p10, es5: r11, lines: o11 }), this.logger = function(e23) { + if (false === e23) + return C10; + if (void 0 === e23) + return console; + if (e23.log && e23.warn && e23.error) + return e23; + throw new Error("logger must implement log, warn and error methods"); + }(t11.logger); + var a11 = t11.validateFormats; + t11.validateFormats = false, this.RULES = (0, i10.getRules)(), b10.call(this, m10, t11, "NOT SUPPORTED"), b10.call(this, g10, t11, "DEPRECATED", "warn"), this._metaOpts = S10.call(this), t11.formats && x10.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), t11.keywords && j10.call(this, t11.keywords), "object" == Ho(t11.meta) && this.addMetaSchema(t11.meta), w10.call(this), t11.validateFormats = a11; + } + return Do(e21, [{ key: "_addVocabularies", value: function() { + this.addKeyword("$async"); + } }, { key: "_addDefaultMetaSchema", value: function() { + var e23 = this.opts, t11 = e23.$data, n11 = e23.meta, r11 = e23.schemaId, o11 = f10; + "id" === r11 && ((o11 = Ro({}, f10)).id = o11.$id, delete o11.$id), n11 && t11 && this.addMetaSchema(o11, o11[r11], false); + } }, { key: "defaultMeta", value: function() { + var e23 = this.opts, t11 = e23.meta, n11 = e23.schemaId; + return this.opts.defaultMeta = "object" == Ho(t11) ? t11[n11] || t11 : void 0; + } }, { key: "validate", value: function(e23, t11) { + var n11; + if ("string" == typeof e23) { + if (!(n11 = this.getSchema(e23))) + throw new Error('no schema with key or ref "'.concat(e23, '"')); + } else + n11 = this.compile(e23); + var r11 = n11(t11); + return "$async" in n11 || (this.errors = n11.errors), r11; + } }, { key: "compile", value: function(e23, t11) { + var n11 = this._addSchema(e23, t11); + return n11.validate || this._compileSchemaEnv(n11); + } }, { key: "compileAsync", value: function(e23, t11) { + if ("function" != typeof this.opts.loadSchema) + throw new Error("options.loadSchema should be a function"); + var n11 = this.opts.loadSchema; + return r11.call(this, e23, t11); + function r11(e24, t12) { + return i11.apply(this, arguments); + } + function i11() { + return (i11 = xo(ko().mark(function e24(t12, n12) { + var r12; + return ko().wrap(function(e25) { + for (; ; ) + switch (e25.prev = e25.next) { + case 0: + return e25.next = 2, a11.call(this, t12.$schema); + case 2: + return r12 = this._addSchema(t12, n12), e25.abrupt("return", r12.validate || c11.call(this, r12)); + case 4: + case "end": + return e25.stop(); + } + }, e24, this); + }))).apply(this, arguments); + } + function a11(e24) { + return s11.apply(this, arguments); + } + function s11() { + return (s11 = xo(ko().mark(function e24(t12) { + return ko().wrap(function(e25) { + for (; ; ) + switch (e25.prev = e25.next) { + case 0: + if (!t12 || this.getSchema(t12)) { + e25.next = 3; + break; + } + return e25.next = 3, r11.call(this, { $ref: t12 }, true); + case 3: + case "end": + return e25.stop(); + } + }, e24, this); + }))).apply(this, arguments); + } + function c11(e24) { + return l11.apply(this, arguments); + } + function l11() { + return (l11 = xo(ko().mark(function e24(t12) { + return ko().wrap(function(e25) { + for (; ; ) + switch (e25.prev = e25.next) { + case 0: + return e25.prev = 0, e25.abrupt("return", this._compileSchemaEnv(t12)); + case 4: + if (e25.prev = 4, e25.t0 = e25.catch(0), e25.t0 instanceof o10.default) { + e25.next = 8; + break; + } + throw e25.t0; + case 8: + return u11.call(this, e25.t0), e25.next = 11, f11.call(this, e25.t0.missingSchema); + case 11: + return e25.abrupt("return", c11.call(this, t12)); + case 12: + case "end": + return e25.stop(); + } + }, e24, this, [[0, 4]]); + }))).apply(this, arguments); + } + function u11(e24) { + var t12 = e24.missingSchema, n12 = e24.missingRef; + if (this.refs[t12]) + throw new Error("AnySchema ".concat(t12, " is loaded but ").concat(n12, " cannot be resolved")); + } + function f11(e24) { + return d11.apply(this, arguments); + } + function d11() { + return d11 = xo(ko().mark(function e24(n12) { + var r12; + return ko().wrap(function(e25) { + for (; ; ) + switch (e25.prev = e25.next) { + case 0: + return e25.next = 2, h11.call(this, n12); + case 2: + if (r12 = e25.sent, this.refs[n12]) { + e25.next = 6; + break; + } + return e25.next = 6, a11.call(this, r12.$schema); + case 6: + this.refs[n12] || this.addSchema(r12, n12, t11); + case 7: + case "end": + return e25.stop(); + } + }, e24, this); + })), d11.apply(this, arguments); + } + function h11(e24) { + return v11.apply(this, arguments); + } + function v11() { + return v11 = xo(ko().mark(function e24(t12) { + var r12; + return ko().wrap(function(e25) { + for (; ; ) + switch (e25.prev = e25.next) { + case 0: + if (!(r12 = this._loading[t12])) { + e25.next = 3; + break; + } + return e25.abrupt("return", r12); + case 3: + return e25.prev = 3, e25.next = 6, this._loading[t12] = n11(t12); + case 6: + return e25.abrupt("return", e25.sent); + case 7: + return e25.prev = 7, delete this._loading[t12], e25.finish(7); + case 10: + case "end": + return e25.stop(); + } + }, e24, this, [[3, , 7, 10]]); + })), v11.apply(this, arguments); + } + } }, { key: "addSchema", value: function(e23, t11, n11) { + var r11, o11 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : this.opts.validateSchema; + if (Array.isArray(e23)) { + var i11, a11 = bo(e23); + try { + for (a11.s(); !(i11 = a11.n()).done; ) { + var s11 = i11.value; + this.addSchema(s11, void 0, n11, o11); + } + } catch (e24) { + a11.e(e24); + } finally { + a11.f(); + } + return this; + } + if ("object" === Ho(e23)) { + var l11 = this.opts.schemaId; + if (void 0 !== (r11 = e23[l11]) && "string" != typeof r11) + throw new Error("schema ".concat(l11, " must be string")); + } + return t11 = (0, c10.normalizeId)(t11 || r11), this._checkUnique(t11), this.schemas[t11] = this._addSchema(e23, n11, t11, o11, true), this; + } }, { key: "addMetaSchema", value: function(e23, t11) { + var n11 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.opts.validateSchema; + return this.addSchema(e23, t11, true, n11), this; + } }, { key: "validateSchema", value: function(e23, t11) { + if ("boolean" == typeof e23) + return true; + var n11; + if (void 0 !== (n11 = e23.$schema) && "string" != typeof n11) + throw new Error("$schema must be a string"); + if (!(n11 = n11 || this.opts.defaultMeta || this.defaultMeta())) + return this.logger.warn("meta-schema not available"), this.errors = null, true; + var r11 = this.validate(n11, e23); + if (!r11 && t11) { + var o11 = "schema is invalid: " + this.errorsText(); + if ("log" !== this.opts.validateSchema) + throw new Error(o11); + this.logger.error(o11); + } + return r11; + } }, { key: "getSchema", value: function(e23) { + for (var t11; "string" == typeof (t11 = k10.call(this, e23)); ) + e23 = t11; + if (void 0 === t11) { + var n11 = this.opts.schemaId, r11 = new a10.SchemaEnv({ schema: {}, schemaId: n11 }); + if (!(t11 = a10.resolveSchema.call(this, r11, e23))) + return; + this.refs[e23] = t11; + } + return t11.validate || this._compileSchemaEnv(t11); + } }, { key: "removeSchema", value: function(e23) { + if (e23 instanceof RegExp) + return this._removeAllSchemas(this.schemas, e23), this._removeAllSchemas(this.refs, e23), this; + switch (Ho(e23)) { + case "undefined": + return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this; + case "string": + var t11 = k10.call(this, e23); + return "object" == Ho(t11) && this._cache.delete(t11.schema), delete this.schemas[e23], delete this.refs[e23], this; + case "object": + var n11 = e23; + this._cache.delete(n11); + var r11 = e23[this.opts.schemaId]; + return r11 && (r11 = (0, c10.normalizeId)(r11), delete this.schemas[r11], delete this.refs[r11]), this; + default: + throw new Error("ajv.removeSchema: invalid parameter"); + } + } }, { key: "addVocabulary", value: function(e23) { + var t11, n11 = bo(e23); + try { + for (n11.s(); !(t11 = n11.n()).done; ) { + var r11 = t11.value; + this.addKeyword(r11); + } + } catch (e24) { + n11.e(e24); + } finally { + n11.f(); + } + return this; + } }, { key: "addKeyword", value: function(e23, t11) { + var n11, r11 = this; + if ("string" == typeof e23) + n11 = e23, "object" == Ho(t11) && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), t11.keyword = n11); + else { + if ("object" != Ho(e23) || void 0 !== t11) + throw new Error("invalid addKeywords parameters"); + if (n11 = (t11 = e23).keyword, Array.isArray(n11) && !n11.length) + throw new Error("addKeywords: keyword must be string or non-empty array"); + } + if (_10.call(this, n11, t11), !t11) + return (0, u10.eachItem)(n11, function(e24) { + return O10.call(r11, e24); + }), this; + E10.call(this, t11); + var o11 = Ro(Ro({}, t11), {}, { type: (0, l10.getJSONTypes)(t11.type), schemaType: (0, l10.getJSONTypes)(t11.schemaType) }); + return (0, u10.eachItem)(n11, 0 === o11.type.length ? function(e24) { + return O10.call(r11, e24, o11); + } : function(e24) { + return o11.type.forEach(function(t12) { + return O10.call(r11, e24, o11, t12); + }); + }), this; + } }, { key: "getKeyword", value: function(e23) { + var t11 = this.RULES.all[e23]; + return "object" == Ho(t11) ? t11.definition : !!t11; + } }, { key: "removeKeyword", value: function(e23) { + var t11 = this.RULES; + delete t11.keywords[e23], delete t11.all[e23]; + var n11, r11 = bo(t11.rules); + try { + for (r11.s(); !(n11 = r11.n()).done; ) { + var o11 = n11.value, i11 = o11.rules.findIndex(function(t12) { + return t12.keyword === e23; + }); + i11 >= 0 && o11.rules.splice(i11, 1); + } + } catch (e24) { + r11.e(e24); + } finally { + r11.f(); + } + return this; + } }, { key: "addFormat", value: function(e23, t11) { + return "string" == typeof t11 && (t11 = new RegExp(t11)), this.formats[e23] = t11, this; + } }, { key: "errorsText", value: function() { + var e23 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.errors, t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n11 = t11.separator, r11 = void 0 === n11 ? ", " : n11, o11 = t11.dataVar, i11 = void 0 === o11 ? "data" : o11; + return e23 && 0 !== e23.length ? e23.map(function(e24) { + return "".concat(i11).concat(e24.instancePath, " ").concat(e24.message); + }).reduce(function(e24, t12) { + return e24 + r11 + t12; + }) : "No errors"; + } }, { key: "$dataMetaSchema", value: function(e23, t11) { + var n11 = this.RULES.all; + e23 = JSON.parse(JSON.stringify(e23)); + var r11, o11 = bo(t11); + try { + for (o11.s(); !(r11 = o11.n()).done; ) { + var i11, a11 = r11.value.split("/").slice(1), s11 = e23, c11 = bo(a11); + try { + for (c11.s(); !(i11 = c11.n()).done; ) { + s11 = s11[i11.value]; + } + } catch (e24) { + c11.e(e24); + } finally { + c11.f(); + } + for (var l11 in n11) { + var u11 = n11[l11]; + if ("object" == Ho(u11)) { + var f11 = u11.definition.$data, d11 = s11[l11]; + f11 && d11 && (s11[l11] = P10(d11)); + } + } + } + } catch (e24) { + o11.e(e24); + } finally { + o11.f(); + } + return e23; + } }, { key: "_removeAllSchemas", value: function(e23, t11) { + for (var n11 in e23) { + var r11 = e23[n11]; + t11 && !t11.test(n11) || ("string" == typeof r11 ? delete e23[n11] : r11 && !r11.meta && (this._cache.delete(r11.schema), delete e23[n11])); + } + } }, { key: "_addSchema", value: function(e23, t11, n11) { + var r11, o11 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : this.opts.validateSchema, i11 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : this.opts.addUsedSchema, s11 = this.opts.schemaId; + if ("object" == Ho(e23)) + r11 = e23[s11]; + else { + if (this.opts.jtd) + throw new Error("schema must be object"); + if ("boolean" != typeof e23) + throw new Error("schema must be object or boolean"); + } + var l11 = this._cache.get(e23); + if (void 0 !== l11) + return l11; + n11 = (0, c10.normalizeId)(r11 || n11); + var u11 = c10.getSchemaRefs.call(this, e23, n11); + return l11 = new a10.SchemaEnv({ schema: e23, schemaId: s11, meta: t11, baseId: n11, localRefs: u11 }), this._cache.set(l11.schema, l11), i11 && !n11.startsWith("#") && (n11 && this._checkUnique(n11), this.refs[n11] = l11), o11 && this.validateSchema(e23, true), l11; + } }, { key: "_checkUnique", value: function(e23) { + if (this.schemas[e23] || this.refs[e23]) + throw new Error('schema with key or id "'.concat(e23, '" already exists')); + } }, { key: "_compileSchemaEnv", value: function(e23) { + if (e23.meta ? this._compileMetaSchema(e23) : a10.compileSchema.call(this, e23), !e23.validate) + throw new Error("ajv implementation error"); + return e23.validate; + } }, { key: "_compileMetaSchema", value: function(e23) { + var t11 = this.opts; + this.opts = this._metaOpts; + try { + a10.compileSchema.call(this, e23); + } finally { + this.opts = t11; + } + } }]), e21; + }(); + function b10(e21, t11, n11) { + var r11 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "error"; + for (var o11 in e21) { + var i11 = o11; + i11 in t11 && this.logger[r11]("".concat(n11, ": option ").concat(o11, ". ").concat(e21[i11])); + } + } + function k10(e21) { + return e21 = (0, c10.normalizeId)(e21), this.schemas[e21] || this.refs[e21]; + } + function w10() { + var e21 = this.opts.schemas; + if (e21) + if (Array.isArray(e21)) + this.addSchema(e21); + else + for (var t11 in e21) + this.addSchema(e21[t11], t11); + } + function x10() { + for (var e21 in this.opts.formats) { + var t11 = this.opts.formats[e21]; + t11 && this.addFormat(e21, t11); + } + } + function j10(e21) { + if (Array.isArray(e21)) + this.addVocabulary(e21); + else + for (var t11 in this.logger.warn("keywords option as map is deprecated, pass array"), e21) { + var n11 = e21[t11]; + n11.keyword || (n11.keyword = t11), this.addKeyword(n11); + } + } + function S10() { + var e21, t11 = Ro({}, this.opts), n11 = bo(v10); + try { + for (n11.s(); !(e21 = n11.n()).done; ) { + delete t11[e21.value]; + } + } catch (e23) { + n11.e(e23); + } finally { + n11.f(); + } + return t11; + } + e20.default = y10, y10.ValidationError = r10.default, y10.MissingRefError = o10.default; + var C10 = { log: function() { + }, warn: function() { + }, error: function() { + } }; + var $10 = /^[a-z_$][a-z0-9_$:-]*$/i; + function _10(e21, t11) { + var n11 = this.RULES; + if ((0, u10.eachItem)(e21, function(e23) { + if (n11.keywords[e23]) + throw new Error("Keyword ".concat(e23, " is already defined")); + if (!$10.test(e23)) + throw new Error("Keyword ".concat(e23, " has invalid name")); + }), t11 && t11.$data && !("code" in t11) && !("validate" in t11)) + throw new Error('$data keyword must have "code" or "validate" function'); + } + function O10(e21, t11, n11) { + var r11, o11 = this, i11 = null == t11 ? void 0 : t11.post; + if (n11 && i11) + throw new Error('keyword with "post" flag cannot have "type"'); + var a11 = this.RULES, s11 = i11 ? a11.post : a11.rules.find(function(e23) { + return e23.type === n11; + }); + if (s11 || (s11 = { type: n11, rules: [] }, a11.rules.push(s11)), a11.keywords[e21] = true, t11) { + var c11 = { keyword: e21, definition: Ro(Ro({}, t11), {}, { type: (0, l10.getJSONTypes)(t11.type), schemaType: (0, l10.getJSONTypes)(t11.schemaType) }) }; + t11.before ? M10.call(this, s11, c11, t11.before) : s11.rules.push(c11), a11.all[e21] = c11, null === (r11 = t11.implements) || void 0 === r11 || r11.forEach(function(e23) { + return o11.addKeyword(e23); + }); + } + } + function M10(e21, t11, n11) { + var r11 = e21.rules.findIndex(function(e23) { + return e23.keyword === n11; + }); + r11 >= 0 ? e21.rules.splice(r11, 0, t11) : (e21.rules.push(t11), this.logger.warn("rule ".concat(n11, " is not defined"))); + } + function E10(e21) { + var t11 = e21.metaSchema; + void 0 !== t11 && (e21.$data && this.opts.$data && (t11 = P10(t11)), e21.validateSchema = this.compile(t11, true)); + } + var A10 = { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" }; + function P10(e21) { + return { anyOf: [e21, A10] }; + } + }(q8); + var f6 = {}; + var d6 = {}; + var h6 = {}; + Object.defineProperty(h6, "__esModule", { value: true }); + var v6 = { keyword: "id", code: function() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); + } }; + h6.default = v6; + var p6 = {}; + Object.defineProperty(p6, "__esModule", { value: true }), p6.callRef = p6.getValidate = void 0; + var m6 = H5(); + var g6 = p5(); + var y6 = G8(); + var b6 = t5(); + var k6 = W5; + var w6 = Q8; + var x6 = { keyword: "$ref", schemaType: "string", code: function(e20) { + var t10 = e20.gen, n10 = e20.schema, r10 = e20.it, o10 = r10.baseId, i10 = r10.schemaEnv, a10 = r10.validateName, s10 = r10.opts, c10 = r10.self, l10 = i10.root; + if (("#" === n10 || "#/" === n10) && o10 === l10.baseId) + return function() { + if (i10 === l10) + return S6(e20, a10, i10, i10.$async); + var n11 = t10.scopeValue("root", { ref: l10 }); + return S6(e20, (0, y6._)(rn || (rn = mo(["", ".validate"])), n11), l10, l10.$async); + }(); + var u10, f10, d10 = k6.resolveRef.call(c10, l10, o10, n10); + if (void 0 === d10) + throw new m6.default(r10.opts.uriResolver, o10, n10); + return d10 instanceof k6.SchemaEnv ? (f10 = j6(e20, u10 = d10), void S6(e20, f10, u10, u10.$async)) : function(r11) { + var o11 = t10.scopeValue("schema", true === s10.code.source ? { ref: r11, code: (0, y6.stringify)(r11) } : { ref: r11 }), i11 = t10.name("valid"), a11 = e20.subschema({ schema: r11, dataTypes: [], schemaPath: y6.nil, topSchemaRef: o11, errSchemaPath: n10 }, i11); + e20.mergeEvaluated(a11), e20.ok(i11); + }(d10); + } }; + function j6(e20, t10) { + var n10 = e20.gen; + return t10.validate ? n10.scopeValue("validate", { ref: t10.validate }) : (0, y6._)(on || (on = mo(["", ".validate"])), n10.scopeValue("wrapper", { ref: t10 })); + } + function S6(e20, t10, n10, r10) { + var o10 = e20.gen, i10 = e20.it, a10 = i10.allErrors, s10 = i10.schemaEnv, c10 = i10.opts.passContext ? b6.default.this : y6.nil; + function l10(e21) { + var t11 = (0, y6._)(cn || (cn = mo(["", ".errors"])), e21); + o10.assign(b6.default.vErrors, (0, y6._)(ln || (ln = mo(["", " === null ? ", " : ", ".concat(", ")"])), b6.default.vErrors, t11, b6.default.vErrors, t11)), o10.assign(b6.default.errors, (0, y6._)(un || (un = mo(["", ".length"])), b6.default.vErrors)); + } + function u10(e21) { + var t11; + if (i10.opts.unevaluated) { + var r11 = null === (t11 = null == n10 ? void 0 : n10.validate) || void 0 === t11 ? void 0 : t11.evaluated; + if (true !== i10.props) + if (r11 && !r11.dynamicProps) + void 0 !== r11.props && (i10.props = w6.mergeEvaluated.props(o10, r11.props, i10.props)); + else { + var a11 = o10.var("props", (0, y6._)(fn || (fn = mo(["", ".evaluated.props"])), e21)); + i10.props = w6.mergeEvaluated.props(o10, a11, i10.props, y6.Name); + } + if (true !== i10.items) + if (r11 && !r11.dynamicItems) + void 0 !== r11.items && (i10.items = w6.mergeEvaluated.items(o10, r11.items, i10.items)); + else { + var s11 = o10.var("items", (0, y6._)(dn || (dn = mo(["", ".evaluated.items"])), e21)); + i10.items = w6.mergeEvaluated.items(o10, s11, i10.items, y6.Name); + } + } + } + r10 ? function() { + if (!s10.$async) + throw new Error("async schema referenced by sync schema"); + var n11 = o10.let("valid"); + o10.try(function() { + o10.code((0, y6._)(an || (an = mo(["await ", ""])), (0, g6.callValidateCode)(e20, t10, c10))), u10(t10), a10 || o10.assign(n11, true); + }, function(e21) { + o10.if((0, y6._)(sn || (sn = mo(["!(", " instanceof ", ")"])), e21, i10.ValidationError), function() { + return o10.throw(e21); + }), l10(e21), a10 || o10.assign(n11, false); + }), e20.ok(n11); + }() : e20.result((0, g6.callValidateCode)(e20, t10, c10), function() { + return u10(t10); + }, function() { + return l10(t10); + }); + } + p6.getValidate = j6, p6.callRef = S6, p6.default = x6, Object.defineProperty(d6, "__esModule", { value: true }); + var C6 = p6; + var $6 = ["$schema", "$id", "$defs", "$vocabulary", { keyword: "$comment" }, "definitions", h6.default, C6.default]; + d6.default = $6; + var _6 = {}; + var O6 = {}; + Object.defineProperty(O6, "__esModule", { value: true }); + var M6 = G8(); + var E6 = M6.operators; + var A6 = { maximum: { okStr: "<=", ok: E6.LTE, fail: E6.GT }, minimum: { okStr: ">=", ok: E6.GTE, fail: E6.LT }, exclusiveMaximum: { okStr: "<", ok: E6.LT, fail: E6.GTE }, exclusiveMinimum: { okStr: ">", ok: E6.GT, fail: E6.LTE } }; + var P6 = { message: function(e20) { + var t10 = e20.keyword, n10 = e20.schemaCode; + return (0, M6.str)(hn || (hn = mo(["must be ", " ", ""])), A6[t10].okStr, n10); + }, params: function(e20) { + var t10 = e20.keyword, n10 = e20.schemaCode; + return (0, M6._)(vn || (vn = mo(["{comparison: ", ", limit: ", "}"])), A6[t10].okStr, n10); + } }; + var T6 = { keyword: Object.keys(A6), type: "number", schemaType: "number", $data: true, error: P6, code: function(e20) { + var t10 = e20.keyword, n10 = e20.data, r10 = e20.schemaCode; + e20.fail$data((0, M6._)(pn || (pn = mo(["", " ", " ", " || isNaN(", ")"])), n10, A6[t10].fail, r10, n10)); + } }; + O6.default = T6; + var R6 = {}; + Object.defineProperty(R6, "__esModule", { value: true }); + var N6 = G8(); + var I6 = { keyword: "multipleOf", type: "number", schemaType: "number", $data: true, error: { message: function(e20) { + var t10 = e20.schemaCode; + return (0, N6.str)(mn || (mn = mo(["must be multiple of ", ""])), t10); + }, params: function(e20) { + var t10 = e20.schemaCode; + return (0, N6._)(gn || (gn = mo(["{multipleOf: ", "}"])), t10); + } }, code: function(e20) { + var t10 = e20.gen, n10 = e20.data, r10 = e20.schemaCode, o10 = e20.it.opts.multipleOfPrecision, i10 = t10.let("res"), a10 = o10 ? (0, N6._)(yn || (yn = mo(["Math.abs(Math.round(", ") - ", ") > 1e-", ""])), i10, i10, o10) : (0, N6._)(bn || (bn = mo(["", " !== parseInt(", ")"])), i10, i10); + e20.fail$data((0, N6._)(kn || (kn = mo(["(", " === 0 || (", " = ", "/", ", ", "))"])), r10, i10, n10, r10, a10)); + } }; + R6.default = I6; + var D6 = {}; + var q6 = {}; + function z6(e20) { + for (var t10, n10 = e20.length, r10 = 0, o10 = 0; o10 < n10; ) + r10++, (t10 = e20.charCodeAt(o10++)) >= 55296 && t10 <= 56319 && o10 < n10 && 56320 == (64512 & (t10 = e20.charCodeAt(o10))) && o10++; + return r10; + } + Object.defineProperty(q6, "__esModule", { value: true }), q6.default = z6, z6.code = 'require("ajv/dist/runtime/ucs2length").default', Object.defineProperty(D6, "__esModule", { value: true }); + var B6 = G8(); + var L6 = Q8; + var F6 = q6; + var V6 = { message: function(e20) { + var t10 = e20.keyword, n10 = e20.schemaCode, r10 = "maxLength" === t10 ? "more" : "fewer"; + return (0, B6.str)(wn || (wn = mo(["must NOT have ", " than ", " characters"])), r10, n10); + }, params: function(e20) { + var t10 = e20.schemaCode; + return (0, B6._)(xn || (xn = mo(["{limit: ", "}"])), t10); + } }; + var H6 = { keyword: ["maxLength", "minLength"], type: "string", schemaType: "number", $data: true, error: V6, code: function(e20) { + var t10 = e20.keyword, n10 = e20.data, r10 = e20.schemaCode, o10 = e20.it, i10 = "maxLength" === t10 ? B6.operators.GT : B6.operators.LT, a10 = false === o10.opts.unicode ? (0, B6._)(jn || (jn = mo(["", ".length"])), n10) : (0, B6._)(Sn || (Sn = mo(["", "(", ")"])), (0, L6.useFunc)(e20.gen, F6.default), n10); + e20.fail$data((0, B6._)(Cn || (Cn = mo(["", " ", " ", ""])), a10, i10, r10)); + } }; + D6.default = H6; + var W6 = {}; + Object.defineProperty(W6, "__esModule", { value: true }); + var U6 = p5(); + var J6 = G8(); + var K6 = { keyword: "pattern", type: "string", schemaType: "string", $data: true, error: { message: function(e20) { + var t10 = e20.schemaCode; + return (0, J6.str)($n || ($n = mo(['must match pattern "', '"'])), t10); + }, params: function(e20) { + var t10 = e20.schemaCode; + return (0, J6._)(_n || (_n = mo(["{pattern: ", "}"])), t10); + } }, code: function(e20) { + var t10 = e20.data, n10 = e20.$data, r10 = e20.schema, o10 = e20.schemaCode, i10 = e20.it.opts.unicodeRegExp ? "u" : "", a10 = n10 ? (0, J6._)(On || (On = mo(["(new RegExp(", ", ", "))"])), o10, i10) : (0, U6.usePattern)(e20, r10); + e20.fail$data((0, J6._)(Mn || (Mn = mo(["!", ".test(", ")"])), a10, t10)); + } }; + W6.default = K6; + var G6 = {}; + Object.defineProperty(G6, "__esModule", { value: true }); + var Q6 = G8(); + var Y6 = { message: function(e20) { + var t10 = e20.keyword, n10 = e20.schemaCode, r10 = "maxProperties" === t10 ? "more" : "fewer"; + return (0, Q6.str)(En || (En = mo(["must NOT have ", " than ", " properties"])), r10, n10); + }, params: function(e20) { + var t10 = e20.schemaCode; + return (0, Q6._)(An || (An = mo(["{limit: ", "}"])), t10); + } }; + var X6 = { keyword: ["maxProperties", "minProperties"], type: "object", schemaType: "number", $data: true, error: Y6, code: function(e20) { + var t10 = e20.keyword, n10 = e20.data, r10 = e20.schemaCode, o10 = "maxProperties" === t10 ? Q6.operators.GT : Q6.operators.LT; + e20.fail$data((0, Q6._)(Pn || (Pn = mo(["Object.keys(", ").length ", " ", ""])), n10, o10, r10)); + } }; + G6.default = X6; + var Z6 = {}; + Object.defineProperty(Z6, "__esModule", { value: true }); + var e72 = p5(); + var t7 = G8(); + var n7 = Q8; + var r7 = { keyword: "required", type: "object", schemaType: "array", $data: true, error: { message: function(e20) { + var t10 = e20.params.missingProperty; + return (0, t7.str)(Tn || (Tn = mo(["must have required property '", "'"])), t10); + }, params: function(e20) { + var t10 = e20.params.missingProperty; + return (0, t7._)(Rn || (Rn = mo(["{missingProperty: ", "}"])), t10); + } }, code: function(e20) { + var t10 = e20.gen, n10 = e20.schema, r10 = e20.schemaCode, o10 = e20.data, i10 = e20.$data, a10 = e20.it, s10 = a10.opts; + if (i10 || 0 !== n10.length) { + var c10 = n10.length >= s10.loopRequired; + if (a10.allErrors ? function() { + if (c10 || i10) + e20.block$data(t7.nil, m10); + else { + var t11, r11 = bo(n10); + try { + for (r11.s(); !(t11 = r11.n()).done; ) { + var o11 = t11.value; + (0, e72.checkReportMissingProp)(e20, o11); + } + } catch (e21) { + r11.e(e21); + } finally { + r11.f(); + } + } + }() : function() { + var a11 = t10.let("missing"); + if (c10 || i10) { + var l11 = t10.let("valid", true); + e20.block$data(l11, function() { + return function(n11, i11) { + e20.setParams({ missingProperty: n11 }), t10.forOf(n11, r10, function() { + t10.assign(i11, (0, e72.propertyInData)(t10, o10, n11, s10.ownProperties)), t10.if((0, t7.not)(i11), function() { + e20.error(), t10.break(); + }); + }, t7.nil); + }(a11, l11); + }), e20.ok(l11); + } else + t10.if((0, e72.checkMissingProp)(e20, n10, a11)), (0, e72.reportMissingProp)(e20, a11), t10.else(); + }(), s10.strictRequired) { + var l10, u10 = e20.parentSchema.properties, f10 = e20.it.definedProperties, d10 = bo(n10); + try { + for (d10.s(); !(l10 = d10.n()).done; ) { + var h10 = l10.value; + if (void 0 === (null == u10 ? void 0 : u10[h10]) && !f10.has(h10)) { + var v10 = a10.schemaEnv.baseId + a10.errSchemaPath, p10 = 'required property "'.concat(h10, '" is not defined at "').concat(v10, '" (strictRequired)'); + (0, n7.checkStrictMode)(a10, p10, a10.opts.strictRequired); + } + } + } catch (e21) { + d10.e(e21); + } finally { + d10.f(); + } + } + } + function m10() { + t10.forOf("prop", r10, function(n11) { + e20.setParams({ missingProperty: n11 }), t10.if((0, e72.noPropertyInData)(t10, o10, n11, s10.ownProperties), function() { + return e20.error(); + }); + }); + } + } }; + Z6.default = r7; + var o7 = {}; + Object.defineProperty(o7, "__esModule", { value: true }); + var i7 = G8(); + var a7 = { message: function(e20) { + var t10 = e20.keyword, n10 = e20.schemaCode, r10 = "maxItems" === t10 ? "more" : "fewer"; + return (0, i7.str)(Nn || (Nn = mo(["must NOT have ", " than ", " items"])), r10, n10); + }, params: function(e20) { + var t10 = e20.schemaCode; + return (0, i7._)(In || (In = mo(["{limit: ", "}"])), t10); + } }; + var s7 = { keyword: ["maxItems", "minItems"], type: "array", schemaType: "number", $data: true, error: a7, code: function(e20) { + var t10 = e20.keyword, n10 = e20.data, r10 = e20.schemaCode, o10 = "maxItems" === t10 ? i7.operators.GT : i7.operators.LT; + e20.fail$data((0, i7._)(Dn || (Dn = mo(["", ".length ", " ", ""])), n10, o10, r10)); + } }; + o7.default = s7; + var c7 = {}; + var l7 = {}; + Object.defineProperty(l7, "__esModule", { value: true }); + var u7 = k5; + u7.code = 'require("ajv/dist/runtime/equal").default', l7.default = u7, Object.defineProperty(c7, "__esModule", { value: true }); + var f7 = r5; + var d7 = G8(); + var h7 = Q8; + var v7 = l7; + var p7 = { message: function(e20) { + var t10 = e20.params, n10 = t10.i, r10 = t10.j; + return (0, d7.str)(qn || (qn = mo(["must NOT have duplicate items (items ## ", " and ", " are identical)"])), r10, n10); + }, params: function(e20) { + var t10 = e20.params, n10 = t10.i, r10 = t10.j; + return (0, d7._)(zn || (zn = mo(["{i: ", ", j: ", "}"])), n10, r10); + } }; + var m7 = { keyword: "uniqueItems", type: "array", schemaType: "boolean", $data: true, error: p7, code: function(e20) { + var t10 = e20.gen, n10 = e20.data, r10 = e20.$data, o10 = e20.schema, i10 = e20.parentSchema, a10 = e20.schemaCode, s10 = e20.it; + if (r10 || o10) { + var c10 = t10.let("valid"), l10 = i10.items ? (0, f7.getSchemaTypes)(i10.items) : []; + e20.block$data(c10, function() { + var r11 = t10.let("i", (0, d7._)(Ln || (Ln = mo(["", ".length"])), n10)), o11 = t10.let("j"); + e20.setParams({ i: r11, j: o11 }), t10.assign(c10, true), t10.if((0, d7._)(Fn || (Fn = mo(["", " > 1"])), r11), function() { + return (l10.length > 0 && !l10.some(function(e21) { + return "object" === e21 || "array" === e21; + }) ? u10 : f10)(r11, o11); + }); + }, (0, d7._)(Bn || (Bn = mo(["", " === false"])), a10)), e20.ok(c10); + } + function u10(r11, o11) { + var i11 = t10.name("item"), a11 = (0, f7.checkDataTypes)(l10, i11, s10.opts.strictNumbers, f7.DataType.Wrong), u11 = t10.const("indices", (0, d7._)(Vn || (Vn = mo(["{}"])))); + t10.for((0, d7._)(Hn || (Hn = mo([";", "--;"])), r11), function() { + t10.let(i11, (0, d7._)(Wn || (Wn = mo(["", "[", "]"])), n10, r11)), t10.if(a11, (0, d7._)(Un || (Un = mo(["continue"])))), l10.length > 1 && t10.if((0, d7._)(Jn || (Jn = mo(["typeof ", ' == "string"'])), i11), (0, d7._)(Kn || (Kn = mo(["", ' += "_"'])), i11)), t10.if((0, d7._)(Gn || (Gn = mo(["typeof ", "[", '] == "number"'])), u11, i11), function() { + t10.assign(o11, (0, d7._)(Qn || (Qn = mo(["", "[", "]"])), u11, i11)), e20.error(), t10.assign(c10, false).break(); + }).code((0, d7._)(Yn || (Yn = mo(["", "[", "] = ", ""])), u11, i11, r11)); + }); + } + function f10(r11, o11) { + var i11 = (0, h7.useFunc)(t10, v7.default), a11 = t10.name("outer"); + t10.label(a11).for((0, d7._)(Xn || (Xn = mo([";", "--;"])), r11), function() { + return t10.for((0, d7._)(Zn || (Zn = mo(["", " = ", "; ", "--;"])), o11, r11, o11), function() { + return t10.if((0, d7._)(er || (er = mo(["", "(", "[", "], ", "[", "])"])), i11, n10, r11, n10, o11), function() { + e20.error(), t10.assign(c10, false).break(a11); + }); + }); + }); + } + } }; + c7.default = m7; + var g7 = {}; + Object.defineProperty(g7, "__esModule", { value: true }); + var y7 = G8(); + var b7 = Q8; + var k7 = l7; + var w7 = { keyword: "const", $data: true, error: { message: "must be equal to constant", params: function(e20) { + var t10 = e20.schemaCode; + return (0, y7._)(tr || (tr = mo(["{allowedValue: ", "}"])), t10); + } }, code: function(e20) { + var t10 = e20.gen, n10 = e20.data, r10 = e20.$data, o10 = e20.schemaCode, i10 = e20.schema; + r10 || i10 && "object" == Ho(i10) ? e20.fail$data((0, y7._)(nr || (nr = mo(["!", "(", ", ", ")"])), (0, b7.useFunc)(t10, k7.default), n10, o10)) : e20.fail((0, y7._)(rr || (rr = mo(["", " !== ", ""])), i10, n10)); + } }; + g7.default = w7; + var x7 = {}; + Object.defineProperty(x7, "__esModule", { value: true }); + var j7 = G8(); + var S7 = Q8; + var C7 = l7; + var $7 = { keyword: "enum", schemaType: "array", $data: true, error: { message: "must be equal to one of the allowed values", params: function(e20) { + var t10 = e20.schemaCode; + return (0, j7._)(or || (or = mo(["{allowedValues: ", "}"])), t10); + } }, code: function(e20) { + var t10 = e20.gen, n10 = e20.data, r10 = e20.$data, o10 = e20.schema, i10 = e20.schemaCode, a10 = e20.it; + if (!r10 && 0 === o10.length) + throw new Error("enum must have non-empty array"); + var s10, c10, l10 = o10.length >= a10.opts.loopEnum, u10 = function() { + return null != s10 ? s10 : s10 = (0, S7.useFunc)(t10, C7.default); + }; + if (l10 || r10) + c10 = t10.let("valid"), e20.block$data(c10, function() { + t10.assign(c10, false), t10.forOf("v", i10, function(e21) { + return t10.if((0, j7._)(ir || (ir = mo(["", "(", ", ", ")"])), u10(), n10, e21), function() { + return t10.assign(c10, true).break(); + }); + }); + }); + else { + if (!Array.isArray(o10)) + throw new Error("ajv implementation error"); + var f10 = t10.const("vSchema", i10); + c10 = j7.or.apply(void 0, Bo(o10.map(function(e21, t11) { + return function(e23, t12) { + var r11 = o10[t12]; + return "object" === Ho(r11) && null !== r11 ? (0, j7._)(ar || (ar = mo(["", "(", ", ", "[", "])"])), u10(), n10, e23, t12) : (0, j7._)(sr || (sr = mo(["", " === ", ""])), n10, r11); + }(f10, t11); + }))); + } + e20.pass(c10); + } }; + x7.default = $7, Object.defineProperty(_6, "__esModule", { value: true }); + var _7 = R6; + var O7 = D6; + var M7 = W6; + var E7 = G6; + var A7 = Z6; + var P7 = o7; + var T7 = c7; + var R7 = g7; + var N7 = x7; + var I7 = [O6.default, _7.default, O7.default, M7.default, E7.default, A7.default, P7.default, T7.default, { keyword: "type", schemaType: ["string", "array"] }, { keyword: "nullable", schemaType: "boolean" }, R7.default, N7.default]; + _6.default = I7; + var D7 = {}; + var q7 = {}; + Object.defineProperty(q7, "__esModule", { value: true }), q7.validateAdditionalItems = void 0; + var z7 = G8(); + var B7 = Q8; + var L7 = { keyword: "additionalItems", type: "array", schemaType: ["boolean", "object"], before: "uniqueItems", error: { message: function(e20) { + var t10 = e20.params.len; + return (0, z7.str)(cr || (cr = mo(["must NOT have more than ", " items"])), t10); + }, params: function(e20) { + var t10 = e20.params.len; + return (0, z7._)(lr || (lr = mo(["{limit: ", "}"])), t10); + } }, code: function(e20) { + var t10 = e20.parentSchema, n10 = e20.it, r10 = t10.items; + Array.isArray(r10) ? F7(e20, r10) : (0, B7.checkStrictMode)(n10, '"additionalItems" is ignored when "items" is not an array of schemas'); + } }; + function F7(e20, t10) { + var n10 = e20.gen, r10 = e20.schema, o10 = e20.data, i10 = e20.keyword, a10 = e20.it; + a10.items = true; + var s10 = n10.const("len", (0, z7._)(ur || (ur = mo(["", ".length"])), o10)); + if (false === r10) + e20.setParams({ len: t10.length }), e20.pass((0, z7._)(fr || (fr = mo(["", " <= ", ""])), s10, t10.length)); + else if ("object" == Ho(r10) && !(0, B7.alwaysValidSchema)(a10, r10)) { + var c10 = n10.var("valid", (0, z7._)(dr || (dr = mo(["", " <= ", ""])), s10, t10.length)); + n10.if((0, z7.not)(c10), function() { + return function(r11) { + n10.forRange("i", t10.length, s10, function(t11) { + e20.subschema({ keyword: i10, dataProp: t11, dataPropType: B7.Type.Num }, r11), a10.allErrors || n10.if((0, z7.not)(r11), function() { + return n10.break(); + }); + }); + }(c10); + }), e20.ok(c10); + } + } + q7.validateAdditionalItems = F7, q7.default = L7; + var V7 = {}; + var H7 = {}; + Object.defineProperty(H7, "__esModule", { value: true }), H7.validateTuple = void 0; + var W7 = G8(); + var U7 = Q8; + var J7 = p5(); + var K7 = { keyword: "items", type: "array", schemaType: ["object", "array", "boolean"], before: "uniqueItems", code: function(e20) { + var t10 = e20.schema, n10 = e20.it; + if (Array.isArray(t10)) + return G7(e20, "additionalItems", t10); + n10.items = true, (0, U7.alwaysValidSchema)(n10, t10) || e20.ok((0, J7.validateArray)(e20)); + } }; + function G7(e20, t10) { + var n10 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : e20.schema, r10 = e20.gen, o10 = e20.parentSchema, i10 = e20.data, a10 = e20.keyword, s10 = e20.it; + !function(e21) { + var r11 = s10.opts, o11 = s10.errSchemaPath, i11 = n10.length, c11 = i11 === e21.minItems && (i11 === e21.maxItems || false === e21[t10]); + if (r11.strictTuples && !c11) { + var l11 = '"'.concat(a10, '" is ').concat(i11, "-tuple, but minItems or maxItems/").concat(t10, ' are not specified or different at path "').concat(o11, '"'); + (0, U7.checkStrictMode)(s10, l11, r11.strictTuples); + } + }(o10), s10.opts.unevaluated && n10.length && true !== s10.items && (s10.items = U7.mergeEvaluated.items(r10, n10.length, s10.items)); + var c10 = r10.name("valid"), l10 = r10.const("len", (0, W7._)(hr || (hr = mo(["", ".length"])), i10)); + n10.forEach(function(t11, n11) { + (0, U7.alwaysValidSchema)(s10, t11) || (r10.if((0, W7._)(vr || (vr = mo(["", " > ", ""])), l10, n11), function() { + return e20.subschema({ keyword: a10, schemaProp: n11, dataProp: n11 }, c10); + }), e20.ok(c10)); + }); + } + H7.validateTuple = G7, H7.default = K7, Object.defineProperty(V7, "__esModule", { value: true }); + var Q7 = H7; + var Y7 = { keyword: "prefixItems", type: "array", schemaType: ["array"], before: "uniqueItems", code: function(e20) { + return (0, Q7.validateTuple)(e20, "items"); + } }; + V7.default = Y7; + var X7 = {}; + Object.defineProperty(X7, "__esModule", { value: true }); + var Z7 = G8(); + var e92 = Q8; + var t9 = p5(); + var n9 = q7; + var r9 = { keyword: "items", type: "array", schemaType: ["object", "boolean"], before: "uniqueItems", error: { message: function(e20) { + var t10 = e20.params.len; + return (0, Z7.str)(pr || (pr = mo(["must NOT have more than ", " items"])), t10); + }, params: function(e20) { + var t10 = e20.params.len; + return (0, Z7._)(mr || (mr = mo(["{limit: ", "}"])), t10); + } }, code: function(e20) { + var t10 = e20.schema, n10 = e20.parentSchema, r10 = e20.it, o10 = n10.prefixItems; + r10.items = true, (0, e92.alwaysValidSchema)(r10, t10) || (o10 ? (0, n9.validateAdditionalItems)(e20, o10) : e20.ok((0, t9.validateArray)(e20))); + } }; + X7.default = r9; + var o9 = {}; + Object.defineProperty(o9, "__esModule", { value: true }); + var i9 = G8(); + var a9 = Q8; + var s9 = { message: function(e20) { + var t10 = e20.params, n10 = t10.min, r10 = t10.max; + return void 0 === r10 ? (0, i9.str)(gr || (gr = mo(["must contain at least ", " valid item(s)"])), n10) : (0, i9.str)(yr || (yr = mo(["must contain at least ", " and no more than ", " valid item(s)"])), n10, r10); + }, params: function(e20) { + var t10 = e20.params, n10 = t10.min, r10 = t10.max; + return void 0 === r10 ? (0, i9._)(br || (br = mo(["{minContains: ", "}"])), n10) : (0, i9._)(kr || (kr = mo(["{minContains: ", ", maxContains: ", "}"])), n10, r10); + } }; + var c9 = { keyword: "contains", type: "array", schemaType: ["object", "boolean"], before: "uniqueItems", trackErrors: true, error: s9, code: function(e20) { + var t10, n10, r10 = e20.gen, o10 = e20.schema, i10 = e20.parentSchema, a10 = e20.data, s10 = e20.it, c10 = i10.minContains, l10 = i10.maxContains; + s10.opts.next ? (t10 = void 0 === c10 ? 1 : c10, n10 = l10) : t10 = 1; + var u10 = r10.const("len", (0, i9._)(wr || (wr = mo(["", ".length"])), a10)); + if (e20.setParams({ min: t10, max: n10 }), void 0 !== n10 || 0 !== t10) { + if (void 0 !== n10 && t10 > n10) + return (0, a9.checkStrictMode)(s10, '"minContains" > "maxContains" is always invalid'), void e20.fail(); + if ((0, a9.alwaysValidSchema)(s10, o10)) { + var f10 = (0, i9._)(xr || (xr = mo(["", " >= ", ""])), u10, t10); + return void 0 !== n10 && (f10 = (0, i9._)(jr || (jr = mo(["", " && ", " <= ", ""])), f10, u10, n10)), void e20.pass(f10); + } + s10.items = true; + var d10 = r10.name("valid"); + void 0 === n10 && 1 === t10 ? v10(d10, function() { + return r10.if(d10, function() { + return r10.break(); + }); + }) : 0 === t10 ? (r10.let(d10, true), void 0 !== n10 && r10.if((0, i9._)(Sr || (Sr = mo(["", ".length > 0"])), a10), h10)) : (r10.let(d10, false), h10()), e20.result(d10, function() { + return e20.reset(); + }); + } else + (0, a9.checkStrictMode)(s10, '"minContains" == 0 without "maxContains": "contains" keyword ignored'); + function h10() { + var e21 = r10.name("_valid"), o11 = r10.let("count", 0); + v10(e21, function() { + return r10.if(e21, function() { + return function(e23) { + r10.code((0, i9._)(Cr || (Cr = mo(["", "++"])), e23)), void 0 === n10 ? r10.if((0, i9._)($r || ($r = mo(["", " >= ", ""])), e23, t10), function() { + return r10.assign(d10, true).break(); + }) : (r10.if((0, i9._)(_r || (_r = mo(["", " > ", ""])), e23, n10), function() { + return r10.assign(d10, false).break(); + }), 1 === t10 ? r10.assign(d10, true) : r10.if((0, i9._)(Or || (Or = mo(["", " >= ", ""])), e23, t10), function() { + return r10.assign(d10, true); + })); + }(o11); + }); + }); + } + function v10(t11, n11) { + r10.forRange("i", 0, u10, function(r11) { + e20.subschema({ keyword: "contains", dataProp: r11, dataPropType: a9.Type.Num, compositeRule: true }, t11), n11(); + }); + } + } }; + o9.default = c9; + var l9 = {}; + !function(e20) { + Object.defineProperty(e20, "__esModule", { value: true }), e20.validateSchemaDeps = e20.validatePropertyDeps = e20.error = void 0; + var t10 = G8(), n10 = Q8, r10 = p5(); + e20.error = { message: function(e21) { + var n11 = e21.params, r11 = n11.property, o11 = n11.depsCount, i11 = n11.deps, a11 = 1 === o11 ? "property" : "properties"; + return (0, t10.str)(Mr || (Mr = mo(["must have ", " ", " when property ", " is present"])), a11, i11, r11); + }, params: function(e21) { + var n11 = e21.params, r11 = n11.property, o11 = n11.depsCount, i11 = n11.deps, a11 = n11.missingProperty; + return (0, t10._)(Er || (Er = mo(["{property: ", ",\n missingProperty: ", ",\n depsCount: ", ",\n deps: ", "}"])), r11, a11, o11, i11); + } }; + var o10 = { keyword: "dependencies", type: "object", schemaType: "object", error: e20.error, code: function(e21) { + var t11 = jo(function(e23) { + var t12 = e23.schema, n12 = {}, r12 = {}; + for (var o11 in t12) { + if ("__proto__" !== o11) + (Array.isArray(t12[o11]) ? n12 : r12)[o11] = t12[o11]; + } + return [n12, r12]; + }(e21), 2), n11 = t11[0], r11 = t11[1]; + i10(e21, n11), a10(e21, r11); + } }; + function i10(e21) { + var n11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21.schema, o11 = e21.gen, i11 = e21.data, a11 = e21.it; + if (0 !== Object.keys(n11).length) { + var s10 = o11.let("missing"), c10 = function() { + var c11 = n11[l10]; + if (0 === c11.length) + return 1; + var u10 = (0, r10.propertyInData)(o11, i11, l10, a11.opts.ownProperties); + e21.setParams({ property: l10, depsCount: c11.length, deps: c11.join(", ") }), a11.allErrors ? o11.if(u10, function() { + var t11, n12 = bo(c11); + try { + for (n12.s(); !(t11 = n12.n()).done; ) { + var o12 = t11.value; + (0, r10.checkReportMissingProp)(e21, o12); + } + } catch (e23) { + n12.e(e23); + } finally { + n12.f(); + } + }) : (o11.if((0, t10._)(Ar || (Ar = mo(["", " && (", ")"])), u10, (0, r10.checkMissingProp)(e21, c11, s10))), (0, r10.reportMissingProp)(e21, s10), o11.else()); + }; + for (var l10 in n11) + c10(); + } + } + function a10(e21) { + var t11 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e21.schema, o11 = e21.gen, i11 = e21.data, a11 = e21.keyword, s10 = e21.it, c10 = o11.name("valid"), l10 = function(l11) { + if ((0, n10.alwaysValidSchema)(s10, t11[l11])) + return 1; + o11.if((0, r10.propertyInData)(o11, i11, l11, s10.opts.ownProperties), function() { + var t12 = e21.subschema({ keyword: a11, schemaProp: l11 }, c10); + e21.mergeValidEvaluated(t12, c10); + }, function() { + return o11.var(c10, true); + }), e21.ok(c10); + }; + for (var u10 in t11) + l10(u10); + } + e20.validatePropertyDeps = i10, e20.validateSchemaDeps = a10, e20.default = o10; + }(l9); + var u9 = {}; + Object.defineProperty(u9, "__esModule", { value: true }); + var f9 = G8(); + var d9 = Q8; + var h9 = { keyword: "propertyNames", type: "object", schemaType: ["object", "boolean"], error: { message: "property name must be valid", params: function(e20) { + var t10 = e20.params; + return (0, f9._)(Pr || (Pr = mo(["{propertyName: ", "}"])), t10.propertyName); + } }, code: function(e20) { + var t10 = e20.gen, n10 = e20.schema, r10 = e20.data, o10 = e20.it; + if (!(0, d9.alwaysValidSchema)(o10, n10)) { + var i10 = t10.name("valid"); + t10.forIn("key", r10, function(n11) { + e20.setParams({ propertyName: n11 }), e20.subschema({ keyword: "propertyNames", data: n11, dataTypes: ["string"], propertyName: n11, compositeRule: true }, i10), t10.if((0, f9.not)(i10), function() { + e20.error(true), o10.allErrors || t10.break(); + }); + }), e20.ok(i10); + } + } }; + u9.default = h9; + var v9 = {}; + Object.defineProperty(v9, "__esModule", { value: true }); + var p9 = p5(); + var m9 = G8(); + var g9 = t5(); + var y9 = Q8; + var b9 = { keyword: "additionalProperties", type: ["object"], schemaType: ["boolean", "object"], allowUndefined: true, trackErrors: true, error: { message: "must NOT have additional properties", params: function(e20) { + var t10 = e20.params; + return (0, m9._)(Tr || (Tr = mo(["{additionalProperty: ", "}"])), t10.additionalProperty); + } }, code: function(e20) { + var t10 = e20.gen, n10 = e20.schema, r10 = e20.parentSchema, o10 = e20.data, i10 = e20.errsCount, a10 = e20.it; + if (!i10) + throw new Error("ajv implementation error"); + var s10 = a10.allErrors, c10 = a10.opts; + if (a10.props = true, "all" === c10.removeAdditional || !(0, y9.alwaysValidSchema)(a10, n10)) { + var l10 = (0, p9.allSchemaProperties)(r10.properties), u10 = (0, p9.allSchemaProperties)(r10.patternProperties); + t10.forIn("key", o10, function(n11) { + l10.length || u10.length ? t10.if(function(n12) { + var o11; + if (l10.length > 8) { + var i11 = (0, y9.schemaRefOrVal)(a10, r10.properties, "properties"); + o11 = (0, p9.isOwnProperty)(t10, i11, n12); + } else + o11 = l10.length ? m9.or.apply(void 0, Bo(l10.map(function(e21) { + return (0, m9._)(Nr || (Nr = mo(["", " === ", ""])), n12, e21); + }))) : m9.nil; + return u10.length && (o11 = m9.or.apply(void 0, [o11].concat(Bo(u10.map(function(t11) { + return (0, m9._)(Ir || (Ir = mo(["", ".test(", ")"])), (0, p9.usePattern)(e20, t11), n12); + }))))), (0, m9.not)(o11); + }(n11), function() { + return d10(n11); + }) : d10(n11); + }), e20.ok((0, m9._)(Rr || (Rr = mo(["", " === ", ""])), i10, g9.default.errors)); + } + function f10(e21) { + t10.code((0, m9._)(Dr || (Dr = mo(["delete ", "[", "]"])), o10, e21)); + } + function d10(r11) { + if ("all" === c10.removeAdditional || c10.removeAdditional && false === n10) + f10(r11); + else { + if (false === n10) + return e20.setParams({ additionalProperty: r11 }), e20.error(), void (s10 || t10.break()); + if ("object" == Ho(n10) && !(0, y9.alwaysValidSchema)(a10, n10)) { + var o11 = t10.name("valid"); + "failing" === c10.removeAdditional ? (h10(r11, o11, false), t10.if((0, m9.not)(o11), function() { + e20.reset(), f10(r11); + })) : (h10(r11, o11), s10 || t10.if((0, m9.not)(o11), function() { + return t10.break(); + })); + } + } + } + function h10(t11, n11, r11) { + var o11 = { keyword: "additionalProperties", dataProp: t11, dataPropType: y9.Type.Str }; + false === r11 && Object.assign(o11, { compositeRule: true, createErrors: false, allErrors: false }), e20.subschema(o11, n11); + } + } }; + v9.default = b9; + var k9 = {}; + Object.defineProperty(k9, "__esModule", { value: true }); + var w9 = q5(); + var x9 = p5(); + var j9 = Q8; + var S9 = v9; + var C9 = { keyword: "properties", type: "object", schemaType: "object", code: function(e20) { + var t10 = e20.gen, n10 = e20.schema, r10 = e20.parentSchema, o10 = e20.data, i10 = e20.it; + "all" === i10.opts.removeAdditional && void 0 === r10.additionalProperties && S9.default.code(new w9.KeywordCxt(i10, S9.default, "additionalProperties")); + var a10, s10 = (0, x9.allSchemaProperties)(n10), c10 = bo(s10); + try { + for (c10.s(); !(a10 = c10.n()).done; ) { + var l10 = a10.value; + i10.definedProperties.add(l10); + } + } catch (e21) { + c10.e(e21); + } finally { + c10.f(); + } + i10.opts.unevaluated && s10.length && true !== i10.props && (i10.props = j9.mergeEvaluated.props(t10, (0, j9.toHash)(s10), i10.props)); + var u10 = s10.filter(function(e21) { + return !(0, j9.alwaysValidSchema)(i10, n10[e21]); + }); + if (0 !== u10.length) { + var f10, d10 = t10.name("valid"), h10 = bo(u10); + try { + for (h10.s(); !(f10 = h10.n()).done; ) { + var v10 = f10.value; + p10(v10) ? m10(v10) : (t10.if((0, x9.propertyInData)(t10, o10, v10, i10.opts.ownProperties)), m10(v10), i10.allErrors || t10.else().var(d10, true), t10.endIf()), e20.it.definedProperties.add(v10), e20.ok(d10); + } + } catch (e21) { + h10.e(e21); + } finally { + h10.f(); + } + } + function p10(e21) { + return i10.opts.useDefaults && !i10.compositeRule && void 0 !== n10[e21].default; + } + function m10(t11) { + e20.subschema({ keyword: "properties", schemaProp: t11, dataProp: t11 }, d10); + } + } }; + k9.default = C9; + var $9 = {}; + Object.defineProperty($9, "__esModule", { value: true }); + var _9 = p5(); + var O9 = G8(); + var M9 = Q8; + var E9 = Q8; + var A9 = { keyword: "patternProperties", type: "object", schemaType: "object", code: function(e20) { + var t10 = e20.gen, n10 = e20.schema, r10 = e20.data, o10 = e20.parentSchema, i10 = e20.it, a10 = i10.opts, s10 = (0, _9.allSchemaProperties)(n10), c10 = s10.filter(function(e21) { + return (0, M9.alwaysValidSchema)(i10, n10[e21]); + }); + if (0 !== s10.length && (c10.length !== s10.length || i10.opts.unevaluated && true !== i10.props)) { + var l10 = a10.strictSchema && !a10.allowMatchingProperties && o10.properties, u10 = t10.name("valid"); + true === i10.props || i10.props instanceof O9.Name || (i10.props = (0, E9.evaluatedPropsToName)(t10, i10.props)); + var f10 = i10.props; + !function() { + var e21, n11 = bo(s10); + try { + for (n11.s(); !(e21 = n11.n()).done; ) { + var r11 = e21.value; + l10 && d10(r11), i10.allErrors ? h10(r11) : (t10.var(u10, true), h10(r11), t10.if(u10)); + } + } catch (e23) { + n11.e(e23); + } finally { + n11.f(); + } + }(); + } + function d10(e21) { + for (var t11 in l10) + new RegExp(e21).test(t11) && (0, M9.checkStrictMode)(i10, "property ".concat(t11, " matches pattern ").concat(e21, " (use allowMatchingProperties)")); + } + function h10(n11) { + t10.forIn("key", r10, function(r11) { + t10.if((0, O9._)(qr || (qr = mo(["", ".test(", ")"])), (0, _9.usePattern)(e20, n11), r11), function() { + var o11 = c10.includes(n11); + o11 || e20.subschema({ keyword: "patternProperties", schemaProp: n11, dataProp: r11, dataPropType: E9.Type.Str }, u10), i10.opts.unevaluated && true !== f10 ? t10.assign((0, O9._)(zr || (zr = mo(["", "[", "]"])), f10, r11), true) : o11 || i10.allErrors || t10.if((0, O9.not)(u10), function() { + return t10.break(); + }); + }); + }); + } + } }; + $9.default = A9; + var P9 = {}; + Object.defineProperty(P9, "__esModule", { value: true }); + var T9 = Q8; + var R9 = { keyword: "not", schemaType: ["object", "boolean"], trackErrors: true, code: function(e20) { + var t10 = e20.gen, n10 = e20.schema, r10 = e20.it; + if ((0, T9.alwaysValidSchema)(r10, n10)) + e20.fail(); + else { + var o10 = t10.name("valid"); + e20.subschema({ keyword: "not", compositeRule: true, createErrors: false, allErrors: false }, o10), e20.failResult(o10, function() { + return e20.reset(); + }, function() { + return e20.error(); + }); + } + }, error: { message: "must NOT be valid" } }; + P9.default = R9; + var N9 = {}; + Object.defineProperty(N9, "__esModule", { value: true }); + var I9 = { keyword: "anyOf", schemaType: "array", trackErrors: true, code: p5().validateUnion, error: { message: "must match a schema in anyOf" } }; + N9.default = I9; + var D9 = {}; + Object.defineProperty(D9, "__esModule", { value: true }); + var q9 = G8(); + var z9 = Q8; + var B9 = { keyword: "oneOf", schemaType: "array", trackErrors: true, error: { message: "must match exactly one schema in oneOf", params: function(e20) { + var t10 = e20.params; + return (0, q9._)(Br || (Br = mo(["{passingSchemas: ", "}"])), t10.passing); + } }, code: function(e20) { + var t10 = e20.gen, n10 = e20.schema, r10 = e20.parentSchema, o10 = e20.it; + if (!Array.isArray(n10)) + throw new Error("ajv implementation error"); + if (!o10.opts.discriminator || !r10.discriminator) { + var i10 = n10, a10 = t10.let("valid", false), s10 = t10.let("passing", null), c10 = t10.name("_valid"); + e20.setParams({ passing: s10 }), t10.block(function() { + i10.forEach(function(n11, r11) { + var i11; + (0, z9.alwaysValidSchema)(o10, n11) ? t10.var(c10, true) : i11 = e20.subschema({ keyword: "oneOf", schemaProp: r11, compositeRule: true }, c10), r11 > 0 && t10.if((0, q9._)(Lr || (Lr = mo(["", " && ", ""])), c10, a10)).assign(a10, false).assign(s10, (0, q9._)(Fr || (Fr = mo(["[", ", ", "]"])), s10, r11)).else(), t10.if(c10, function() { + t10.assign(a10, true), t10.assign(s10, r11), i11 && e20.mergeEvaluated(i11, q9.Name); + }); + }); + }), e20.result(a10, function() { + return e20.reset(); + }, function() { + return e20.error(true); + }); + } + } }; + D9.default = B9; + var L9 = {}; + Object.defineProperty(L9, "__esModule", { value: true }); + var F9 = Q8; + var V9 = { keyword: "allOf", schemaType: "array", code: function(e20) { + var t10 = e20.gen, n10 = e20.schema, r10 = e20.it; + if (!Array.isArray(n10)) + throw new Error("ajv implementation error"); + var o10 = t10.name("valid"); + n10.forEach(function(t11, n11) { + if (!(0, F9.alwaysValidSchema)(r10, t11)) { + var i10 = e20.subschema({ keyword: "allOf", schemaProp: n11 }, o10); + e20.ok(o10), e20.mergeEvaluated(i10); + } + }); + } }; + L9.default = V9; + var H9 = {}; + Object.defineProperty(H9, "__esModule", { value: true }); + var W9 = G8(); + var U9 = Q8; + var J9 = { keyword: "if", schemaType: ["object", "boolean"], trackErrors: true, error: { message: function(e20) { + var t10 = e20.params; + return (0, W9.str)(Vr || (Vr = mo(['must match "', '" schema'])), t10.ifClause); + }, params: function(e20) { + var t10 = e20.params; + return (0, W9._)(Hr || (Hr = mo(["{failingKeyword: ", "}"])), t10.ifClause); + } }, code: function(e20) { + var t10 = e20.gen, n10 = e20.parentSchema, r10 = e20.it; + void 0 === n10.then && void 0 === n10.else && (0, U9.checkStrictMode)(r10, '"if" without "then" and "else" is ignored'); + var o10 = K9(r10, "then"), i10 = K9(r10, "else"); + if (o10 || i10) { + var a10, s10 = t10.let("valid", true), c10 = t10.name("_valid"); + if (a10 = e20.subschema({ keyword: "if", compositeRule: true, createErrors: false, allErrors: false }, c10), e20.mergeEvaluated(a10), e20.reset(), o10 && i10) { + var l10 = t10.let("ifClause"); + e20.setParams({ ifClause: l10 }), t10.if(c10, u10("then", l10), u10("else", l10)); + } else + o10 ? t10.if(c10, u10("then")) : t10.if((0, W9.not)(c10), u10("else")); + e20.pass(s10, function() { + return e20.error(true); + }); + } + function u10(n11, r11) { + return function() { + var o11 = e20.subschema({ keyword: n11 }, c10); + t10.assign(s10, c10), e20.mergeValidEvaluated(o11, s10), r11 ? t10.assign(r11, (0, W9._)(Wr || (Wr = mo(["", ""])), n11)) : e20.setParams({ ifClause: n11 }); + }; + } + } }; + function K9(e20, t10) { + var n10 = e20.schema[t10]; + return void 0 !== n10 && !(0, U9.alwaysValidSchema)(e20, n10); + } + H9.default = J9; + var G9 = {}; + Object.defineProperty(G9, "__esModule", { value: true }); + var Q9 = Q8; + var Y9 = { keyword: ["then", "else"], schemaType: ["object", "boolean"], code: function(e20) { + var t10 = e20.keyword, n10 = e20.parentSchema, r10 = e20.it; + void 0 === n10.if && (0, Q9.checkStrictMode)(r10, '"'.concat(t10, '" without "if" is ignored')); + } }; + G9.default = Y9, Object.defineProperty(D7, "__esModule", { value: true }); + var X9 = q7; + var Z9 = V7; + var eee = H7; + var tee = X7; + var nee = o9; + var ree = l9; + var oee = u9; + var iee = v9; + var aee = k9; + var see = $9; + var cee = P9; + var lee = N9; + var uee = D9; + var fee = L9; + var dee = H9; + var hee = G9; + D7.default = function() { + var e20 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], t10 = [cee.default, lee.default, uee.default, fee.default, dee.default, hee.default, oee.default, iee.default, ree.default, aee.default, see.default]; + return e20 ? t10.push(Z9.default, tee.default) : t10.push(X9.default, eee.default), t10.push(nee.default), t10; + }; + var vee = {}; + var pee = {}; + Object.defineProperty(pee, "__esModule", { value: true }); + var mee = G8(); + var gee = { keyword: "format", type: ["number", "string"], schemaType: "string", $data: true, error: { message: function(e20) { + var t10 = e20.schemaCode; + return (0, mee.str)(Ur || (Ur = mo(['must match format "', '"'])), t10); + }, params: function(e20) { + var t10 = e20.schemaCode; + return (0, mee._)(Jr || (Jr = mo(["{format: ", "}"])), t10); + } }, code: function(e20, t10) { + var n10 = e20.gen, r10 = e20.data, o10 = e20.$data, i10 = e20.schema, a10 = e20.schemaCode, s10 = e20.it, c10 = s10.opts, l10 = s10.errSchemaPath, u10 = s10.schemaEnv, f10 = s10.self; + c10.validateFormats && (o10 ? function() { + var o11 = n10.scopeValue("formats", { ref: f10.formats, code: c10.code.formats }), i11 = n10.const("fDef", (0, mee._)(Kr || (Kr = mo(["", "[", "]"])), o11, a10)), s11 = n10.let("fType"), l11 = n10.let("format"); + n10.if((0, mee._)(Gr || (Gr = mo(["typeof ", ' == "object" && !(', " instanceof RegExp)"])), i11, i11), function() { + return n10.assign(s11, (0, mee._)(Qr || (Qr = mo(["", '.type || "string"'])), i11)).assign(l11, (0, mee._)(Yr || (Yr = mo(["", ".validate"])), i11)); + }, function() { + return n10.assign(s11, (0, mee._)(Xr || (Xr = mo(['"string"'])))).assign(l11, i11); + }), e20.fail$data((0, mee.or)(false === c10.strictSchema ? mee.nil : (0, mee._)(Zr || (Zr = mo(["", " && !", ""])), a10, l11), (d10 = u10.$async ? (0, mee._)(eo || (eo = mo(["(", ".async ? await ", "(", ") : ", "(", "))"])), i11, l11, r10, l11, r10) : (0, mee._)(to || (to = mo(["", "(", ")"])), l11, r10), h10 = (0, mee._)(no || (no = mo(["(typeof ", ' == "function" ? ', " : ", ".test(", "))"])), l11, d10, l11, r10), (0, mee._)(ro || (ro = mo(["", " && ", " !== true && ", " === ", " && !", ""])), l11, l11, s11, t10, h10)))); + var d10, h10; + }() : function() { + var o11 = f10.formats[i10]; + if (!o11) + return void function() { + if (false === c10.strictSchema) + return void f10.logger.warn(e21()); + throw new Error(e21()); + function e21() { + return 'unknown format "'.concat(i10, '" ignored in schema at path "').concat(l10, '"'); + } + }(); + if (true === o11) + return; + var a11 = jo(function(e21) { + var t11 = e21 instanceof RegExp ? (0, mee.regexpCode)(e21) : c10.code.formats ? (0, mee._)(oo || (oo = mo(["", "", ""])), c10.code.formats, (0, mee.getProperty)(i10)) : void 0, r11 = n10.scopeValue("formats", { key: i10, ref: e21, code: t11 }); + if ("object" == Ho(e21) && !(e21 instanceof RegExp)) + return [e21.type || "string", e21.validate, (0, mee._)(io || (io = mo(["", ".validate"])), r11)]; + return ["string", e21, r11]; + }(o11), 3), s11 = a11[0], d10 = a11[1], h10 = a11[2]; + s11 === t10 && e20.pass(function() { + if ("object" == Ho(o11) && !(o11 instanceof RegExp) && o11.async) { + if (!u10.$async) + throw new Error("async format in sync schema"); + return (0, mee._)(ao || (ao = mo(["await ", "(", ")"])), h10, r10); + } + return "function" == typeof d10 ? (0, mee._)(so || (so = mo(["", "(", ")"])), h10, r10) : (0, mee._)(co || (co = mo(["", ".test(", ")"])), h10, r10); + }()); + }()); + } }; + pee.default = gee, Object.defineProperty(vee, "__esModule", { value: true }); + var yee = [pee.default]; + vee.default = yee; + var bee = {}; + Object.defineProperty(bee, "__esModule", { value: true }), bee.contentVocabulary = bee.metadataVocabulary = void 0, bee.metadataVocabulary = ["title", "description", "default", "deprecated", "readOnly", "writeOnly", "examples"], bee.contentVocabulary = ["contentMediaType", "contentEncoding", "contentSchema"], Object.defineProperty(f6, "__esModule", { value: true }); + var kee = _6; + var wee = D7; + var xee = vee; + var jee = bee; + var See = [d6.default, kee.default, (0, wee.default)(), xee.default, jee.metadataVocabulary, jee.contentVocabulary]; + f6.default = See; + var Cee = {}; + var $ee = {}; + !function(e20) { + var t10; + Object.defineProperty(e20, "__esModule", { value: true }), e20.DiscrError = void 0, (t10 = e20.DiscrError || (e20.DiscrError = {})).Tag = "tag", t10.Mapping = "mapping"; + }($ee), Object.defineProperty(Cee, "__esModule", { value: true }); + var _ee = G8(); + var Oee = $ee; + var Mee = W5; + var Eee = Q8; + var Aee = { keyword: "discriminator", type: "object", schemaType: "object", error: { message: function(e20) { + var t10 = e20.params, n10 = t10.discrError, r10 = t10.tagName; + return n10 === Oee.DiscrError.Tag ? 'tag "'.concat(r10, '" must be string') : 'value of tag "'.concat(r10, '" must be in oneOf'); + }, params: function(e20) { + var t10 = e20.params, n10 = t10.discrError, r10 = t10.tag, o10 = t10.tagName; + return (0, _ee._)(lo || (lo = mo(["{error: ", ", tag: ", ", tagValue: ", "}"])), n10, o10, r10); + } }, code: function(e20) { + var t10 = e20.gen, n10 = e20.data, r10 = e20.schema, o10 = e20.parentSchema, i10 = e20.it, a10 = o10.oneOf; + if (!i10.opts.discriminator) + throw new Error("discriminator: requires discriminator option"); + var s10 = r10.propertyName; + if ("string" != typeof s10) + throw new Error("discriminator: requires propertyName"); + if (r10.mapping) + throw new Error("discriminator: mapping is not supported"); + if (!a10) + throw new Error("discriminator: requires oneOf keyword"); + var c10 = t10.let("valid", false), l10 = t10.const("tag", (0, _ee._)(uo || (uo = mo(["", "", ""])), n10, (0, _ee.getProperty)(s10))); + function u10(n11) { + var r11 = t10.name("valid"), o11 = e20.subschema({ keyword: "oneOf", schemaProp: n11 }, r11); + return e20.mergeEvaluated(o11, _ee.Name), r11; + } + t10.if((0, _ee._)(fo || (fo = mo(["typeof ", ' == "string"'])), l10), function() { + return function() { + var n11 = function() { + for (var e21, t11 = {}, n12 = f10(o10), r12 = true, c11 = 0; c11 < a10.length; c11++) { + var l11 = a10[c11]; + (null == l11 ? void 0 : l11.$ref) && !(0, Eee.schemaHasRulesButRef)(l11, i10.self.RULES) && (l11 = Mee.resolveRef.call(i10.self, i10.schemaEnv.root, i10.baseId, null == l11 ? void 0 : l11.$ref)) instanceof Mee.SchemaEnv && (l11 = l11.schema); + var u11 = null === (e21 = null == l11 ? void 0 : l11.properties) || void 0 === e21 ? void 0 : e21[s10]; + if ("object" != Ho(u11)) + throw new Error('discriminator: oneOf subschemas (or referenced schemas) must have "properties/'.concat(s10, '"')); + r12 = r12 && (n12 || f10(l11)), d10(u11, c11); + } + if (!r12) + throw new Error('discriminator: "'.concat(s10, '" must be required')); + return t11; + function f10(e23) { + var t12 = e23.required; + return Array.isArray(t12) && t12.includes(s10); + } + function d10(e23, t12) { + if (e23.const) + h10(e23.const, t12); + else { + if (!e23.enum) + throw new Error('discriminator: "properties/'.concat(s10, '" must have "const" or "enum"')); + var n13, r13 = bo(e23.enum); + try { + for (r13.s(); !(n13 = r13.n()).done; ) { + h10(n13.value, t12); + } + } catch (e24) { + r13.e(e24); + } finally { + r13.f(); + } + } + } + function h10(e23, n13) { + if ("string" != typeof e23 || e23 in t11) + throw new Error('discriminator: "'.concat(s10, '" values must be unique strings')); + t11[e23] = n13; + } + }(); + for (var r11 in t10.if(false), n11) + t10.elseIf((0, _ee._)(ho || (ho = mo(["", " === ", ""])), l10, r11)), t10.assign(c10, u10(n11[r11])); + t10.else(), e20.error(false, { discrError: Oee.DiscrError.Mapping, tag: l10, tagName: s10 }), t10.endIf(); + }(); + }, function() { + return e20.error(false, { discrError: Oee.DiscrError.Tag, tag: l10, tagName: s10 }); + }), e20.ok(c10); + } }; + Cee.default = Aee; + var Pee = { $schema: "http://json-schema.org/draft-07/schema#", $id: "http://json-schema.org/draft-07/schema#", title: "Core schema meta-schema", definitions: { schemaArray: { type: "array", minItems: 1, items: { $ref: "#" } }, nonNegativeInteger: { type: "integer", minimum: 0 }, nonNegativeIntegerDefault0: { allOf: [{ $ref: "#/definitions/nonNegativeInteger" }, { default: 0 }] }, simpleTypes: { enum: ["array", "boolean", "integer", "null", "number", "object", "string"] }, stringArray: { type: "array", items: { type: "string" }, uniqueItems: true, default: [] } }, type: ["object", "boolean"], properties: { $id: { type: "string", format: "uri-reference" }, $schema: { type: "string", format: "uri" }, $ref: { type: "string", format: "uri-reference" }, $comment: { type: "string" }, title: { type: "string" }, description: { type: "string" }, default: true, readOnly: { type: "boolean", default: false }, examples: { type: "array", items: true }, multipleOf: { type: "number", exclusiveMinimum: 0 }, maximum: { type: "number" }, exclusiveMaximum: { type: "number" }, minimum: { type: "number" }, exclusiveMinimum: { type: "number" }, maxLength: { $ref: "#/definitions/nonNegativeInteger" }, minLength: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, pattern: { type: "string", format: "regex" }, additionalItems: { $ref: "#" }, items: { anyOf: [{ $ref: "#" }, { $ref: "#/definitions/schemaArray" }], default: true }, maxItems: { $ref: "#/definitions/nonNegativeInteger" }, minItems: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, uniqueItems: { type: "boolean", default: false }, contains: { $ref: "#" }, maxProperties: { $ref: "#/definitions/nonNegativeInteger" }, minProperties: { $ref: "#/definitions/nonNegativeIntegerDefault0" }, required: { $ref: "#/definitions/stringArray" }, additionalProperties: { $ref: "#" }, definitions: { type: "object", additionalProperties: { $ref: "#" }, default: {} }, properties: { type: "object", additionalProperties: { $ref: "#" }, default: {} }, patternProperties: { type: "object", additionalProperties: { $ref: "#" }, propertyNames: { format: "regex" }, default: {} }, dependencies: { type: "object", additionalProperties: { anyOf: [{ $ref: "#" }, { $ref: "#/definitions/stringArray" }] } }, propertyNames: { $ref: "#" }, const: true, enum: { type: "array", items: true, minItems: 1, uniqueItems: true }, type: { anyOf: [{ $ref: "#/definitions/simpleTypes" }, { type: "array", items: { $ref: "#/definitions/simpleTypes" }, minItems: 1, uniqueItems: true }] }, format: { type: "string" }, contentMediaType: { type: "string" }, contentEncoding: { type: "string" }, if: { $ref: "#" }, then: { $ref: "#" }, else: { $ref: "#" }, allOf: { $ref: "#/definitions/schemaArray" }, anyOf: { $ref: "#/definitions/schemaArray" }, oneOf: { $ref: "#/definitions/schemaArray" }, not: { $ref: "#" } }, default: true }; + !function(e20, t10) { + Object.defineProperty(t10, "__esModule", { value: true }), t10.MissingRefError = t10.ValidationError = t10.CodeGen = t10.Name = t10.nil = t10.stringify = t10.str = t10._ = t10.KeywordCxt = void 0; + var n10 = f6, r10 = Cee, o10 = Pee, i10 = ["/properties"], a10 = "http://json-schema.org/draft-07/schema", s10 = function(e21) { + function t11() { + return No(this, t11), _o(this, t11, arguments); + } + return Ao(t11, e21), Do(t11, [{ key: "_addVocabularies", value: function() { + var e23 = this; + go(Mo(t11.prototype), "_addVocabularies", this).call(this), n10.default.forEach(function(t12) { + return e23.addVocabulary(t12); + }), this.opts.discriminator && this.addKeyword(r10.default); + } }, { key: "_addDefaultMetaSchema", value: function() { + if (go(Mo(t11.prototype), "_addDefaultMetaSchema", this).call(this), this.opts.meta) { + var e23 = this.opts.$data ? this.$dataMetaSchema(o10, i10) : o10; + this.addMetaSchema(e23, a10, false), this.refs["http://json-schema.org/schema"] = a10; + } + } }, { key: "defaultMeta", value: function() { + return this.opts.defaultMeta = go(Mo(t11.prototype), "defaultMeta", this).call(this) || (this.getSchema(a10) ? a10 : void 0); + } }]), t11; + }(q8.default); + e20.exports = t10 = s10, Object.defineProperty(t10, "__esModule", { value: true }), t10.default = s10; + var c10 = q5(); + Object.defineProperty(t10, "KeywordCxt", { enumerable: true, get: function() { + return c10.KeywordCxt; + } }); + var l10 = G8(); + Object.defineProperty(t10, "_", { enumerable: true, get: function() { + return l10._; + } }), Object.defineProperty(t10, "str", { enumerable: true, get: function() { + return l10.str; + } }), Object.defineProperty(t10, "stringify", { enumerable: true, get: function() { + return l10.stringify; + } }), Object.defineProperty(t10, "nil", { enumerable: true, get: function() { + return l10.nil; + } }), Object.defineProperty(t10, "Name", { enumerable: true, get: function() { + return l10.Name; + } }), Object.defineProperty(t10, "CodeGen", { enumerable: true, get: function() { + return l10.CodeGen; + } }); + var u10 = L5(); + Object.defineProperty(t10, "ValidationError", { enumerable: true, get: function() { + return u10.default; + } }); + var f10 = H5(); + Object.defineProperty(t10, "MissingRefError", { enumerable: true, get: function() { + return f10.default; + } }); + }(D8, D8.exports); + var Tee = yc(D8.exports); + var Dee = {}; + !function(e20) { + function t10(e21) { + return null !== e21 && "[object Array]" === Object.prototype.toString.call(e21); + } + function n10(e21) { + return null !== e21 && "[object Object]" === Object.prototype.toString.call(e21); + } + function r10(e21, o11) { + if (e21 === o11) + return true; + if (Object.prototype.toString.call(e21) !== Object.prototype.toString.call(o11)) + return false; + if (true === t10(e21)) { + if (e21.length !== o11.length) + return false; + for (var i11 = 0; i11 < e21.length; i11++) + if (false === r10(e21[i11], o11[i11])) + return false; + return true; + } + if (true === n10(e21)) { + var a11 = {}; + for (var s11 in e21) + if (hasOwnProperty.call(e21, s11)) { + if (false === r10(e21[s11], o11[s11])) + return false; + a11[s11] = true; + } + for (var c11 in o11) + if (hasOwnProperty.call(o11, c11) && true !== a11[c11]) + return false; + return true; + } + return false; + } + function o10(e21) { + if ("" === e21 || false === e21 || null === e21) + return true; + if (t10(e21) && 0 === e21.length) + return true; + if (n10(e21)) { + for (var r11 in e21) + if (e21.hasOwnProperty(r11)) + return false; + return true; + } + return false; + } + var i10; + i10 = "function" == typeof String.prototype.trimLeft ? function(e21) { + return e21.trimLeft(); + } : function(e21) { + return e21.match(/^\s*(.*)/)[1]; + }; + var a10 = 0, s10 = 1, c10 = 2, l10 = 3, u10 = 4, f10 = 6, d10 = 8, h10 = 9, v10 = { 0: "number", 1: "any", 2: "string", 3: "array", 4: "object", 5: "boolean", 6: "expression", 7: "null", 8: "Array", 9: "Array" }, p10 = "EOF", m10 = "UnquotedIdentifier", g10 = "QuotedIdentifier", y10 = "Rbracket", b10 = "Rparen", k10 = "Comma", w10 = "Colon", x10 = "Rbrace", j10 = "Number", S10 = "Current", C10 = "Expref", $10 = "Pipe", _10 = "Or", O10 = "And", M10 = "EQ", E10 = "GT", A10 = "LT", P10 = "GTE", T8 = "LTE", R8 = "NE", N8 = "Flatten", I10 = "Star", D10 = "Filter", q10 = "Dot", z10 = "Not", B10 = "Lbrace", L10 = "Lbracket", F10 = "Lparen", V10 = "Literal", H10 = { ".": q10, "*": I10, ",": k10, ":": w10, "{": B10, "}": x10, "]": y10, "(": F10, ")": b10, "@": S10 }, W10 = { "<": true, ">": true, "=": true, "!": true }, U10 = { " ": true, " ": true, "\n": true }; + function J10(e21) { + return e21 >= "0" && e21 <= "9" || "-" === e21; + } + function K10() { + } + K10.prototype = { tokenize: function(e21) { + var t11, n11, r11, o11, i11 = []; + for (this._current = 0; this._current < e21.length; ) + if ((o11 = e21[this._current]) >= "a" && o11 <= "z" || o11 >= "A" && o11 <= "Z" || "_" === o11) + t11 = this._current, n11 = this._consumeUnquotedIdentifier(e21), i11.push({ type: m10, value: n11, start: t11 }); + else if (void 0 !== H10[e21[this._current]]) + i11.push({ type: H10[e21[this._current]], value: e21[this._current], start: this._current }), this._current++; + else if (J10(e21[this._current])) + r11 = this._consumeNumber(e21), i11.push(r11); + else if ("[" === e21[this._current]) + r11 = this._consumeLBracket(e21), i11.push(r11); + else if ('"' === e21[this._current]) + t11 = this._current, n11 = this._consumeQuotedIdentifier(e21), i11.push({ type: g10, value: n11, start: t11 }); + else if ("'" === e21[this._current]) + t11 = this._current, n11 = this._consumeRawStringLiteral(e21), i11.push({ type: V10, value: n11, start: t11 }); + else if ("`" === e21[this._current]) { + t11 = this._current; + var a11 = this._consumeLiteral(e21); + i11.push({ type: V10, value: a11, start: t11 }); + } else if (void 0 !== W10[e21[this._current]]) + i11.push(this._consumeOperator(e21)); + else if (void 0 !== U10[e21[this._current]]) + this._current++; + else if ("&" === e21[this._current]) + t11 = this._current, this._current++, "&" === e21[this._current] ? (this._current++, i11.push({ type: O10, value: "&&", start: t11 })) : i11.push({ type: C10, value: "&", start: t11 }); + else { + if ("|" !== e21[this._current]) { + var s11 = new Error("Unknown character:" + e21[this._current]); + throw s11.name = "LexerError", s11; + } + t11 = this._current, this._current++, "|" === e21[this._current] ? (this._current++, i11.push({ type: _10, value: "||", start: t11 })) : i11.push({ type: $10, value: "|", start: t11 }); + } + return i11; + }, _consumeUnquotedIdentifier: function(e21) { + var t11, n11 = this._current; + for (this._current++; this._current < e21.length && ((t11 = e21[this._current]) >= "a" && t11 <= "z" || t11 >= "A" && t11 <= "Z" || t11 >= "0" && t11 <= "9" || "_" === t11); ) + this._current++; + return e21.slice(n11, this._current); + }, _consumeQuotedIdentifier: function(e21) { + var t11 = this._current; + this._current++; + for (var n11 = e21.length; '"' !== e21[this._current] && this._current < n11; ) { + var r11 = this._current; + "\\" !== e21[r11] || "\\" !== e21[r11 + 1] && '"' !== e21[r11 + 1] ? r11++ : r11 += 2, this._current = r11; + } + return this._current++, JSON.parse(e21.slice(t11, this._current)); + }, _consumeRawStringLiteral: function(e21) { + var t11 = this._current; + this._current++; + for (var n11 = e21.length; "'" !== e21[this._current] && this._current < n11; ) { + var r11 = this._current; + "\\" !== e21[r11] || "\\" !== e21[r11 + 1] && "'" !== e21[r11 + 1] ? r11++ : r11 += 2, this._current = r11; + } + return this._current++, e21.slice(t11 + 1, this._current - 1).replace("\\'", "'"); + }, _consumeNumber: function(e21) { + var t11 = this._current; + this._current++; + for (var n11 = e21.length; J10(e21[this._current]) && this._current < n11; ) + this._current++; + var r11 = parseInt(e21.slice(t11, this._current)); + return { type: j10, value: r11, start: t11 }; + }, _consumeLBracket: function(e21) { + var t11 = this._current; + return this._current++, "?" === e21[this._current] ? (this._current++, { type: D10, value: "[?", start: t11 }) : "]" === e21[this._current] ? (this._current++, { type: N8, value: "[]", start: t11 }) : { type: L10, value: "[", start: t11 }; + }, _consumeOperator: function(e21) { + var t11 = this._current, n11 = e21[t11]; + return this._current++, "!" === n11 ? "=" === e21[this._current] ? (this._current++, { type: R8, value: "!=", start: t11 }) : { type: z10, value: "!", start: t11 } : "<" === n11 ? "=" === e21[this._current] ? (this._current++, { type: T8, value: "<=", start: t11 }) : { type: A10, value: "<", start: t11 } : ">" === n11 ? "=" === e21[this._current] ? (this._current++, { type: P10, value: ">=", start: t11 }) : { type: E10, value: ">", start: t11 } : "=" === n11 && "=" === e21[this._current] ? (this._current++, { type: M10, value: "==", start: t11 }) : void 0; + }, _consumeLiteral: function(e21) { + this._current++; + for (var t11, n11 = this._current, r11 = e21.length; "`" !== e21[this._current] && this._current < r11; ) { + var o11 = this._current; + "\\" !== e21[o11] || "\\" !== e21[o11 + 1] && "`" !== e21[o11 + 1] ? o11++ : o11 += 2, this._current = o11; + } + var a11 = i10(e21.slice(n11, this._current)); + return a11 = a11.replace("\\`", "`"), t11 = this._looksLikeJSON(a11) ? JSON.parse(a11) : JSON.parse('"' + a11 + '"'), this._current++, t11; + }, _looksLikeJSON: function(e21) { + if ("" === e21) + return false; + if ('[{"'.indexOf(e21[0]) >= 0) + return true; + if (["true", "false", "null"].indexOf(e21) >= 0) + return true; + if (!("-0123456789".indexOf(e21[0]) >= 0)) + return false; + try { + return JSON.parse(e21), true; + } catch (e23) { + return false; + } + } }; + var G10 = {}; + function Q10() { + } + function Y10(e21) { + this.runtime = e21; + } + function X10(e21) { + this._interpreter = e21, this.functionTable = { abs: { _func: this._functionAbs, _signature: [{ types: [a10] }] }, avg: { _func: this._functionAvg, _signature: [{ types: [d10] }] }, ceil: { _func: this._functionCeil, _signature: [{ types: [a10] }] }, contains: { _func: this._functionContains, _signature: [{ types: [c10, l10] }, { types: [s10] }] }, ends_with: { _func: this._functionEndsWith, _signature: [{ types: [c10] }, { types: [c10] }] }, floor: { _func: this._functionFloor, _signature: [{ types: [a10] }] }, length: { _func: this._functionLength, _signature: [{ types: [c10, l10, u10] }] }, map: { _func: this._functionMap, _signature: [{ types: [f10] }, { types: [l10] }] }, max: { _func: this._functionMax, _signature: [{ types: [d10, h10] }] }, merge: { _func: this._functionMerge, _signature: [{ types: [u10], variadic: true }] }, max_by: { _func: this._functionMaxBy, _signature: [{ types: [l10] }, { types: [f10] }] }, sum: { _func: this._functionSum, _signature: [{ types: [d10] }] }, starts_with: { _func: this._functionStartsWith, _signature: [{ types: [c10] }, { types: [c10] }] }, min: { _func: this._functionMin, _signature: [{ types: [d10, h10] }] }, min_by: { _func: this._functionMinBy, _signature: [{ types: [l10] }, { types: [f10] }] }, type: { _func: this._functionType, _signature: [{ types: [s10] }] }, keys: { _func: this._functionKeys, _signature: [{ types: [u10] }] }, values: { _func: this._functionValues, _signature: [{ types: [u10] }] }, sort: { _func: this._functionSort, _signature: [{ types: [h10, d10] }] }, sort_by: { _func: this._functionSortBy, _signature: [{ types: [l10] }, { types: [f10] }] }, join: { _func: this._functionJoin, _signature: [{ types: [c10] }, { types: [h10] }] }, reverse: { _func: this._functionReverse, _signature: [{ types: [c10, l10] }] }, to_array: { _func: this._functionToArray, _signature: [{ types: [s10] }] }, to_string: { _func: this._functionToString, _signature: [{ types: [s10] }] }, to_number: { _func: this._functionToNumber, _signature: [{ types: [s10] }] }, not_null: { _func: this._functionNotNull, _signature: [{ types: [s10], variadic: true }] } }; + } + G10[p10] = 0, G10[m10] = 0, G10[g10] = 0, G10[y10] = 0, G10[b10] = 0, G10[k10] = 0, G10[x10] = 0, G10[j10] = 0, G10[S10] = 0, G10[C10] = 0, G10[$10] = 1, G10[_10] = 2, G10[O10] = 3, G10[M10] = 5, G10[E10] = 5, G10[A10] = 5, G10[P10] = 5, G10[T8] = 5, G10[R8] = 5, G10[N8] = 9, G10[I10] = 20, G10[D10] = 21, G10[q10] = 40, G10[z10] = 45, G10[B10] = 50, G10[L10] = 55, G10[F10] = 60, Q10.prototype = { parse: function(e21) { + this._loadTokens(e21), this.index = 0; + var t11 = this.expression(0); + if (this._lookahead(0) !== p10) { + var n11 = this._lookaheadToken(0), r11 = new Error("Unexpected token type: " + n11.type + ", value: " + n11.value); + throw r11.name = "ParserError", r11; + } + return t11; + }, _loadTokens: function(e21) { + var t11 = new K10().tokenize(e21); + t11.push({ type: p10, value: "", start: e21.length }), this.tokens = t11; + }, expression: function(e21) { + var t11 = this._lookaheadToken(0); + this._advance(); + for (var n11 = this.nud(t11), r11 = this._lookahead(0); e21 < G10[r11]; ) + this._advance(), n11 = this.led(r11, n11), r11 = this._lookahead(0); + return n11; + }, _lookahead: function(e21) { + return this.tokens[this.index + e21].type; + }, _lookaheadToken: function(e21) { + return this.tokens[this.index + e21]; + }, _advance: function() { + this.index++; + }, nud: function(e21) { + var t11, n11; + switch (e21.type) { + case V10: + return { type: "Literal", value: e21.value }; + case m10: + return { type: "Field", name: e21.value }; + case g10: + var r11 = { type: "Field", name: e21.value }; + if (this._lookahead(0) === F10) + throw new Error("Quoted identifier not allowed for function names."); + return r11; + case z10: + return { type: "NotExpression", children: [t11 = this.expression(G10.Not)] }; + case I10: + return t11 = null, { type: "ValueProjection", children: [{ type: "Identity" }, t11 = this._lookahead(0) === y10 ? { type: "Identity" } : this._parseProjectionRHS(G10.Star)] }; + case D10: + return this.led(e21.type, { type: "Identity" }); + case B10: + return this._parseMultiselectHash(); + case N8: + return { type: "Projection", children: [{ type: N8, children: [{ type: "Identity" }] }, t11 = this._parseProjectionRHS(G10.Flatten)] }; + case L10: + return this._lookahead(0) === j10 || this._lookahead(0) === w10 ? (t11 = this._parseIndexExpression(), this._projectIfSlice({ type: "Identity" }, t11)) : this._lookahead(0) === I10 && this._lookahead(1) === y10 ? (this._advance(), this._advance(), { type: "Projection", children: [{ type: "Identity" }, t11 = this._parseProjectionRHS(G10.Star)] }) : this._parseMultiselectList(); + case S10: + return { type: S10 }; + case C10: + return { type: "ExpressionReference", children: [n11 = this.expression(G10.Expref)] }; + case F10: + for (var o11 = []; this._lookahead(0) !== b10; ) + this._lookahead(0) === S10 ? (n11 = { type: S10 }, this._advance()) : n11 = this.expression(0), o11.push(n11); + return this._match(b10), o11[0]; + default: + this._errorToken(e21); + } + }, led: function(e21, t11) { + var n11; + switch (e21) { + case q10: + var r11 = G10.Dot; + return this._lookahead(0) !== I10 ? { type: "Subexpression", children: [t11, n11 = this._parseDotRHS(r11)] } : (this._advance(), { type: "ValueProjection", children: [t11, n11 = this._parseProjectionRHS(r11)] }); + case $10: + return n11 = this.expression(G10.Pipe), { type: $10, children: [t11, n11] }; + case _10: + return { type: "OrExpression", children: [t11, n11 = this.expression(G10.Or)] }; + case O10: + return { type: "AndExpression", children: [t11, n11 = this.expression(G10.And)] }; + case F10: + for (var o11, i11 = t11.name, a11 = []; this._lookahead(0) !== b10; ) + this._lookahead(0) === S10 ? (o11 = { type: S10 }, this._advance()) : o11 = this.expression(0), this._lookahead(0) === k10 && this._match(k10), a11.push(o11); + return this._match(b10), { type: "Function", name: i11, children: a11 }; + case D10: + var s11 = this.expression(0); + return this._match(y10), { type: "FilterProjection", children: [t11, n11 = this._lookahead(0) === N8 ? { type: "Identity" } : this._parseProjectionRHS(G10.Filter), s11] }; + case N8: + return { type: "Projection", children: [{ type: N8, children: [t11] }, this._parseProjectionRHS(G10.Flatten)] }; + case M10: + case R8: + case E10: + case P10: + case A10: + case T8: + return this._parseComparator(t11, e21); + case L10: + var c11 = this._lookaheadToken(0); + return c11.type === j10 || c11.type === w10 ? (n11 = this._parseIndexExpression(), this._projectIfSlice(t11, n11)) : (this._match(I10), this._match(y10), { type: "Projection", children: [t11, n11 = this._parseProjectionRHS(G10.Star)] }); + default: + this._errorToken(this._lookaheadToken(0)); + } + }, _match: function(e21) { + if (this._lookahead(0) !== e21) { + var t11 = this._lookaheadToken(0), n11 = new Error("Expected " + e21 + ", got: " + t11.type); + throw n11.name = "ParserError", n11; + } + this._advance(); + }, _errorToken: function(e21) { + var t11 = new Error("Invalid token (" + e21.type + '): "' + e21.value + '"'); + throw t11.name = "ParserError", t11; + }, _parseIndexExpression: function() { + if (this._lookahead(0) === w10 || this._lookahead(1) === w10) + return this._parseSliceExpression(); + var e21 = { type: "Index", value: this._lookaheadToken(0).value }; + return this._advance(), this._match(y10), e21; + }, _projectIfSlice: function(e21, t11) { + var n11 = { type: "IndexExpression", children: [e21, t11] }; + return "Slice" === t11.type ? { type: "Projection", children: [n11, this._parseProjectionRHS(G10.Star)] } : n11; + }, _parseSliceExpression: function() { + for (var e21 = [null, null, null], t11 = 0, n11 = this._lookahead(0); n11 !== y10 && t11 < 3; ) { + if (n11 === w10) + t11++, this._advance(); + else { + if (n11 !== j10) { + var r11 = this._lookahead(0), o11 = new Error("Syntax error, unexpected token: " + r11.value + "(" + r11.type + ")"); + throw o11.name = "Parsererror", o11; + } + e21[t11] = this._lookaheadToken(0).value, this._advance(); + } + n11 = this._lookahead(0); + } + return this._match(y10), { type: "Slice", children: e21 }; + }, _parseComparator: function(e21, t11) { + return { type: "Comparator", name: t11, children: [e21, this.expression(G10[t11])] }; + }, _parseDotRHS: function(e21) { + var t11 = this._lookahead(0); + return [m10, g10, I10].indexOf(t11) >= 0 ? this.expression(e21) : t11 === L10 ? (this._match(L10), this._parseMultiselectList()) : t11 === B10 ? (this._match(B10), this._parseMultiselectHash()) : void 0; + }, _parseProjectionRHS: function(e21) { + var t11; + if (G10[this._lookahead(0)] < 10) + t11 = { type: "Identity" }; + else if (this._lookahead(0) === L10) + t11 = this.expression(e21); + else if (this._lookahead(0) === D10) + t11 = this.expression(e21); + else { + if (this._lookahead(0) !== q10) { + var n11 = this._lookaheadToken(0), r11 = new Error("Sytanx error, unexpected token: " + n11.value + "(" + n11.type + ")"); + throw r11.name = "ParserError", r11; + } + this._match(q10), t11 = this._parseDotRHS(e21); + } + return t11; + }, _parseMultiselectList: function() { + for (var e21 = []; this._lookahead(0) !== y10; ) { + var t11 = this.expression(0); + if (e21.push(t11), this._lookahead(0) === k10 && (this._match(k10), this._lookahead(0) === y10)) + throw new Error("Unexpected token Rbracket"); + } + return this._match(y10), { type: "MultiSelectList", children: e21 }; + }, _parseMultiselectHash: function() { + for (var e21, t11, n11, r11 = [], o11 = [m10, g10]; ; ) { + if (e21 = this._lookaheadToken(0), o11.indexOf(e21.type) < 0) + throw new Error("Expecting an identifier token, got: " + e21.type); + if (t11 = e21.value, this._advance(), this._match(w10), n11 = { type: "KeyValuePair", name: t11, value: this.expression(0) }, r11.push(n11), this._lookahead(0) === k10) + this._match(k10); + else if (this._lookahead(0) === x10) { + this._match(x10); + break; + } + } + return { type: "MultiSelectHash", children: r11 }; + } }, Y10.prototype = { search: function(e21, t11) { + return this.visit(e21, t11); + }, visit: function(e21, i11) { + var a11, s11, c11, l11, u11, f11, d11, h11, v11; + switch (e21.type) { + case "Field": + return null !== i11 && n10(i11) ? void 0 === (f11 = i11[e21.name]) ? null : f11 : null; + case "Subexpression": + for (c11 = this.visit(e21.children[0], i11), v11 = 1; v11 < e21.children.length; v11++) + if (null === (c11 = this.visit(e21.children[1], c11))) + return null; + return c11; + case "IndexExpression": + return d11 = this.visit(e21.children[0], i11), this.visit(e21.children[1], d11); + case "Index": + if (!t10(i11)) + return null; + var p11 = e21.value; + return p11 < 0 && (p11 = i11.length + p11), void 0 === (c11 = i11[p11]) && (c11 = null), c11; + case "Slice": + if (!t10(i11)) + return null; + var m11 = e21.children.slice(0), g11 = this.computeSliceParams(i11.length, m11), y11 = g11[0], b11 = g11[1], k11 = g11[2]; + if (c11 = [], k11 > 0) + for (v11 = y11; v11 < b11; v11 += k11) + c11.push(i11[v11]); + else + for (v11 = y11; v11 > b11; v11 += k11) + c11.push(i11[v11]); + return c11; + case "Projection": + var w11 = this.visit(e21.children[0], i11); + if (!t10(w11)) + return null; + for (h11 = [], v11 = 0; v11 < w11.length; v11++) + null !== (s11 = this.visit(e21.children[1], w11[v11])) && h11.push(s11); + return h11; + case "ValueProjection": + if (!n10(w11 = this.visit(e21.children[0], i11))) + return null; + h11 = []; + var x11 = function(e23) { + for (var t11 = Object.keys(e23), n11 = [], r11 = 0; r11 < t11.length; r11++) + n11.push(e23[t11[r11]]); + return n11; + }(w11); + for (v11 = 0; v11 < x11.length; v11++) + null !== (s11 = this.visit(e21.children[1], x11[v11])) && h11.push(s11); + return h11; + case "FilterProjection": + if (!t10(w11 = this.visit(e21.children[0], i11))) + return null; + var j11 = [], _11 = []; + for (v11 = 0; v11 < w11.length; v11++) + o10(a11 = this.visit(e21.children[2], w11[v11])) || j11.push(w11[v11]); + for (var O11 = 0; O11 < j11.length; O11++) + null !== (s11 = this.visit(e21.children[1], j11[O11])) && _11.push(s11); + return _11; + case "Comparator": + switch (l11 = this.visit(e21.children[0], i11), u11 = this.visit(e21.children[1], i11), e21.name) { + case M10: + c11 = r10(l11, u11); + break; + case R8: + c11 = !r10(l11, u11); + break; + case E10: + c11 = l11 > u11; + break; + case P10: + c11 = l11 >= u11; + break; + case A10: + c11 = l11 < u11; + break; + case T8: + c11 = l11 <= u11; + break; + default: + throw new Error("Unknown comparator: " + e21.name); + } + return c11; + case N8: + var I11 = this.visit(e21.children[0], i11); + if (!t10(I11)) + return null; + var D11 = []; + for (v11 = 0; v11 < I11.length; v11++) + t10(s11 = I11[v11]) ? D11.push.apply(D11, s11) : D11.push(s11); + return D11; + case "Identity": + return i11; + case "MultiSelectList": + if (null === i11) + return null; + for (h11 = [], v11 = 0; v11 < e21.children.length; v11++) + h11.push(this.visit(e21.children[v11], i11)); + return h11; + case "MultiSelectHash": + if (null === i11) + return null; + var q11; + for (h11 = {}, v11 = 0; v11 < e21.children.length; v11++) + h11[(q11 = e21.children[v11]).name] = this.visit(q11.value, i11); + return h11; + case "OrExpression": + return o10(a11 = this.visit(e21.children[0], i11)) && (a11 = this.visit(e21.children[1], i11)), a11; + case "AndExpression": + return true === o10(l11 = this.visit(e21.children[0], i11)) ? l11 : this.visit(e21.children[1], i11); + case "NotExpression": + return o10(l11 = this.visit(e21.children[0], i11)); + case "Literal": + return e21.value; + case $10: + return d11 = this.visit(e21.children[0], i11), this.visit(e21.children[1], d11); + case S10: + return i11; + case "Function": + var z11 = []; + for (v11 = 0; v11 < e21.children.length; v11++) + z11.push(this.visit(e21.children[v11], i11)); + return this.runtime.callFunction(e21.name, z11); + case "ExpressionReference": + var B11 = e21.children[0]; + return B11.jmespathType = C10, B11; + default: + throw new Error("Unknown node type: " + e21.type); + } + }, computeSliceParams: function(e21, t11) { + var n11 = t11[0], r11 = t11[1], o11 = t11[2], i11 = [null, null, null]; + if (null === o11) + o11 = 1; + else if (0 === o11) { + var a11 = new Error("Invalid slice, step cannot be 0"); + throw a11.name = "RuntimeError", a11; + } + var s11 = o11 < 0; + return n11 = null === n11 ? s11 ? e21 - 1 : 0 : this.capSliceRange(e21, n11, o11), r11 = null === r11 ? s11 ? -1 : e21 : this.capSliceRange(e21, r11, o11), i11[0] = n11, i11[1] = r11, i11[2] = o11, i11; + }, capSliceRange: function(e21, t11, n11) { + return t11 < 0 ? (t11 += e21) < 0 && (t11 = n11 < 0 ? -1 : 0) : t11 >= e21 && (t11 = n11 < 0 ? e21 - 1 : e21), t11; + } }, X10.prototype = { callFunction: function(e21, t11) { + var n11 = this.functionTable[e21]; + if (void 0 === n11) + throw new Error("Unknown function: " + e21 + "()"); + return this._validateArgs(e21, t11, n11._signature), n11._func.call(this, t11); + }, _validateArgs: function(e21, t11, n11) { + var r11, o11, i11, a11; + if (n11[n11.length - 1].variadic) { + if (t11.length < n11.length) + throw r11 = 1 === n11.length ? " argument" : " arguments", new Error("ArgumentError: " + e21 + "() takes at least" + n11.length + r11 + " but received " + t11.length); + } else if (t11.length !== n11.length) + throw r11 = 1 === n11.length ? " argument" : " arguments", new Error("ArgumentError: " + e21 + "() takes " + n11.length + r11 + " but received " + t11.length); + for (var s11 = 0; s11 < n11.length; s11++) { + a11 = false, o11 = n11[s11].types, i11 = this._getTypeName(t11[s11]); + for (var c11 = 0; c11 < o11.length; c11++) + if (this._typeMatches(i11, o11[c11], t11[s11])) { + a11 = true; + break; + } + if (!a11) { + var l11 = o11.map(function(e23) { + return v10[e23]; + }).join(","); + throw new Error("TypeError: " + e21 + "() expected argument " + (s11 + 1) + " to be type " + l11 + " but received type " + v10[i11] + " instead."); + } + } + }, _typeMatches: function(e21, t11, n11) { + if (t11 === s10) + return true; + if (t11 !== h10 && t11 !== d10 && t11 !== l10) + return e21 === t11; + if (t11 === l10) + return e21 === l10; + if (e21 === l10) { + var r11; + t11 === d10 ? r11 = a10 : t11 === h10 && (r11 = c10); + for (var o11 = 0; o11 < n11.length; o11++) + if (!this._typeMatches(this._getTypeName(n11[o11]), r11, n11[o11])) + return false; + return true; + } + }, _getTypeName: function(e21) { + switch (Object.prototype.toString.call(e21)) { + case "[object String]": + return c10; + case "[object Number]": + return a10; + case "[object Array]": + return l10; + case "[object Boolean]": + return 5; + case "[object Null]": + return 7; + case "[object Object]": + return e21.jmespathType === C10 ? f10 : u10; + } + }, _functionStartsWith: function(e21) { + return 0 === e21[0].lastIndexOf(e21[1]); + }, _functionEndsWith: function(e21) { + var t11 = e21[0], n11 = e21[1]; + return -1 !== t11.indexOf(n11, t11.length - n11.length); + }, _functionReverse: function(e21) { + if (this._getTypeName(e21[0]) === c10) { + for (var t11 = e21[0], n11 = "", r11 = t11.length - 1; r11 >= 0; r11--) + n11 += t11[r11]; + return n11; + } + var o11 = e21[0].slice(0); + return o11.reverse(), o11; + }, _functionAbs: function(e21) { + return Math.abs(e21[0]); + }, _functionCeil: function(e21) { + return Math.ceil(e21[0]); + }, _functionAvg: function(e21) { + for (var t11 = 0, n11 = e21[0], r11 = 0; r11 < n11.length; r11++) + t11 += n11[r11]; + return t11 / n11.length; + }, _functionContains: function(e21) { + return e21[0].indexOf(e21[1]) >= 0; + }, _functionFloor: function(e21) { + return Math.floor(e21[0]); + }, _functionLength: function(e21) { + return n10(e21[0]) ? Object.keys(e21[0]).length : e21[0].length; + }, _functionMap: function(e21) { + for (var t11 = [], n11 = this._interpreter, r11 = e21[0], o11 = e21[1], i11 = 0; i11 < o11.length; i11++) + t11.push(n11.visit(r11, o11[i11])); + return t11; + }, _functionMerge: function(e21) { + for (var t11 = {}, n11 = 0; n11 < e21.length; n11++) { + var r11 = e21[n11]; + for (var o11 in r11) + t11[o11] = r11[o11]; + } + return t11; + }, _functionMax: function(e21) { + if (e21[0].length > 0) { + if (this._getTypeName(e21[0][0]) === a10) + return Math.max.apply(Math, e21[0]); + for (var t11 = e21[0], n11 = t11[0], r11 = 1; r11 < t11.length; r11++) + n11.localeCompare(t11[r11]) < 0 && (n11 = t11[r11]); + return n11; + } + return null; + }, _functionMin: function(e21) { + if (e21[0].length > 0) { + if (this._getTypeName(e21[0][0]) === a10) + return Math.min.apply(Math, e21[0]); + for (var t11 = e21[0], n11 = t11[0], r11 = 1; r11 < t11.length; r11++) + t11[r11].localeCompare(n11) < 0 && (n11 = t11[r11]); + return n11; + } + return null; + }, _functionSum: function(e21) { + for (var t11 = 0, n11 = e21[0], r11 = 0; r11 < n11.length; r11++) + t11 += n11[r11]; + return t11; + }, _functionType: function(e21) { + switch (this._getTypeName(e21[0])) { + case a10: + return "number"; + case c10: + return "string"; + case l10: + return "array"; + case u10: + return "object"; + case 5: + return "boolean"; + case f10: + return "expref"; + case 7: + return "null"; + } + }, _functionKeys: function(e21) { + return Object.keys(e21[0]); + }, _functionValues: function(e21) { + for (var t11 = e21[0], n11 = Object.keys(t11), r11 = [], o11 = 0; o11 < n11.length; o11++) + r11.push(t11[n11[o11]]); + return r11; + }, _functionJoin: function(e21) { + var t11 = e21[0]; + return e21[1].join(t11); + }, _functionToArray: function(e21) { + return this._getTypeName(e21[0]) === l10 ? e21[0] : [e21[0]]; + }, _functionToString: function(e21) { + return this._getTypeName(e21[0]) === c10 ? e21[0] : JSON.stringify(e21[0]); + }, _functionToNumber: function(e21) { + var t11, n11 = this._getTypeName(e21[0]); + return n11 === a10 ? e21[0] : n11 !== c10 || (t11 = +e21[0], isNaN(t11)) ? null : t11; + }, _functionNotNull: function(e21) { + for (var t11 = 0; t11 < e21.length; t11++) + if (7 !== this._getTypeName(e21[t11])) + return e21[t11]; + return null; + }, _functionSort: function(e21) { + var t11 = e21[0].slice(0); + return t11.sort(), t11; + }, _functionSortBy: function(e21) { + var t11 = e21[0].slice(0); + if (0 === t11.length) + return t11; + var n11 = this._interpreter, r11 = e21[1], o11 = this._getTypeName(n11.visit(r11, t11[0])); + if ([a10, c10].indexOf(o11) < 0) + throw new Error("TypeError"); + for (var i11 = this, s11 = [], l11 = 0; l11 < t11.length; l11++) + s11.push([l11, t11[l11]]); + s11.sort(function(e23, t12) { + var a11 = n11.visit(r11, e23[1]), s12 = n11.visit(r11, t12[1]); + if (i11._getTypeName(a11) !== o11) + throw new Error("TypeError: expected " + o11 + ", received " + i11._getTypeName(a11)); + if (i11._getTypeName(s12) !== o11) + throw new Error("TypeError: expected " + o11 + ", received " + i11._getTypeName(s12)); + return a11 > s12 ? 1 : a11 < s12 ? -1 : e23[0] - t12[0]; + }); + for (var u11 = 0; u11 < s11.length; u11++) + t11[u11] = s11[u11][1]; + return t11; + }, _functionMaxBy: function(e21) { + for (var t11, n11, r11 = e21[1], o11 = e21[0], i11 = this.createKeyFunction(r11, [a10, c10]), s11 = -1 / 0, l11 = 0; l11 < o11.length; l11++) + (n11 = i11(o11[l11])) > s11 && (s11 = n11, t11 = o11[l11]); + return t11; + }, _functionMinBy: function(e21) { + for (var t11, n11, r11 = e21[1], o11 = e21[0], i11 = this.createKeyFunction(r11, [a10, c10]), s11 = 1 / 0, l11 = 0; l11 < o11.length; l11++) + (n11 = i11(o11[l11])) < s11 && (s11 = n11, t11 = o11[l11]); + return t11; + }, createKeyFunction: function(e21, t11) { + var n11 = this, r11 = this._interpreter; + return function(o11) { + var i11 = r11.visit(e21, o11); + if (t11.indexOf(n11._getTypeName(i11)) < 0) { + var a11 = "TypeError: expected one of " + t11 + ", received " + n11._getTypeName(i11); + throw new Error(a11); + } + return i11; + }; + } }, e20.tokenize = function(e21) { + return new K10().tokenize(e21); + }, e20.compile = function(e21) { + return new Q10().parse(e21); + }, e20.search = function(e21, t11) { + var n11 = new Q10(), r11 = new X10(), o11 = new Y10(r11); + r11._interpreter = o11; + var i11 = n11.parse(t11); + return o11.search(i11, e21); + }, e20.strictDeepEqual = r10; + }(Dee); + var qee = yc(Dee); + var Fee = function(e20, t10) { + if (!(e20 instanceof t10)) + throw new TypeError("Cannot call a class as a function"); + }; + var Vee = /* @__PURE__ */ function() { + function e20(e21, t10) { + for (var n10 = 0; n10 < t10.length; n10++) { + var r10 = t10[n10]; + r10.enumerable = r10.enumerable || false, r10.configurable = true, "value" in r10 && (r10.writable = true), Object.defineProperty(e21, r10.key, r10); + } + } + return function(t10, n10, r10) { + return n10 && e20(t10.prototype, n10), r10 && e20(t10, r10), t10; + }; + }(); + var Hee = function(e20, t10) { + if (Array.isArray(e20)) + return e20; + if (Symbol.iterator in Object(e20)) + return function(e21, t11) { + var n10 = [], r10 = true, o10 = false, i10 = void 0; + try { + for (var a10, s10 = e21[Symbol.iterator](); !(r10 = (a10 = s10.next()).done) && (n10.push(a10.value), !t11 || n10.length !== t11); r10 = true) + ; + } catch (e23) { + o10 = true, i10 = e23; + } finally { + try { + !r10 && s10.return && s10.return(); + } finally { + if (o10) + throw i10; + } + } + return n10; + }(e20, t10); + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + }; + String.prototype.startsWith = String.prototype.startsWith || function(e20) { + return 0 === this.indexOf(e20); + }, String.prototype.padStart = String.prototype.padStart || function(e20, t10) { + for (var n10 = this; n10.length < e20; ) + n10 = t10 + n10; + return n10; + }; + var Wee = { cb: "0f8ff", tqw: "aebd7", q: "-ffff", qmrn: "7fffd4", zr: "0ffff", bg: "5f5dc", bsq: "e4c4", bck: "---", nch: "ebcd", b: "--ff", bvt: "8a2be2", brwn: "a52a2a", brw: "deb887", ctb: "5f9ea0", hrt: "7fff-", chcT: "d2691e", cr: "7f50", rnw: "6495ed", crns: "8dc", crms: "dc143c", cn: "-ffff", Db: "--8b", Dcn: "-8b8b", Dgnr: "b8860b", Dgr: "a9a9a9", Dgrn: "-64-", Dkhk: "bdb76b", Dmgn: "8b-8b", Dvgr: "556b2f", Drng: "8c-", Drch: "9932cc", Dr: "8b--", Dsmn: "e9967a", Dsgr: "8fbc8f", DsTb: "483d8b", DsTg: "2f4f4f", Dtrq: "-ced1", Dvt: "94-d3", ppnk: "1493", pskb: "-bfff", mgr: "696969", grb: "1e90ff", rbrc: "b22222", rwht: "af0", stg: "228b22", chs: "-ff", gnsb: "dcdcdc", st: "8f8ff", g: "d7-", gnr: "daa520", gr: "808080", grn: "-8-0", grnw: "adff2f", hnw: "0fff0", htpn: "69b4", nnr: "cd5c5c", ng: "4b-82", vr: "0", khk: "0e68c", vnr: "e6e6fa", nrb: "0f5", wngr: "7cfc-", mnch: "acd", Lb: "add8e6", Lcr: "08080", Lcn: "e0ffff", Lgnr: "afad2", Lgr: "d3d3d3", Lgrn: "90ee90", Lpnk: "b6c1", Lsmn: "a07a", Lsgr: "20b2aa", Lskb: "87cefa", LsTg: "778899", Lstb: "b0c4de", Lw: "e0", m: "-ff-", mgrn: "32cd32", nn: "af0e6", mgnt: "-ff", mrn: "8--0", mqm: "66cdaa", mmb: "--cd", mmrc: "ba55d3", mmpr: "9370db", msg: "3cb371", mmsT: "7b68ee", "": "-fa9a", mtr: "48d1cc", mmvt: "c71585", mnLb: "191970", ntc: "5fffa", mstr: "e4e1", mccs: "e4b5", vjw: "dead", nv: "--80", c: "df5e6", v: "808-0", vrb: "6b8e23", rng: "a5-", rngr: "45-", rch: "da70d6", pgnr: "eee8aa", pgrn: "98fb98", ptrq: "afeeee", pvtr: "db7093", ppwh: "efd5", pchp: "dab9", pr: "cd853f", pnk: "c0cb", pm: "dda0dd", pwrb: "b0e0e6", prp: "8-080", cc: "663399", r: "--", sbr: "bc8f8f", rb: "4169e1", sbrw: "8b4513", smn: "a8072", nbr: "4a460", sgrn: "2e8b57", ssh: "5ee", snn: "a0522d", svr: "c0c0c0", skb: "87ceeb", sTb: "6a5acd", sTgr: "708090", snw: "afa", n: "-ff7f", stb: "4682b4", tn: "d2b48c", t: "-8080", thst: "d8bfd8", tmT: "6347", trqs: "40e0d0", vt: "ee82ee", whT: "5deb3", wht: "", hts: "5f5f5", w: "-", wgrn: "9acd32" }; + function Uee(e20) { + var t10 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; + return (t10 > 0 ? e20.toFixed(t10).replace(/0+$/, "").replace(/\.$/, "") : e20.toString()) || "0"; + } + var Jee = function() { + function e20(t10, n10, r10, o10) { + Fee(this, e20); + var i10 = this; + if (void 0 === t10) + ; + else if (Array.isArray(t10)) + this.rgba = t10; + else if (void 0 === r10) { + var a10 = t10 && "" + t10; + a10 && function(t11) { + if (t11.startsWith("hsl")) { + var n11 = t11.match(/([\-\d\.e]+)/g).map(Number), r11 = Hee(n11, 4), o11 = r11[0], a11 = r11[1], s10 = r11[2], c10 = r11[3]; + void 0 === c10 && (c10 = 1), o11 /= 360, a11 /= 100, s10 /= 100, i10.hsla = [o11, a11, s10, c10]; + } else if (t11.startsWith("rgb")) { + var l10 = t11.match(/([\-\d\.e]+)/g).map(Number), u10 = Hee(l10, 4), f10 = u10[0], d10 = u10[1], h10 = u10[2], v10 = u10[3]; + void 0 === v10 && (v10 = 1), i10.rgba = [f10, d10, h10, v10]; + } else + t11.startsWith("#") ? i10.rgba = e20.hexToRgb(t11) : i10.rgba = e20.nameToRgb(t11) || e20.hexToRgb(t11); + }(a10.toLowerCase()); + } else + this.rgba = [t10, n10, r10, void 0 === o10 ? 1 : o10]; + } + return Vee(e20, [{ key: "printRGB", value: function(e21) { + var t10 = (e21 ? this.rgba : this.rgba.slice(0, 3)).map(function(e23, t11) { + return Uee(e23, 3 === t11 ? 3 : 0); + }); + return e21 ? "rgba(" + t10 + ")" : "rgb(" + t10 + ")"; + } }, { key: "printHSL", value: function(e21) { + var t10 = [360, 100, 100, 1], n10 = ["", "%", "%", ""], r10 = (e21 ? this.hsla : this.hsla.slice(0, 3)).map(function(e23, r11) { + return Uee(e23 * t10[r11], 3 === r11 ? 3 : 1) + n10[r11]; + }); + return e21 ? "hsla(" + r10 + ")" : "hsl(" + r10 + ")"; + } }, { key: "printHex", value: function(e21) { + var t10 = this.hex; + return e21 ? t10 : t10.substring(0, 7); + } }, { key: "rgba", get: function() { + if (this._rgba) + return this._rgba; + if (!this._hsla) + throw new Error("No color is set"); + return this._rgba = e20.hslToRgb(this._hsla); + }, set: function(e21) { + 3 === e21.length && (e21[3] = 1), this._rgba = e21, this._hsla = null; + } }, { key: "rgbString", get: function() { + return this.printRGB(); + } }, { key: "rgbaString", get: function() { + return this.printRGB(true); + } }, { key: "hsla", get: function() { + if (this._hsla) + return this._hsla; + if (!this._rgba) + throw new Error("No color is set"); + return this._hsla = e20.rgbToHsl(this._rgba); + }, set: function(e21) { + 3 === e21.length && (e21[3] = 1), this._hsla = e21, this._rgba = null; + } }, { key: "hslString", get: function() { + return this.printHSL(); + } }, { key: "hslaString", get: function() { + return this.printHSL(true); + } }, { key: "hex", get: function() { + var e21 = this.rgba.map(function(e23, t10) { + return t10 < 3 ? e23.toString(16) : Math.round(255 * e23).toString(16); + }); + return "#" + e21.map(function(e23) { + return e23.padStart(2, "0"); + }).join(""); + }, set: function(t10) { + this.rgba = e20.hexToRgb(t10); + } }], [{ key: "hexToRgb", value: function(e21) { + var t10 = (e21.startsWith("#") ? e21.slice(1) : e21).replace(/^(\w{3})$/, "$1F").replace(/^(\w)(\w)(\w)(\w)$/, "$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/, "$1FF"); + if (!t10.match(/^([0-9a-fA-F]{8})$/)) + throw new Error("Unknown hex color; " + e21); + var n10 = t10.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map(function(e23) { + return parseInt(e23, 16); + }); + return n10[3] = n10[3] / 255, n10; + } }, { key: "nameToRgb", value: function(t10) { + var n10 = t10.toLowerCase().replace("at", "T").replace(/[aeiouyldf]/g, "").replace("ght", "L").replace("rk", "D").slice(-5, 4), r10 = Wee[n10]; + return void 0 === r10 ? r10 : e20.hexToRgb(r10.replace(/\-/g, "00").padStart(6, "f")); + } }, { key: "rgbToHsl", value: function(e21) { + var t10 = Hee(e21, 4), n10 = t10[0], r10 = t10[1], o10 = t10[2], i10 = t10[3]; + n10 /= 255, r10 /= 255, o10 /= 255; + var a10 = Math.max(n10, r10, o10), s10 = Math.min(n10, r10, o10), c10 = void 0, l10 = void 0, u10 = (a10 + s10) / 2; + if (a10 === s10) + c10 = l10 = 0; + else { + var f10 = a10 - s10; + switch (l10 = u10 > 0.5 ? f10 / (2 - a10 - s10) : f10 / (a10 + s10), a10) { + case n10: + c10 = (r10 - o10) / f10 + (r10 < o10 ? 6 : 0); + break; + case r10: + c10 = (o10 - n10) / f10 + 2; + break; + case o10: + c10 = (n10 - r10) / f10 + 4; + } + c10 /= 6; + } + return [c10, l10, u10, i10]; + } }, { key: "hslToRgb", value: function(e21) { + var t10 = Hee(e21, 4), n10 = t10[0], r10 = t10[1], o10 = t10[2], i10 = t10[3], a10 = void 0, s10 = void 0, c10 = void 0; + if (0 === r10) + a10 = s10 = c10 = o10; + else { + var l10 = function(e23, t11, n11) { + return n11 < 0 && (n11 += 1), n11 > 1 && (n11 -= 1), n11 < 1 / 6 ? e23 + 6 * (t11 - e23) * n11 : n11 < 0.5 ? t11 : n11 < 2 / 3 ? e23 + (t11 - e23) * (2 / 3 - n11) * 6 : e23; + }, u10 = o10 < 0.5 ? o10 * (1 + r10) : o10 + r10 - o10 * r10, f10 = 2 * o10 - u10; + a10 = l10(f10, u10, n10 + 1 / 3), s10 = l10(f10, u10, n10), c10 = l10(f10, u10, n10 - 1 / 3); + } + var d10 = [255 * a10, 255 * s10, 255 * c10].map(Math.round); + return d10[3] = i10, d10; + } }]), e20; + }(); + var Kee = function() { + function e20() { + Fee(this, e20), this._events = []; + } + return Vee(e20, [{ key: "add", value: function(e21, t10, n10) { + e21.addEventListener(t10, n10, false), this._events.push({ target: e21, type: t10, handler: n10 }); + } }, { key: "remove", value: function(t10, n10, r10) { + this._events = this._events.filter(function(o10) { + var i10 = true; + return t10 && t10 !== o10.target && (i10 = false), n10 && n10 !== o10.type && (i10 = false), r10 && r10 !== o10.handler && (i10 = false), i10 && e20._doRemove(o10.target, o10.type, o10.handler), !i10; + }); + } }, { key: "destroy", value: function() { + this._events.forEach(function(t10) { + return e20._doRemove(t10.target, t10.type, t10.handler); + }), this._events = []; + } }], [{ key: "_doRemove", value: function(e21, t10, n10) { + e21.removeEventListener(t10, n10, false); + } }]), e20; + }(); + function Gee(e20, t10, n10) { + var r10 = false; + function o10(e21, t11, n11) { + return Math.max(t11, Math.min(e21, n11)); + } + function i10(e21, i11, a11) { + if (a11 && (r10 = true), r10) { + e21.preventDefault(); + var s11 = t10.getBoundingClientRect(), c10 = s11.width, l10 = s11.height, u10 = i11.clientX, f10 = i11.clientY, d10 = o10(u10 - s11.left, 0, c10), h10 = o10(f10 - s11.top, 0, l10); + n10(d10 / c10, h10 / l10); + } + } + function a10(e21, t11) { + 1 === (void 0 === e21.buttons ? e21.which : e21.buttons) ? i10(e21, e21, t11) : r10 = false; + } + function s10(e21, t11) { + 1 === e21.touches.length ? i10(e21, e21.touches[0], t11) : r10 = false; + } + e20.add(t10, "mousedown", function(e21) { + a10(e21, true); + }), e20.add(t10, "touchstart", function(e21) { + s10(e21, true); + }), e20.add(window, "mousemove", a10), e20.add(t10, "touchmove", s10), e20.add(window, "mouseup", function(e21) { + r10 = false; + }), e20.add(t10, "touchend", function(e21) { + r10 = false; + }), e20.add(t10, "touchcancel", function(e21) { + r10 = false; + }); + } + var Qee = "keydown"; + var Yee = "mousedown"; + var Xee = "focusin"; + function Zee(e20, t10) { + return (t10 || document).querySelector(e20); + } + function ete(e20) { + e20.preventDefault(), e20.stopPropagation(); + } + function tte(e20, t10, n10, r10, o10) { + e20.add(t10, Qee, function(e21) { + n10.indexOf(e21.key) >= 0 && (o10 && ete(e21), r10(e21)); + }); + } + var nte = function() { + function e20(t10) { + Fee(this, e20), this.settings = { popup: "right", layout: "default", alpha: true, editor: true, editorFormat: "hex", cancelButton: false, defaultColor: "#0cf" }, this._events = new Kee(), this.onChange = null, this.onDone = null, this.onOpen = null, this.onClose = null, this.setOptions(t10); + } + return Vee(e20, [{ key: "setOptions", value: function(e21) { + var t10 = this; + if (e21) { + var n10 = this.settings; + if (e21 instanceof HTMLElement) + n10.parent = e21; + else { + n10.parent && e21.parent && n10.parent !== e21.parent && (this._events.remove(n10.parent), this._popupInited = false), function(e23, t11, n11) { + for (var r11 in e23) + n11 && n11.indexOf(r11) >= 0 || (t11[r11] = e23[r11]); + }(e21, n10), e21.onChange && (this.onChange = e21.onChange), e21.onDone && (this.onDone = e21.onDone), e21.onOpen && (this.onOpen = e21.onOpen), e21.onClose && (this.onClose = e21.onClose); + var r10 = e21.color || e21.colour; + r10 && this._setColor(r10); + } + var o10 = n10.parent; + if (o10 && n10.popup && !this._popupInited) { + var i10 = function(e23) { + return t10.openHandler(e23); + }; + this._events.add(o10, "click", i10), tte(this._events, o10, [" ", "Spacebar", "Enter"], i10), this._popupInited = true; + } else + e21.parent && !n10.popup && this.show(); + } + } }, { key: "openHandler", value: function(e21) { + if (this.show()) { + e21 && e21.preventDefault(), this.settings.parent.style.pointerEvents = "none"; + var t10 = e21 && e21.type === Qee ? this._domEdit : this.domElement; + setTimeout(function() { + return t10.focus(); + }, 100), this.onOpen && this.onOpen(this.colour); + } + } }, { key: "closeHandler", value: function(e21) { + var t10 = e21 && e21.type, n10 = false; + if (e21) + if (t10 === Yee || t10 === Xee) { + var r10 = (this.__containedEvent || 0) + 100; + e21.timeStamp > r10 && (n10 = true); + } else + ete(e21), n10 = true; + else + n10 = true; + n10 && this.hide() && (this.settings.parent.style.pointerEvents = "", t10 !== Yee && this.settings.parent.focus(), this.onClose && this.onClose(this.colour)); + } }, { key: "movePopup", value: function(e21, t10) { + this.closeHandler(), this.setOptions(e21), t10 && this.openHandler(); + } }, { key: "setColor", value: function(e21, t10) { + this._setColor(e21, { silent: t10 }); + } }, { key: "_setColor", value: function(e21, t10) { + if ("string" == typeof e21 && (e21 = e21.trim()), e21) { + t10 = t10 || {}; + var n10 = void 0; + try { + n10 = new Jee(e21); + } catch (e23) { + if (t10.failSilently) + return; + throw e23; + } + if (!this.settings.alpha) { + var r10 = n10.hsla; + r10[3] = 1, n10.hsla = r10; + } + this.colour = this.color = n10, this._setHSLA(null, null, null, null, t10); + } + } }, { key: "setColour", value: function(e21, t10) { + this.setColor(e21, t10); + } }, { key: "show", value: function() { + if (!this.settings.parent) + return false; + if (this.domElement) { + var e21 = this._toggleDOM(true); + return this._setPosition(), e21; + } + var t10, n10, r10 = this.settings.template || '
', o10 = (t10 = r10, (n10 = document.createElement("div")).innerHTML = t10, n10.firstElementChild); + return this.domElement = o10, this._domH = Zee(".picker_hue", o10), this._domSL = Zee(".picker_sl", o10), this._domA = Zee(".picker_alpha", o10), this._domEdit = Zee(".picker_editor input", o10), this._domSample = Zee(".picker_sample", o10), this._domOkay = Zee(".picker_done button", o10), this._domCancel = Zee(".picker_cancel button", o10), o10.classList.add("layout_" + this.settings.layout), this.settings.alpha || o10.classList.add("no_alpha"), this.settings.editor || o10.classList.add("no_editor"), this.settings.cancelButton || o10.classList.add("no_cancel"), this._ifPopup(function() { + return o10.classList.add("popup"); + }), this._setPosition(), this.colour ? this._updateUI() : this._setColor(this.settings.defaultColor), this._bindEvents(), true; + } }, { key: "hide", value: function() { + return this._toggleDOM(false); + } }, { key: "destroy", value: function() { + this._events.destroy(), this.domElement && this.settings.parent.removeChild(this.domElement); + } }, { key: "_bindEvents", value: function() { + var e21 = this, t10 = this, n10 = this.domElement, r10 = this._events; + function o10(e23, t11, n11) { + r10.add(e23, t11, n11); + } + o10(n10, "click", function(e23) { + return e23.preventDefault(); + }), Gee(r10, this._domH, function(e23, n11) { + return t10._setHSLA(e23); + }), Gee(r10, this._domSL, function(e23, n11) { + return t10._setHSLA(null, e23, 1 - n11); + }), this.settings.alpha && Gee(r10, this._domA, function(e23, n11) { + return t10._setHSLA(null, null, null, 1 - n11); + }); + var i10 = this._domEdit; + o10(i10, "input", function(e23) { + t10._setColor(this.value, { fromEditor: true, failSilently: true }); + }), o10(i10, "focus", function(e23) { + var t11 = this; + t11.selectionStart === t11.selectionEnd && t11.select(); + }), this._ifPopup(function() { + var t11 = function(t12) { + return e21.closeHandler(t12); + }; + o10(window, Yee, t11), o10(window, Xee, t11), tte(r10, n10, ["Esc", "Escape"], t11); + var i11 = function(t12) { + e21.__containedEvent = t12.timeStamp; + }; + o10(n10, Yee, i11), o10(n10, Xee, i11), o10(e21._domCancel, "click", t11); + }); + var a10 = function(t11) { + e21._ifPopup(function() { + return e21.closeHandler(t11); + }), e21.onDone && e21.onDone(e21.colour); + }; + o10(this._domOkay, "click", a10), tte(r10, n10, ["Enter"], a10); + } }, { key: "_setPosition", value: function() { + var e21 = this.settings.parent, t10 = this.domElement; + e21 !== t10.parentNode && e21.appendChild(t10), this._ifPopup(function(n10) { + "static" === getComputedStyle(e21).position && (e21.style.position = "relative"); + var r10 = true === n10 ? "popup_right" : "popup_" + n10; + ["popup_top", "popup_bottom", "popup_left", "popup_right"].forEach(function(e23) { + e23 === r10 ? t10.classList.add(e23) : t10.classList.remove(e23); + }), t10.classList.add(r10); + }); + } }, { key: "_setHSLA", value: function(e21, t10, n10, r10, o10) { + o10 = o10 || {}; + var i10 = this.colour, a10 = i10.hsla; + [e21, t10, n10, r10].forEach(function(e23, t11) { + (e23 || 0 === e23) && (a10[t11] = e23); + }), i10.hsla = a10, this._updateUI(o10), this.onChange && !o10.silent && this.onChange(i10); + } }, { key: "_updateUI", value: function(e21) { + if (this.domElement) { + e21 = e21 || {}; + var t10 = this.colour, n10 = t10.hsla, r10 = "hsl(" + 360 * n10[0] + ", 100%, 50%)", o10 = t10.hslString, i10 = t10.hslaString, a10 = this._domH, s10 = this._domSL, c10 = this._domA, l10 = Zee(".picker_selector", a10), u10 = Zee(".picker_selector", s10), f10 = Zee(".picker_selector", c10); + y10(0, l10, n10[0]), this._domSL.style.backgroundColor = this._domH.style.color = r10, y10(0, u10, n10[1]), b10(0, u10, 1 - n10[2]), s10.style.color = o10, b10(0, f10, 1 - n10[3]); + var d10 = o10, h10 = d10.replace("hsl", "hsla").replace(")", ", 0)"), v10 = "linear-gradient(" + [d10, h10] + ")"; + if (this._domA.style.background = v10 + ", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em", !e21.fromEditor) { + var p10 = this.settings.editorFormat, m10 = this.settings.alpha, g10 = void 0; + switch (p10) { + case "rgb": + g10 = t10.printRGB(m10); + break; + case "hsl": + g10 = t10.printHSL(m10); + break; + default: + g10 = t10.printHex(m10); + } + this._domEdit.value = g10; + } + this._domSample.style.color = i10; + } + function y10(e23, t11, n11) { + t11.style.left = 100 * n11 + "%"; + } + function b10(e23, t11, n11) { + t11.style.top = 100 * n11 + "%"; + } + } }, { key: "_ifPopup", value: function(e21, t10) { + this.settings.parent && this.settings.popup ? e21 && e21(this.settings.popup) : t10 && t10(); + } }, { key: "_toggleDOM", value: function(e21) { + var t10 = this.domElement; + if (!t10) + return false; + var n10 = e21 ? "" : "none", r10 = t10.style.display !== n10; + return r10 && (t10.style.display = n10), r10; + } }]), e20; + }(); + var rte = document.createElement("style"); + rte.textContent = '.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}', document.documentElement.firstElementChild.appendChild(rte), nte.StyleElement = rte; + var ote = Object.freeze({ __proto__: null, default: nte }); + + // jsoneditor.js + JSONEditorInstance = new C8({ target: JSONEditor_target, props: {} }); +})(); +/*! Bundled license information: + +vanilla-jsoneditor/standalone.js: + (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *) + +vanilla-jsoneditor/standalone.js: + (** + * @license + * Lodash (Custom Build) + * Build: `lodash modularize exports="es" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + *) + +vanilla-jsoneditor/standalone.js: + (*! + * vanilla-picker v2.12.2 + * https://vanilla-picker.js.org + * + * Copyright 2017-2023 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate) + * Released under the ISC license. + *) +*/ diff --git a/apps/hadash/jsoneditor.wrapperjs b/apps/hadash/jsoneditor.wrapperjs new file mode 100644 index 000000000..951d4b8b7 --- /dev/null +++ b/apps/hadash/jsoneditor.wrapperjs @@ -0,0 +1,22 @@ +/* + * JSONEditor wrapper + * + * This script is bundled together with the actual JSONEditor (https://github.com/josdejong/svelte-jsoneditor) + * using ESBuild (see below). + * + * The following global variables need to be defined before including the jsoneditor-bundle.js: + * + * JSONEditorInstance will contain the new JSONEditor instance + * JSONEditor_target element ID of container (
) for the JSONEditor + * + * To build the bundle, run the following commands: + * npm install esbuild + * npm install vanilla-jsoneditor + * ./node_modules/.bin/esbuild jsoneditor.wrapperjs --bundle --outfile=jsoneditor.bundlejs + * + */ + +import { JSONEditor } from 'vanilla-jsoneditor/standalone.js' + +JSONEditorInstance = new JSONEditor({ target: JSONEditor_target, props: {} }); + diff --git a/apps/hadash/metadata.json b/apps/hadash/metadata.json new file mode 100644 index 000000000..88b91f1bf --- /dev/null +++ b/apps/hadash/metadata.json @@ -0,0 +1,20 @@ +{ + "id": "hadash", + "name": "Home-Assistant Dashboard", + "shortName":"HA-Dash", + "version":"1.01", + "description": "Interact with Home-Assistant (query states, call services)", + "icon": "hadash.png", + "screenshots": [{ "url": "screenshot.png" }], + "type": "app", + "tags": "tool,online", + "supports": ["BANGLEJS2"], + "dependencies": { "textinput": "type" }, + "readme": "README.md", + "interface": "interface.html", + "storage": [ + { "name":"hadash.app.js", "url":"hadash.app.js" }, + { "name":"hadash.img", "url":"hadash-icon.js", "evaluate":true } + ], + "data": [{ "name":"hadash.json" }] +} diff --git a/apps/hadash/screenshot.png b/apps/hadash/screenshot.png new file mode 100644 index 000000000..09cd252e0 Binary files /dev/null and b/apps/hadash/screenshot.png differ diff --git a/apps/hasensors/ChangeLog b/apps/hasensors/ChangeLog index 7b3a63039..7372b1d12 100644 --- a/apps/hasensors/ChangeLog +++ b/apps/hasensors/ChangeLog @@ -1,3 +1,7 @@ 0.01: New app! 0.02: Add sensor icons Customize code directly, remove config file +0.03: Add HRM sensor + Add step count sensor + Add pressure and temperature sensors + Document Home Assistant `unique ID` workaround diff --git a/apps/hasensors/README.md b/apps/hasensors/README.md index e7f6ca98d..069122b6c 100644 --- a/apps/hasensors/README.md +++ b/apps/hasensors/README.md @@ -21,4 +21,30 @@ You need to fill out these fields: Currently creates these sensors: * `_battery_level`: Your watch battery level as percentage -* `_battery_state`: `charging` or `discharging` \ No newline at end of file +* `_battery_state`: `charging` or `discharging` +* `_hrm`: Heart rate (only if measured: this app doesn't enable/disable the sensor) +* `_steps`: Step Count +* `_pressure`: Pressure +* `_temperature`: Temperature + +## Home Assistant `unique ID` workaround + +If you try to customize the created entities, Home Assistant will complain that +> This entity ('sensor.…') does not have a unique ID, therefore its settings +> cannot be managed from the UI. + +The problem is that these sensors are created "dynamically", and there is no way +to supply a `unique ID`. +There is a workaround though: +1. Make note of the sensor name you want to customize (e.g. `banglejs_battery_state`). +2. Disconnect your Bangle.js from your phone, so it doesn't send updates. +3. Restart Home Assistant, the sensor is now gone. +4. Create a template sensor: choose "Template a sensor". + - Use the name from step 1 (without `sensor.` prefix). + - Set the state template to `unknown`. +5. Reconnect your Bangle.js: it will now update the new template sensor, which + *does* have a `unique ID`. + +**Warning:** Do not customize the `Entity ID`: the app sends values by sensor +ID, so you end up with both a non-updating template sensor and "dynamic" sensor +without `unique ID`. diff --git a/apps/hasensors/boot.js b/apps/hasensors/boot.js index efafbc8a3..feb7d246c 100644 --- a/apps/hasensors/boot.js +++ b/apps/hasensors/boot.js @@ -1,6 +1,8 @@ (function () { - const sb = () => require("hasensors").sendBattery(); - Bangle.on("charging", sb); - NRF.on("connect", () => setTimeout(sb, 2000)); - setInterval(sb, 10 * 60 * 1000); -})(); \ No newline at end of file + const su = () => require("hasensors").sendUpdate(); + Bangle.on("charging", su); + NRF.on("connect", () => setTimeout(su, 2000)); + su(); + setInterval(su, 10 * 60 * 1000); + Bangle.on('HRM', h=>require("hasensors").sendHRM(h)); +})(); diff --git a/apps/hasensors/lib.js b/apps/hasensors/lib.js index 83072262c..5a0cf0cab 100644 --- a/apps/hasensors/lib.js +++ b/apps/hasensors/lib.js @@ -12,9 +12,8 @@ function post(sensor, data) { }); } -exports.sendBattery = function () { - if (!NRF.getSecurityStatus().connected) return; - const b = E.getBattery(), +function sendBattery() { + const b = E.getBattery(), c = Bangle.isCharging(); let i = "mdi:battery"; if (c) i += "-charging"; @@ -40,4 +39,75 @@ exports.sendBattery = function () { icon: i, } }); -} \ No newline at end of file +} + +function sendSteps() { + post("steps", { + state: Bangle.getStepCount(), + attributes: { + friendly_name: "{name} Step Count", + unit_of_measurement: "steps", + state_class: "total", + icon: "mdi:shoe-print", + } + }); +} + +/** + * Sends pressure *and temperature* + */ +function sendPressure() { + if (!Bangle.getPressure) return; // not a Bangle 2 + const promise = Bangle.getPressure(); + if (!promise) return; // emulator? + promise.then(values=>{ + post("pressure", { + state: Math.round(values.pressure*10)/10, + attributes: { + friendly_name: "{name} Pressure", + unit_of_measurement: "hPa", + device_class: "atmospheric pressure", + state_class: "measurement", + icon: "mdi:gauge", + } + }); + post("temperature", { + state: Math.round(values.temperature*10)/10, + attributes: { + friendly_name: "{name} Temperature", + unit_of_measurement: "°C", + device_class: "temperature", + state_class: "measurement", + icon: "mdi:thermometer", + } + }); + }); +} + +exports.sendUpdate = function() { + if (!NRF.getSecurityStatus().connected) return; + sendBattery(); + sendSteps(); + sendPressure(); +} + + +let hrm_last = 0; +const HRM_INTERVAL = 10*60*1000; +exports.sendHRM = function (hrm) { + if (!NRF.getSecurityStatus().connected) return; + const now = (new Date).getTime(); + if (hrm_last > now-HRM_INTERVAL) return; + post("hrm", { + state: hrm.bpm, + attributes: { + confidence: hrm.confidence, + raw: hrm.raw, + friendly_name: "{name} Heart Rate", + icon: "mdi:heart", + unit_of_measurement: "bpm", + state_class: "measurement", + } + }); + hrm_last = now; +}; diff --git a/apps/hasensors/metadata.json b/apps/hasensors/metadata.json index 5764c6100..550095c76 100644 --- a/apps/hasensors/metadata.json +++ b/apps/hasensors/metadata.json @@ -2,7 +2,7 @@ "id": "hasensors", "name": "Home Assistant Sensors", "shortName": "HA sensors", - "version": "0.02", + "version": "0.03", "description": "Send sensor values to Home Assistant using Android Integration/Gadgetbridge", "icon": "ha.png", "type": "bootloader", diff --git a/apps/health/ChangeLog b/apps/health/ChangeLog index 1d108ece4..78119fbde 100644 --- a/apps/health/ChangeLog +++ b/apps/health/ChangeLog @@ -32,3 +32,13 @@ 0.28: Calculate distance from steps if myprofile is installed and stride length is set 0.29: Minor code improvements 0.30: Minor code improvements +0.31: Add support for new health format (storing more data) + Added graphs for Temperature and Battery +0.32: If getting HRM every 3/10 minutes, don't turn it on if the Bangle is charging or hasn't moved and is face down/up +0.33: Ensure readAllRecordsSince always includes the current day + Speed improvements (put temporary functions in RAM where possible) +0.34: Fix readFullDatabase (was skipping first month of data) +0.35: Update boot/lib.min.js +0.36: Fix Distance graphs that used '1*' to remove the suffix +0.37: Reduce movement limit for HRM off from 400 to 100 + Fix daily summary for movement (was not scaling down correctly) \ No newline at end of file diff --git a/apps/health/README.md b/apps/health/README.md index ba6204670..a73985988 100644 --- a/apps/health/README.md +++ b/apps/health/README.md @@ -42,11 +42,46 @@ and run `EspruinoDocs/bin/minify.js lib.js lib.min.js` HRM data is stored as a number representing the best/average value from a 10 minute period. +## Usage in code + +You can read a day's worth of health data using readDay, which will call the callback with each data packet: + +```JS +require("health").readDay(new Date(), print) +// ... for each 10 min packet: +{ "steps": 40, "bpmMin": 92, "bpmMax": 95, "movement": 488, + "battery": 51, "isCharging": false, "temperature": 25.5, "altitude": 79, + "activity": "UNKNOWN", + "bpm": 93.5, "hr": 6, "min": 50 } +``` + +Other functions are available too, and they all take a `Date` as an argument: + +```JS +// Read all records from the given month +require("health").readAllRecords(d, cb) + +// Read the entire database. There is no guarantee that the months are read in order. +require("health").readFullDatabase(cb) + +// Read all records per day, until the current time. +// There may be some records for the day of the timestamp previous to the timestamp +require("health").readAllRecordsSince(d, cb) + +// Read daily summaries from the given month +require("health").readDailySummaries(d, cb) + +// Read all records from the given day +require("health").readDay(d, cb) +``` + + ## TODO -* `interface` page for desktop to allow data to be viewed and exported in common formats * More features in app: - * Step counting goal (ensure pedometers use this) + * Viewing stored altitude/bpm min/max graphs + * Currently we only graph per hour but we have 10 min data - should it be shown? + * Pie chart to show percent of time in each activity * Calendar view showing steps per day * Yearly view * Heart rate 'zone' graph diff --git a/apps/health/app.js b/apps/health/app.js index 17c5e1ceb..d3dda2e2f 100644 --- a/apps/health/app.js +++ b/apps/health/app.js @@ -8,6 +8,8 @@ function menuMain() { /*LANG*/"Step Counting": () => menuStepCount(), /*LANG*/"Movement": () => menuMovement(), /*LANG*/"Heart Rate": () => menuHRM(), + /*LANG*/"Battery": () => menuBattery(), + /*LANG*/"Temperature": () => menuTemperature(), /*LANG*/"Settings": () => eval(require("Storage").read("health.settings.js"))(()=>{loadSettings();menuMain();}) }); } @@ -16,8 +18,11 @@ function menuStepCount() { const menu = { "": { title:/*LANG*/"Steps" }, /*LANG*/"< Back": () => menuMain(), - /*LANG*/"per hour": () => stepsPerHour(menuStepCount), - /*LANG*/"per day": () => stepsPerDay(menuStepCount) + /*LANG*/"per hour": () => showGraph({id:"stepsPerHour",range:"hour",field:"steps", back:menuStepCount}), + /*LANG*/"per day": () => { + showGraph({id:"stepsPerHour",range:"day",field:"steps", back:menuStepCount}) + drawHorizontalLine(settings.stepGoal); + } }; if (myprofile.strideLength) { menu[/*LANG*/"distance"] = () => menuDistance(); @@ -27,12 +32,15 @@ function menuStepCount() { } function menuDistance() { - const distMult = 1*require("locale").distance(myprofile.strideLength, 2); // hackish: this removes the distance suffix, e.g. 'm' + const distMult = parseFloat(require("locale").distance(myprofile.strideLength, 2)); // this removes the distance suffix, e.g. 'm' E.showMenu({ "": { title:/*LANG*/"Distance" }, /*LANG*/"< Back": () => menuStepCount(), - /*LANG*/"per hour": () => stepsPerHour(menuDistance, distMult), - /*LANG*/"per day": () => stepsPerDay(menuDistance, distMult) + /*LANG*/"per hour": () => showGraph({id:"stepsPerHour",range:"hour",field:"steps",mult:distMult, back:menuDistance}), + /*LANG*/"per day": () => { + showGraph({id:"stepsPerDay",range:"day",field:"steps",mult:distMult, back:menuDistance}) + drawHorizontalLine(settings.stepGoal * (distMult || 1)); + } }); } @@ -40,8 +48,8 @@ function menuMovement() { E.showMenu({ "": { title:/*LANG*/"Movement" }, /*LANG*/"< Back": () => menuMain(), - /*LANG*/"per hour": () => movementPerHour(), - /*LANG*/"per day": () => movementPerDay(), + /*LANG*/"per hour": () => showGraph({id:"movementPerHour",range:"hour",field:"movement",average:true,back:menuMovement}), + /*LANG*/"per day": () => showGraph({id:"movementPerDay",range:"day",field:"movement",average:true,back:menuMovement}), }); } @@ -49,96 +57,76 @@ function menuHRM() { E.showMenu({ "": { title:/*LANG*/"Heart Rate" }, /*LANG*/"< Back": () => menuMain(), - /*LANG*/"per hour": () => hrmPerHour(), - /*LANG*/"per day": () => hrmPerDay(), + /*LANG*/"per hour": () => showGraph({id:"hrmPerHour",range:"hour",field:"bpm",ignoreZero:true, average:true,back:menuHRM}), + /*LANG*/"per day": () => showGraph({id:"hrmPerDay",range:"day",field:"bpm",ignoreZero:true, average:true,back:menuHRM}), }); } -function stepsPerHour(back, mult) { - E.showMessage(/*LANG*/"Loading..."); - current_selection = "stepsPerHour"; - var data = new Uint16Array(24); - require("health").readDay(new Date(), h=>data[h.hr]+=h.steps); - if (mult !== undefined) { - // Calculate distance from steps - data.forEach((d, i) => data[i] = d*mult+0.5); +function menuBattery() { + E.showMenu({ + "": { title:/*LANG*/"Battery" }, + /*LANG*/"< Back": () => menuMain(), + /*LANG*/"per hour": () => showGraph({id:"batPerHour",range:"hour",field:"battery",average:true,back:menuBattery}), + /*LANG*/"per day": () => showGraph({id:"batPerDay",range:"day",field:"battery",average:true,back:menuBattery}), + }); +} + +function menuTemperature() { + E.showMenu({ + "": { title:/*LANG*/"Temperature" }, + /*LANG*/"< Back": () => menuMain(), + /*LANG*/"per hour": () => showGraph({id:"batPerHour",range:"hour",field:"temperature",average:true,back:menuTemperature}), + /*LANG*/"per day": () => showGraph({id:"batPerDay",range:"day",field:"temperature",average:true,back:menuTemperature}), + }); +} + +/* + Display a graph. Options are: + + { + range: "day"/"hour" + id: "stepsPerHour" // id of graph + field: "steps" // field name + mult: 1.0, // optional multiplier + ignoreZero: bool, // if set, ignore record that were 0 in average + average: bool, // if set, average records (ignoring) + back: fn() // callback for back button } - setButton(back, mult); - barChart(/*LANG*/"HOUR", data, mult); -} - -function stepsPerDay(back, mult) { +*/ +function showGraph(options) { E.showMessage(/*LANG*/"Loading..."); - current_selection = "stepsPerDay"; - var data = new Uint16Array(32); - require("health").readDailySummaries(new Date(), h=>data[h.day]+=h.steps); - // Include data for today - if (data[(new Date()).getDate()] === 0) { - data[(new Date()).getDate()] = Bangle.getHealthStatus("day").steps; + current_selection = options.id; + var data,cnt,title; + if (options.range=="hour") { + title = /*LANG*/"HOUR"; + data = new Uint16Array(24); + cnt = new Uint8Array(24); + require("health").readDay(new Date(), h=>{ + data[h.hr]+=h[options.field]; + if (!options.ignoreZero || h[options.field]) cnt[h.hr]++; + }); + } else if (options.range=="day") { + title = /*LANG*/"DAY"; + var data = new Uint16Array(32); + var cnt = new Uint8Array(32); + require("health").readDailySummaries(new Date(), h=>{ + data[h.day]+=h[options.field]; + if (!options.ignoreZero || h[options.field]) cnt[h.day]++; + }); + // Include data for today + var day = (new Date()).getDate(); + if (data[day] === 0) { + data[day] = Bangle.getHealthStatus("day")[options.field]; + if (!options.ignoreZero || data[day]) cnt[day]++; + } + } else throw new Error("Unknown range"); + if (options.average) + data.forEach((d,i)=>data[i] = d/cnt[i]+0.5); + if (options.mult !== undefined) { // Calculate distance from steps + data.forEach((d, i) => data[i] = d*options.mult+0.5); } - if (mult !== undefined) { - // Calculate distance from steps - data.forEach((d, i) => data[i] = d*mult+0.5); - } - setButton(back, mult); - barChart(/*LANG*/"DAY", data, mult); - drawHorizontalLine(settings.stepGoal * (mult || 1)); -} - -function hrmPerHour() { - E.showMessage(/*LANG*/"Loading..."); - current_selection = "hrmPerHour"; - var data = new Uint16Array(24); - var cnt = new Uint8Array(24); - require("health").readDay(new Date(), h=>{ - data[h.hr]+=h.bpm; - if (h.bpm) cnt[h.hr]++; - }); - data.forEach((d,i)=>data[i] = d/cnt[i]+0.5); - setButton(menuHRM); - barChart(/*LANG*/"HOUR", data); -} - -function hrmPerDay() { - E.showMessage(/*LANG*/"Loading..."); - current_selection = "hrmPerDay"; - var data = new Uint16Array(32); - var cnt = new Uint8Array(32); - require("health").readDailySummaries(new Date(), h=>{ - data[h.day]+=h.bpm; - if (h.bpm) cnt[h.day]++; - }); - data.forEach((d,i)=>data[i] = d/cnt[i]+0.5); - setButton(menuHRM); - barChart(/*LANG*/"DAY", data); -} - -function movementPerHour() { - E.showMessage(/*LANG*/"Loading..."); - current_selection = "movementPerHour"; - var data = new Uint16Array(24); - var cnt = new Uint8Array(24); - require("health").readDay(new Date(), h=>{ - data[h.hr]+=h.movement; - cnt[h.hr]++; - }); - data.forEach((d,i)=>data[i] = d/cnt[i]+0.5); - setButton(menuMovement); - barChart(/*LANG*/"HOUR", data); -} - -function movementPerDay() { - E.showMessage(/*LANG*/"Loading..."); - current_selection = "movementPerDay"; - var data = new Uint16Array(32); - var cnt = new Uint8Array(32); - require("health").readDailySummaries(new Date(), h=>{ - data[h.day]+=h.movement; - cnt[h.day]++; - }); - data.forEach((d,i)=>data[i] = d/cnt[i]+0.5); - setButton(menuMovement); - barChart(/*LANG*/"DAY", data); + setButton(options.back, options.mult); + barChart(title, data, options.mult); } // Bar Chart Code diff --git a/apps/health/boot.js b/apps/health/boot.js index 66b4acda6..b0d0a4a7c 100644 --- a/apps/health/boot.js +++ b/apps/health/boot.js @@ -1,43 +1,59 @@ -(function() { - var settings = require("Storage").readJSON("health.json", 1) || {}; - var hrm = 0|settings.hrm; - if (hrm == 1 || hrm == 2) { - function onHealth() { - Bangle.setHRMPower(1, "health"); - setTimeout(() => Bangle.setHRMPower(0, "health"), hrm * 60000); // give it 1 minute detection time for 3 min setting and 2 minutes for 10 min setting - if (hrm == 1) { - function startMeasurement() { - Bangle.setHRMPower(1, "health"); - setTimeout(() => { - Bangle.setHRMPower(0, "health"); - }, 60000); - } +{ // Handle turning HRM on/off at the right times + let settings = require("Storage").readJSON("health.json", 1) || {}; + let hrm = 0|settings.hrm; + if (hrm == 1 || hrm == 2) { // 1=every 3 minutes, 2=every 10 minutes + let onHealth = function(h) { + function startMeasurement() { + // if is charging, or hardly moved and face up/down, don't start HRM + if (Bangle.isCharging() || + (Bangle.getHealthStatus("last").movement<100 && Math.abs(Bangle.getAccel().z)>0.99)) return; + // otherwise turn HRM on + Bangle.setHRMPower(1, "health"); + setTimeout(() => { + Bangle.setHRMPower(0, "health"); + }, hrm * 60000); // give it 1 minute detection time for 3 min setting and 2 minutes for 10 min setting + } + startMeasurement(); + if (hrm == 1) { // 3 minutes setTimeout(startMeasurement, 200000); setTimeout(startMeasurement, 400000); } } Bangle.on("health", onHealth); Bangle.on("HRM", (h) => { + // as soon as we have a decent HRM reading, turn it off if (h.confidence > 90 && Math.abs(Bangle.getHealthStatus().bpm - h.bpm) < 1) Bangle.setHRMPower(0, "health"); }); - if (Bangle.getHealthStatus().bpmConfidence > 90) return; - onHealth(); - } else Bangle.setHRMPower(!!hrm, "health"); -})(); - + if (Bangle.getHealthStatus().bpmConfidence < 90) onHealth(); // if we didn't have a good HRM confidence already, start HRM now + } else Bangle.setHRMPower(!!hrm, "health"); // if HRM>2, keep it on permanently +} Bangle.on("health", health => { + (Bangle.getPressure?Bangle.getPressure():Promise.resolve({})).then(pressure => { + Object.assign(health, pressure); // add temperature/pressure/altitude // ensure we write health info for *last* block var d = new Date(Date.now() - 590000); - const DB_RECORD_LEN = 4; const DB_RECORDS_PER_HR = 6; const DB_RECORDS_PER_DAY = DB_RECORDS_PER_HR*24 + 1/*summary*/; const DB_RECORDS_PER_MONTH = DB_RECORDS_PER_DAY*31; const DB_HEADER_LEN = 8; - const DB_FILE_LEN = DB_HEADER_LEN + DB_RECORDS_PER_MONTH*DB_RECORD_LEN; - if (health && health.steps > 0) { - handleStepGoalNotification(); + if (health && health.steps > 0) { // Show step goal notification + var settings = require("Storage").readJSON("health.json",1)||{}; + const steps = Bangle.getHealthStatus("day").steps; + if (settings.stepGoalNotification && settings.stepGoal > 0 && steps >= settings.stepGoal) { + const now = new Date(Date.now()).toISOString().split('T')[0]; // yyyy-mm-dd + if (!settings.stepGoalNotificationDate || settings.stepGoalNotificationDate < now) { // notification not yet shown today? + Bangle.buzz(200, 0.5); + require("notify").show({ + title : settings.stepGoal + /*LANG*/ " steps", + body : /*LANG*/ "You reached your step goal!", + icon : atob("DAyBABmD6BaBMAsA8BCBCBCBCA8AAA==") + }); + settings.stepGoalNotificationDate = now; + require("Storage").writeJSON("health.json", settings); + } + } } function getRecordFN(d) { @@ -48,75 +64,48 @@ Bangle.on("health", health => { (DB_RECORDS_PER_HR*d.getHours()) + (0|(d.getMinutes()*DB_RECORDS_PER_HR/60)); } - function getRecordData(health) { - return String.fromCharCode( - health.steps>>8,health.steps&255, // 16 bit steps - health.bpm, // 8 bit bpm - Math.min(health.movement, 255)); // movement - } var rec = getRecordIdx(d); var fn = getRecordFN(d); - var f = require("Storage").read(fn); - if (f) { - var dt = f.substr(DB_HEADER_LEN+(rec*DB_RECORD_LEN), DB_RECORD_LEN); - if (dt!="\xFF\xFF\xFF\xFF") { + var inf, f = require("Storage").read(fn); + + if (f!==undefined) { + inf = require("health").getDecoder(f); + var dt = f.substr(DB_HEADER_LEN+(rec*inf.r), inf.r); + if (dt!=inf.clr) { print("HEALTH ERR: Already written!"); return; } } else { - require("Storage").write(fn, "HEALTH1\0", 0, DB_FILE_LEN); // header + inf = require("health").getDecoder("HEALTH2"); + require("Storage").write(fn, "HEALTH2\0", 0, DB_HEADER_LEN + DB_RECORDS_PER_MONTH*inf.r); // header (and allocate full new file) } - var recordPos = DB_HEADER_LEN+(rec*DB_RECORD_LEN); - - // scale down reported movement value in order to fit it within a - // uint8 DB field - health = Object.assign({}, health); - health.movement /= 8; - - require("Storage").write(fn, getRecordData(health), recordPos, DB_FILE_LEN); + var recordPos = DB_HEADER_LEN+(rec*inf.r); + require("Storage").write(fn, inf.encode(health), recordPos); if (rec%DB_RECORDS_PER_DAY != DB_RECORDS_PER_DAY-2) return; // we're at the end of the day. Read in all of the data for the day and sum it up - var sumPos = recordPos + DB_RECORD_LEN; // record after the current one is the sum - if (f.substr(sumPos, DB_RECORD_LEN)!="\xFF\xFF\xFF\xFF") { + var sumPos = recordPos + inf.r; // record after the current one is the sum + if (f.substr(sumPos, inf.r)!=inf.clr) { print("HEALTH ERR: Daily summary already written!"); return; } health = { steps:0, bpm:0, movement:0, movCnt:0, bpmCnt:0}; var records = DB_RECORDS_PER_HR*24; for (var i=0;i 0 && steps >= settings.stepGoal) { - const now = new Date(Date.now()).toISOString().split('T')[0]; // yyyy-mm-dd - if (!settings.stepGoalNotificationDate || settings.stepGoalNotificationDate < now) { // notification not yet shown today? - Bangle.buzz(200, 0.5); - require("notify").show({ - title : settings.stepGoal + /*LANG*/ " steps", - body : /*LANG*/ "You reached your step goal!", - icon : atob("DAyBABmD6BaBMAsA8BCBCBCBCA8AAA==") - }); - settings.stepGoalNotificationDate = now; - require("Storage").writeJSON("health.json", settings); - } - } -} + require("Storage").write(fn, inf.encode(health), sumPos); +})}); diff --git a/apps/health/boot.min.js b/apps/health/boot.min.js index 0d1a80f4c..31f69af99 100644 --- a/apps/health/boot.min.js +++ b/apps/health/boot.min.js @@ -1,5 +1,5 @@ -function m(){var a=require("Storage").readJSON("health.json",1)||{},d=Bangle.getHealthStatus("day").steps;a.stepGoalNotification&&0=a.stepGoal&&(d=(new Date(Date.now())).toISOString().split("T")[0],!a.stepGoalNotificationDate||a.stepGoalNotificationDateBangle.setHRMPower(0,"health"),6E4*a);if(1==a){function b(){Bangle.setHRMPower(1,"health");setTimeout(()=>{Bangle.setHRMPower(0,"health")},6E4)}setTimeout(b,2E5);setTimeout(b,4E5)}}Bangle.on("health",d);Bangle.on("HRM",b=>{90Math.abs(Bangle.getHealthStatus().bpm-b.bpm)&&Bangle.setHRMPower(0,"health")});90{function d(c){return String.fromCharCode(c.steps>>8,c.steps&255,c.bpm,Math.min(c.movement,255))}var b=new Date(Date.now()-59E4);a&&0k;k++){e=g.substr(h,4);if("\xff\xff\xff\xff"!=e){a.steps+=(e.charCodeAt(0)<<8)+e.charCodeAt(1);var l=e.charCodeAt(2);a.bpm+=l;a.movement+=e.charCodeAt(3);a.movCnt++; -l&&a.bpmCnt++}h-=4}a.bpmCnt&&(a.bpm/=a.bpmCnt);a.movCnt&&(a.movement/=a.movCnt);require("Storage").write(b,d(a),f,17988)}}) \ No newline at end of file +{let a=0|(require("Storage").readJSON("health.json",1)||{}).hrm;if(1==a||2==a){let d=function(b){function c(){Bangle.isCharging()||100>Bangle.getHealthStatus("last").movement&&.99{Bangle.setHRMPower(0,"health")},6E4*a))}c();1==a&&(setTimeout(c,2E5),setTimeout(c,4E5))};Bangle.on("health",d);Bangle.on("HRM",b=>{90Math.abs(Bangle.getHealthStatus().bpm-b.bpm)&&Bangle.setHRMPower(0, +"health")});90>Bangle.getHealthStatus().bpmConfidence&&d()}else Bangle.setHRMPower(!!a,"health")}Bangle.on("health",a=>{(Bangle.getPressure?Bangle.getPressure():Promise.resolve({})).then(d=>{Object.assign(a,d);d=new Date(Date.now()-59E4);if(a&&0=b.stepGoal&&(c=(new Date(Date.now())).toISOString().split("T")[0],!b.stepGoalNotificationDate||b.stepGoalNotificationDate< +c)&&(Bangle.buzz(200,.5),require("notify").show({title:b.stepGoal+" steps",body:"You reached your step goal!",icon:atob("DAyBABmD6BaBMAsA8BCBCBCBCA8AAA==")}),b.stepGoalNotificationDate=c,require("Storage").writeJSON("health.json",b))}var g=function(f){return 145*(f.getDate()-1)+6*f.getHours()+(0|6*f.getMinutes()/60)}(d);d=function(f){return"health-"+f.getFullYear()+"-"+(f.getMonth()+1)+".raw"}(d);c=require("Storage").read(d);if(void 0!==c){b=require("health").getDecoder(c);var e=c.substr(8+g*b.r, +b.r);if(e!=b.clr){print("HEALTH ERR: Already written!");return}}else b=require("health").getDecoder("HEALTH2"),require("Storage").write(d,"HEALTH2\x00",0,8+4495*b.r);var h=8+g*b.r;require("Storage").write(d,b.encode(a),h);if(143==g%145)if(g=h+b.r,c.substr(g,b.r)!=b.clr)print("HEALTH ERR: Daily summary already written!");else{a={steps:0,bpm:0,movement:0,movCnt:0,bpmCnt:0};for(var k=0;144>k;k++)e=c.substr(h,b.r),e!=b.clr&&(e=b.decode(e),a.steps+=e.steps,a.bpm+=e.bpm,a.movement+=e.movement,a.movCnt++, +e.bpm&&a.bpmCnt++),h-=b.r;a.bpmCnt&&(a.bpm/=a.bpmCnt);a.movCnt&&(a.movement/=a.movCnt);require("Storage").write(d,b.encode(a),g)}})}) \ No newline at end of file diff --git a/apps/health/interface.html b/apps/health/interface.html index 34d478473..bc254172e 100644 --- a/apps/health/interface.html +++ b/apps/health/interface.html @@ -7,45 +7,49 @@ + + + + + + + +
+
+
Recorder Options: +
Select what sensor/data you want to record and average each minute: +
+
+ + + + + + + + +
+
High Resolution Accelerometer Data: +
If you want to record high temporal resolution accelerometer data (magnitude of x,y,z; can store up to 4 days of data at 1 second, will rollover). +
+ + + +

Interval for logging averaged magnitude and sum from accelerometer - default is 1 second +

+
+
+
GPS PSMOO Options: +
Option to have GPS work in PSMOO (uses GPSSetup app/module) +
+
+ + + +

The time spent scanning for a GPS signal.

+ + +

The time between scans when a signal is not acquired.

+ + +

The time between scans when a signal is acquired.

+
+
Extras: + + +

Will detect falls.

+ +

Enable this if you want your questions to be shuffled at random each time.

+ +

On by default. Will enable quick access to the HeatSuite app for participants by simply swiping right on the screen.

+ + +

For communicating with HeatSuite Nodes. Maximum of 4 (no special) characters. +

+ + +

ONLY CHANGE IF YOU KNOW WHAT YOU ARE DOING.

+ +
+
+
+ + + +

+ + + + + + + + + \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.app.js b/apps/heatsuite/heatsuite.app.js new file mode 100644 index 000000000..9519d73b2 --- /dev/null +++ b/apps/heatsuite/heatsuite.app.js @@ -0,0 +1,189 @@ +{ +let studyTasksJSON = "heatsuite.tasks.json"; +let studyTasks = require('Storage').readJSON(studyTasksJSON, true) || {}; + +let Layout = require("Layout"); +let modHS = require("HSModule"); +let layout; +let NRFFindDeviceTimeout, TaskScreenTimeout; + +let settings = modHS.getSettings(); + +let appCache = modHS.getCache(); + +function queueNRFFindDeviceTimeout() { + if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout); + NRFFindDeviceTimeout = setTimeout(function () { + NRFFindDeviceTimeout = undefined; + findBtDevices(); + }, 3000); +} + +function findBtDevices() { + NRF.setScan(); //clear any scans running! + NRF.findDevices(function (devices) { + let found = false; + if (devices.length !== 0) { + devices.every((d) => { + modHS.log("Found device", d); + let services = d.services; + modHS.log("Services: ", services); + if (services !== undefined && services.includes('1810') && d.id === settings.bt_bloodPressure_id) { + //Blood Pressure + found = true; + layout.msg.label = "BP Found"; + layout.render(); + if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout); + return Bangle.load('heatsuite.bp.js'); + } else if (services !== undefined && services.includes('181b') && studyTasks.filter(task => task.id === "bodyMass")) { + let data = d.serviceData[services]; + let ctlByte = data[1]; + let weightRemoved = ctlByte & (1 << 7); + modHS.log(weightRemoved); + if (weightRemoved === 0) { + //Mass found + found = true; + layout.msg.label = "Scale Found"; + layout.render(); + if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout); + return Bangle.load('heatsuite.mass.js'); + } + modHS.log("No weight on scale"); + } else if (services !== undefined && services.includes('1809') && d.id === settings.bt_coreTemperature_id) { + //Core Temperature + found = true; + layout.msg.label = "Temp Found"; + layout.render(); + if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout); + return Bangle.load('heatsuite.bletemp.js'); + } + }); + } + if (!found) { + modHS.log("Search Complete, No Devices Found"); + queueNRFFindDeviceTimeout(); + } else { + if (TaskScreenTimeout) clearTimeout(TaskScreenTimeout); + if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout); + } + }, { timeout: 3000, active: true}); +} + +function taskButtonInterpretter(string) { + //turn off FindDeviceHandler whenever we navigate off task screen + let command = 'if (NRFFindDeviceTimeout){clearTimeout(NRFFindDeviceTimeout);}' + string; + return eval(command); +} + +function queueTaskScreenTimeout() { + if (TaskScreenTimeout) clearTimeout(TaskScreenTimeout); + if (TaskScreenTimeout === undefined) { + TaskScreenTimeout = setTimeout(function () { + if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout); + Bangle.load(); + }, 180000); + } +} + +function draw() { + let btRequired = false; + g.clear(); + g.reset(); + if (studyTasks.length === 0) { + if(require("Storage").list().includes("heatsuite.survey.json")){ //likely just using for EMA survey + return Bangle.load('heatsuite.survey.js'); //go right to survey! + } + modHS.log('No Study Tasks loaded...'); + layout = new Layout({ + type: "v", + c: [ + { + type: "txt", + font: "Vector:30", + label: "No Study Tasks Loaded.", + wrap: true, + fillx: 1, + filly: 1 + } + ] + }); + layout.render(); + return; + } + let taskArr = appCache.taskQueue; + let taskID = []; + if (taskArr !== undefined) { + taskID = taskArr.filter(function (taskArr) { + return taskArr.id; + }).map(function (taskArr) { + return taskArr.id; + }); + } + let layoutOut = { type: "v", c: [] }; + let row = { type: "h", c: [] }; + let rowCount = 2; + if( studyTasks.length > 4){ + rowCount = 3; //so we can include up to 9 tasks on the screen at once + } + studyTasks.forEach(task => { + let btn = { type: "btn", fillx: 1, filly: 1 }; + btn.id = task.id; + btn.src = eval(task.icon); + //callback on button press + if (task.cbBtn) { + btn.cb = l => taskButtonInterpretter(task.cbBtn); + } + //back color determination + btn.btnFaceCol = "#90EE90"; + //a to do!! + if (taskID.includes(task.id)) { + btn.btnFaceCol = "#FFFF00"; + } + //no bt paired + if (task.btPair === true) { + if (settings["bt_" + task.id + "_id"] === undefined || !settings["bt_" + task.id + "_id"]) { + //make it clickable so we can go to settings and pair something + btn.btnFaceCol = "#FF0000"; + btn.cb = l => eval(require("Storage").read("heatsuite.settings.js"))(()=>load("heatsuite.app.js")); + } + } + if(task.btInfo !== undefined){ + btRequired = true;//we will be scanning for bluetooth devices + } + //builder for each icon in taskScreen + if (row.c.length >= rowCount) { + layoutOut.c.push(row); + row = { type: "h", c: [] }; + } + row.c.push(btn); + }); + //push that last row in if needed + if (row.c.length > 0) { + layoutOut.c.push(row); + } + //Final + if(btRequired) layoutOut.c.push({ type: "txt", font: "6x8:2", label: "Searching...", id: "msg", fillx: 1 }); + let options = { + lazy: true, + btns:[{label:"Exit", cb: l=>Bangle.showClock() }], + remove: () => { + NRF.setScan(); //clear scan + if (TaskScreenTimeout) clearTimeout(TaskScreenTimeout); + if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout); + NRFFindDeviceTimeout = undefined; + TaskScreenTimeout = undefined; + require("widget_utils").show(); + } + }; + layout = new Layout(layoutOut, options); + layout.render(); + if(btRequired) queueNRFFindDeviceTimeout(); + queueTaskScreenTimeout(); +} + +Bangle.setLocked(false); //unlock screen! +Bangle.loadWidgets(); +Bangle.drawWidgets(); +require("widget_utils").hide(); +draw(); +} \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.bletemp.js b/apps/heatsuite/heatsuite.bletemp.js new file mode 100644 index 000000000..653a27ba3 --- /dev/null +++ b/apps/heatsuite/heatsuite.bletemp.js @@ -0,0 +1,127 @@ +var Layout = require("Layout"); +const modHS = require('HSModule'); +var layout; + +var settings = modHS.getSettings(); +//var appCache = modHS.getCache(); +function log(msg) { + if (!settings.DEBUG) { + return; + } else { + console.log(msg); + } +} + +//Schema for the message coming from the BLE ThermistorPod: +const Schema_ThermistorPodBLE = { + msgType: 'int32', + ta: 'float32', + rh: 'float32', + batP: 'int32', + temp: 'float32', + tempAvg: 'float32', + adc: 'int32', + resistance: 'float32', + ambLight: 'int32' +}; + +function getTcore(id) { + layout = new Layout({ + type: "v", c: [ + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: "Oral Temp", fillx: 1 }, + ] + }, + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: "Waiting...", fillx: 1 }, + ] + } + ] + }); + g.clear(); + layout.render(); + var gatt; + var startTime; + var complete = false; + var TCoreData = { + "temp": null, + "ta": null, + "rh": null, + "measures": [] + }; + NRF.connect(id).then(function (g) { + gatt = g; + startTime = parseInt((getTime()).toFixed(0)); + gatt.device.on('gattserverdisconnected', function (reason) { + gatt = null; + Bangle.load(); + log("Disconnected ", reason); + }); + return gatt.getPrimaryService("1809"); + }).then(function (s) { + return s.getCharacteristic("00002A1F-0000-1000-8000-00805F9B34FB"); + }).then(function (c) { + c.on('characteristicvaluechanged', function (event) { + const receivedData = modHS.parseBLEData(event.target.value, Schema_ThermistorPodBLE); + TCoreData.temp = receivedData.tempAvg; + TCoreData.ta = receivedData.ta; + TCoreData.rh = receivedData.rh; + TCoreData.measures.push(receivedData.adc); + var timeNow = parseInt((getTime()).toFixed(0)); + var diff = timeNow - startTime; + var display; + if (diff > 90 && !complete) { // time to save the data and disconnect + complete = true; + if (modHS.saveDataToFile('coreTemp', 'coreTemperature', TCoreData)) { + display = { + type: "v", c: [ + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: "Saved!", fillx: 1 } + ] + } + ] + }; + + } + } else { + var remaining = 90 - diff; + display = { + type: "v", c: [ + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: remaining + " secs", fillx: 1 } + ] + }, + { + type: "h", c: [ + { type: "txt", font: "4x6:2", label: receivedData.adc + " " + receivedData.temp.toFixed(2) + "C", fillx: 1 } + ] + } + ] + }; + } + layout = new Layout(display); + g.clear(); + layout.render(); + if (complete) { + if(gatt){ + gatt.disconnect(); + } + setTimeout(() => { Bangle.load() }, 2000); + } + }); + return c.startNotifications(); + }).then(function (d) { + }).catch(function (e) { + E.showAlert("error! " + e).then(function () { Bangle.load(); }); + }); +} + +let macID = settings.bt_coreTemperature_id.split(" "); +//so you can see timeout +Bangle.setOptions({backlightTimeout: 0}) // turn off the timeout +Bangle.setBacklight(1); // keep screen on +getTcore(macID[0]); \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.bp.js b/apps/heatsuite/heatsuite.bp.js new file mode 100644 index 000000000..5a3ff9a79 --- /dev/null +++ b/apps/heatsuite/heatsuite.bp.js @@ -0,0 +1,186 @@ +var Layout = require("Layout"); +const modHS = require('HSModule'); +var layout; +var settings = modHS.getSettings(); +//var appCache = modHS.getCache(); +function log(msg) { + if (!settings.DEBUG) { + return; + } else { + console.log(msg); + } +} + +//Schema for the message coming from the A&D Medical UA651BLE: +function analyzeBPData(data) { + const flags = data.getUint8(0, 1); + const buf = data.buffer; + let result = { //Schema for BP measures + "sbp" : null, + "dbp" : null, + "map" : null, + "hr" : null, + "moved" : null, + "cuffLoose" : null, + "irregularPulse" : null, + "improperMeasure" : null, + "year" : null, + "month" : null, + "day" : null, + "hour" : null, + "minute" : null, + "second" : null + }; + let index = 1; + result.sbp = buf[index]; + index += 2; + result.dbp = buf[index]; + index += 2; + result.map = buf[index]; + index += 2; + if (flags & 0x02) { + result.year = buf[index] + (buf[index + 1] << 8), + result.month = buf[index + 2], + result.day = buf[index + 3], + result.hour = buf[index + 4], + result.minute = buf[index + 5], + result.second = buf[index + 6], + index += 7; + } + if (flags & 0x04) { + result.hr = buf[index]; + index += 2; + } + if (flags & 0x08) { + index += 1; + } + if (flags & 0x10) { + const ms = buf[index]; + result.moved = (ms & 0b1) ? 1 : 0; + result.cuffLoose = (ms & 0b10) ? 1 : 0; + result.irregularPulse = (ms & 0b100) ? 1 : 0; + result.improperMeasure = (ms & 0b100000) ? 1 : 0; + index += 1; + } + return result; +} + +function getBP(id) { + layout = new Layout({ + type: "v", c: [ + { + type: "h", c: [ + { type: "txt", font: "6x8:2", label: "Blood Pressure", fillx: 1 }, + ] + }, + { + type: "h", c: [ + { type: "txt", font: "6x8:2", label: "Waiting...", fillx: 1 }, + ] + } + ] + }); + g.clear(); + layout.render(); + var device; + var service; + log("connecting to ", id); + NRF.connect(id).then(function (d) { + device = d; + return new Promise(resolve => setTimeout(resolve, 1000)); + }).then(function () { + log("connected"); + if (device.getSecurityStatus().bonded) { + log("Already bonded"); + return true; + } else { + log("Start bonding"); + return device.startBonding(); + } + }).then(function () { + device.device.on('gattserverdisconnected', function (reason) { + Bangle.load(); + log("Disconnected ", reason); + }); + return device.getPrimaryService("1810"); + }).then(function (s) { + service = s; + return service.getCharacteristic("2A08"); + }).then(function (characteristic) { + //set time on device during pairing + var date = new Date(); + var b = new ArrayBuffer(7); + var v = new DataView(b); + v.setUint16(0, date.getFullYear(), true); + v.setUint8(2, date.getMonth() + 1); + v.setUint8(3, date.getDate()); + v.setUint8(4, date.getHours()); + v.setUint8(5, date.getMinutes()); + v.setUint8(5, date.getSeconds()); + var arr = []; + for (let i = 0; i < v.buffer.length; i++) { + arr[i] = v.buffer[i]; + } + return characteristic.writeValue(arr); + }).then(function () { + return service.getCharacteristic("2A35"); + }).then(function (c) { + c.on('characteristicvaluechanged', function (event) { + //log("-> "); // this is a DataView + //log(event.target.value); + const receivedData = analyzeBPData(event.target.value); + modHS.saveDataToFile('bpres', 'bloodPressure', receivedData); + layout = new Layout({ + type: "v", c: [ + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: receivedData.sbp, fillx: 1 }, + { type: "txt", font: "12x20:2", label: "/", fillx: 1 }, + { type: "txt", font: "12x20:2", label: receivedData.dbp, fillx: 1 } + ] + }, + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: receivedData.hr, fillx: 1 }, + { type: "txt", font: "12x20:2", label: "BPM", fillx: 1 }, + ] + }, + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: "Saved!", fillx: 1 } + ] + }, + ] + }); + g.clear(); + layout.render(); + }); + return c.startNotifications(); + }).then(function (d) { + log("Setting Notification Interval"); + log("Waiting for notifications"); + }).catch(function (e) { + log("GATT ", device); + layout = new Layout({ + type: "v", c: [ + { + type: "h", c: [ + { type: "txt", font: "6x8:2", label: "ERROR!", fillx: 1 }, + ] + }, + { + type: "h", c: [ + { type: "txt", font: "6x8:1", label: e, fillx: 1 }, + ] + } + ] + }); + g.clear(); + layout.render(); + if (!device.connected) { + getBP(id); + } + }); +} +var macID = settings.bt_bloodPressure_id.split(" "); +setTimeout(() => { getBP(macID[0]) }, 2000); \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.default.json b/apps/heatsuite/heatsuite.default.json new file mode 100644 index 000000000..411bb6652 --- /dev/null +++ b/apps/heatsuite/heatsuite.default.json @@ -0,0 +1,11 @@ +{ + "DEBUG" : false, + "SAVE_DEBUG": false, + "notifications" : true, + "record" : ["bat","steps","hrm","baro","acc"], + "filePrefix": "htst", + "GPS" : true, + "GPSAdaptiveTime" : 2, + "GPSInterval" : 30, + "GPSScanTime" : 5 +} \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.mass.js b/apps/heatsuite/heatsuite.mass.js new file mode 100644 index 000000000..89ebf0f13 --- /dev/null +++ b/apps/heatsuite/heatsuite.mass.js @@ -0,0 +1,70 @@ +var Layout = require("Layout"); +var modHS = require("HSModule"); +var layout; + +/** --------- MI SCALE --------------------------- */ +function getMass(service) { + var datareceived = []; + layout = new Layout({ + type: "v", c: [ + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: "Body Mass", fillx: 1 }, + ] + }, + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: "Waiting...", fillx: 1 }, + ] + } + ] + }); + g.clear(); + layout.render(); + + NRF.setScan();//clear other scans + + NRF.setScan(function (devices) { + var data = devices.serviceData[service]; + datareceived.push(data); + var ctlByte = data[1]; + var stabilized = ctlByte & (1 << 5); + var weight = ((data[12] << 8) + data[11]) / 200; + var impedance = (data[10] << 8) + data[9]; + if (stabilized && datareceived.length > 1 && impedance > 0 && impedance < 65534) { + NRF.setScan(); + datareceived = []; + var dataOut ={ + 'mass' : weight, + 'impedance' : impedance + }; + modHS.saveDataToFile('mass', 'bodyMass', dataOut); + layout = new Layout({ + type: "v", c: [ + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: weight, fillx: 1 }, + { type: "txt", font: "12x20:2", label: "kg", fillx: 1 } + ] + }, + { + type: "h", c: [ + { type: "txt", font: "6x8:2", label: impedance, fillx: 1 }, + ] + }, + { + type: "h", c: [ + { type: "txt", font: "12x20:2", label: "Saved!", fillx: 1 } + ] + }, + ] + }); + g.clear(); + layout.render(); + setTimeout(function () { Bangle.load(); }, 3000); + } + }, { timeout: 2000, filters: [{ services: [service] }] }); +} + +//init +getMass('181b'); \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.module.js b/apps/heatsuite/heatsuite.module.js new file mode 100644 index 000000000..3da2a4bf1 --- /dev/null +++ b/apps/heatsuite/heatsuite.module.js @@ -0,0 +1,216 @@ +function _getSettings() { + var out = Object.assign( + require('Storage').readJSON("heatsuite.default.json", true) || {}, + require('Storage').readJSON("heatsuite.settings.json", true) || {} + ); + out.StudyTasks = require('Storage').readJSON("heatsuite.tasks.json", true) || {}; + return out; +} +function _checkFileHeaders(filename,header){ + var storageFile = require("Storage").open(filename, "r"); + var headers = storageFile.readLine().trim(); + var headerString = header.join(","); + if(headers === headerString){ + return true; + }else{ + return false; + } +} +function _renameOldFile(file){ + var rename = false; + var i = 1; + while(!rename){ + var filename = file+"_"+String(i); + if(require('Storage').list(filename).length == 0){ + var newFile = require("Storage").open(filename, "w"); + var oldFile = require("Storage").open(file, "r"); + var l = oldFile.readLine(); + while (l!==undefined) { + newFile.write(l); + l = oldFile.readLine(); + } + oldFile.erase(); //erase old file + require("Storage").compact(); //compact memory + rename = true; + }else{ + i++; + } + } +} +function _getRecordFile(type, headers) { + var settings = _getSettings(); + var dt = new Date(); + var hour = dt.getHours(); + if (hour < 10) hour = '0' + hour; + var month = dt.getMonth() + 1; + if (month < 10) month = '0' + month; + var day = dt.getDate(); + if (day < 10) day = '0' + day; + var date = dt.getFullYear() + "" + month + "" + day; + var fileName = settings.filePrefix + "_" + type + "_"; + fileName = fileName + date; + if (require('Storage').list(fileName).length > 0 && type !== "accel") { + if(_checkFileHeaders(fileName,headers)){ + return require('Storage').open(fileName, 'a'); + }else{ // need to rename the old file as headers have changed + _renameOldFile(fileName); + } + } + if (type !== "accel") { + var storageFile = require("Storage").open(fileName, "w"); + storageFile.write(headers.join(",") + "\n"); + } + return require("Storage").open(fileName, "a"); +} +function _checkStorageFree(type) { + var settings = _getSettings(); + var freeSpace = require("Storage").getFree(); + var filePrefix = settings.filePrefix + type; + var csvList = require("Storage").list(filePrefix); + if (freeSpace < 500000) { + if(csvList.length > 0){ + require("Storage").open(csvList[0],"r").erase(); + } + require("Storage").compact(); + } +} +function _saveDataToFile(type, task, arr) { + var newArr = { + 'unix' : parseInt((getTime()).toFixed(0)), + 'tz' : (new Date()).getTimezoneOffset() * -60 + } + for (var key in arr) { + newArr[key] = arr[key]; + } + var data = []; + var headers = []; + for (var key in newArr) { + if(Array.isArray(newArr[key])){ + newArr[key] = newArr[key].join(';'); + } + data.push(newArr[key]); + headers.push(key); + } + var currFile = _getRecordFile(type, headers); + if (currFile) { + var String = data.join(',') + '\n'; + currFile.write(String); + _updateTaskQueue(task, newArr); + return true; + } +} +function _updateTaskQueue(task, arr) { + var appCache = _getCache(); + var taskQueue = appCache.taskQueue; + var tasktime = parseInt((getTime()).toFixed(0)); + if (taskQueue !== undefined) { + var newTaskQueue = taskQueue.filter(function (taskQueue) { + return taskQueue.id !== task; + }); + appCache.taskQueue = newTaskQueue; + } + if (appCache[task] === undefined) appCache[task] = {}; + if (task === 'survey') { //we will refactor the value to be an object with keys + var key = arr.key; + if(appCache.survey[key] === undefined) appCache.survey[key] = {}; + appCache.survey[key] = { + unix: tasktime, + resp: arr.value + }; + }else{ + appCache[task] = arr; + } + appCache[task].unix = tasktime; + //lets always store cache so we can restore values if needed + _writeCache(appCache); +} +function _getCache() { + return require('Storage').readJSON("heatsuite.cache.json", true) || {}; +} +function _writeCache(cache) { + var oldCache = _getCache(); + if (oldCache !== cache) require('Storage').writeJSON("heatsuite.cache.json", cache); + return _getCache(); +} +function _clearCache() { + require('Storage').writeJSON("heatsuite.cache.json", {}); + return _getCache(); +} +function _parseBLEData(buffer, dataSchema) { + let offset = 0; + let result = {}; + for (let field in dataSchema) { + const dataType = dataSchema[field]; + let value; + switch (dataType) { + case 'uint8': + value = buffer.getUint8(offset,true); + offset += 1; // 1 byte for uint8 + break; + case 'uint16': + value = buffer.getUint16(offset,true); // Assuming little-endian format + offset += 4; // 2 bytes for uint16 + break; + case 'int32': + value = buffer.getInt32(offset,true); // Assuming little-endian format + offset += 4; // 4 bytes for int32 + break; + case 'float32': + value = buffer.getFloat32(offset,true); // Assuming little-endian format + offset += 4; // 4 bytes for float32 + break; + case 'float64': + value = buffer.getFloat64(offset,true); // Assuming little-endian format + offset += 8; // 8 bytes for float64 + break; + case 'array': + value = []; + for (let i = 0; i < 6; i++) { + value.push(buffer.getUint8(offset,true)); + offset += 1; // 1 byte for each uint8 + } + break; + case 'float16':{ + const b0 = buffer.getUint8(offset, true); + const b1 = buffer.getUint8(offset + 1, true); + const mantissa = (b1 << 8) | b0; + const sign = mantissa & 0x8000 ? -1 : 1; + const exponent = (mantissa >> 11) & 0x0F; + const fraction = mantissa & 0x7FF; + value = sign * (1 + fraction / 2048) * Math.pow(2, exponent - 15); + offset += 2; + break; + } + default: + throw new Error(`Unknown data type: ${dataType}`); + } + result[field] = value; + } + return result; +} +function _log(msg) { + var settings = _getSettings(); + if(settings.SAVE_DEBUG){ + var file = require('Storage').open('heatsuite.log', 'a'); + var string = String(parseInt((new Date().getTime() / 1000).toFixed(0)))+": "+msg+"\n"; + file.write(string); + return; + } + else if (!settings.DEBUG) { + return; + } else { + console.log(msg); + } + } +exports = { + getSettings: _getSettings, + getRecordFile: _getRecordFile, + saveDataToFile: _saveDataToFile, + checkStorageFree : _checkStorageFree, + getCache: _getCache, + writeCache: _writeCache, + clearCache: _clearCache, + updateTaskQueue: _updateTaskQueue, + parseBLEData: _parseBLEData, + log: _log, +}; \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.settings.js b/apps/heatsuite/heatsuite.settings.js new file mode 100644 index 000000000..d4d3d9c63 --- /dev/null +++ b/apps/heatsuite/heatsuite.settings.js @@ -0,0 +1,359 @@ +(function (back) { + + var settingsJSON = "heatsuite.settings.json"; + var studyTasksJSON = "heatsuite.tasks.json"; + + function log(msg) { + if (!settings.DEBUG) { + return; + } else { + console.log(msg); + } + } + + function writeSettings(key, value) { + var s = require('Storage').readJSON(settingsJSON, true) || {}; + s[key] = value; + require('Storage').writeJSON(settingsJSON, s); + settings = readSettings(); + if (global.WIDGETS && WIDGETS["heatsuite"]) WIDGETS["heatsuite"].changed(); //redraw widget on settings update if open + } + + function readSettings() { + var out = Object.assign( + require('Storage').readJSON("heatsuite.default.json", true) || {}, + require('Storage').readJSON(settingsJSON, true) || {} + ); + out.StudyTasks = require('Storage').readJSON(studyTasksJSON, true) || {}; + return out; + } + var settings = readSettings(); + + /*---- PAIRING FUNCTIONS FOR DEVICES ----*/ + function BPPair(id) { + var device; + E.showMessage(`Pairing /n ${id}`, "Bluetooth"); + NRF.connect(id).then(function (d) { + device = d; + return new Promise(resolve => setTimeout(resolve, 2000)); + }).then(function () { + log("connected"); + if (device.getSecurityStatus().bonded) { + log("Already bonded"); + return true; + } else { + log("Start bonding"); + return device.startBonding(); + } + }).then(function () { + device.device.on('gattserverdisconnected', function (reason) { + log("Disconnected ", reason); + }); + return device.getPrimaryService("1810"); + }).then(function (service) { + log(service); + return service.getCharacteristic("2A08"); + }).then(function (characteristic) { + //set time on device during pairing + var date = new Date(); + var b = new ArrayBuffer(7); + var v = new DataView(b); + v.setUint16(0, date.getFullYear(), true); + v.setUint8(2, date.getMonth() + 1); + v.setUint8(3, date.getDate()); + v.setUint8(4, date.getHours()); + v.setUint8(5, date.getMinutes()); + v.setUint8(5, date.getSeconds()); + var arr = []; + for (let i = 0; i < v.buffer.length; i++) { + arr[i] = v.buffer[i]; + } + return characteristic.writeValue(arr); + }).then(function () { + writeSettings("bt_bloodPressure_id", id); + // Store the name for displaying later. Will connect by ID + if (device.name) { + writeSettings("bt_bloodPressure_name", device.name); + } + E.showAlert("Paired!").then(function () { E.showMenu(deviceSettings()) }); + log("Device ID paired, time set, Done!"); + return device.disconnect(); + }).catch(function (e) { + log(e); + E.showAlert("error! " + e).then(function () { E.showMenu(deviceSettings()) }); + }); + } + function PairTcore(id) { + E.showMessage(`Pairing /n ${id}`, "Bluetooth"); + var gatt; + NRF.connect(id).then(function (g) { + gatt = g; + console.log("connected!!!"); + // return gatt.startBonding(); + //}).then(function() { + console.log("bonded", gatt.getSecurityStatus()); + writeSettings("bt_coreTemperature_id", id); + E.showAlert("Paired!").then(function () { E.showMenu(deviceSettings()) }); + log("Device ID paired, Done!"); + gatt.disconnect(); + }).catch(function (e) { + log("ERROR: " + e); + E.showAlert("error! " + e).then(function () { E.showMenu(deviceSettings()) }); + }); + } + + function deviceSettings() { + var menu = { '< Back': function () { E.showMenu(mainMenuSettings()); } }; + menu[''] = { 'title': 'Devices' }; + settings.StudyTasks.forEach(task => { + if (task.btPair === undefined || !task.btPair) return; + let key = task.id; // Adjust based on how you identify tasks + let id = "bt_" + key + "_id"; + if (settings[id] !== undefined) { + menu["Clear " + key] = function () { + E.showPrompt("Clear " + key + " device?").then((r) => { + if (r) { + writeSettings("bt_" + key + "_id", undefined); + writeSettings("bt_" + key + "_name", undefined); + } + E.showMenu(mainMenuSettings()); + }); + }; + } else { + menu["Pair " + key] = () => createMenuFromScan(key, task.btInfo.service); + } + }); + return menu; + } + + function recordMenu(){ + var updateRecorder = function(name,v){ + var r = settings.record; + r = r.filter(item => item !== name); + if(v){ + r.push(name); + } + writeSettings("record",r); + } + var menu = { '< Back': function () { E.showMenu(mainMenuSettings()); } }; + menu[''] = { 'title': 'Recorder' }; + var recorderOptions = { + 'hrm' : 'Optical HR', + 'steps' : "Steps", + 'bat' : 'Battery', + 'movement': 'Movement', + 'acc':'Accelerometry', + 'baro':'Temp/Pressure', + 'bthrm': 'BT HRM', + 'CORESensor':'CORE Sensor' + } + for (let key in recorderOptions) { + let name = recorderOptions[key]; + menu[name] = { + value: settings.record.includes(key), + onchange: v => {updateRecorder(key,v);} + }; + } + menu['High Acc'] = { + value: settings.highAcc || false, + onchange: v => { + settings.highAcc = v; + writeSettings("highAcc", v); + } + }; + return menu; + } + + function mainMenuSettings() { + var menu = { + '': { 'title': 'Main' }, + '< Back': back + }; + + menu['Recorders'] = function () {E.showMenu(recordMenu()) }; + menu['Devices'] = function () { E.showMenu(deviceSettings()) }; + menu['GPS'] = function () { E.showMenu(gpsSettings()) }; + menu['Language'] = function () { E.showMenu(languageMenu()) }; + menu['Swipe Launch'] = { + value: settings.swipeOpen || false, + onchange: v => { + settings.swipeOpen = v; + writeSettings("swipeOpen", v); + } + }; + menu['Survey Random'] = { + value: settings.surveyRandomize || false, + onchange: v => { + settings.GPS = v; + writeSettings("surveyRandomize", v); + } + }; + menu['HRM Interval'] = { + value: settings.HRMInterval || 0, + min: 0, max: 60, + onchange: v => { + settings.HRMInterval = v; + writeSettings("HRMInterval", v); + } + }; + menu['Restart BLE'] = function () { + E.showPrompt("Restart Bluetooth?").then((r) => { + if (r) { + NRF.disconnect() + NRF.restart(); + } + E.showMenu(mainMenuSettings()); + }); + }; + menu['Clear Cache'] = function () { + E.showPrompt("Clear Cache?").then((r) => { + if (r) { + require('Storage').writeJSON("heatsuite.cache.json", {}); + } + E.showMenu(mainMenuSettings()); + }); + } + menu['Clear Study ID'] = function () { + E.showPrompt("Clear study ID (includes ignored)?").then((r) => { + if (r) { + writeSettings("studyID", undefined); + writeSettings("studyIDIgnore", []); + } + E.showMenu(mainMenuSettings()); + }); + } + menu['Notifications'] = { + value: settings.notifications || false, + onchange: v => { + settings.notifications = v; + writeSettings("notifications", v); + } + }; + menu['Debug'] = function () { E.showMenu(debugMenu()) }; + return menu; + } + function debugMenu(){ + var menu = { + '': { 'title': 'Debug' }, + '< Back': function () { E.showMenu(mainMenuSettings()); } + }; + menu['Console'] = { + value: settings.DEBUG || false, + onchange: v => { + settings.DEBUG = v; + writeSettings("DEBUG", v); + } + }; + menu['Log (file)'] = { + value: settings.SAVE_DEBUG || false, + onchange: v => { + settings.SAVE_DEBUG = v; + writeSettings("SAVE_DEBUG", v); + } + }; + return menu; + } + function gpsSettings() { + var menu = { + '': { 'title': 'GPS' }, + '< Back': function () { E.showMenu(mainMenuSettings()); } + }; + menu['GPS'] = { + value: settings.GPS || false, + onchange: v => { + settings.GPS = v; + writeSettings("GPS", v); + } + }; + menu['Scan Time (min)'] = { + value: settings.GPSScanTime || 1, + min: 0, max: 60, + onchange: v => { + settings.GPSScanTime = v; + writeSettings("GPSScanTime", v); + } + }; + menu['Interval (min)'] = { + value: settings.GPSInterval || 10, + min: 0, max: 180, + onchange: v => { + settings.GPSinterval = v; + writeSettings("GPSInterval", v); + } + }; + menu['Adaptive (min)'] = { + value: settings.GPSAdaptiveTime || 2, + min: 0, max: 60, + onchange: v => { + settings.GPSAdaptiveTime = v; + writeSettings("GPSAdaptiveTime", v); + } + }; + return menu; + } + + function languageMenu() { + var menu = { '< Back': function () { E.showMenu(mainMenuSettings()); } }; + menu[''] = { 'title': 'Language' }; + var surveySettings = require('Storage').readJSON("heatsuite.survey.json", true) || {}; + + Object.keys(surveySettings.supported).forEach(key => { + //var id = surveySettings.supported[key]; + menu[key] = function () { + E.showPrompt("Set " + key + "?").then((r) => { + if (r) { + writeSettings('lang', key); + } + E.showMenu(mainMenuSettings()); + }); + }; + }); + return menu; + } + + function createMenuFromScan(type, service) { + E.showMenu(); + E.showMessage("Scanning for 4 seconds"); + var submenu_scan = { + '< Back': function () { E.showMenu(deviceSettings()); } + }; + NRF.findDevices(function (devices) { + submenu_scan[''] = { title: `Scan (${devices.length} found)` }; + if (devices.length === 0) { + E.showAlert("No " + type + " devices found") + .then(() => E.showMenu(deviceSettings())); + return; + } else { + devices.forEach((d) => { + print("Found device", d); + var shown = (d.name || d.id.substr(0, 17)); + submenu_scan[shown] = function () { + E.showPrompt("Set " + shown + "?").then((r) => { + if (r) { + switch (type) { + case "bloodPressure": + BPPair(d.id); + break; + case "coreTemperature": + PairTcore(d.id); + break; + case "bthrm": + + break; + default: + E.showMenu(deviceSettings()); + break; + } + } else { + E.showMenu(deviceSettings()); + } + }); + }; + }); + } + E.showMenu(submenu_scan); + }, { timeout: 4000, active: true, filters: [{ services: [service] }] }); + } + + E.showMenu(mainMenuSettings()); +}) \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.survey.js b/apps/heatsuite/heatsuite.survey.js new file mode 100644 index 000000000..ed917ccd4 --- /dev/null +++ b/apps/heatsuite/heatsuite.survey.js @@ -0,0 +1,228 @@ +var surveyFileJSON = "heatsuite.survey.json"; +var Layout = require("Layout"); +const modHS = require('HSModule'); +var layout; +var TaskScreenTimeout; +Bangle.setOptions({ + 'backlightTimeout':30000, + 'lockTimeout':30000 +}); + +var settings = modHS.getSettings(); +//randomize question order +function shuffle(array) { + const result = []; + var itemsLeft = array; + while (itemsLeft.length) { + var Item; + if (itemsLeft[0].orderFix !== undefined && itemsLeft[0].orderFix == true) { + Item = itemsLeft.splice(0, 1)[0]; + } else { + var randomIndex = Math.floor(Math.random() * itemsLeft.length); + Item = itemsLeft.splice(randomIndex, 1)[0]; + } + result.push(Item); // ...and add it to the result + } + return result; +} +var surveyFile = require('Storage').readJSON(surveyFileJSON, true) || {"questions":[{"text":{"en_GB":"Thermal Comfort?"},"options":[{"text":{"en_GB":"Comfortable"},"value":0,"color":"#ffffff","btnColor":"#38ed35"},{"text":{"en_GB":"Uncomfortable"},"value":1,"color":"#ffffff","btnColor":"#ff0019"}],"tod":[[0,2359]],"key":"comfort"}],"supported":{"en_GB":"English (GB)"}}; +var QArr = surveyFile.questions; +if (settings.surveyRandomize !== undefined && settings.surveyRandomize) { + QArr = shuffle(QArr); +} + + +function log(msg) { + if (!settings.DEBUG) { + return; + } else { + console.log(msg); + } +} + +var appCache = modHS.getCache(); +var lang = settings.lang || require("locale").name || "en_GB"; + +function queueTaskScreenTimeout() { + if (TaskScreenTimeout) clearTimeout(TaskScreenTimeout); + if (TaskScreenTimeout === undefined) { + TaskScreenTimeout = setTimeout(function () { + Bangle.load(); + }, 180000); + } +} + +/** -----------==== SURVEYS ====---------------- */ +var scrollInterval; +function drawScrollingText(text,height) { + Bangle.appRect = { x: 0, y: height, w: g.getWidth(), h: g.getHeight() - height, x2: g.getWidth()-1, y2: g.getHeight()-1 }; + let stringWidth = g.stringWidth(text); + let textX = (stringWidth > g.getWidth())? (stringWidth/2) : 0; + g.setColor("#000"); + g.setBgColor("#FFF"); + g.setFont("Vector:20", 2); + g.clearRect(0, 0, g.getWidth(), height); + function QuestionText() { + g.setColor("#000"); + g.setBgColor("#FFF"); + g.setFont("Vector:20", 2); + g.clearRect(0, 0, g.getWidth(), height); + g.drawString(text, textX, height/2); + textX -= 5; + if (textX < (-(stringWidth/2)+g.getWidth())) textX = (stringWidth/2); + g.flip(); + } + if(scrollInterval) clearTimeout(scrollInterval); + if(stringWidth > g.getWidth()){ + scrollInterval = setInterval(QuestionText, 60); //will need to scroll as its too long + }else{ + QuestionText(); + } +} +function drawResponseOpts(ind){ + //force scrolling of question at the top + var question = QArr[ind]; + drawScrollingText(question.text[lang].replace(/\\n/g, " "),30); + var height = 30; + var options = question.options; + if(options.length < 4){ + height = Math.floor(Bangle.appRect.h / options.length); + } + let drawItem = function (idx,r){ + var optionText = options[idx].value; + if (options[idx].text !== undefined) { + optionText = options[idx].text[lang]; + } + g.setColor((options[idx].color)?options[idx].color:"#000"); + g.setBgColor((options[idx].btnColor)?options[idx].btnColor:"#CCC").clearRect(r.x,r.y,r.x+r.w-1,r.y+r.h-1); + g.setFontAlign(0, 0, 0); + g.setFont("Vector:20").drawString(optionText,r.x+(g.getWidth()/2),r.y+(height/2)); + }; + let selectItem = function(id) { + var resp = (options[id] && options[id].text && lang in options[id].text) ? options[id].text[lang] : options[id].value; + const cbString = ind + "," + question.key + "," + resp + "," + options[id].value; + return surveyResponse(cbString); + }; + E.showScroller({ + h : height, + c : options.length, + draw : drawItem, + select : selectItem + }); +} +function drawSurveyLayout(index) { + if(scrollInterval) clearTimeout(scrollInterval); + if (surveyFile === undefined) { + log('No Survey File'); + E.showAlert("No Survey File Found.").then(function () { + Bangle.showClock(); + }); + return; + } + if (index == QArr.length) { + //at the end, so we can show a saved image and redirect to time screen + g.clear(); + g.reset(); + g.setBgColor("#FFF"); + Bangle.buzz(150); + layout = new Layout({ + type: "v", + c: [{ + type: "img", + pad: 4, + src: require("heatshrink").decompress(atob("ikUwYFCgVJkgMDhMkyVJAwQFCAQNAgESAoQCBwEBBwlIgAFDpNkyAjDkm/5MEBwdf+gUEl/6AoVZkmX/oLClv6pf+DQn1/4+E3//0gFBkACBv/SBYI7D5JiDLJx9CBAR4CAoWQQ4Z9DgAA==")) + }, + { + type: "txt", + font: "Vector:30", + label: "Done!" + }] + }); + layout.render(); + setTimeout(function () { + Bangle.load(); + }, 500); + return; + } + var question = QArr[index]; + var dateN = new Date(); + if (question.tod !== undefined && question.tod.length > 0) { + //Now we need to see if we are in window of the day that we are eligible to ask the question + var windowOfDay = false; + var currMT = parseInt(dateN.getHours() + "" + dateN.getMinutes()); + for (let d = 0; d < question.tod.length; d++) { + if (currMT > question.tod[d][0] && currMT < question.tod[d][1]) { + windowOfDay = true; + break; + } + } + if (!windowOfDay) { + drawSurveyLayout(index + 1); + return; + } + } + if (appCache.survey !== undefined){ //first time we are asking this question + if(appCache.survey[question.key] !== undefined) { + //lets just check if this survey question can be shown right now, otherwise we will skip it + var lastS = new Date(appCache.survey[question.key].unix * 1000); + if (question.oncePerDay !== undefined && question.oncePerDay) { // check if we can only show survey once a day and if we already have + //if (dateN.getFullYear() + dateN.getMonth() + dateN.getDate() === lastS.getFullYear() + lastS.getMonth() + lastS.getDate()) { + if(Math.floor(dateN.getTime() / 86400000) === Math.floor(lastS.getTime() / 86400000)){ + drawSurveyLayout(index + 1); + return; + } + } + } + } + Bangle.buzz(100); + g.clear(); + g.reset(); + var out = { + type: "v", + c: [] + }; + //default to English if question isn't translated + if (!question.text[lang]) { + lang = "en_GB"; + } + var questionText = question.text[lang].replace(/\\n/g, "\n"); + var q = { + type: "txt", + wrap: true, + fillx: 1, + filly: 1, + font: "Vector:20", + label: questionText, + id: "label" + }; + out.c.push(q); + var optFont = 'Vector:30'; + if (question.optFont !== undefined) optFont = question.optFont; + var opt = { + type: "btn", + font: optFont, + label: ">>", + pad: 1, + btnFaceCol: "#0f0", + cb: l => drawResponseOpts(index) + }; + out.c.push(opt); + layout = new Layout(out); + layout.render(); + return; +} + +function surveyResponse(text) { + var arr = text.split(','); + var nextSurvey = parseInt(arr[0]) + 1; + let newArr = { + "key": arr[1], + "resp": arr[2], + "value": arr[3] + } + modHS.saveDataToFile('survey', 'survey', newArr); + drawSurveyLayout(nextSurvey); +} + +drawSurveyLayout(0); +queueTaskScreenTimeout(); \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.urine.js b/apps/heatsuite/heatsuite.urine.js new file mode 100644 index 000000000..0bc376d57 --- /dev/null +++ b/apps/heatsuite/heatsuite.urine.js @@ -0,0 +1,88 @@ +var Layout = require("Layout"); +const modHS = require('HSModule'); +var layout; + +//var settings = modHS.getSettings(); +var appCache = modHS.getCache(); + +var results = { + color: 0, + volume: null, + colorAssessment: appCache.urine && appCache.urine.colorAssessment ? appCache.urine.colorAssessment : 0 +} + +function YMDInt(date) { + var year = date.getFullYear().toString(); + var month = (date.getMonth() + 1).toString().padStart(2, '0'); + var day = date.getDate().toString().padStart(2, '0'); + var concatenatedDate = year + month + day; + var concatenatedInteger = parseInt(concatenatedDate); + return concatenatedInteger; +} + +function saveUrineData(color) { + if (color > 0) { + var d = new Date(); + results.color = color; + results.colorAssessment = YMDInt(d); + } + Bangle.buzz(150); + modHS.saveDataToFile('urine', 'urine', results); + g.clear(); + g.reset(); + layout = new Layout({ + type: "v", + c: [{ + type: "img", + pad: 4, + src: require("heatshrink").decompress(atob("ikUwYFCgVJkgMDhMkyVJAwQFCAQNAgESAoQCBwEBBwlIgAFDpNkyAjDkm/5MEBwdf+gUEl/6AoVZkmX/oLClv6pf+DQn1/4+E3//0gFBkACBv/SBYI7D5JiDLJx9CBAR4CAoWQQ4Z9DgAA==")) + }, + { + type: "txt", + font: "Vector:30", + label: "Saved!" + }] + }); + layout.render(); + setTimeout(function () { + Bangle.load(); + }, 500); +} + +function drawColorAssessment(){ + var dateNow = new Date(); + var lastUrineColorDate = appCache.urine && appCache.urine.colorAssessment ? appCache.urine.colorAssessment : 0; + var hourCurrent = dateNow.getHours(); + var currentDay = YMDInt(dateNow); + if (hourCurrent >= 16 && currentDay > lastUrineColorDate) { + var layout = new Layout({ + type: "v", c: [ + { + type: "h", c: [ + { type: "btn", font: "6x8:2", label: " ", btnFaceCol: E.HSBtoRGB(0.3, 0.99, 1), cb: l => saveUrineData(2), fillx: 1, filly: 1, pad: 1 }, + { type: "btn", font: "6x8:2", label: " ", btnFaceCol: E.HSBtoRGB(0.2, 1, 1), cb: l => saveUrineData(1), fillx: 1, filly: 1, pad: 1 } + + ] + }, + { + type: "h", c: [ + { type: "btn", font: "6x8:2", label: " ", btnFaceCol: E.HSBtoRGB(0.38, 1, 1), cb: l => saveUrineData(3), fillx: 1, filly: 1, pad: 1 }, + { type: "btn", font: "6x8:2", label: " ", btnFaceCol: E.HSBtoRGB(0.44, 1, 0.9), cb: l => saveUrineData(4), fillx: 1, filly: 1, pad: 1 }, + ] + } + ] + }); + g.clear(); + g.reset(); + layout.render(); + } else { + saveUrineData(0); + } +} + +drawColorAssessment(); +/* +//Urine Colours adapted NSW chart and from the Hillmen Urine Chart to includes blood presence +//https://www.health.nsw.gov.au/environment/beattheheat/Pages/urine-colour-chart.aspx + +*/ \ No newline at end of file diff --git a/apps/heatsuite/heatsuite.wid.js b/apps/heatsuite/heatsuite.wid.js new file mode 100644 index 000000000..342862e5d --- /dev/null +++ b/apps/heatsuite/heatsuite.wid.js @@ -0,0 +1,819 @@ +(() => { + const modHS = require('HSModule'); + var settings = modHS.getSettings(); + var cache = modHS.getCache(); + var hrmInterval = 0; + var appName = "heatsuite"; + var bleAdvertGen = 0xE9D0; + var lastBLEAdvert = []; + var recorders; + var activeRecorders = []; + var dataLog = []; + var lastGPSFix = 0; + var gpsLog = []; + var connectionLock = false; + var processQueue = []; + var processQueueTimeout = null; + let initHandlerTimeout = null; + let BTHRM_ConnectCheck = null; + //high Accelerometry data + var perSecAccHandler = null; + var highAccTimeout = null; + var highAccWriteTimeout = null; + //Fall Detection + var fallTime = 0; + var fallDetected = false; + + Bangle.setOptions({ + "hrmSportMode": -1, + }); + //function for setting timeouts to the nearest second or minute + function timeoutAligned(periodMs, callback) { + var now = new Date(); + var millisPassed = (now.getSeconds() * 1000) + now.getMilliseconds(); + if (periodMs < 1000) periodMs = 1000; //nothing less than a second is allowed + var millisLeft = periodMs - (millisPassed % periodMs); + return setTimeout(() => { callback(); }, millisLeft); + } + function secondsSinceMidnight() {//valuable for compact storage of time + let d = new Date(); + return d.getHours() * 3600 + d.getMinutes() * 60 + d.getSeconds(); + } + function queueProcess(func, arg) { + processQueue.push((next) => func(next, arg)); + if (!connectionLock) { + processNextInQueue(); + } else { + if (!processQueueTimeout) { + processQueueTimeout = setTimeout(processNextInQueue, 1000); + } + } + } + function processNextInQueue() { + clearTimeout(processQueueTimeout); // Clear the timeout when processing starts + processQueueTimeout = null; + if (processQueue.length === 0) { + return; + } + if (!connectionLock && processQueue.length > 0) { + const task = processQueue.shift(); + task(() => { + modHS.log("[ProcessQueue] Processing queued Task"); + processNextInQueue(); + }); + } else { + if (!processQueueTimeout) { + processQueueTimeout = setTimeout(processNextInQueue, 1000); + } + } + } + function stringToBytes(str) { + const byteArray = new Uint8Array(str.length); + for (let i = 0; i < str.length; i++) { + byteArray[i] = str.charCodeAt(i); + } + return byteArray; + } + function xorEncryptWithSalt(payload, key, salt) { + const encrypted = []; + const keyLen = key.length; + const saltLen = salt.length; + + for (let i = 0; i < payload.length; i++) { + encrypted[i] = payload[i] ^ key.charCodeAt(i % keyLen) ^ salt.charCodeAt(i % saltLen); + } + return encrypted; + } + function shuffleArray(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + let temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + return array; + } + function flattenArray(array) { + let flattened = []; + for (let i = 0; i < array.length; i++) { + if (Array.isArray(array[i])) { + // If the element is an array, concatenate it recursively + flattened = flattened.concat(flattenArray(array[i])); + } else { + // If it's not an array, add the element to the result + flattened.push(array[i]); + } + } + return flattened; + } + function createRandomizedPayload(studyid, battery, temperature, heartRate, hr_loc, movement, pingFlag) { + let textBytes = stringToBytes(studyid); + if (textBytes.length < 4) { + const paddedArray = new Uint8Array(4); // Create a new Uint8Array with 4 bytes (default 0x00) + paddedArray.set(textBytes); // Copy the textBytes into the paddedArray + textBytes = paddedArray; // Replace textBytes with the padded version + } + const dataBlocks = []; + dataBlocks.push([0x00, textBytes[0], textBytes[1], textBytes[2], textBytes[3]]); // Study Code + var alert = false; + if (cache.hasOwnProperty('alert') && Object.keys(cache.alert).length > 0) { + var HEALTH_EVENTS = { + fall: 1, + custom: 99 + }; + var HEALTH_EVENT_TYPE = HEALTH_EVENTS[cache.alert.type] || HEALTH_EVENTS.custom; + dataBlocks.push([0x07, HEALTH_EVENT_TYPE]); + } + if (studyid !== "####") { + if (battery != null) { + dataBlocks.push([0x01, battery]); // Battery level + } + if (temperature != null && !isNaN(temperature)) { + dataBlocks.push([0x02, temperature & 255, (temperature >> 8) & 255]); // Temperature + } + if (heartRate != null && !isNaN(heartRate)) { + dataBlocks.push([0x03, heartRate]); + } + if (hr_loc != null && !isNaN(hr_loc) && !alert) { //sub this for an alert flag if needed! + dataBlocks.push([0x04, hr_loc]); + } + + if (movement != null && !isNaN(movement)) { + dataBlocks.push([ + 0x05, + movement & 255, + (movement >> 8) & 255, + (movement >> 16) & 255, + (movement >> 24) & 255 + ]); + } + } + if (!isNaN(pingFlag)) { + let statusByte = (+Bangle.isCharging() << 1) | pingFlag; + dataBlocks.push([0x06, statusByte]); + } + modHS.log(JSON.stringify(dataBlocks)); + const randomizedDataBlocks = shuffleArray(dataBlocks); + const payload = flattenArray(randomizedDataBlocks); + return studyid !== "####" ? xorEncryptWithSalt(payload, "heatsuite", studyid) : payload; + } + //from: https://github.com/espruino/BangleApps/tree/master/apps/recorder + //adapted to minute average data + let getRecorders = function () { + var recorders = { + hrm: function () { + var bpm = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }, bpmConfidence = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }, src = ""; + function onHRM(h) { + if (h.confidence !== 0) bpmConfidence = newValueHandler(bpmConfidence, h.confidence); + if (h.bpm !== 0) bpm = newValueHandler(bpm, h.bpm); + src = h.src; + } + return { + name: "HR", + fields: ["hr", "hr_conf", "hr_src"], + getValues: () => { + var r = [bpm.avg === null ? null : bpm.avg.toFixed(0), bpmConfidence.avg === null ? null : bpmConfidence.avg.toFixed(0), src]; + bpm = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + bpmConfidence = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + src = ""; + return r; + }, + start: () => { + Bangle.on('HRM', onHRM); + Bangle.setHRMPower(1, appName); + }, + stop: () => { + Bangle.removeListener('HRM', onHRM); + Bangle.setHRMPower(0, appName); + }, + draw: (x, y) => g.setColor(Bangle.isHRMOn() ? "#f00" : "#f88").drawImage(atob("DAwBAAAAMMeef+f+f+P8H4DwBgAA"), x, y) + }; + }, + bthrm: function () { + var bt_bpm = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var bt_bat = ""; + var bt_energy = ""; + var bt_contact = ""; + var bt_rr = []; + function onBTHRM(h) { + //modHS.log(JSON.stringify(h)); + if (h.bpm === 0) return; + bt_bpm = newValueHandler(bt_bpm, h.bpm); + bt_bat = h.bat; + bt_energy = h.energy; + bt_contact = h.contact; + if (h.rr) { + h.rr.forEach(val => bt_rr.push(val)); + } + } + return { + name: "BT HR", + fields: ["bt_bpm", "bt_bat", "bt_energy", "bt_contact", "bt_rr"], + getValues: () => { + const result = [bt_bpm.avg === null ? null : bt_bpm.avg.toFixed(0), bt_bat, bt_energy, bt_contact, bt_rr.join(";")]; + bt_bpm = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + bt_rr = []; + bt_bat = ""; + bt_energy = ""; + bt_contact = ""; + return result; + }, + start: () => { + Bangle.on('BTHRM', onBTHRM); + if (Bangle.setBTHRMPower) Bangle.setBTHRMPower(1, appName); + }, + stop: () => { + Bangle.removeListener('BTHRM', onBTHRM); + if (Bangle.setBTHRMPower) Bangle.setBTHRMPower(0, appName); + } + } + }, + CORESensor: function () { + var core = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var skin = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var core_hr = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var heatflux = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var hsi = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var core_bat = null; + var unit = null; + function onCORE(h) { + core = newValueHandler(core, h.core); + skin = newValueHandler(skin, h.skin); + if (core_hr > 0) { + core_hr = newValueHandler(core_hr, h.hr); + } + heatflux = newValueHandler(heatflux, h.heatflux); + hsi = newValueHandler(hsi, h.hsi); + core_bat = h.battery; + unit = h.unit; + } + return { + name: "CORESensor", + fields: ["core", "skin", "unit", "core_hr", "hf","hsi", "core_bat"], + getValues: () => { + const result = [core.avg === null ? null : core.avg.toFixed(2), skin.avg === null ? null : skin.avg.toFixed(2), unit, core_hr.avg === null ? null : core_hr.avg.toFixed(0), heatflux.avg === null ? null : heatflux.avg.toFixed(2),hsi.avg === null ? null : hsi.avg.toFixed(1), core_bat]; + core = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + skin = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + core_hr = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + heatflux = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + hsi = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + core_bat = null; + unit = null; + return result; + }, + start: () => { + Bangle.on('CORESensor', onCORE); + if (Bangle.setCORESensorPower) Bangle.setCORESensorPower(1, appName); + }, + stop: () => { + Bangle.removeListener('CORESensor', onCORE); + if (Bangle.setCORESensorPower) Bangle.setCORESensorPower(0, appName); + } + } + }, + bat: function () { + return { + name: "BAT", + fields: ["batt_p", "batt_v", "charging"], + getValues: () => { + return [E.getBattery(), NRF.getBattery().toFixed(2), Bangle.isCharging()]; + }, + start: () => { + }, + stop: () => { + }, + draw: (x, y) => g.setColor(Bangle.isCharging() ? "#0f0" : "#ff0").drawImage(atob("DAwBAABgH4G4EYG4H4H4H4GIH4AA"), x, y) + }; + }, + steps: function () { + var lastSteps = 0; + return { + name: "steps", + fields: ["steps"], + getValues: () => { + var c = Bangle.getStepCount(), r = [c - lastSteps]; + lastSteps = c; + return r; + }, + start: () => { lastSteps = Bangle.getStepCount(); }, + stop: () => { }, + draw: (x, y) => g.reset().drawImage(atob("DAwBAAMMeeeeeeeecOMMAAMMMMAA"), x, y) + }; + }, + movement: function () { + return { + name: "movement", + fields: ["movement"], + getValues: () => { + return [Bangle.getHealthStatus().movement]; + }, + start: () => { }, + stop: () => { }, + draw: (x, y) => g.reset().drawImage(atob("DAwBAAMMeeeeeeeecOMMAAMMMMAA"), x, y) + }; + }, + acc: function () { + var accMagArray = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + function accelHandler(accel) { + // magnitude is computed as: sqrt(x*x + y*y + z*z) + // to compute Elucidean Norm Minus One, simply run: mag - 1 + // (https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0061691) + accMagArray = newValueHandler(accMagArray, accel.mag); + } + return { + name: "Accelerometer", + fields: ["acc_min", "acc_max", "acc_avg", "acc_sum"], + getValues: () => { + var r = [accMagArray.min === null ? null : accMagArray.min.toFixed(4), accMagArray.max === null ? null : accMagArray.max.toFixed(4), accMagArray.avg === null ? null : accMagArray.avg.toFixed(4), accMagArray.sum === null ? null : accMagArray.sum.toFixed(4)]; + accMagArray = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + return r; + }, + start: () => { + //Bangle.setPollInterval(80); // This will allow it to be dynamic and save battery + Bangle.on('accel', accelHandler); + }, + stop: () => { + Bangle.removeListener('accel', accelHandler); + }, + draw: (x, y) => g.setColor(Bangle.isHRMOn() ? "#f00" : "#f88").drawImage(atob("DAwBAAAAMMeef+f+f+P8H4DwBgAA"), x, y) + }; + }, + }; + if (Bangle.getPressure) { + recorders['baro'] = function () { + var temp = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var press = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var alt = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + function onPress(c) { + if (c.temperature !== 0) temp = newValueHandler(temp, c.temperature); + if (c.pressure !== 0) press = newValueHandler(press, c.pressure); + if (c.altitude !== 0) alt = newValueHandler(alt, c.altitude); + } + return { + name: "Baro", + fields: ["baro_temp", "baro_press", "baro_alt"], + getValues: () => { + var r = [temp.avg === null ? null : temp.avg.toFixed(2), press.avg === null ? null : press.avg.toFixed(2), alt.avg === null ? null : alt.avg.toFixed(2)]; + var temp = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var press = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + var alt = { "count": null, "avg": null, "min": null, "max": null, "sum": null, "last": null }; + return r; + }, + start: () => { + Bangle.setBarometerPower(1, appName); + Bangle.on('pressure', onPress); + }, + stop: () => { + Bangle.setBarometerPower(0, appName); + Bangle.removeListener('pressure', onPress); + }, + draw: (x, y) => g.setColor("#0f0").drawImage(atob("DAwBAAH4EIHIEIHIEIHIEIEIH4AA"), x, y) + }; + } + } + return recorders; + } + function newValueHandler(arr, value) {//a way to keep resource use down for each sensor since this could grow large! + arr.count = (arr.count === null) ? 1 : arr.count + 1; + if (arr.count === 1) arr.min = value; + arr.last = value; + arr.avg = (value + (arr.avg * (arr.count - 1))) / arr.count; + arr.sum = arr.sum + value; + arr.min = (value < arr.min) ? value : arr.min; + arr.max = (value > arr.max) ? value : arr.max; + return arr; + } + //increased accelerometer data storage for higher resolution activity tracking + function perSecAcc(status) { + if(!status){ + if (perSecAccHandler) Bangle.removeListener('accel', perSecAccHandler); + if (highAccTimeout) clearTimeout(highAccTimeout); + if (highAccWriteTimeout) clearTimeout(highAccWriteTimeout); + return; + } + function arrayAcc() { + return { count: 0, sum: 0 }; + } + function updateArray(acc, value) { + acc.sum += value; + acc.count++; + } + function getAvg(acc) { + return acc.count ? acc.sum / acc.count : 0; + } + let mag = arrayAcc(); + let accTemp = []; + perSecAccHandler = function(accel){ + updateArray(mag, accel.mag); + }; + Bangle.on('accel', perSecAccHandler); + + function writeAccLog(buf) { + if (!buf || !buf.length) return; + let f = modHS.getRecordFile("accel", []); + if (!f) return; + let line = ""; + function processArrayChunk() { + let chunkSize = 10; + for (let i = 0; i < chunkSize && buf.length; i++) { + let data = buf.shift(); + if (!data || data.length !== 8) continue; + let dv = new DataView(data.buffer); + let t = dv.getUint32(0, true); + let mag = dv.getUint16(4, true); + let sum = dv.getUint16(6, true); + line += t + "," + mag + "," + sum + "\n"; + } + if (buf.length) { + setTimeout(processArrayChunk, 10); + } else { + f.write(line); + f = null; + } + } + processArrayChunk(); + } + + function writeHSAccelSetTimeout() { + if (accTemp.length > 0) { + queueProcess((next, buf) => { + writeAccLog(buf); + next(); + },accTemp); + accTemp = []; + } + highAccWriteTimeout = timeoutAligned(10000, writeHSAccelSetTimeout); //check every 10 seconds + } + function tempAccLog() { + let secondsSM = secondsSinceMidnight(); + let scaledMagAvg = Math.round(getAvg(mag) * 8192); + let scaledMagSum = Math.round(mag.sum * 1024); + let b = new Uint8Array(8); + let dv = new DataView(b.buffer); + dv.setUint32(0, secondsSM, true); + dv.setUint16(4, scaledMagAvg, true); + dv.setUint16(6, scaledMagSum, true); + accTemp.push(b); // Push Uint8Array + mag = arrayAcc(); + highAccTimeout = timeoutAligned(1000, tempAccLog); + } + let rawAccLogInt = (settings.AccLogInt ? settings.AccLogInt * 1000 : 1000); + let accLogInt = Math.max(1000, Math.round(rawAccLogInt / 1000) * 1000); + highAccTimeout = timeoutAligned(accLogInt, tempAccLog); + highAccWriteTimeout = timeoutAligned(30000, writeHSAccelSetTimeout); + } + + function updateBLEAdvert(data) { + var unix = parseInt((new Date().getTime() / 1000).toFixed(0)); + var batt = null, + rawTemp = null, + temperature = null, + heartRate = null, + hr_loc = null, + rawMovement = null, + movement = null; + if (data.length > 0) { + var headers = ['unix', 'tz']; + activeRecorders.forEach(recorder => headers.push.apply(headers, recorder.fields)); + const safeGet = (field) => { + const index = headers.indexOf(field); + return index !== -1 ? data[index] : null; + }; + unix = data[0]; // Unix timestamp is always first + batt = safeGet('batt_p', data, headers); + rawTemp = safeGet('baro_temp', data, headers); + temperature = (rawTemp != null) ? Math.round(rawTemp * 100) : null; + heartRate = safeGet('hr', data, headers); + hr_loc = 1; + if (headers.includes('bt_hrm')) { + hr_loc = 2; + heartRate = safeGet('bt_hrm', data, headers); + } + rawMovement = safeGet('acc_sum', data, headers); + movement = (rawMovement != null) ? Math.round(rawMovement * 10000) : null; + } + var studyid = settings.studyID || "####"; + if (studyid.length > 4) { + studyid = studyid.substring(0, 4); + } + var lastNodePing = cache.lastNodePing || 0; + var nodePing = (Math.abs(unix - lastNodePing) > 360) ? 1 : 0; + let advert = createRandomizedPayload(studyid, batt, temperature, heartRate, hr_loc, movement, nodePing); + modHS.log(advert); + require("ble_advert").set(bleAdvertGen, advert); + } + + function fallDetectFunc(acc) { + if (!fallDetected) { + let d = new Date().getTime(); + if (fallTime != 0) { + modHS.log("acc", acc.mag); + } + if (fallTime != 0 && d - fallTime > 200) { + fallTime = 0; fallDetected = false; + } else if (acc.mag < 0.3 && fallTime === 0) { + fallTime = d; + modHS.log("FALLING", fallTime); + } else if (acc.mag > 2.1 && d - fallTime < 200) { + //IMPACT + Bangle.buzz(400); + E.showPrompt("Did you fall?", { title: "FALL DETECTION", img: atob("FBQBAfgAf+Af/4P//D+fx/n+f5/v+f//n//5//+f//n////3//5/n+P//D//wf/4B/4AH4A=") }).then((r) => { + if (r) { + fallDetected = true; + modHS.saveDataToFile('alert', 'marker', { 'event': 'fall' }); + Bangle.showClock(); + } else { + Bangle.showClock(); //no fall, so just return to clock + } + }); + } + } + } + + function storeTempLog(unix) { + var fields = [unix, ((new Date()).getTimezoneOffset() * -60)]; + activeRecorders.forEach(recorder => fields.push.apply(fields, recorder.getValues())); + dataLog.push(fields); + lastBLEAdvert = fields; + updateBLEAdvert(lastBLEAdvert); + } + + function writeLog() { + var headers = ["unix", "tz"]; + activeRecorders.forEach(recorder => headers.push.apply(headers, recorder.fields)); + var storageFile = modHS.getRecordFile('minData', headers); + try { + if (storageFile) { + while (dataLog.length > 0) { + let item = dataLog.shift(); + storageFile.write(item.join(',') + '\n'); + } + } + } catch (e) { + modHS.log(e); + } + modHS.checkStorageFree('minData'); + return true; + } + + function toggleHRM() { + var recHRM = recorders['hrm']; + var hrm = recHRM(); + if (Bangle.isHRMOn()) { + hrm.stop(); + } else { + hrm.start(); + } + } + + function writeGPS() { + var storageFile = modHS.getRecordFile('gps', ["unix", "tz", 'lat', "lon", "alt", "speed", "course", "fix", "satellites"]); + if (storageFile) { + while (gpsLog.length > 0) { //store it + let item = gpsLog.shift(); + storageFile.write(item.join(',') + '\n'); + cache["lastGPSSignal"] = item[0]; + queueProcess((next, cache) => { + modHS.writeCache(cache); + next(); + }, cache); + } + } + } + function gpsHandler() { + if (settings.GPS) { + function logGPS(f) { + if (!isNaN(f.lat)) { + const unix = parseInt((new Date().getTime() / 1000).toFixed(0)); + if (unix > lastGPSFix + 60) { + var fields = [unix, ((new Date()).getTimezoneOffset() * -60), f.lat, f.lon, f.alt, f.speed, f.course, f.fix, f.satellites]; + gpsLog.push(fields); + lastGPSFix = unix; + } + } + } + Bangle.on('GPS', logGPS); + Bangle.setGPSPower(1, appName); + var updateTime = settings.GPSInterval !== undefined ? settings.GPSInterval * 60 : 600; + var searchTime = settings.GPSScanTime !== undefined ? settings.GPSScanTime * 60 : 60; + var adaptiveTime = settings.GPSAdaptiveTime !== undefined ? settings.GPSAdaptiveTime * 60 : 120; + require("gpssetup").setPowerMode({ power_mode: "PSMOO", update: updateTime, search: searchTime, adaptive: adaptiveTime, appName: appName }); + } else { + Bangle.setGPSPower(0, appName); //just make sure its off + } + } + + function studyTaskCheck(timenow) { + modHS.log("[StudyTask] Func init at " + timenow); + let notifications = false; + const tasks = settings.StudyTasks; + tasks.forEach(task => { + let key = task.id; + modHS.log(`[StudyTask] Processing task: ${JSON.stringify(task)}`); + if (!cache[key]) { + cache[key] = {}; + } + const d = new Date(timenow * 1000); + const hours = d.getHours(); + const minutes = d.getMinutes().toString().padStart(2, "0"); + const tod = parseInt(`${hours}${minutes}`); + const lastTaskTime = cache[key].unix || 0; + const debounceTime = (timenow - lastTaskTime) >= task.debounce; + if (task.tod !== undefined && Array.isArray(task.tod) && task.tod.includes(tod) && debounceTime) { + modHS.log(`[StudyTask] Time to notify: ${task}`); + const taskID = { id: key, time: timenow }; + cache.taskQueue = cache.taskQueue || []; // Ensure taskQueue exists + cache.taskQueue.push(taskID); + var seen = {}; + var newTaskQueue = []; + for (var i = 0; i < cache.taskQueue.length; i++) { + var obj = cache.taskQueue[i]; + if (!seen[obj.id]) { + seen[obj.id] = true; + newTaskQueue.push(obj); + } + } + cache.taskQueue = newTaskQueue; + modHS.log(`[StudyTask] ${JSON.stringify(cache)}`); + if (task.notify) { + notifications = true; + } + modHS.writeCache(cache); + WIDGETS["heatsuite"].draw(); + } + }); + if (notifications) { + Bangle.buzz(200); + setTimeout(() => Bangle.buzz(200), 300); + } + if (notifications && Bangle.CLOCK && settings.notifications) { + const desc = `Tasks: ${cache.taskQueue.length}`; + E.showPrompt(desc, { + title: "NOTIFICATION", + img: atob("FBQBAfgAf+Af/4P//D+fx/n+f5/v+f//n//5//+f//n////3//5/n+P//D//wf/4B/4AH4A="), + buttons: { + " X ": false, + " >> ": true + } + }).then(v => { + if (v) { + Bangle.load("heatsuite.app.js"); + } else { + Bangle.load(); + } + }); + } + modHS.log("[StudyTask] Func end"); + } + + //heart beat of the backend + function init() { + cache = modHS.getCache(); //update cache each minute + var unix = parseInt((new Date().getTime() / 1000).toFixed(0)); + if (storeTempLog(unix)) { + modHS.log("Data Logged to RAM"); + } + queueProcess((next, unix) => { + modHS.log("[HRM + StudyTask]"); + try { + // HRM interval check + if (settings.HRMInterval > 0) { + if (hrmInterval >= settings.HRMInterval) { + toggleHRM(); + hrmInterval = 0; + } + hrmInterval++; + } + if (settings.StudyTasks.length > 0) { + studyTaskCheck(unix); // This might also need to be queued if async + } + } catch (error) { + modHS.log("Error in StudyTaskCheck:", error); + } finally { + next(); // Ensure next() is called even if an error occurs + } + }, unix); + } + function initHandler() { + function callback() { + init(); initHandler(); + } + initHandlerTimeout = timeoutAligned(60000, callback); + } + + function startRecorder() { + settings = modHS.getSettings(); + if (initHandlerTimeout) clearTimeout(initHandlerTimeout); + if (BTHRM_ConnectCheck) clearInterval(BTHRM_ConnectCheck); + activeRecorders = []; //clear active recorders + recorders = getRecorders(); + settings.record.forEach(r => { + var recorder = recorders[r]; + if (!recorder) { + return; + } + var activeRecorder = recorder(); + activeRecorder.start(); + activeRecorders.push(activeRecorder); + }); + if (settings.hasOwnProperty('fallDetect') && settings.fallDetect) { + Bangle.on('accel', fallDetectFunc); + } else { + Bangle.removeListener('accel', fallDetectFunc); + } + //BTHRM Additions + if (settings.record.includes('bthrm') && Bangle.hasOwnProperty("isBTHRMConnected")) { + var BTHRMStatus = 0; + BTHRM_ConnectCheck = setInterval(function () { + if (Bangle.isBTHRMConnected() != BTHRMStatus) { + BTHRMStatus = Bangle.isBTHRMConnected(); + WIDGETS["heatsuite"].draw(); + } + }, 10000); //runs every 10 seconds + } + updateBLEAdvert(lastBLEAdvert); + initHandler(); + if (settings.highAcc !== undefined && settings.highAcc) { + perSecAcc(settings.highAcc); + } + if(settings.swipeOpen !== undefined && settings.swipeOpen){ + Bangle.on('swipe', function(dir) { + if (dir === 1) { // 1 = right swipe + Bangle.buzz(); + require("widget_utils").hide(); + Bangle.load('heatsuite.app.js'); + } + }); + } + } + + startRecorder(); + + gpsHandler(); + + function writeSetTimeout() { + if (dataLog.length > 0) { + queueProcess((next, unix) => { + writeLog(); + next(); + },0); + } + if (gpsLog.length > 0) { + //writeGPS(); + queueProcess((next, unix) => { + writeGPS(); + next(); + },0); + } + setTimeout(writeSetTimeout, 5000); + } + + //log writer/checker + writeSetTimeout(); + + //widget stuff + var iconWidth = 44; + function draw() { + g.reset(); + g.setColor(cache.taskQueue === undefined ? "#fff" : cache.taskQueue.length > 0 ? "#f00" : "#0f0"); + g.setFontAlign(0, 0); + g.fillRect({ x: this.x, y: this.y, w: this.x + iconWidth - 1, h: this.y + 23, r: 8 }); + g.setColor(-1); + g.setFont("Vector", 12); + g.drawImage(atob("FBfCAP//AADk+kPKAAAoAAAAAKoAAAAAKAAAAFQoFQAAVTxVAFQVVVQVRABVABFVEBQEVQBUABUAAFUAVQCoFVVUKogAVQAiqBVVVCoAVQBVAABUABUAVRAUBFVEAFUAEVQVVVQVAFU8VQAAVCgVAAAAKAAAAACqAAAAACgAAA=="), this.x + 1, this.y + 1); + g.setColor((Bangle.hasOwnProperty("isBTHRMConnected") && Bangle.isBTHRMConnected()) ? "#00F" : "#0f0"); + g.drawImage(atob("EhCCAAKoAqgCqqiqqCqqqqqqqqqqqqqqqqqqqqqqqqqqqqqiqqqqqAqqqqoAKqqqgACqqqAAAqqoAAAKqgAAACqAAAAAoAAAAAoAAA=="), this.x + 22, this.y + 3); + + } + WIDGETS.heatsuite = { + area: 'tr', + width: iconWidth, + draw: draw, + changed: function () { + startRecorder(); + WIDGETS["heatsuite"].draw(); + } + }; + + //Diagnosing BLUETOOTH Connection Issues + //for managing memory issues - keeping code here for testing purposes in the future + if (NRF.getSecurityStatus().connected) { //if widget starts while a bluetooth connection exits, force connection flag - but this is + //connectionLock = true; + } + NRF.on('error', function (msg) { + modHS.log("[NRF][ERROR] " + msg); + }); + NRF.on('connect', function (addr) { + //connectionLock = true; + modHS.log("[NRF][CONNECTED] " + JSON.stringify(addr)); + }); + NRF.on('disconnect', function (reason) { + connectionLock = false; + cache = modHS.getCache(); //update cache each disconnect + if (lastBLEAdvert) { + updateBLEAdvert(lastBLEAdvert); //update this if its changed with cache update + } + processNextInQueue(); + modHS.log("[NRF][DISCONNECT] " + JSON.stringify(reason)); + }); +})(); \ No newline at end of file diff --git a/apps/heatsuite/heatsuite_layout.png b/apps/heatsuite/heatsuite_layout.png new file mode 100644 index 000000000..04947cd91 Binary files /dev/null and b/apps/heatsuite/heatsuite_layout.png differ diff --git a/apps/heatsuite/icon.png b/apps/heatsuite/icon.png new file mode 100644 index 000000000..0d66e0651 Binary files /dev/null and b/apps/heatsuite/icon.png differ diff --git a/apps/heatsuite/metadata.json b/apps/heatsuite/metadata.json new file mode 100644 index 000000000..3e1346aa5 --- /dev/null +++ b/apps/heatsuite/metadata.json @@ -0,0 +1,30 @@ +{ "id": "heatsuite", + "name": "HeatSuite", + "shortName":"HeatSuite", + "version":"0.10", + "description": "The smartwatch software to integrate with HeatSuite", + "icon": "icon.png", + "type": "app", + "tags": "health,tool", + "supports" : ["BANGLEJS2"], + "readme": "README.md", + "dependencies" : { "bthrm":"app", "gpssetup" : "app", "coretemp":"app"}, + "customConnect": true, + "custom": "custom.html", + "storage": [ + {"name":"heatsuite.img","url":"app-icon.js","evaluate":true}, + {"name":"HSModule","url":"heatsuite.module.js"}, + {"name":"heatsuite.app.js","url":"heatsuite.app.js"}, + {"name":"heatsuite.settings.js","url":"heatsuite.settings.js"}, + {"name":"heatsuite.wid.js","url":"heatsuite.wid.js"}, + {"name":"heatsuite.survey.js","url":"heatsuite.survey.js"}, + {"name":"heatsuite.bletemp.js","url":"heatsuite.bletemp.js"}, + {"name":"heatsuite.bp.js","url":"heatsuite.bp.js"}, + {"name":"heatsuite.mass.js","url":"heatsuite.mass.js"}, + {"name":"heatsuite.urine.js","url":"heatsuite.urine.js"} + ], + "data": [ + {"name":"heatsuite.settings.json"}, + {"name":"heatsuite.cache.json"} + ] +} diff --git a/apps/hrm/metadata.json b/apps/hrm/metadata.json index 2c82f92e5..76121814b 100644 --- a/apps/hrm/metadata.json +++ b/apps/hrm/metadata.json @@ -4,6 +4,7 @@ "version": "0.13", "description": "Measure your heart rate and see live sensor data", "icon": "heartrate.png", + "screenshots" : [ { "url":"screenshot.png" } ], "tags": "health", "supports": ["BANGLEJS","BANGLEJS2"], "storage": [ diff --git a/apps/hrm/screenshot.png b/apps/hrm/screenshot.png new file mode 100644 index 000000000..9fc678c31 Binary files /dev/null and b/apps/hrm/screenshot.png differ diff --git a/apps/hrmmar/README.md b/apps/hrmmar/README.md index 2d9612117..4f512c773 100644 --- a/apps/hrmmar/README.md +++ b/apps/hrmmar/README.md @@ -2,6 +2,8 @@ Measurements from the build in PPG-Sensor (Photoplethysmograph) is sensitive to motion and can be corrupted with Motion Artifacts (MA). This module allows to remove these. +**WARNING:** On Bangle.js 2 this has been found to make heart rate readings [substantially less accurate in some cases](https://github.com/orgs/espruino/discussions/7738#discussioncomment-13594093) (the HRM already has built in motion artefact removal). + ## Settings * **MA removal** diff --git a/apps/hrmmar/metadata.json b/apps/hrmmar/metadata.json index fcb2fac5c..5ff49f3fc 100644 --- a/apps/hrmmar/metadata.json +++ b/apps/hrmmar/metadata.json @@ -4,7 +4,7 @@ "shortName":"HRM MA removal", "icon": "app.png", "version":"0.02", - "description": "Removes Motion Artifacts in Bangle.js's heart rate sensor data.", + "description": "Removes Motion Artifacts in Bangle.js's heart rate sensor data. **WARNING:** On Bangle.js 2 this has been found to make heart rate readings substantially less accurate in some cases.", "type": "bootloader", "tags": "health", "supports": ["BANGLEJS","BANGLEJS2"], diff --git a/apps/hworldclock/ChangeLog b/apps/hworldclock/ChangeLog index 42e785b0a..ad327831a 100644 --- a/apps/hworldclock/ChangeLog +++ b/apps/hworldclock/ChangeLog @@ -21,3 +21,4 @@ 0.34: Fix 'fast load' so clock doesn't always redraw when screen unlocked/locked 0.35: Minor code improvements 0.36: Minor code improvements +0.37: Fix settings (show default as '90' not 'off') \ No newline at end of file diff --git a/apps/hworldclock/metadata.json b/apps/hworldclock/metadata.json index 422ef6b89..aeae2d254 100644 --- a/apps/hworldclock/metadata.json +++ b/apps/hworldclock/metadata.json @@ -2,7 +2,7 @@ "id": "hworldclock", "name": "Hanks World Clock", "shortName": "Hanks World Clock", - "version": "0.36", + "version": "0.37", "description": "Current time zone plus up to three others", "allow_emulator":true, "icon": "app.png", diff --git a/apps/hworldclock/settings.js b/apps/hworldclock/settings.js index 98b91dc7b..457bc47b3 100644 --- a/apps/hworldclock/settings.js +++ b/apps/hworldclock/settings.js @@ -2,6 +2,7 @@ var FILE = "hworldclock.json"; var settings = Object.assign({ secondsOnUnlock: false, + rotationTarget: "90", }, require('Storage').readJSON(FILE, true) || {}); function writeSettings() { @@ -55,4 +56,4 @@ E.showMenu(mainmenu); -}); +}) \ No newline at end of file diff --git a/apps/iconbits/README.md b/apps/iconbits/README.md index 90bc0f5a3..f63ac788f 100644 --- a/apps/iconbits/README.md +++ b/apps/iconbits/README.md @@ -16,5 +16,4 @@ It is also possible to load existing icon into editor, using "load_icon("");" command. At the end of iconbits.app.js file there are more utility functions. - - +Create 48x48 icon in gimp. \ No newline at end of file diff --git a/apps/iconbits/icon.png b/apps/iconbits/icon.png new file mode 100644 index 000000000..10c6e078c Binary files /dev/null and b/apps/iconbits/icon.png differ diff --git a/apps/iconlaunch/ChangeLog b/apps/iconlaunch/ChangeLog index 504f747bd..76ad52e88 100644 --- a/apps/iconlaunch/ChangeLog +++ b/apps/iconlaunch/ChangeLog @@ -23,4 +23,7 @@ 0.16: Use firmware provided E.showScroller method 0.17: fix fullscreen with oneClickExit 0.18: Better performance -0.19: Remove 'jit' keyword as 'for(..of..)' is not supported (fix #2937) \ No newline at end of file +0.19: Remove 'jit' keyword as 'for(..of..)' is not supported (fix #2937) +0.20: Use '28' font if installed (2v26+) and put it inside a rounded rect in the current theme + Ensure 'oneClickExit' is the default +0.21: Display placeholder icons at start and render line by line to the screen to make loading seem faster \ No newline at end of file diff --git a/apps/iconlaunch/app.js b/apps/iconlaunch/app.js index f7d5b7bf1..f6546c016 100644 --- a/apps/iconlaunch/app.js +++ b/apps/iconlaunch/app.js @@ -4,10 +4,11 @@ showClocks: true, fullscreen: false, direct: false, - oneClickExit: false, + oneClickExit: true, swipeExit: false, timeOut:"Off" }, s.readJSON("iconlaunch.json", true) || {}); + let font = g.getFonts().includes("28") ? "28" : "12x20"; if (!settings.fullscreen) { Bangle.loadWidgets(); @@ -15,6 +16,22 @@ } else { // for fast-load, if we had widgets then we should hide them require("widget_utils").hide(); } + + let selectedItem = -1; + const R = Bangle.appRect; + const iconSize = 48; + const appsN = Math.floor(R.w / iconSize); + const whitespace = Math.floor((R.w - appsN * iconSize) / (appsN + 1)); + const iconYoffset = Math.floor(whitespace/4)-1; + const itemSize = iconSize + whitespace; + + // show some grey blocks as a loading screen + g.clearRect(Bangle.appRect).setColor("#888"); + for (var y=R.y+whitespace/2;y { + onchange: (m) => { save("showClocks", m); s.erase("iconlaunch.cache.json"); //delete the cache app list } @@ -50,4 +50,4 @@ }, }; E.showMenu(appMenu); -}); +}) diff --git a/apps/icons/gen/generate.js b/apps/icons/gen/generate.js index b91eedcdc..fd97a1ce9 100755 --- a/apps/icons/gen/generate.js +++ b/apps/icons/gen/generate.js @@ -7,7 +7,7 @@ /* eslint-env node */ -var imageconverter = require("../../../webtools/imageconverter.js").imageconverter; +var imageconverter = require("../../../webtools/imageconverter.js"); var icons = JSON.parse(require("fs").readFileSync(__dirname+"/icon_names.json")); const imgOptions = { mode : "1bit", diff --git a/apps/infoclk/ChangeLog b/apps/infoclk/ChangeLog index def512856..911e64894 100644 --- a/apps/infoclk/ChangeLog +++ b/apps/infoclk/ChangeLog @@ -12,3 +12,4 @@ Broke out config loading into separate file to avoid duplicating a whole bunch of code Added support for fast loading 0.10: Minor code improvements +0.11: Make sure variables are properly defined in settings.js diff --git a/apps/infoclk/metadata.json b/apps/infoclk/metadata.json index 1b1b6e604..ddd16c4a6 100644 --- a/apps/infoclk/metadata.json +++ b/apps/infoclk/metadata.json @@ -1,7 +1,7 @@ { "id": "infoclk", "name": "Informational clock", - "version": "0.10", + "version": "0.11", "description": "A configurable clock with extra info and shortcuts when unlocked, but large time when locked", "readme": "README.md", "icon": "icon.png", @@ -41,4 +41,4 @@ "dependencies": { "weather": "app" } -} \ No newline at end of file +} diff --git a/apps/infoclk/settings.js b/apps/infoclk/settings.js index a9adf87fc..dd18626e1 100644 --- a/apps/infoclk/settings.js +++ b/apps/infoclk/settings.js @@ -17,6 +17,9 @@ } else return '' + hour; } + let minute; // Is used in onchange functions. Defined here to appease the linter. + let hour; // Is used in onchange functions. Defined here to appease the linter. + // The menu for configuring when the seconds are shown function showSecondsMenu() { E.showMenu({ @@ -744,4 +747,4 @@ } showMainMenu(); -}); \ No newline at end of file +}) diff --git a/apps/intervalTimer/metadata.json b/apps/intervalTimer/metadata.json index 2722473c1..a0489833c 100644 --- a/apps/intervalTimer/metadata.json +++ b/apps/intervalTimer/metadata.json @@ -5,7 +5,7 @@ "icon": "app.png", "version":"0.01", "description": "Interval Timer for workouts, HIIT, or whatever else.", - "tags": "timer, interval, hiit, workout", + "tags": "timer,interval,hiit,workout", "readme":"README.md", "supports":["BANGLEJS2"], "storage": [ diff --git a/apps/ios/ChangeLog b/apps/ios/ChangeLog index 904ad1f7d..7952d546b 100644 --- a/apps/ios/ChangeLog +++ b/apps/ios/ChangeLog @@ -16,4 +16,7 @@ 0.15: Enable calendar and weather updates via custom notifications (via shortcuts app) 0.16: Always request Current Time service from iOS 0.17: Default to passing full UTF8 strings into messages app (which can now process them with an international font) -0.18: Fix UTF8 conversion (check for `font` library, not `fonts`) \ No newline at end of file +0.18: Fix UTF8 conversion (check for `font` library, not `fonts`) +0.19: Convert numeric weather values to int from BangleDumpWeather shortcut +0.20: Add feels-like temperature data field to weather parsing from BangleDumpWeather shortcut. +0.21: Add BangleDumpLocation shortcut, to update location data on watch without needing to use the watch's GPS, and added more app names/ ids. diff --git a/apps/ios/README.md b/apps/ios/README.md index 79ab1e7a1..9de586982 100644 --- a/apps/ios/README.md +++ b/apps/ios/README.md @@ -35,20 +35,21 @@ for now. It's just a few bucks/pounds/euro's. If you like to try a free app first, you can always use NRF Toolbox or Bluetooth BLE Device Finder to find and connect your Bangle. -### Weather and Calendar +### Weather, Calendar, and Location -By using the `Shortcuts` app on your phone, you can send weather and calendar data to your watch. This works by sending a notification, which is read by the watch through ANCS. The watch then parses the notification for the data. +By using the `Shortcuts` app on your phone, you can send weather, calendar, and location data to your watch. This works by sending a notification, which is read by the watch through ANCS. The watch then parses the notification for the data. -While you may write your own shortcuts if you prefer (for example, to get weather from a different source), two are provided: +While you may write your own shortcuts if you prefer (for example, to get weather from a different source), three are provided: -- Calendar shortcut: https://www.icloud.com/shortcuts/4eac12548b4c424dbcdb1bd58cff338f -- Weather shortcut: https://www.icloud.com/shortcuts/106c68bfac3746fe9a55761a3be8d092 +- [Calendar shortcut](https://www.icloud.com/shortcuts/4eac12548b4c424dbcdb1bd58cff338f) +- [Weather shortcut](https://www.icloud.com/shortcuts/73be0ce1076446f3bdc45a5707de5c4d) +- [Location shortcut](https://www.icloud.com/shortcuts/853c41e09a8e491f893a63b464d73ea1) -The weather shortcut requires an OpenWeatherMap api key, which you can get for free from https://openweathermap.org/api. The shortcut will prompt you for this when you add it to your phone. +Note: The shortcuts must keep the names defaulted by the shortcut in order for the watch to detect the weather, calender, or location data. If you rename it from `BangleDump...` to something else, it will no longer get the info, and just display it as a notification on the watch. These shortcuts can also be automated to run periodically, for example every hour, using the `Automation` tab in the Shortcuts app. -The shortcuts will send a notification, which can be annoying. One potential workaround for this would be to create a focus mode, and have an automation: +The shortcuts will send a notification. Even though the notification is deleted as soon as Bangle.js receives it, it can be quite annoying. One potential workaround for this would be to create a focus mode, and have an automation: - activate the focus mode (hiding notifications from the shortcut) - run the shortcut - deactivate the focus mode @@ -60,4 +61,9 @@ Please file any issues on https://github.com/espruino/BangleApps/issues/new?titl ## Creator -Gordon Williams +- Gordon Williams + +## Contributors + +- RKBoss6 +- stweedo diff --git a/apps/ios/boot.js b/apps/ios/boot.js index fe9cde77d..e3b6fa677 100644 --- a/apps/ios/boot.js +++ b/apps/ios/boot.js @@ -78,28 +78,56 @@ E.on('notify',msg=>{ "com.apple.reminders": "Reminders", "com.apple.shortcuts": "Shortcuts", "com.apple.TestFlight": "TestFlight", - "com.apple.ScreenTimeNotifications": "ScreenTime", + "com.apple.ScreenTimeNotifications": "Screen Time", "com.apple.wifid.usernotification": "WiFi", + "com.apple.Maps": "Maps", + "com.apple.Music": "Apple Music", + "com.apple.AppStore": "App Store", + "com.apple.Preferences": "Settings", + "com.apple.calculator": "Calculator", + "com.apple.camera": "Camera", + "com.apple.weather": "Weather", + "com.apple.VoiceMemos": "Voice Memos", + "com.apple.News": "News", + "com.apple.tv": "Apple TV", + "com.apple.findmy": "Find My", + "com.apple.compass": "Compass", + "com.apple.measure": "Measure", "com.atebits.Tweetie2": "Twitter", - "com.burbn.instagram" : "Instagram", + "com.burbn.instagram": "Instagram", "com.facebook.Facebook": "Facebook", "com.facebook.Messenger": "Messenger", - "com.google.Chromecast" : "Google Home", - "com.google.Gmail" : "GMail", - "com.google.hangouts" : "Hangouts", - "com.google.ios.youtube" : "YouTube", - "com.hammerandchisel.discord" : "Discord", - "com.ifttt.ifttt" : "IFTTT", - "com.jumbo.app" : "Jumbo", - "com.linkedin.LinkedIn" : "LinkedIn", + "com.google.Chromecast": "Google Home", + "com.google.Gmail": "GMail", + "com.google.hangouts": "Hangouts", + "com.google.ios.youtube": "YouTube", + "com.google.ios.chrome": "Google Chrome", + "com.google.Maps": "Google Maps", + "com.google.Drive": "Google Drive", + "com.google.GoogleMobile": "Google", + "com.hammerandchisel.discord": "Discord", + "com.ifttt.ifttt": "IFTTT", + "com.jumbo.app": "Jumbo", + "com.linkedin.LinkedIn": "LinkedIn", "com.marktplaats.iphone": "Marktplaats", - "com.microsoft.Office.Outlook" : "Outlook Mail", - "com.nestlabs.jasper.release" : "Nest", - "com.netflix.Netflix" : "Netflix", - "com.reddit.Reddit" : "Reddit", + "com.microsoft.Office.Outlook": "Outlook Mail", + "com.microsoft.Office.Word": "Microsoft Word", + "com.microsoft.Office.Excel": "Microsoft Excel", + "com.microsoft.Office.Powerpoint": "Microsoft PowerPoint", + "com.nestlabs.jasper.release": "Nest", + "com.netflix.Netflix": "Netflix", + "com.reddit.Reddit": "Reddit", "com.skype.skype": "Skype", "com.skype.SkypeForiPad": "Skype", "com.spotify.client": "Spotify", + "com.soundcloud.TouchApp": "SoundCloud", + "com.disney.disneyplus": "Disney+", + "com.hbo.hbonow": "HBO Max", + "com.amazon.Amazon": "Amazon Shopping", + "com.amazon.AmazonVideo": "Prime Video", + "com.dropbox.Dropbox": "Dropbox", + "com.evernote.iPhone.Evernote": "Evernote", + "com.trello": "Trello", "com.storytel.iphone": "Storytel", "com.strava.stravaride": "Strava", "com.tinyspeck.chatlyio": "Slack", @@ -110,20 +138,22 @@ E.on('notify',msg=>{ "com.valvesoftware.Steam": "Steam", "com.vilcsak.bitcoin2": "Coinbase", "com.wordfeud.free": "WordFeud", - "com.yourcompany.PPClient": "PayPal", + "com.paypal.PPClient": "PayPal", "com.zhiliaoapp.musically": "TikTok", + "com.pinterest": "Pinterest", + "com.tumblr.tumblr": "Tumblr", "de.no26.Number26": "N26", "io.robbie.HomeAssistant": "Home Assistant", "net.superblock.Pushover": "Pushover", "net.weks.prowl": "Prowl", "net.whatsapp.WhatsApp": "WhatsApp", - "nl.ah.Appie": "Albert Heijn", "nl.postnl.TrackNTrace": "PostNL", "org.whispersystems.signal": "Signal", "ph.telegra.Telegraph": "Telegram", - "tv.twitch": "Twitch", - // could also use NRF.ancsGetAppInfo(msg.appId) here - }; + "tv.twitch": "Twitch" +}; + + //if (appNames[msg.appId]) msg.a if (msg.title === "BangleDumpCalendar") { @@ -180,6 +210,7 @@ E.on('notify',msg=>{ let weatherEvent = { t: "weather", temp: d.temp, + feels: d.feels, hi: d.hi, lo: d.lo, hum: d.hum, @@ -190,11 +221,57 @@ E.on('notify',msg=>{ wind: d.wind, wdir: d.wdir, loc: d.loc - } + }; + // Convert string fields to numbers for iOS weather shortcut + const numFields = ['code', 'wdir', 'temp','feels', 'hi', 'lo', 'hum', 'wind', 'uv', 'rain']; + numFields.forEach(field => { + if (weatherEvent[field] != null) weatherEvent[field] = +weatherEvent[field]; + }); require("weather").update(weatherEvent); NRF.ancsAction(msg.uid, false); return; } + + if (msg.title === "BangleDumpLocation") { + + const d = JSON.parse(msg.message); + + /* Example: + {"lat":"2912.0744", "lon":"2333.332", "city":"Chicago"}*/ + let locationJson = { + t: "location", + lat:d.lat, + lon:d.lon, + city:d.city + + }; + // Convert string fields to numbers + const numFields = ['lat', 'lon']; + numFields.forEach(field => { + if (locationJson[field] != null) locationJson[field] = +locationJson[field]; + }); + + //load mylocation file + let myLocationJson = Object.assign({ + lat: d.lat, + lon: d.lon, + location:d.city + }, require("Storage").readJSON("mylocation.json", true) || {}); + //remove notification from phone + NRF.ancsAction(msg.uid, false); + if(Math.abs(myLocationJson.lat - locationJson.lat) < 0.0001 && Math.abs(myLocationJson.lon -locationJson.lon) < 0.0001){ + //same location, do not write + return; + } + + myLocationJson.lon=locationJson.lon; + myLocationJson.lat=locationJson.lat; + myLocationJson.location=locationJson.city; + require("Storage").write("mylocation.json",myLocationJson); + + + return; + } require("messages").pushMessage({ t : msg.event, @@ -340,4 +417,4 @@ E.emit("ANCS", { } else { Bangle.ancsConvertUTF8 = E.asUTF8; } -} \ No newline at end of file +} diff --git a/apps/ios/metadata.json b/apps/ios/metadata.json index 6efcac15e..b549abb4c 100644 --- a/apps/ios/metadata.json +++ b/apps/ios/metadata.json @@ -1,11 +1,12 @@ { "id": "ios", "name": "iOS Integration", - "version": "0.18", - "description": "Display notifications/music/etc from iOS devices", + "version": "0.21", + "description": "Display/pull notifications, music, weather, location, and agenda from iOS devices", "icon": "app.png", "tags": "tool,system,ios,apple,messages,notifications", "dependencies": {"messages":"module"}, + "dependencies" : {"mylocation":"app" }, "supports": ["BANGLEJS","BANGLEJS2"], "readme": "README.md", "storage": [ diff --git a/apps/jsonclock/ChangeLog b/apps/jsonclock/ChangeLog new file mode 100644 index 000000000..a5b6cdc1e --- /dev/null +++ b/apps/jsonclock/ChangeLog @@ -0,0 +1,3 @@ +0.01: first release +0.02: memory leak fix; color changes to better align with VSCode color scheme; logo is transparent +0.03: Fixed redrawing of commas diff --git a/apps/jsonclock/README.md b/apps/jsonclock/README.md new file mode 100644 index 000000000..e37bfc537 --- /dev/null +++ b/apps/jsonclock/README.md @@ -0,0 +1,23 @@ +# JSON Clock ![](app.png) + + *JSON view of the time.* + +Written by: [David Volovskiy](https://github.com/voloved) and fully +inspired by [This FitBit face](https://github.com/Sharkgrammer/clockface.json) + +* Displays a JSON that shows the date, time, step count, sunrise/set and battery. +* If the Bangle's theme is dark, then it'll show in dark view (`Settings>System>Theme>Dark BW`) +* It'll show 12 hrs if it's set so in `Settings>System>Locale>Time Format` +* Along with the physical button, you can leave the clock by pressing the `X` next to the `clockface.json` in the tab. +* If the steps cannot be gotten, they won't display +* If the location isn't set, then the JSON array will ignore the sun info and instead display the time as a struct. + +## Screenshots +![dark](dark.png) +![dark-no location](dark-noloc.png) +![dark-no step](dark-nostep.png) +![dark-no location and step](dark-nolocnostep.png) +![light](light.png) +![light-no location](light-noloc.png) +![light-no step](light-nostep.png) +![light-no location and step](light-nolocnostep.png) \ No newline at end of file diff --git a/apps/jsonclock/app-icon.js b/apps/jsonclock/app-icon.js new file mode 100644 index 000000000..745ebdc17 --- /dev/null +++ b/apps/jsonclock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwcDtu27YCOvv2/d933fBAP7DSICIsOG4dh2HYBAPDEbVsmwdPCKICmso7C23jxvHjlx48bI4gUBy1JkoaC5Mkt1GLIopGyJWrGoeSrYICxu47lt28jC42SAoXcyO3jgUBI9eW7ILD03TLJwRIC4zpituyGoRZLrLpCtJHNlpZDdN225IXPy1LINICNrdyo3bx028YOH5cly3bt028lum8jIljpCxoIC4xHDUInblgOC3McuPIWZACE28cEwYCmwz7UAWEMgxHShoRNgJHiA==")) diff --git a/apps/jsonclock/app.js b/apps/jsonclock/app.js new file mode 100644 index 000000000..3cdc72eb8 --- /dev/null +++ b/apps/jsonclock/app.js @@ -0,0 +1,276 @@ +{ +const SunCalc = require("suncalc"); // from modules folder +const storage = require('Storage'); +const widget_utils = require('widget_utils'); +const global_settings = storage.readJSON("setting.json", true) || {}; +const LOCATION_FILE = "mylocation.json"; +let location; +let cachedSunTimes = null; +let lastSunCalcDate = null; +var valsArrs = {}; +let drawTimeout; + +const h = g.getHeight(); +const w = g.getWidth(); +const fontSize = 13; +const lineHeight = 16; +const buttonHeight = 12; +const buttonX = 78; +const buttonY = 3; +const headerHeight = 16; +const usableHeight = h - headerHeight; +const maxLines = Math.floor(usableHeight / lineHeight); + +var settings = { + hr_12: global_settings["12hour"] !== undefined ? global_settings["12hour"] : false, + dark_mode: g.theme.dark +}; + +let clrs = { + tab: "#505050", // grey + keys: settings.dark_mode ? "#4287f5" : "#0000FF", // blue + strings: settings.dark_mode ? "#F0A000" : "#FF0000", // orange or red + ints: settings.dark_mode ? "#00FF00" : "#005F00", // green + bg: g.theme.bg, + brackets: g.theme.fg, +}; + +// requires the myLocation app +let loadLocation = function() { + location = require("Storage").readJSON(LOCATION_FILE, 1) || {}; + location.lat = location.lat || 0; + location.lon = location.lon || 0; + location.location = location.location || null; +}; + +let getHr = function(h) { + var amPm = ""; + if (settings.hr_12) { + amPm = h < 12 ? "AM" : "PM"; + h = h % 12; + if (h == 0) h = 12; + } + return [h, amPm]; +}; + +let extractTime = function(d) { + const out = getHr(d.getHours()); + const h = out[0]; + const amPm = out[1]; + const m = d.getMinutes(); + return `${h}:${("0"+m).substr(-2)}${amPm}`; +}; + +let extractDate = function(d) { + const weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + ]; + + const weekday = weekdays[d.getDay()]; + const month = months[d.getMonth()]; + const day = d.getDate(); + + return `${weekday} ${month} ${day}`; +}; + +let getSteps = function() { + try { + return Bangle.getHealthStatus("day").steps; + } catch (e) { + if (WIDGETS.wpedom !== undefined) + return WIDGETS.wpedom.getSteps(); + else + return null; + } +}; + +let getVal = function(now, loc) { + const vals = {}; + const currentDateStr = extractDate(now); + if (loc.location) { + if (lastSunCalcDate !== currentDateStr) { + cachedSunTimes = SunCalc.getTimes(now, location.lat, location.lon); + lastSunCalcDate = currentDateStr; + } + vals.rise = extractTime(cachedSunTimes.sunrise); + vals.set = extractTime(cachedSunTimes.sunset); + } + vals.time = extractTime(now); + vals.date = currentDateStr; + vals.batt_pct = E.getBattery(); + vals.steps = getSteps(); + return vals; +}; + + +let getKeyValRegex = function(line) { + return line.trim().match(/^"([^"]+)":\s*(.+)$/); +}; + +let getIndentRegex = function(line) { + const indentMatch = line.match(/^(\s*)/); + return indentMatch ? indentMatch[1] : ""; +}; + +let getJsonLine = function() { + const now = new Date(); + const vals = getVal(now, location); + //vals.steps = null; // For testing; uncomment to see the steps not appear + //location.location = null; // For testing, if null, the time becomes an struct to take up sun's struct + const hasLoc = location.location !== null; + let raw = { + time: hasLoc + ? vals.time + : { + hr: getHr(now.getHours())[0], + min: now.getMinutes(), + }, + dt: vals.date, + "batt_%": vals.batt_pct, + }; + if (vals.steps != null) { + raw.steps = vals.steps; + } + if (hasLoc) { + raw.sun = { + rise: vals.rise, + set: vals.set, + }; + } + let jsonText = JSON.stringify(raw, null, 2); + return jsonText.split("\n"); +}; + +let draw = function() { + g.clear(); + g.setFontAlign(-1, -1); + g.setFont("Vector", 10); + + g.setColor(clrs.tab); + + g.fillRect(90, 0, w, headerHeight); + g.setColor(clrs.brackets); + g.drawString("clockface.json", 3, 3); + + g.setFont("Vector", buttonHeight); + g.drawString("X", buttonX, buttonY); + g.setFont("Vector", fontSize); + + var lines = getJsonLine(); + var numWidth = 0; + + // Draw numbers first to find out their max width + for (let i = 0; i < maxLines; i++) { + const y = headerHeight + i * lineHeight; + const lineNumberStr = (i + 1).toString().padStart(2, " ") + " "; + g.drawString(lineNumberStr, 0, y); + numWidth = Math.max(numWidth, g.stringWidth(lineNumberStr)); + } + for (let i = 0; i < maxLines; i++) { + const y = headerHeight + i * lineHeight; + const line = lines[i]; + if (!line) continue; + + let kvMatch = getKeyValRegex(line); + if (kvMatch) { + const key = kvMatch[1]; + let value = kvMatch[2]; + + // Key + g.setColor(clrs.keys); + const indent = getIndentRegex(line); + const keyText = indent + `"${key}"`; + g.drawString(keyText, numWidth, y); + const keyWidth = g.stringWidth(keyText); + let x = numWidth + keyWidth; + + g.setColor(clrs.brackets); + const colonText = ": "; + g.drawString(colonText, x, y); + x += g.stringWidth(colonText); + + // Value color + const endComma = value.endsWith(','); + valsArrs[key] = {text:value, x:x, y:y, endComma:endComma}; + if (endComma) value = value.slice(0, -1); + if (value.startsWith('"')) { + valsArrs[key].color = clrs.strings; + } else if (value.startsWith('{') || value.startsWith('}')) { + valsArrs[key].color = clrs.brackets; + } else { + valsArrs[key].color = clrs.ints; + } + g.setColor(valsArrs[key].color); + g.drawString(value, x, y); + if (endComma){ + g.setColor(clrs.brackets); + g.drawString(',', x + g.stringWidth(value), y); + } + } + else { + g.setColor(clrs.brackets); + g.drawString(line, numWidth, y); + } + } +}; + +// Redraws only values that changed +let redraw = function() { + g.setFontAlign(-1, -1); + g.setFont("Vector", fontSize); + var lines = getJsonLine(); + + for (let i = 0; i < lines.length; i++) { + let kvMatch = getKeyValRegex(lines[i]); + if (!kvMatch) continue; + const key = kvMatch[1]; + let value = kvMatch[2]; + if (!(key in valsArrs)) continue; + let valsArr = valsArrs[key]; + if (value === valsArr.text) continue; // No need to update + if (valsArr.endComma) value = value.slice(0, -1); + valsArrs[key].text = value; + + // Clear prev values + g.setColor(clrs.bg); + g.fillRect(valsArr.x, valsArr.y, w, valsArr.y + lineHeight); + + g.setColor(valsArr.color); + g.drawString(value, valsArr.x, valsArr.y); + if (valsArr.endComma){ + g.setColor(clrs.brackets); + g.drawString(',', valsArr.x + g.stringWidth(value), valsArr.y); + } + } +}; + +let redrawValues = function() { + redraw(); + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + redrawValues(); + }, 60000 - (Date.now() % 60000)); +}; + +Bangle.on('touch', (zone, e) => { + if (e.x >= (buttonY - buttonHeight) && e.x <= (buttonX + buttonHeight) && + (e.y >= (buttonY - buttonHeight) && e.y <= (buttonY + buttonHeight))) { + Bangle.showLauncher(); // Exit app + } +}); + +Bangle.on('backlight', function(on) { + if (on) { + redrawValues(); + } +}); + +Bangle.setUI("clock"); +loadLocation(); +Bangle.loadWidgets(); +widget_utils.hide(); +draw(); +redrawValues(); // To set the timeout +} \ No newline at end of file diff --git a/apps/jsonclock/app.png b/apps/jsonclock/app.png new file mode 100644 index 000000000..753fab354 Binary files /dev/null and b/apps/jsonclock/app.png differ diff --git a/apps/jsonclock/dark-noloc.png b/apps/jsonclock/dark-noloc.png new file mode 100644 index 000000000..f0470de64 Binary files /dev/null and b/apps/jsonclock/dark-noloc.png differ diff --git a/apps/jsonclock/dark-nolocnostep.png b/apps/jsonclock/dark-nolocnostep.png new file mode 100644 index 000000000..40474ed46 Binary files /dev/null and b/apps/jsonclock/dark-nolocnostep.png differ diff --git a/apps/jsonclock/dark-nostep.png b/apps/jsonclock/dark-nostep.png new file mode 100644 index 000000000..3e16f6dc0 Binary files /dev/null and b/apps/jsonclock/dark-nostep.png differ diff --git a/apps/jsonclock/dark.png b/apps/jsonclock/dark.png new file mode 100644 index 000000000..ad28f6988 Binary files /dev/null and b/apps/jsonclock/dark.png differ diff --git a/apps/jsonclock/light-noloc.png b/apps/jsonclock/light-noloc.png new file mode 100644 index 000000000..2db238a69 Binary files /dev/null and b/apps/jsonclock/light-noloc.png differ diff --git a/apps/jsonclock/light-nolocnostep.png b/apps/jsonclock/light-nolocnostep.png new file mode 100644 index 000000000..c9763abad Binary files /dev/null and b/apps/jsonclock/light-nolocnostep.png differ diff --git a/apps/jsonclock/light-nostep.png b/apps/jsonclock/light-nostep.png new file mode 100644 index 000000000..2fd0a8431 Binary files /dev/null and b/apps/jsonclock/light-nostep.png differ diff --git a/apps/jsonclock/light.png b/apps/jsonclock/light.png new file mode 100644 index 000000000..c0a90fdd5 Binary files /dev/null and b/apps/jsonclock/light.png differ diff --git a/apps/jsonclock/metadata.json b/apps/jsonclock/metadata.json new file mode 100644 index 000000000..da1522207 --- /dev/null +++ b/apps/jsonclock/metadata.json @@ -0,0 +1,15 @@ +{ "id": "jsonclock", + "name": "JsonClock", + "version": "0.03", + "description": "JSON view of the time, date, steps, battery, and sunrise and sunset times", + "icon": "app.png", + "screenshots": [{"url":"dark.png"}], + "readme": "README.md", + "type": "clock", + "tags": "clock", + "supports": ["BANGLEJS","BANGLEJS2"], + "storage": [ + {"name":"jsonclock.app.js","url":"app.js"}, + {"name":"jsonclock.img","url":"app-icon.js","evaluate":true} + ] +} diff --git a/apps/jsonclock/tran.png b/apps/jsonclock/tran.png new file mode 100644 index 000000000..463180e9f Binary files /dev/null and b/apps/jsonclock/tran.png differ diff --git a/apps/jwalk/README.md b/apps/jwalk/README.md new file mode 100644 index 000000000..96383a211 --- /dev/null +++ b/apps/jwalk/README.md @@ -0,0 +1,21 @@ +# Japanese Walking Timer + +A simple timer designed to help you manage your walking intervals, whether you're in a relaxed mode or an intense workout! + +![](screenshot.png) + +## Usage + +- The timer starts with a default total duration and interval duration, which can be adjusted in the settings. +- Tap the screen to pause or resume the timer. +- The timer will switch modes between "Relax" and "Intense" at the end of each interval. +- The display shows the current time, the remaining interval time, and the total time left. + +## Creator + +[Fabian Köll] ([Koell](https://github.com/Koell)) + + +## Icon + +[Icon](https://www.koreanwikiproject.com/wiki/images/2/2f/%E8%A1%8C.png) \ No newline at end of file diff --git a/apps/jwalk/app-icon.js b/apps/jwalk/app-icon.js new file mode 100644 index 000000000..405359b5a --- /dev/null +++ b/apps/jwalk/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEw4cA///A4IDBvvv11zw0xlljjnnJ3USoARP0uICJ+hnOACJ8mkARO9Mn0AGDhP2FQ8FhM9L4nyyc4CI0OpJZBgVN//lkmSsARGnlMPoMH2mSpMkzPQCAsBoViAgMC/WTt2T2giGhUTiBWDm3SU5FQ7yNOgeHum7Ypu+3sB5rFMgP3tEB5MxBg2X//+yAFBOIKhBngcFn8pkmTO4ShFAAUT+cSSQOSpgKDlihCPoN/mIOBCIVvUIsBk//zWStOz////u27QRCheTzEOtVJnV+6070BgGj2a4EL5V39MAgkm2ARGvGbNwMkOgUHknwCAsC43DvAIEg8mGo0Um+yCI0nkARF0O8nQjHCIsFh1gCJ08WwM6rARLgftNAMzCIsDI4te4gDBuYRM/pxCCJoADCI6PHdINDCI0kYo8BqYRHYowRByZ9GCJEDCLXACLVQAoUL+mXCJBrBiARD7clCJNzBIl8pIRIgEuwBGExMmUI4qH9MnYo4AH3MxCB0Ai/oCJ4AY")) \ No newline at end of file diff --git a/apps/jwalk/app.js b/apps/jwalk/app.js new file mode 100644 index 000000000..2a29bcd7f --- /dev/null +++ b/apps/jwalk/app.js @@ -0,0 +1,178 @@ +// === Utility Functions === +function formatTime(seconds) { + let mins = Math.floor(seconds / 60); + let secs = (seconds % 60).toString().padStart(2, '0'); + return `${mins}:${secs}`; +} + +function getTimeStr() { + let d = new Date(); + return `${d.getHours().toString().padStart(2, '0')}:${d.getMinutes().toString().padStart(2, '0')}`; +} + +function updateCachedLeftTime() { + cachedLeftTime = "Left: " + formatTime(state.remainingTotal); +} + +// === Constants === +const FILE = "jwalk.json"; +const DEFAULTS = { + totalDuration: 30, + intervalDuration: 3, + startMode: 0, + modeBuzzerDuration: 1000, + finishBuzzerDuration: 1500, + showClock: 1, + updateWhileLocked: 0 +}; + +// === Settings and State === +let settings = require("Storage").readJSON(FILE, 1) || DEFAULTS; + +let state = { + remainingTotal: settings.totalDuration * 60, + intervalDuration: settings.intervalDuration * 60, + remainingInterval: 0, + intervalEnd: 0, + paused: false, + currentMode: settings.startMode === 1 ? "Intense" : "Relax", + finished: false, + forceDraw: false, +}; + +let cachedLeftTime = ""; +let lastMinuteStr = getTimeStr(); +let drawTimerInterval; + +// === UI Rendering === +function drawUI() { + let y = Bangle.appRect.y + 8; + g.reset().setBgColor(g.theme.bg).clearRect(Bangle.appRect); + g.setColor(g.theme.fg); + + let displayInterval = state.paused + ? state.remainingInterval + : Math.max(0, Math.floor((state.intervalEnd - Date.now()) / 1000)); + + g.setFont("Vector", 40); + g.setFontAlign(0, 0); + g.drawString(formatTime(displayInterval), g.getWidth() / 2, y + 70); + + let cy = y + 100; + if (state.paused) { + g.setFont("Vector", 15); + g.drawString("PAUSED", g.getWidth() / 2, cy); + } else { + let cx = g.getWidth() / 2; + g.setColor(g.theme.accent || g.theme.fg2 || g.theme.fg); + if (state.currentMode === "Relax") { + g.fillCircle(cx, cy, 5); + } else { + g.fillPoly([ + cx, cy - 6, + cx - 6, cy + 6, + cx + 6, cy + 6 + ]); + } + g.setColor(g.theme.fg); + } + + g.setFont("6x8", 2); + g.setFontAlign(0, -1); + g.drawString(state.currentMode, g.getWidth() / 2, y + 15); + g.drawString(cachedLeftTime, g.getWidth() / 2, cy + 15); + + if (settings.showClock) { + g.setFontAlign(1, 0); + g.drawString(lastMinuteStr, g.getWidth() - 4, y); + } + g.flip(); +} + +// === Workout Logic === +function toggleMode() { + state.currentMode = state.currentMode === "Relax" ? "Intense" : "Relax"; + Bangle.buzz(settings.modeBuzzerDuration); + state.forceDraw = true; +} + +function startNextInterval() { + if (state.remainingTotal <= 0) { + finishWorkout(); + return; + } + + state.remainingInterval = Math.min(state.intervalDuration, state.remainingTotal); + state.remainingTotal -= state.remainingInterval; + updateCachedLeftTime(); + state.intervalEnd = Date.now() + state.remainingInterval * 1000; + state.forceDraw = true; +} + +function togglePause() { + if (state.finished) return; + + if (!state.paused) { + state.remainingInterval = Math.max(0, Math.floor((state.intervalEnd - Date.now()) / 1000)); + state.paused = true; + } else { + state.intervalEnd = Date.now() + state.remainingInterval * 1000; + state.paused = false; + } + drawUI(); +} + +function finishWorkout() { + clearInterval(drawTimerInterval); + Bangle.buzz(settings.finishBuzzerDuration); + state.finished = true; + + setTimeout(() => { + g.clear(); + g.setFont("Vector", 30); + g.setFontAlign(0, 0); + g.drawString("Well done!", g.getWidth() / 2, g.getHeight() / 2); + g.flip(); + + const exitHandler = () => { + Bangle.removeListener("touch", exitHandler); + Bangle.removeListener("btn1", exitHandler); + load(); // Exit app + }; + + Bangle.on("touch", exitHandler); + setWatch(exitHandler, BTN1, { repeat: false }); + }, 500); +} + +// === Timer Tick === +function tick() { + if (state.finished) return; + + const currentMinuteStr = getTimeStr(); + if (currentMinuteStr !== lastMinuteStr) { + lastMinuteStr = currentMinuteStr; + state.forceDraw = true; + } + + if (!state.paused && (state.intervalEnd - Date.now()) / 1000 <= 0) { + toggleMode(); + startNextInterval(); + return; + } + + if (state.forceDraw || settings.updateWhileLocked || !Bangle.isLocked()) { + drawUI(); + state.forceDraw = false; + } +} + +// === Initialization === +Bangle.on("touch", togglePause); +Bangle.loadWidgets(); +Bangle.drawWidgets(); + +updateCachedLeftTime(); +startNextInterval(); +drawUI(); +drawTimerInterval = setInterval(tick, 1000); \ No newline at end of file diff --git a/apps/jwalk/app.png b/apps/jwalk/app.png new file mode 100644 index 000000000..caa09a9de Binary files /dev/null and b/apps/jwalk/app.png differ diff --git a/apps/jwalk/metadata.json b/apps/jwalk/metadata.json new file mode 100644 index 000000000..71035df61 --- /dev/null +++ b/apps/jwalk/metadata.json @@ -0,0 +1,19 @@ +{ + "id": "jwalk", + "name": "Japanese Walking", + "shortName": "J-Walk", + "icon": "app.png", + "version": "0.01", + "description": "Alternating walk timer: 3 min Relax / 3 min Intense for a set time. Tap to pause/resume. Start mode, interval and total time configurable via Settings.", + "tags": "walk,timer,fitness", + "supports": ["BANGLEJS","BANGLEJS2"], + "readme": "README.md", + "data": [ + { "name": "jwalk.json" } + ], + "storage": [ + { "name": "jwalk.app.js", "url": "app.js" }, + { "name": "jwalk.settings.js", "url": "settings.js" }, + { "name": "jwalk.img", "url": "app-icon.js", "evaluate": true } + ] +} \ No newline at end of file diff --git a/apps/jwalk/screenshot.png b/apps/jwalk/screenshot.png new file mode 100644 index 000000000..a00decdf9 Binary files /dev/null and b/apps/jwalk/screenshot.png differ diff --git a/apps/jwalk/settings.js b/apps/jwalk/settings.js new file mode 100644 index 000000000..553f65213 --- /dev/null +++ b/apps/jwalk/settings.js @@ -0,0 +1,65 @@ +(function (back) { + const FILE = "jwalk.json"; + const DEFAULTS = { + totalDuration: 30, + intervalDuration: 3, + startMode: 0, + modeBuzzerDuration: 1000, + finishBuzzerDuration: 1500, + showClock: 1, + updateWhileLocked: 0 + }; + + let settings = require("Storage").readJSON(FILE, 1) || DEFAULTS; + + function saveSettings() { + require("Storage").writeJSON(FILE, settings); + } + + function showSettingsMenu() { + E.showMenu({ + '': { title: 'Japanese Walking' }, + '< Back': back, + 'Total Time (min)': { + value: settings.totalDuration, + min: 10, max: 60, step: 1, + onchange: v => { settings.totalDuration = v; saveSettings(); } + }, + 'Interval (min)': { + value: settings.intervalDuration, + min: 1, max: 10, step: 1, + onchange: v => { settings.intervalDuration = v; saveSettings(); } + }, + 'Start Mode': { + value: settings.startMode, + min: 0, max: 1, + format: v => v ? "Intense" : "Relax", + onchange: v => { settings.startMode = v; saveSettings(); } + }, + 'Display Clock': { + value: settings.showClock, + min: 0, max: 1, + format: v => v ? "Show" : "Hide" , + onchange: v => { settings.showClock = v; saveSettings(); } + }, + 'Update UI While Locked': { + value: settings.updateWhileLocked, + min: 0, max: 1, + format: v => v ? "Always" : "On Change", + onchange: v => { settings.updateWhileLocked = v; saveSettings(); } + }, + 'Mode Buzz (ms)': { + value: settings.modeBuzzerDuration, + min: 0, max: 2000, step: 50, + onchange: v => { settings.modeBuzzerDuration = v; saveSettings(); } + }, + 'Finish Buzz (ms)': { + value: settings.finishBuzzerDuration, + min: 0, max: 5000, step: 100, + onchange: v => { settings.finishBuzzerDuration = v; saveSettings(); } + }, + }); + } + + showSettingsMenu(); +}) \ No newline at end of file diff --git a/apps/kanagsec/metadata.json b/apps/kanagsec/metadata.json index c00ec9d7a..2e3376c5b 100644 --- a/apps/kanagsec/metadata.json +++ b/apps/kanagsec/metadata.json @@ -1,23 +1,23 @@ -{ +{ "id": "kanagsec", "name": "Kanagawa clock", "shortName":"kanagawa", "version": "0.04", "description": "A clock that displays the great wave of kanagawa (image from wikipedia) with seconds in active mode.", "icon": "app.png", - "tags": "clock, kanagawa, wave", + "tags": "clock,kanagawa,wave", "type": "clock", - "supports" : ["BANGLEJS2"], + "supports" : ["BANGLEJS2"], "readme": "README.md", "allow_emulator":true, - "storage": + "storage": [ {"name":"kanagsec.app.js","url":"app.js"}, {"name":"kanagsec.img","url":"app-icon.js","evaluate":true} ], - "screenshots" : + "screenshots" : [ { "url":"screenshot.png" }, - { "url":"screenshot2.png" } + { "url":"screenshot2.png" } ] } \ No newline at end of file diff --git a/apps/kbedgewrite/ChangeLog b/apps/kbedgewrite/ChangeLog new file mode 100644 index 000000000..93f9336cf --- /dev/null +++ b/apps/kbedgewrite/ChangeLog @@ -0,0 +1,3 @@ +0.01: New App! +0.02: Accents and extended mode characters +0.03: Bugfix - draw initial text after the back button has been removed diff --git a/apps/kbedgewrite/EwChart.pdf b/apps/kbedgewrite/EwChart.pdf new file mode 100644 index 000000000..2143a741b Binary files /dev/null and b/apps/kbedgewrite/EwChart.pdf differ diff --git a/apps/kbedgewrite/README.md b/apps/kbedgewrite/README.md new file mode 100644 index 000000000..2f668d4cf --- /dev/null +++ b/apps/kbedgewrite/README.md @@ -0,0 +1,25 @@ +# EdgeWrite Keyboard + +A library that provides a swipeable keyboard using the EdgeWrite system https://depts.washington.edu/ewrite/ + +## Usage + +Swipe from corner to corner to enter characters, then press the button to submit the text to the calling app. To capitalize letters, complete your stroke in the top left corner. + +To display the in app character chart, long press the screen; you can scroll through it by swiping. A dot represents the starting position of the swipe. Press the button to go back. + +![](letters.png) + +For a full character chart see [EwChart.pdf](EwChart.pdf) + +**Supported:** Letters (including capitals), numbers, backspace, word backspace, space, punctuation, new line, accents, extended mode (if characters are supported by the vector font), and some cursor controls (left, right, word left/right, home, end). + +**Unsupported:** Word-level stroking. + +## Settings + +Font size can be selected in Settings app > "Apps" > "EdgeWrite Keyboard" + +## Author + +Woogal [github](https://github.com/retcurve) diff --git a/apps/kbedgewrite/app.png b/apps/kbedgewrite/app.png new file mode 100644 index 000000000..c7608b273 Binary files /dev/null and b/apps/kbedgewrite/app.png differ diff --git a/apps/kbedgewrite/characterset.json b/apps/kbedgewrite/characterset.json new file mode 100644 index 000000000..9aa70ae71 --- /dev/null +++ b/apps/kbedgewrite/characterset.json @@ -0,0 +1,285 @@ +{ + "134": "a", + "1341": "a", + "124": "a", + "1241": "a", + "321434": "a", + "2141": "b", + "21341": "b", + "21241": "b", + "14121": "b", + "134121": "b", + "12141": "b", + "123241": "b", + "123141": "b", + "2123241": "b", + "2123141": "b", + "232141": "b", + "3214": "c", + "4123": "c", + "3414": "d", + "34214": "d", + "34314": "d", + "421434": "d", + "41434": "d", + "12341": "d", + "212341": "d", + "23214": "e", + "2324": "e", + "13214": "e", + "41231": "e", + "32314": "e", + "32414": "e", + "324": "e", + "314": "e", + "321": "f", + "32341": "g", + "3231": "g", + "323414": "g", + "321414": "g", + "3214341": "g", + "32143414": "g", + "324341": "g", + "3243414": "g", + "314341": "g", + "3143414": "g", + "312341": "g", + "3123414": "g", + "2134": "h", + "21234": "h", + "2124": "h", + "21": "i", + "341": "j", + "21314": "k", + "2131": "k", + "21214": "k", + "21414": "k", + "21324": "k", + "214": "l", + "12434": "m", + "212434": "m", + "12134": "m", + "212134": "m", + "13434": "m", + "213434": "m", + "12124": "m", + "212124": "m", + "123434": "m", + "2123434": "m", + "121234": "m", + "2121234": "m", + "1243": "n", + "1234": "n", + "21243": "n", + "12343": "n", + "1343": "n", + "32143": "o", + "34123": "o", + "2321": "p", + "1231": "p", + "21231": "p", + "23121": "p", + "32343": "q", + "34323": "q", + "4324": "q", + "34324": "q", + "32434": "q", + "3214323": "q", + "3214324": "q", + "214323": "q", + "214324": "q", + "234123": "q", + "234124": "q", + "123414": "q", + "143214": "q", + "123": "r", + "2123": "r", + "12324": "r", + "212324": "r", + "12314": "r", + "212314": "r", + "3241": "s", + "234": "t", + "2143": "u", + "213": "v", + "243": "v", + "21343": "w", + "24343": "w", + "214343": "w", + "212143": "w", + "2431": "x", + "3124": "x", + "2413": "x", + "2434": "y", + "24341": "y", + "214341": "y", + "2314": "z", + "321431": "0", + "341231": "0", + "34": "1", + "23414": "2", + "1314": "2", + "23124": "2", + "234214": "2", + "2341": "3", + "23241": "3", + "23141": "3", + "232341": "3", + "234141": "3", + "21434": "4", + "31434": "4", + "3143": "4", + "4134": "4", + "32141": "5", + "4241": "5", + "32431": "5", + "321341": "5", + "3141": "6", + "231": "7", + "2343": "7", + "32413": "8", + "31423": "8", + "323141": "8", + "232414": "8", + "3234": "9", + "23": " ", + "14": " ", + "45": ".", + "15": ",", + "125": "\"", + "435": "'", + "315": "/", + "135": "/", + "245": "\\", + "425": "\\", + "2345": "?", + "215": "!", + "2125": "|", + "345": ":", + "3415": ";", + "32145": "(", + "23415": ")", + "41235": "[", + "14325": "]", + "3145": "<", + "2415": ">", + "31245": "{", + "24315": "}", + "324135": "&", + "314235": "&", + "413245": "&", + "423145": "&", + "321435": "@", + "341235": "@", + "3214325": "@", + "3412315": "@", + "3143215": "@", + "31432145": "@", + "21345": "#", + "31315": "#", + "32415": "$", + "2315": "%", + "23145": "%", + "1345": "^", + "1245": "^", + "31425": "*", + "24135": "*", + "235": "-", + "145": "_", + "21235": "+", + "212325": "+", + "23235": "=", + "12435": "~", + "2425": "`", + "31": " \n", + "24": " ", + "46": "\xb7", + "432146": "\xb0", + "412346": "\xb0", + "123246": "\xae", + "2123246": "\xae", + "123146": "\xae", + "2123146": "\xae", + "2346": "\xac", + "32146": "\xa9", + "41236": "\xa2", + "24316": "\xd7", + "31246": "\xd7", + "316": "\xf7", + "136": "\xf7", + "232146": "\x80", + "23246": "\x80", + "132146": "\x80", + "412316": "\x80", + "323146": "\x80", + "324146": "\x80", + "24346": "\xa5", + "243416": "\xa5", + "2143416": "\xa5", + "34146": "\xf0", + "342146": "\xf0", + "343146": "\xf0", + "4214346": "\xf0", + "414346": "\xf0", + "434146": "\xf0", + "123416": "\xf0", + "2123416": "\xf0", + "1346": "\xe6", + "1246": "\xe6", + "13416": "\xe6", + "12416": "\xe6", + "3214346": "\xe6", + "21416": "\xdf", + "213416": "\xdf", + "212416": "\xdf", + "141216": "\xdf", + "1341216": "\xdf", + "121416": "\xdf", + "1232416": "\xdf", + "1231416": "\xdf", + "21232416": "\xdf", + "21231416": "\xdf", + "2321416": "\xdf", + "2146": "\xa3", + "21436": "\xb5", + "214346": "\xb5", + "121436": "\xb5", + "1214346": "\xb5", + "3214316": "\xf8", + "3412316": "\xf8", + "4126": "\xbf", + "216": "\xa1", + "346": "\xa6", + "21236": "\xb1", + "212326": "\xb1", + "31426": "\xa4", + "24136": "\xa4", + "3146": "\xab", + "2416": "\xbb", + "32": "#bs", + "41": "#wbs", + "12": "#pu-on", + "43": "#pu-on", + "325": "#pu-off", + "415": "#pu-off", + "42": "#ex-on", + "326": "#ex-off", + "416": "#ex-off", + "323": "#cur-left", + "232": "#cur-right", + "414": "#cur-word-left", + "141": "#cur-word-right", + "4141": "#cur-home", + "1414": "#cur-end", + "242": "#grave", + "313": "#acute", + "431": "#circumflex", + "421": "#circumflex", + "3421": "#tilde", + "43412": "#umlaut", + "43214": "#ring", + "41234": "#ring", + "142": "#cedilla", + "143": "#cedilla" +} + diff --git a/apps/kbedgewrite/letters.png b/apps/kbedgewrite/letters.png new file mode 100644 index 000000000..4d55d431d Binary files /dev/null and b/apps/kbedgewrite/letters.png differ diff --git a/apps/kbedgewrite/lib.js b/apps/kbedgewrite/lib.js new file mode 100644 index 000000000..62e699fa7 --- /dev/null +++ b/apps/kbedgewrite/lib.js @@ -0,0 +1,393 @@ +exports.input = function(options) { + + let chart = { + width : 352, height : 244, bpp : 1, + buffer : require("heatshrink").decompress(atob("AH4A/AH4Aj4AQPsAIHgPgDR9ACB8gBA8CChUBAolIAomAAgcICogrDiArJHQsEKQl2Cwh4EkwEDgx5DpgrJBQh+GoQ2EHogKJwgrJBQkAgbWEoIgEXRQrD/wrPQYorPK4i+EFZcIDYliFaZxEFYvMAokHYocA/iOEBQk+BQnwAgV8D4gxEmjbFAB8ICiZyFFfgAUnArqAF8D/4AC/gED/8fAgfnAgf4B4k/AgfPAgf5Agf+gECXAmAAgUBmAKDkkAh/4gEJB4kggF/AoNMB4gZDFIIrEmm8AocggJgBFYX4h+ADYk9kEH8ImBpEB/Ef4GJGoP/8ArG+gjBFYcOSIPCkkHBAN4FY14gAMBpEeBIM75MHNAMevQrEgckFYtwAYM/kkYAgMGFYl9kKJC8FIsAEBg/pjiSC/QrEhkk3ArE4ADBh8kUoIABFYk5kQECnFIGAUD5IwCgBXFmEkxAcDkIDCFYNAFY8RkXwIwQrDgGJCgcyFYlgFZMEFZUkFYUDpIKDhJsDbYkBwFEFZEAFZUl/CqC5IrEYgQrFgcAFYqfDFYJzDK43n////BXFhgrHBAIrUkMkAoYrFJwIAB4QrDMAIrVlArJgPAPoIeBFYS4BFYpHEFasAuB9BFYjNBomEFZElDYorPh+B+ArDgJJBFcMAvkAiQrCW4WEFcIABFYcGFdUMFdUYFdUwFc0KFYUgFdVAFdWAFdMBAwQrngYrqQgIrpggrqhgrDb4QrGkgKDFa8IAwVExAMDkQrOHYgrMiArFn/AFZkP/wrZg/AnwrGoAbEuEB8ERFaMwFYk4gEBwEhFZMDLoMcFaUgFYngAgNwFYtgDYbwCgYrFpC/IiQrBDYdExYRCjEhCwckHYcJNgfRSYgrMOYdExwECg0gbwIrCX4f5IAdxFZ1iNQJ9CFYOYAgUMkFwAgMBkkOAgX5XwIABiMjAgUCFYoPCgOCFYskwIRCuEgUoUOkkBLoMH9MHV4WBkIaCjgrFg4UBh0CFY2Av0Ah+AkEDCINwaAN8AIPJgH4gH8gMgj+Ag/gQY1/gfwFYMCUgmAgP/+EAaoM//+AFYMDAgIbBg//OgIPBv4yBpCqDV4QJBK4X/AAX8Agf/FIIAC84ED/IPJ54PI/w1DAH4A/AH4A/AA0QAolAAgcCAYUBBwkMFbYAOggrViQrZyBsHO40AjILJP4kwFZEDtAfIgOwQYuAJpArEGogrEgVIUZEBhArU4ArTgQrVkArqDYiDWjJ0DgP4FY8BjAJDj5ADgdsBQc5JYnwKBBXLAEwrrjwrqAD0D/4AC/gED/8fAgfHAgf5Agf+n4FDfAYAHgQEDgjqDgMwBQdkAgcJB4cDsAKDp4wD+Y7EFYIRD4mcCwcgAYUHkpIDhI2DgNAAgUIpQZDiRVFgXwEAVE3grHh8n8ArDvArIpYZDqUBKwP4+RpBFYUckgrKK4dJ/ArDrgEChlKB4dSjxQCFYJXDsEk3ArMgPJuArDpwECilJRwdSDQYrCNIWAkmIFY8CkgrCg2JV4lJcIQrBhAKC6QaD8QcBAwMDgArLHYUIxMQFYdIGwUSpMGBQWSDQgrDgkAmgrIgIrDmMJFYtgFYVIwIrMjBpBFZtBFYwFCFYOALoWSCgUAkQrDTgMUwgrLgOCFYtEVQUiFYIWCFZIIBFZsDggrGVQUhFYJ2BFZTuBFZsEFY70BFYcMFY0SFYUBAwIrNjEIFY0BIoIrBoDTBgMSFY4LBFZ0wjArGToQrCGIIrJggrLgGkCwNAiArHCIIrCgHAFZEQdoQrNfIMJCYQrBoUAGQIrDUoIrIc4QrMX4IrIDQIrDiArJN4UUwQrKX4NAFY8MFYkIFZIiCijwBbZK/BwArHgwrEggrJA4QrMjD4BFY8DFYkCFZPAV5YrCTwMAFY41BFYcBFZJTCFZkgWAIrHgHAFYcAwIrHiIGCFZiwCFZFAFYlBFbGAFAIrIkArEsIrHAQIrNoMAjArJiArEkIrHkwrOEIMwFYMQFY0YFYLOCiIrHkgrQsArJhArEhIrHlgrOoj8BFZMEFYkMyQrGlAGCkgrIMwOIgIdBFZECFYkEFY84FZ2YgZ0CFY8DFYkCFY7JBFZuQgwrKgIrGDQYrHxArJ0EIFZUA0IrDgIrEkQcBAwYrL8AnCFZNhpIJDFY9gAwVEFZEEknACAQrJuIrDgArWkuAwP/FYMgh//+EBowPCmNL4AFC6SoDFYTiDFYsuAYUckuD/0A//JkPwgEPwNPB4Uyp4rDqUOMwXCFYILDomQFYch/ggB8Elg4JClM+PwdfX4dPbYQrBgPggE+gQMBEoeEFYkggZ4BgElBIcJOYcJpwrDpYPDqUAj//4ArGgn/AAc/AgfnAgf5B4l/AgfID4cTAgYpBJYIACPgIAYcgIAC+IEDY4IA/AH4A/AH4AehAWVgQFEoAPIBIgrWjuAAgUBzAKDg4nCgMwBIcYAgcBiAFDmIfDgY8FiArEBYkEBIaDJBQsRAolIFYp0JFYcA8ArOhIKEtArJK5IPBFZwKFkALEjCDEUAgrDgQrKBQj7EgOwFYkXAonoAgcfGwUD+AJDh5ADgH4AgcGFYmQQYppJAEArrngFEjgrkAH4A/AAMD/4AC/gED/+/AgfnAgf5B4kgD4dMAgcZBwf+gECsEHAgMEwEAv8AjGggH/+EAkgEB/8AhMAj4/BgMuEwdJDQIABhI2DgQBB//4gP8FYIqBDgOgn8Ah/gkgJBBQPJn/gOAP5BwIACpfAGAZDBAAMiCQIGCgeEw49Cv2jCwUPkoECgfpvgbChorDgQrDgPJFYsCIIIABum4AgU80xHDklgFYd4PAaDDFYkDhIrCgIrCEAdkFYcA0grEjBHDmArDlArDV4cMhJACg8SFYiDBxwmD0QrEgwmDBIYrFpArCjDbDjIrCTQU8gmBNIMD8ArFgIcCFZMBFYdgFYcxFYVD///8EEwE///8sArFDIIrQ4ArD4IrCDQUAFYIECoArGWAQrNgIKBFYMDgQrCGQQrG0IrFhgrNoDSCFYUGFakDFZ48BhMQgEIFajcCFYkBmArGSgIrCiArMwArGGgIrFiIrHA4IrCkEChQrBAwIrPDYQrMfoIrC4ArMwgrHOYQrM4ArCTAMEFajLCFZi/CFYIjBFakCFZomBFYQTBFaocBFZgmBFYUEFax0BFZgmBFYUIFa9AFZgmBFYQlBFa0gFZggCFYkSFakQFZgGCFYMgFa8YFZgmBFYVAFa8IFZgmBFYXAFZuIFZEEFZgbCFYIEBFa0CFYsoFYlBAoUJiIjCFasDFdUBFYkJFYtCBQYnBEYMiFakAxIrKwgrqxAKDigrOyArJpIrKzAKDlgrP0QrSgVIyAKGgS4BFakpFZWgBQcwFZ2g04FDkgEDFYo2DFYPAFZUgFZGvFYn4AYMH9IrJpIrEEgUCwQrK8GvQYkH+f//EJBIcFk4mCn1JDQYrDgYrLoGmV4sEDYQJDgMgn///+AcwtgBwQrCBYYrEoOwbZEJB4YrBgH/8EApAPDjIODFIMDHYIAB/gED/8fAgfnAgf4B4hWCAAPPAgfxAgf+GoYA/AH4A/AG8QAQMMgQIDoAsikEAggFCgIng4FAFIMghArCgIrCkBiCgEZwA4DxgcDhIKDABEDmMR7EQkECggBB4FBQYPY8ggDDAmIAgZqNgUQiOEFYKDBV4OADANAwlECQUGFZLFEABXxggrBjwrBgMD4MAoMEFYcHCwlQAgbGDK5UBK4cgFYKEBK4IrFUgtwAgcIFZsSiOIFYMiV4UEV4SDEjPADAaXBAAUPbZkB8P5uF8j0/j+Pw/H8Hx/F44wYIFYgAPdZoAIoArpgPgCqcDTwgA/AH6SN/4AC/gED/+fAga3Pg4fEBYsCkAECgmABQeQAgYODABcEAhArC+AECimcAgUYy4xDFaH4FZ003wrEBQUDQZ8FwgrKG4c03grEx6aCK58FgQrKhgECumbAgUoyYEChgrcgYECqmBVQUkbYcwFbkBEwWkwFAFY3AbaCvLgFggEBFYMwFYpkBFaDPDFZAmBgMkwEYBINkFYUGFaIEIFYcIAYIrBBoVEFYQyBFbpLBggrBYIQrDFIIrdgIrDAgIrE4AreEAMIFYMAAIIrCgIFBFb1giArCoABBFYIMCFb0wFYYjBwQrBhgrghEgFYUwFYcYFcEEoArCEwOEFYIwBFb8CwArChArDWgIrffoIrCBwIrCAwIrfgYrDA4IrBgIPCFb0GV4cDFYQLCbcEgFYRTBFYISDFb0IiArCVYIrBhgrhiEIFYdAFYMIFcMghgrDsArBiArh4EEFYcgFYInDFbsBwECFYcQFYNgFcEDFoIrDjArBoArggwrFhArBAoQrejAEB0glCgkEFcUwAgPkEoUGomRB4YrdUoV0FYUCFcUBE4QrDgNAyQrgbQIABmgrD5ArhbQQrEgHIykAv/8FbtgAgUUFYdIy//wED/jbdFY8IK4IABgegFb8EFYcByCvYhgLFgf/AAX8Agf/j4ED8ArOg4fEChwA/AH4A/ACQ=")) + }; + let chartX = 0; + let chartY = 0; + + let settings = Object.assign({ + fontSize: 32, + }, require('Storage').readJSON("kbedgewrite.json", true)); + + let shouldShowWidgetBar = Bangle.appRect.y > 0; + + options = options||{}; + let text = options.text; + // Substring doesn't play well with UTF8 + if (E.isUTF8(text)) { + text = E.decodeUTF8(text); + } + let wrappedText = ''; + + if ('string' != typeof text) text=''; + + // Colours for number of corner occurrences + let colours = ['#ff0', '#0f0', '#f00', '#00f' ,'#0ff', '#f0f', '#fff']; + + const cornerSize = g.getWidth() / 3; + let punctuationMode = false; + let extendedMode = false; + let path = ''; + let cursorPos = text.length; + let chartShown = false; + + let characterSet = Object.assign({}, require('Storage').readJSON('kbedgewrite.charset.json', true) || {}); + + const accentedCharacters = { + '#grave': { + 'a': String.fromCharCode(0xE0), + 'A': String.fromCharCode(0xC0), + 'e': String.fromCharCode(0xE8), + 'E': String.fromCharCode(0xC8), + 'i': String.fromCharCode(0xEC), + 'I': String.fromCharCode(0xCC), + 'o': String.fromCharCode(0xF2), + 'O': String.fromCharCode(0xD2), + 'u': String.fromCharCode(0xF9), + 'U': String.fromCharCode(0xD9) + }, + '#acute': { + 'a': String.fromCharCode(0xE1), + 'A': String.fromCharCode(0xC1), + 'e': String.fromCharCode(0xE9), + 'E': String.fromCharCode(0xC9), + 'i': String.fromCharCode(0xED), + 'I': String.fromCharCode(0xCD), + 'o': String.fromCharCode(0xF3), + 'O': String.fromCharCode(0xD3), + 'u': String.fromCharCode(0xFA), + 'U': String.fromCharCode(0xDA), + 'y': String.fromCharCode(0xFD), + 'Y': String.fromCharCode(0xDD) + }, + '#circumflex': { + 'a': String.fromCharCode(0xE2), + 'A': String.fromCharCode(0xC2), + 'e': String.fromCharCode(0xEA), + 'E': String.fromCharCode(0xCA), + 'i': String.fromCharCode(0xEE), + 'I': String.fromCharCode(0xCE), + 'o': String.fromCharCode(0xF4), + 'O': String.fromCharCode(0xD4), + 'u': String.fromCharCode(0xFB), + 'U': String.fromCharCode(0xDB) + }, + '#umlaut': { + 'a': String.fromCharCode(0xE4), + 'A': String.fromCharCode(0xC4), + 'e': String.fromCharCode(0xEB), + 'E': String.fromCharCode(0xCB), + 'i': String.fromCharCode(0xEF), + 'I': String.fromCharCode(0xCF), + 'o': String.fromCharCode(0xF6), + 'O': String.fromCharCode(0xD6), + 'u': String.fromCharCode(0xFC), + 'U': String.fromCharCode(0xDC), + 'y': String.fromCharCode(0xFF) + }, + '#tilde': { + 'a': String.fromCharCode(0xE3), + 'A': String.fromCharCode(0xC3), + 'n': String.fromCharCode(0xF1), + 'N': String.fromCharCode(0xD1), + 'o': String.fromCharCode(0xF5), + 'O': String.fromCharCode(0xD5) + }, + '#ring': { + 'a': String.fromCharCode(0xE5), + 'A': String.fromCharCode(0xC5) + }, + '#cedilla': { + 'c': String.fromCharCode(0xE7), + 'C': String.fromCharCode(0xC7) + }, + + }; + + function wrapText() { + let stringToWrap = text.substring(0, cursorPos) + '_' + text.substring(cursorPos); + let l = []; + let startPos = 0; + + g.setFont("Vector", settings.fontSize); // set the font so we can calculate a string width + + // Wrap the string into array of lines that will fit the screen width + for (let i = 0; i < stringToWrap.length; i++) { + // wrap if string is too long or we hit a line break + if (stringToWrap.charCodeAt(i) == 10 || g.stringWidth(stringToWrap.substring(startPos, i+1)) > 176) { + l.push(stringToWrap.substring(startPos, i)); + // skip the line break + if (stringToWrap.charCodeAt(i) == 10) { + i++; + } + startPos = i; + } + } + // Add the final line + l.push(stringToWrap.substring(startPos)); + + // Number of lines that can fit on the screen + let numLines = Math.floor(g.getHeight() / g.getFontHeight()); + + // If too many lines, reposition so the cursor can be seen + if (l.length > numLines) { + let textPos = 0; + let lineNum; + for (lineNum = 0; lineNum < l.length; lineNum++) { + textPos = textPos + l[lineNum].length; + if (textPos >= cursorPos) break; + } + l=l.slice(lineNum - l.length - numLines + 1); + } + + wrappedText = l.join('\n'); + } + + function draw() { + g.clearRect(Bangle.appRect).setClipRect(Bangle.appRect.x, Bangle.appRect.y, Bangle.appRect.x2, Bangle.appRect.y2); + + g.setColor(g.theme.fg); + g.setFont("Vector", settings.fontSize); + g.setFontAlign(-1, -1, 0); + g.drawString(wrappedText, Bangle.appRect.x, Bangle.appRect.y); + + // Draw punctuation or extended flags + if (punctuationMode || extendedMode) { + let x = (g.getWidth() / 2) - 12; + let y = g.getHeight() - 32; + g.setColor(punctuationMode ? '#F00' : '#0F0'); + g.fillRect(x,y,x+24,y+32); + g.setColor('#FFF'); + g.setFont('6x8:4'); + g.drawString(punctuationMode ? 'P' : 'E', x+4, y+4, false); + } + + // Draw corners + for (let corner=1; corner<5; corner++) { + // Count the occurences of the current corner to set the appropriate colour + let regex = new RegExp(corner.toString(), 'g' ); + let count = (path.match(regex)||[]).length; + if (count>0) { + g.setColor(colours[count-1]); + let x = (corner<3) ? 0 : g.getWidth() - (cornerSize); + let y = (corner>1 && corner<4) ? 0 : g.getHeight() - (cornerSize); + g.fillRect(x, y, x + (cornerSize), y + (cornerSize)); + } + } + } + + function processPath() { + // Punctuation paths end in 5 + if (punctuationMode) { + path = path + '5'; + } + // Extended paths end in 6 + if (extendedMode) { + path = path + '6'; + } + + // Find character from path + let char = characterSet[path]; + + // Unknown character, but ends in a 2 so may be a capital letter + if (char == 'undefined' && path.slice(-1) == '2') { + // Remove the 2 and look for a letter + char = characterSet[path.slice(0,-1)]; + // Handle capitals + if (char != 'undefined') { + if (char.charCodeAt(0)>96 && char.charCodeAt(0)<123) { + char = char.toUpperCase(); + } + } + } + + if (char != 'undefined') { + switch (char) { + // Backspace + case '#bs': { + text = text.substring(0,cursorPos-1) + text.substring(cursorPos); + cursorPos--; + break; + } + // Word Backspace + case '#wbs': { + let lastIndex = text.substring(0, cursorPos).lastIndexOf(' '); + + // If cursor character is the break character, remove it + if (lastIndex == cursorPos - 1) { + text = text.substring(0, cursorPos-1) + text.substring(cursorPos); + cursorPos--; + } + // Remove everything up to the last word break character + let words = text.substring(0, cursorPos).split(' '); + text = words.slice(0, -1).join(' ') + ' ' + text.substring(cursorPos); + cursorPos = cursorPos - words.slice(-1)[0].length; + break; + } + // Enable punctuation mode + case '#pu-on': { + punctuationMode = true; + break; + } + // Disable punctuation mode + case '#pu-off': { + punctuationMode = false; + break; + } + // Enable extended mode + case '#ex-on': { + extendedMode = true; + break; + } + // Disable extended mode + case '#ex-off': { + extendedMode = false; + break; + } + // Cursor controls + case '#cur-left': { + if (cursorPos > 0) { + cursorPos--; + } + break; + } + case '#cur-right': { + if (cursorPos < text.length) { + cursorPos++; + } + break; + } + case '#cur-word-left': { + if (text.substring(cursorPos-1, cursorPos) == ' ') { + cursorPos--; + } + cursorPos = 1 + text.substring(0, cursorPos).lastIndexOf(' '); + break; + } + case '#cur-word-right': { + if (text.substring(cursorPos, cursorPos+1) == ' ') { + cursorPos++; + } + let nextPos = text.substring(cursorPos).indexOf(' '); + if (nextPos > -1) { + cursorPos = cursorPos + nextPos; + } else { + cursorPos = text.length; + } + break; + } + case '#cur-home': { + cursorPos = 0; + break; + } + case '#cur-end': { + cursorPos = text.length; + break; + } + // Accents + case '#grave': + case '#acute': + case '#circumflex': + case '#umlaut': + case '#tilde': + case '#ring': + case '#cedilla': + // If the previous character can be accented, replace it with the accented version + if (cursorPos > 0) { + char = accentedCharacters[char][text.substring(cursorPos-1, cursorPos)]; + if (char != 'undefined') { + text = text.substring(0, cursorPos-1) + char + text.substring(cursorPos); + } + } + break; + // Append character + default: { + text = text.substring(0, cursorPos) + char + text.substring(cursorPos); + cursorPos = cursorPos + char.length; + } + } + } + // Reset path + path = ""; + } + + let dragHandler = e=>{ + 'ram'; + if (!chartShown) { + if (e.b == 0) { // Finger lifted, process completed path + processPath(); + wrapText(); + draw(); + } else { + let corner = 0; + + if (e.x < cornerSize) { + if (e.y < cornerSize) { + corner = 2; + } else if (e.y > g.getHeight() - cornerSize) { + corner = 1; + } + } else if (e.x > g.getWidth() - cornerSize) { + if (e.y < cornerSize) { + corner = 3; + } else if (e.y > g.getHeight() - cornerSize) { + corner = 4; + } + } + + // Append new corner to path + if (corner > 0 && path.slice(-1) != corner) { + path += corner; + draw(); + } + } + } else { + // Drag chart + chartX = Math.clip(chartX + e.dx, -chart.width/2, 0); + chartY = Math.clip(chartY + e.dy, -chart.height/2, 0); + g.clearRect(Bangle.appRect).setClipRect(Bangle.appRect.x, Bangle.appRect.y, Bangle.appRect.x2, Bangle.appRect.y2); + g.drawImage(chart, chartX, chartY + Bangle.appRect.y); + } + }; + + + return new Promise((resolve,reject) => { + Bangle.setUI({ + mode: 'custom', + drag: dragHandler, + touch: (button, xy) => { + if (xy.type == 2) { + chartShown = true; + path = ""; + g.clearRect(Bangle.appRect); + g.drawImage(chart, chartX, chartY + Bangle.appRect.y); + } + }, + btn: () => { + if (chartShown) { + chartShown = false; + draw(); + } else { + // Exit and return text on button + if (shouldShowWidgetBar) { + require("widget_utils").show(); + } + Bangle.setUI(); + g.clearRect(Bangle.appRect); + resolve(text); + } + } + }); + + // Draw initial string + require("widget_utils").hide(); + g.setBgColor(g.theme.bg); + wrapText(); + draw(); + + }); + + +}; diff --git a/apps/kbedgewrite/metadata.json b/apps/kbedgewrite/metadata.json new file mode 100644 index 000000000..01436c6aa --- /dev/null +++ b/apps/kbedgewrite/metadata.json @@ -0,0 +1,19 @@ +{ "id": "kbedgewrite", + "name": "EdgeWrite keyboard", + "version":"0.03", + "description": "A library for text input via EdgeWrite swipe gestures", + "icon": "app.png", + "type":"textinput", + "tags": "keyboard", + "supports" : ["BANGLEJS2"], + "readme": "README.md", + "screenshots" : [ { "url":"screenshot.png" } ], + "storage": [ + {"name":"textinput","url":"lib.js"}, + {"name":"kbedgewrite.charset.json","url":"characterset.json"}, + {"name":"kbedgewrite.settings.js","url":"settings.js"} + ], + "data": [ + {"name":"kbedgewrite.json"} + ] +} diff --git a/apps/kbedgewrite/screenshot.png b/apps/kbedgewrite/screenshot.png new file mode 100644 index 000000000..48db615e1 Binary files /dev/null and b/apps/kbedgewrite/screenshot.png differ diff --git a/apps/kbedgewrite/settings.js b/apps/kbedgewrite/settings.js new file mode 100644 index 000000000..d6cc851e6 --- /dev/null +++ b/apps/kbedgewrite/settings.js @@ -0,0 +1,40 @@ +(function(back) { + var FILE = 'kbedgewrite.json'; + + // Load settings + var settings = Object.assign({ + fontSize: 32 + }, require('Storage').readJSON(FILE, true) || {}); + + function setSetting(key,value) { + settings[key] = value; + require('Storage').writeJSON(FILE, settings); + } + + // Helper method which uses int-based menu item for set of string values and their labels + function stringItems(key, startvalue, values, labels) { + return { + value: (startvalue === undefined ? 0 : values.indexOf(startvalue)), + format: v => labels[v], + min: 0, + max: values.length - 1, + wrap: true, + step: 1, + onchange: v => { + setSetting(key,values[v]); + } + }; + } + + // Helper method which breaks string set settings down to local settings object + function stringInSettings(name, values, labels) { + return stringItems(name,settings[name], values, labels); + } + + // Show the menu + E.showMenu({ + '' : { 'title' : 'EdgeWrite' }, + '< Back' : () => back(), + 'Font Size': stringInSettings('fontSize', [24, 32, 48], ['Small', 'Medium', 'Large']) + }); +}) \ No newline at end of file diff --git a/apps/kineticscroll/ChangeLog b/apps/kineticscroll/ChangeLog index f85af87de..430938d82 100644 --- a/apps/kineticscroll/ChangeLog +++ b/apps/kineticscroll/ChangeLog @@ -2,3 +2,4 @@ 0.02: Minor code improvements 0.03: Better scrolling behaviour 0.04: Fix incorrect appRect handling (missing back buttons and doubled menu titles) +0.05: Bring in change from the firmware implementation forwarding the type of touch (short/long). diff --git a/apps/kineticscroll/boot.js b/apps/kineticscroll/boot.js index 4deb71cc7..4304e98e7 100644 --- a/apps/kineticscroll/boot.js +++ b/apps/kineticscroll/boot.js @@ -50,7 +50,7 @@ if ((menuScrollMin<0 || i>=0) && i{let a=c.h*c.c-Bangle.appRect.h;a{let a=Bangle.appRect;g.reset().clearRect(a).setClipRect(a.x,a.y,a.x2,a.y2);for(var b=h(a.y),d=Math.min(h(a.y2),c.c-1);b<=d;b++)c.draw(b,{x:a.x,y:k(b),w:a.w,h:c.h});g.setClipRect(0,0,g.getWidth()- 1,g.getHeight()-1)},w=()=>{let a=Bangle.appRect;.1=f?f=0:e.scroll-=f*q);var b=u();e.scroll>b&&(e.scroll=b,f=0);e.scrollb){b=Math.max(a.y2-(1-b),a.y);g.setClipRect(a.x,b,a.x2,a.y2);var d=h(b);for(b=k(d);ba.y- -c.h;b-=c.h)c.draw(d,{x:a.x,y:b,w:a.w,h:c.h}),d--;g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1);n=void 0}};let x={mode:"custom",back:c.back,drag:a=>{let b=Date.now();q=Math.sign(a.dy);e.scroll-=a.dy;if(0p*q&&0b-r&&(f=q*p/(b-t)*100),t=0;w()},touch:(a,b)=>{a=Bangle.appRect;if(!(b.ym||0<=d)&&d{n&&clearTimeout(n);c.remove()});Bangle.setUI(x); -let e={scroll:E.clip(0|c.scroll,m,u()),draw:()=>{let a=Bangle.appRect;g.reset().clearRect(a).setClipRect(a.x,a.y,a.x2,a.y2);var b=h(a.y);let d=Math.min(h(a.y2),c.c-1);for(;b<=d;b++)c.draw(b,{x:a.x,y:k(b),w:a.w,h:c.h});g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)},drawItem:a=>{let b=Bangle.appRect,d=k(a);g.reset().setClipRect(b.x,Math.max(d,b.y),b.x2,Math.min(d+c.h,b.y2));c.draw(a,{x:b.x,y:d,w:b.w,h:c.h});g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)},isActive:()=>Bangle.uiRedraw==v},l=e.scroll& --2;e.draw();g.flip();return e}})() \ No newline at end of file +c.h;b-=c.h)c.draw(d,{x:a.x,y:b,w:a.w,h:c.h}),d--;g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1);n=void 0}};let x={mode:"custom",back:c.back,drag:a=>{let b=Date.now();q=Math.sign(a.dy);e.scroll-=a.dy;if(0p*q&&0b-r&&(f=q*p/(b-t)*100),t=0;w()},touch:(a,b)=>{a=Bangle.appRect;if(!(b.ym||0<=d)&&d{n&&clearTimeout(n);c.remove()}); +Bangle.setUI(x);let e={scroll:E.clip(0|c.scroll,m,u()),draw:()=>{let a=Bangle.appRect;g.reset().clearRect(a).setClipRect(a.x,a.y,a.x2,a.y2);var b=h(a.y);let d=Math.min(h(a.y2),c.c-1);for(;b<=d;b++)c.draw(b,{x:a.x,y:k(b),w:a.w,h:c.h});g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)},drawItem:a=>{let b=Bangle.appRect,d=k(a);g.reset().setClipRect(b.x,Math.max(d,b.y),b.x2,Math.min(d+c.h,b.y2));c.draw(a,{x:b.x,y:d,w:b.w,h:c.h});g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1)},isActive:()=>Bangle.uiRedraw== +v},l=e.scroll&-2;e.draw();g.flip();return e}})() \ No newline at end of file diff --git a/apps/kineticscroll/metadata.json b/apps/kineticscroll/metadata.json index 528c99792..793e31cd9 100644 --- a/apps/kineticscroll/metadata.json +++ b/apps/kineticscroll/metadata.json @@ -1,12 +1,12 @@ { "id": "kineticscroll", "name": "Kinetic Scroll", "shortName":"Kinetic Scroll", - "version": "0.04", + "version": "0.05", "description": "Replacement for the system scroller with kinetic scrolling.", "icon": "app.png", "type": "bootloader", "tags": "system", - "supports" : ["BANGLEJS2"], + "supports" : ["BANGLEJS2"], "readme": "README.md", "storage": [ {"name":"kineticscroll.boot.js","url":"boot.min.js"} diff --git a/apps/largeclock/settings.js b/apps/largeclock/settings.js index 4ebf842ce..a5e35192a 100644 --- a/apps/largeclock/settings.js +++ b/apps/largeclock/settings.js @@ -82,4 +82,4 @@ }; E.showMenu(mainMenu); -}); +}) diff --git a/apps/launch/ChangeLog b/apps/launch/ChangeLog index 608f32fd5..95816f8ee 100644 --- a/apps/launch/ChangeLog +++ b/apps/launch/ChangeLog @@ -21,3 +21,10 @@ 0.19: Fix regression after back button added (returnToClock was called twice!) 0.20: Use Bangle.showClock for changing to clock 0.21: Make the "App source not found" warning less buggy +0.22: Add less padding between launcher items, use new font if available in 2v26+ +0.23: Draw a placeholder screen right at the start to speed up apparent boot time +0.24: Fix Launcher when a custom font from 2v26+ is specified (fix #3787) + Fix fullscreen when fastloading the launcher. (TODO:fix back btn flicker) +0.25: Fix showClocks setting not taking effect by now clearing cache when changing those settings. + Remove Vector Font size option (Vector fonts added as other font styles) + Add Height option to set menu item height independently of Font \ No newline at end of file diff --git a/apps/launch/README.md b/apps/launch/README.md index 4e6185dea..228352d09 100644 --- a/apps/launch/README.md +++ b/apps/launch/README.md @@ -8,7 +8,7 @@ The app is needed to display a menu with all the apps installed on your Bangle. Settings -------- -- `Font` - The font used (`4x6`, `6x8`, `12x20`, `6x15` or `Vector`). Default `12x20`. -- `Vector Font Size` - The size of the font if `Font` is set to `Vector`. Default `10`. +- `Font` - The font to use when drawing menu items. Default `22`. +- `Height` - The size of each menu item in the launched. Default `52` where icons are scaled 1:1. - `Show Clocks` - If set to `No` then clocks won't appear in the app list. Default `Yes`. - `Fullscreen` - If set to `Yes` then widgets won't be loaded. Default `No`. diff --git a/apps/launch/app.js b/apps/launch/app.js index b34c4d2f6..3a8119a47 100644 --- a/apps/launch/app.js +++ b/apps/launch/app.js @@ -1,93 +1,105 @@ { // must be inside our own scope here so that when we are unloaded everything disappears -let s = require("Storage"); -// handle customised launcher -let scaleval = 1; -let vectorval = 20; -let font = g.getFonts().includes("12x20") ? "12x20" : "6x8:2"; -let settings = Object.assign({ - showClocks: true, - fullscreen: false -}, s.readJSON("launch.json", true) || {}); -if ("vectorsize" in settings) - vectorval = parseInt(settings.vectorsize); -if ("font" in settings){ - if(settings.font == "Vector"){ - scaleval = vectorval/20; - font = "Vector"+(vectorval).toString(); - } else{ - font = settings.font; - scaleval = (font.split("x")[1])/20; + let s = require("Storage"); + // handle customised launcher + let settings = Object.assign({ + showClocks: true, + fullscreen: false, + height: 52 + }, s.readJSON("launch.json", true) || {}); + let font = settings.font; + if (!font || font=="Vector"/*compat with old settings*/) { + let fonts = g.getFonts(); + font = fonts.includes("12x20") ? "12x20" : "6x8:2"; + if (fonts.includes("22")) font="22"; // 2v26+ } -} -// cache app list so launcher loads more quickly -let launchCache = s.readJSON("launch.cache.json", true)||{}; -let launchHash = require("Storage").hash(/\.info/); -if (launchCache.hash!=launchHash) { - launchCache = { - hash : launchHash, - apps : s.list(/\.info$/) - .map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}) - .filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || !app.type)) - .sort((a,b)=>{ - var n=(0|a.sortorder)-(0|b.sortorder); - if (n) return n; // do sortorder first - if (a.nameb.name) return 1; - return 0; - }) }; - s.writeJSON("launch.cache.json", launchCache); -} -let apps = launchCache.apps; -// Now apps list is loaded - render -if (!settings.fullscreen) - Bangle.loadWidgets(); + let height = 0|Math.max(settings.height,12), pad = 2; + let imgsize = height-pad*2, imgscale = imgsize/48; -const drawMenu = () => { - E.showScroller({ - h : 64*scaleval, c : apps.length, - draw : (i, r) => { - var app = apps[i]; - if (!app) return; - g.clearRect((r.x),(r.y),(r.x+r.w-1), (r.y+r.h-1)); - g.setFont(font).setFontAlign(-1,0).drawString(app.name,64*scaleval,r.y+(32*scaleval)); - if (app.icon) { - if (!app.img) app.img = s.read(app.icon); // load icon if it wasn't loaded - try {g.drawImage(app.img,8*scaleval, r.y+(8*scaleval), {scale: scaleval});} catch(e){} - } - }, - select : i => { - var app = apps[i]; - if (!app) return; - if (!app.src || require("Storage").read(app.src)===undefined) { - E.showScroller(); - E.showMessage(/*LANG*/"App Source\nNot found"); - setTimeout(drawMenu, 2000); - } else { - load(app.src); - } - }, - back : Bangle.showClock, // button press or tap in top left shows clock now - remove : () => { - // cleanup the timeout to not leave anything behind after being removed from ram - if (lockTimeout) clearTimeout(lockTimeout); - Bangle.removeListener("lock", lockHandler); + // Load widgets if we need to + if (!settings.fullscreen) { + Bangle.loadWidgets(); + } else if (global.WIDGETS) { + require("widget_utils").hide(); + } + { // Draw 'placeholder' + let R = Bangle.appRect, mid = height/2, th = g.setFont(font).stringMetrics("X").height/2; + g.reset().clearRect(R).setColor("#888"); + for (var y=R.y;y{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}) + .filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || !app.type)) + .sort((a,b)=>{ + var n=(0|a.sortorder)-(0|b.sortorder); + if (n) return n; // do sortorder first + if (a.nameb.name) return 1; + return 0; + }) }; + s.writeJSON("launch.cache.json", launchCache); + } + let apps = launchCache.apps; + + + const drawMenu = () => { + E.showScroller({ + h : height, c : apps.length, + draw : (i, r) => { + var app = apps[i]; + if (!app) return; + g.clearRect(r).setFont(font).setFontAlign(-1,0).drawString(app.name,imgsize+pad*2,r.y+2+r.h/2); + if (app.icon) { + if (!app.img) app.img = s.read(app.icon); // load icon if it wasn't loaded + try {g.drawImage(app.img, pad, r.y+pad, {scale: imgscale});} catch(e){} + } + }, + select : i => { + var app = apps[i]; + if (!app) return; + if (!app.src || require("Storage").read(app.src)===undefined) { + E.showScroller(); + E.showMessage(/*LANG*/"App Source\nNot found"); + setTimeout(drawMenu, 2000); + } else { + load(app.src); + } + }, + back : Bangle.showClock, // button press or tap in top left shows clock now + remove : () => { + // cleanup the timeout to not leave anything behind after being removed from ram + if (lockTimeout) clearTimeout(lockTimeout); + Bangle.removeListener("lock", lockHandler); + // Restore widgets if they were hidden by fullscreen setting + if (global.WIDGETS) require("widget_utils").show(); + } + }); + g.flip(); // force a render before widgets have finished drawing + + // 10s of inactivity goes back to clock + Bangle.setLocked(false); // unlock initially + let lockTimeout; + let lockHandler = function(locked) { + if (lockTimeout) clearTimeout(lockTimeout); + lockTimeout = undefined; + if (locked) + lockTimeout = setTimeout(Bangle.showClock, 10000); + }; + Bangle.on("lock", lockHandler); + }; + // Now apps list is loaded - render + drawMenu(); + // finally draw widgets + if (!settings.fullscreen) + Bangle.drawWidgets(); +} \ No newline at end of file diff --git a/apps/launch/metadata.json b/apps/launch/metadata.json index 86f52089f..09a061d82 100644 --- a/apps/launch/metadata.json +++ b/apps/launch/metadata.json @@ -2,7 +2,7 @@ "id": "launch", "name": "Launcher", "shortName": "Launcher", - "version": "0.21", + "version": "0.25", "description": "This is needed to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.", "readme": "README.md", "icon": "app.png", diff --git a/apps/launch/settings.js b/apps/launch/settings.js index 496a6d77e..f00bee2d0 100644 --- a/apps/launch/settings.js +++ b/apps/launch/settings.js @@ -1,37 +1,59 @@ -// make sure to enclose the function in parentheses (function(back) { let settings = Object.assign({ showClocks: true, - fullscreen: false + fullscreen: false, + height: 52 }, require("Storage").readJSON("launch.json", true) || {}); - let fonts = g.getFonts(); - function save(key, value) { - settings[key] = value; + let fonts = g.getFonts().filter(f=>f!="Vector"); + for (var f=10;f<20;f++) fonts.push("Vector"+f); + let defaultfont = fonts.includes("12x20") ? "12x20" : "6x8:2"; + if (fonts.includes("22")) defaultfont="22"; // 2v26+ + + let heights = [28,40,52,64,76]; + + function save() { require("Storage").write("launch.json",settings); } + function clearCache() { + require("Storage").erase("launch.cache.json"); + } const appMenu = { "": { "title": /*LANG*/"Launcher" }, /*LANG*/"< Back": back, /*LANG*/"Font": { - value: fonts.includes(settings.font)? fonts.indexOf(settings.font) : fonts.indexOf("12x20"), + value: fonts.includes(settings.font)? fonts.indexOf(settings.font) : fonts.indexOf(defaultfont), min:0, max:fonts.length-1, step:1,wrap:true, - onchange: (m) => {save("font", fonts[m])}, + onchange: (m) => { + settings.font=fonts[m]; + save(); + }, format: v => fonts[v] }, - /*LANG*/"Vector Font Size": { - value: settings.vectorsize || 10, - min:10, max: 20,step:1,wrap:true, - onchange: (m) => {save("vectorsize", m)} + /*LANG*/"Height": { + value: heights.includes(settings.height) ? heights.indexOf(settings.height) : heights.indexOf(52), + min:0, max: heights.length-1,step:1,wrap:true, + format: v => heights[v]+"px", + onchange: (m) => { + settings.height=heights[m]; + save(); + } }, /*LANG*/"Show Clocks": { - value: settings.showClocks == true, - onchange: (m) => { save("showClocks", m) } + value: !!settings.showClocks, + onchange: (m) => { + settings.showClocks=m; + save(); + clearCache(); + } }, /*LANG*/"Fullscreen": { - value: settings.fullscreen == true, - onchange: (m) => { save("fullscreen", m) } + value: !!settings.fullscreen, + onchange: (m) => { + settings.fullscreen=m; + save(); + } } }; E.showMenu(appMenu); -}); +}) diff --git a/apps/lcdclock/ChangeLog b/apps/lcdclock/ChangeLog index df68cb17e..4b9e4ebc1 100644 --- a/apps/lcdclock/ChangeLog +++ b/apps/lcdclock/ChangeLog @@ -4,3 +4,4 @@ 0.04: clock_info is loaded before widgets to match other clocks 0.05: fix alignment of clock items caused by 0.04 (fix #2970) 0.06: Minor code improvements +0.07: fix special characters in clockinfo menus diff --git a/apps/lcdclock/app.js b/apps/lcdclock/app.js index 77e1afdf0..bf0ea83e9 100644 --- a/apps/lcdclock/app.js +++ b/apps/lcdclock/app.js @@ -38,7 +38,7 @@ let clockInfoDraw = (itm, info, options) => { if (info.img) g.drawImage(info.img, options.x+2, options.y+2); var title = clockInfoItems[options.menuA].name; - var text = info.text.toString().toUpperCase(); + var text = info.text.toString().toUpperCase().replace(/[^A-Z0-9]/g, ""); if (title!="Bangle") g.setFontAlign(1,0).drawString(title.toUpperCase(), options.x+options.w-2, options.y+14); if (g.setFont("7Seg:2").stringWidth(text)+8>options.w) g.setFont("7Seg"); g.setFontAlign(0,0).drawString(text, options.x+options.w/2, options.y+40); @@ -82,4 +82,4 @@ Bangle.drawWidgets(); let clockInfoItems = require("clock_info").load(); let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:R.x, y:R.y, w:midX-2, h:barY-R.y-2, draw : clockInfoDraw}); let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:midX+2, y:R.y, w:midX-3, h:barY-R.y-2, draw : clockInfoDraw}); -} \ No newline at end of file +} diff --git a/apps/lcdclock/metadata.json b/apps/lcdclock/metadata.json index d1ab47d8a..5413a8f2f 100644 --- a/apps/lcdclock/metadata.json +++ b/apps/lcdclock/metadata.json @@ -1,6 +1,6 @@ { "id": "lcdclock", "name": "LCD Clock", - "version": "0.06", + "version": "0.07", "description": "A Casio-style clock, with ClockInfo areas at the top and bottom. Tap them and swipe up/down to toggle between different information", "icon": "app.png", "screenshots": [{"url":"screenshot.png"}], diff --git a/apps/lcdclockplus/ChangeLog b/apps/lcdclockplus/ChangeLog index 7727f3cc4..1348999aa 100644 --- a/apps/lcdclockplus/ChangeLog +++ b/apps/lcdclockplus/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Minor code improvements +0.03: fix special characters in clockinfo menus diff --git a/apps/lcdclockplus/app.js b/apps/lcdclockplus/app.js index 4bf48b585..d5cad352d 100644 --- a/apps/lcdclockplus/app.js +++ b/apps/lcdclockplus/app.js @@ -51,7 +51,7 @@ let clockInfoDraw = (itm, info, options) => { if (info.img) { g.drawImage(info.img, options.x+1,options.y+2); } - var text = info.text.toString().toUpperCase(); + var text = info.text.toString().toUpperCase().replace(/[^A-Z0-9]/g, ""); if (g.setFont("7Seg:2").stringWidth(text)+24-2>options.w) g.setFont("7Seg"); g.setFontAlign(0,-1).drawString(text, options.x+options.w/2+13, options.y+6); }; diff --git a/apps/lcdclockplus/metadata.json b/apps/lcdclockplus/metadata.json index a25d5e6d5..b0187f800 100644 --- a/apps/lcdclockplus/metadata.json +++ b/apps/lcdclockplus/metadata.json @@ -1,6 +1,6 @@ { "id": "lcdclockplus", "name": "LCD Clock Plus", - "version": "0.02", + "version": "0.03", "description": "A Casio-style clock, with four ClockInfo areas at the top and bottom. Tap them and swipe up/down and left/right to toggle between different information.", "icon": "app.png", "screenshots": [{"url":"screenshot.png"},{"url":"screenshot2.png"}], diff --git a/apps/lightswitch/ChangeLog b/apps/lightswitch/ChangeLog index 8c4ddb60c..ba0663f6d 100644 --- a/apps/lightswitch/ChangeLog +++ b/apps/lightswitch/ChangeLog @@ -8,3 +8,4 @@ 0.08: Ensure boot code doesn't allocate and leave a gloval variable named 'settings' 0.09: Handle lightswitch logic running before its widget has loaded 0.10: Minor code improvements +0.11: Fix issue where backlight is not turned on. diff --git a/apps/lightswitch/lib.js b/apps/lightswitch/lib.js index 3dd07579c..446291f1e 100644 --- a/apps/lightswitch/lib.js +++ b/apps/lightswitch/lib.js @@ -10,13 +10,17 @@ exports = { unlockSide: "", tapSide: "right", tapOn: "always", + isOn: true }, require("Storage").readJSON("lightswitch.json", true) || {}); // cache lock status var locked = Bangle.isLocked(); // check to unlock - if (locked && data.dir === w.unlockSide) Bangle.setLocked(); + if (locked && data.dir === w.unlockSide) { + Bangle.setLocked(); + if (w.isOn) Bangle.setLCDPower(true); + } // check to flash if (data.dir === w.tapSide && (w.tapOn === "always" || locked === (w.tapOn === "locked"))) require("lightswitch.js").flash(); @@ -38,13 +42,14 @@ exports = { isOn: true }, require("Storage").readJSON("lightswitch.json", true) || {}); - // chack if locked, backlight off or actual value lower then minimal flash value + // check if locked, backlight off or actual value lower then minimal flash value if (Bangle.isLocked() || !w.isOn || w.value < w.minFlash) { // set inner bulb and brightness var setBrightness = function(w, value) { if (w.drawInnerBulb) w.drawInnerBulb(value); Bangle.setLCDBrightness(value); + Bangle.setLCDPower(true); }; // override timeout if defined diff --git a/apps/lightswitch/metadata.json b/apps/lightswitch/metadata.json index c0472131d..1ac06d61d 100644 --- a/apps/lightswitch/metadata.json +++ b/apps/lightswitch/metadata.json @@ -2,7 +2,7 @@ "id": "lightswitch", "name": "Light Switch Widget", "shortName": "Light Switch", - "version": "0.10", + "version": "0.11", "description": "A fast way to switch LCD backlight on/off, change the brightness and show the lock status. All in one widget.", "icon": "images/app.png", "screenshots": [ diff --git a/apps/lightswitch/widget.js b/apps/lightswitch/widget.js index 6b573355b..601849414 100644 --- a/apps/lightswitch/widget.js +++ b/apps/lightswitch/widget.js @@ -121,6 +121,7 @@ } else { // activate backlight this.isOn = true; + Bangle.setLCDPower(true); // redraw complete widget icon this.drawIcon(false); } diff --git a/apps/lint_exemptions.js b/apps/lint_exemptions.js index b3503de72..980164b09 100644 --- a/apps/lint_exemptions.js +++ b/apps/lint_exemptions.js @@ -79,25 +79,12 @@ module.exports = { "no-undef" ] }, - "apps/podadrem/app.js": { - "hash": "f7392e74974f69553aade2dcc07527b5d3b71a9b84e6dc5e0dd995e78dff8007", - "rules": [ - "no-unused-vars" - ] - }, "apps/openstmap/imagefilter.js": { "hash": "8a71e9a0ecfa94150379c41a5a915cfdac39f8b2e485e5cc1ce4629e85293acd", "rules": [ "no-unused-vars" ] }, - "apps/mtnclock/app.js": { - "hash": "c48e3ed1a605e6a131e5947718e26cc9481c6eeab36c5670bb74f0c58cb96cd8", - "rules": [ - "no-unused-vars", - "no-undef" - ] - }, "apps/mmonday/manic-monday.js": { "hash": "2eff38d4d1cde2b9f17800a554da58300a6250de3e014995a6958a11bcb5b76a", "rules": [ @@ -155,13 +142,6 @@ module.exports = { "no-unused-vars" ] }, - "apps/waypoints/waypoints.app.js": { - "hash": "ff02639eb8f81784c942093d57d254295e2c78918adb4bcffdf0d0284ebfac55", - "rules": [ - "no-unused-vars", - "no-undef" - ] - }, "apps/timerclk/timer.js": { "hash": "3b70606f1742b34bf4769f6e8703144ff0c3ba401a3a21f97ddcab5432c94db5", "rules": [ @@ -189,13 +169,6 @@ module.exports = { "no-unused-vars" ] }, - "apps/skyspy/skyspy.app.js": { - "hash": "49a727a4c052e8c6322a502750ca036b0d58896f476b1cffebe9c53e426c8bcc", - "rules": [ - "no-unused-vars", - "no-undef" - ] - }, "apps/scribble/app.js": { "hash": "6d13abd27bab8009a6bdabe1df2df394bc14aac20c68f67e8f8b085fa6b427cd", "rules": [ @@ -209,12 +182,6 @@ module.exports = { "no-unused-vars" ] }, - "apps/poweroff/settings.js": { - "hash": "c197afe72c612a4b3825a3a12a628d0f4ed83823da3f28885bbf473037a02506", - "rules": [ - "no-unused-vars" - ] - }, "apps/oxofocus/app.js": { "hash": "cd29309373974ef038725e26d8a2ff2634a437c89cdffc3b12defd65a948db75", "rules": [ @@ -222,13 +189,6 @@ module.exports = { "no-undef" ] }, - "apps/orloj/app.js": { - "hash": "fa43f035d759ba94f564392f410c0c6c485bb41a33c062f03d666738d517ccf3", - "rules": [ - "no-unused-vars", - "no-undef" - ] - }, "apps/nixie/m_vatch.js": { "hash": "36a7fa956f99d5815cd6bac570d2b86833d1d37474d7eef0bb21892bdf6723a8", "rules": [ @@ -362,13 +322,6 @@ module.exports = { "no-unused-vars" ] }, - "apps/gbmusic/app.js": { - "hash": "c36e9ccf6813264000732cf8aae5b16bb63afafb3bdc81f6f98d670c008b3416", - "rules": [ - "no-unused-vars", - "no-undef" - ] - }, "apps/gbdebug/app.js": { "hash": "5372409dd09a1b165b009afc7dc9af24d4be223ffc6507a3f6e1cbb694a3eeec", "rules": [ @@ -376,12 +329,6 @@ module.exports = { "no-undef" ] }, - "apps/gallery/app.js": { - "hash": "81b119cc61c9d1ae76071f7ef05580f4f93ac60bf97fbdfe418463817e045402", - "rules": [ - "no-unused-vars" - ] - }, "apps/football/app.js": { "hash": "a24c293073557c259cffbf4f1340b6c9111832b7230b3e36072f32335ce4047b", "rules": [ @@ -412,18 +359,6 @@ module.exports = { "no-unused-vars" ] }, - "apps/coretemp/settings.js": { - "hash": "b5aa84ecab587b444028b4491b2c2e8f3b2303aa33745265ab629c6ff5141cfb", - "rules": [ - "no-unused-vars" - ] - }, - "apps/coretemp/boot.js": { - "hash": "02ee3a04d7dc485367394a91e570affd712ab919bbb155bdafc00e534d3bcd4a", - "rules": [ - "no-unused-vars" - ] - }, "apps/configurable_clock/app.js": { "hash": "09d1d02b63abc4ecea5e00a7372de7150ccfe67c2502ff5d298ec7b8e29c353b", "rules": [ @@ -463,12 +398,6 @@ module.exports = { "no-undef" ] }, - "apps/calculator/app.js": { - "hash": "fcb7c7b6c4ec5ce0f425d2a690baab8da235a12e685fe2680cbd4cf2cfdef0b0", - "rules": [ - "no-unused-vars" - ] - }, "apps/bowserWF/app.js": { "hash": "83feae92eda4c25028892b5b8b7d1b04f7ec3bb45f51eeba517a80b3ab2053cf", "rules": [ @@ -510,13 +439,6 @@ module.exports = { "no-undef" ] }, - "apps/doztime/app-bangle1.js": { - "hash": "1e9598c201175180ae77d1c3bc47e8138b339b72eb58782b5057fb7aefdc88a1", - "rules": [ - "no-unused-vars", - "no-undef" - ] - }, "apps/carcrazy/app.js": { "hash": "fd9f98f4f9e24c63a8fa02918dceab4503edf88e06537922caf86e85884408f3", "rules": [ @@ -535,26 +457,14 @@ module.exports = { "no-undef" ] }, - "apps/widbt_notify/widget.js": { - "hash": "16372ffcbc6bd1419ca326c7da40c2195f82a4bfceb6f123c15872624c4f0adf", - "rules": [ - "no-undef" - ] - }, "apps/widbgjs/widget.js": { "hash": "9852ce9aafb0a1ca3029d497282c8cdf07438ea36a3323313bad5b7569b1081b", "rules": [ "no-undef" ] }, - "apps/warpdrive/app.js": { - "hash": "c2f9113c4d298a3021ec4bc0bc5f5d1bcd88267b4fa2acc03ae17d6447ed7d00", - "rules": [ - "no-undef" - ] - }, "apps/usgs/settings.js": { - "hash": "af1b7bc7e041c1e6988b407b6c8ee66dbd6a0e181a20caf102d2abdb6dbd5ac0", + "hash": "00ee672a6920f5667bfbd2988fd2853cfd579895a843ae036a00028dcb13878d", "rules": [ "no-undef" ] @@ -571,12 +481,6 @@ module.exports = { "no-undef" ] }, - "apps/timecal/timecal.app.js": { - "hash": "9ad04daff299db71901a07d2d1d5116e273287041e9c342c3cd7a4b67db12936", - "rules": [ - "no-undef" - ] - }, "apps/tictactoe/app.js": { "hash": "ab459d8ceff1cbcf8fb10360dcfd3cef8130b59500adf404cf443f81e145099e", "rules": [ @@ -613,12 +517,6 @@ module.exports = { "no-undef" ] }, - "apps/swp2clk/settings.js": { - "hash": "2d9de7ffdf171f6e7b058741046c8a326cf9d5dba651f52fcdb523214b08d626", - "rules": [ - "no-undef" - ] - }, "apps/sunclock/app.js": { "hash": "54f49294816e06907003a71289a8b79641b1cd082044fb22bb4c4b80f6845459", "rules": [ @@ -643,12 +541,6 @@ module.exports = { "no-undef" ] }, - "apps/spotrem/app.js": { - "hash": "35f3ee5371acde28427fd01e191ff58108d3d9e4db1a221dca081b7a7b9c3c77", - "rules": [ - "no-undef" - ] - }, "apps/speedalt/app.js": { "hash": "2c8a2c0d7f60a8c25ee86e943f59df8fb5816ceac00e9e077220227d8885b133", "rules": [ @@ -673,12 +565,6 @@ module.exports = { "no-undef" ] }, - "apps/slopeclockpp/app.js": { - "hash": "f6e3f6723ed4fc71a3cacb3d24ec4fb47447a65d495adccb9d86333c19d4d0bd", - "rules": [ - "no-undef" - ] - }, "apps/slopeclock/app.js": { "hash": "fe29b4674b3e3a791898fd2067acc7c0fcb433dc8d4a8e8e3338c6d42a6c468f", "rules": [ @@ -793,12 +679,6 @@ module.exports = { "no-undef" ] }, - "apps/owmweather/boot.js": { - "hash": "10fe98e871a7df3338fc764d62ac4db65c20c44774aad112f5faf26c7497f78e", - "rules": [ - "no-undef" - ] - }, "apps/openwind/app.js": { "hash": "91bfda771bd5cc3127ede3b52f5f088b733ac9e7fc2d8dff4f1d732e66a8af47", "rules": [ @@ -847,12 +727,6 @@ module.exports = { "no-undef" ] }, - "apps/multidice/app.js": { - "hash": "4657e0c1a72c555426561f4395febea280d4140cfeba19429c4f0c4737caf7f5", - "rules": [ - "no-undef" - ] - }, "apps/mtgwatchface/app.js": { "hash": "7f5ffbd611368003fced26cab9e42dee2bb66b615176ca075198aaf6417b21c9", "rules": [ @@ -949,12 +823,6 @@ module.exports = { "no-undef" ] }, - "apps/infoclk/settings.js": { - "hash": "56adc3eff3cbc04dd08238ed7e559416ebbc7736c872070c757d70bf5f31b440", - "rules": [ - "no-undef" - ] - }, "apps/infoclk/app.js": { "hash": "27cc368eb1be14658db7fd482e78c4bc7673e2a1c68bc3a1a5f7c7e29915ca88", "rules": [ @@ -1003,12 +871,6 @@ module.exports = { "no-undef" ] }, - "apps/gpssetup/gpssetup.js": { - "hash": "a63f670f4adf04895e6837270fcf19bd56f0a6d049cfb8e3ad8928c283d1bfd3", - "rules": [ - "no-undef" - ] - }, "apps/glbasic/glbasic.app.js": { "hash": "7d12a030d6f0ef69a0e5a9783229fd49c0a6a06bf751e3ac562145d2ce8350e9", "rules": [ @@ -1027,12 +889,6 @@ module.exports = { "no-undef" ] }, - "apps/gbmusic/boot.js": { - "hash": "1bf553c4c3452eae3930b4a08cd3e01efc2686fcb19fd2c4f9aa949b7768ff4c", - "rules": [ - "no-undef" - ] - }, "apps/gallifr/app.js": { "hash": "710063b833ce75cae54a6d0b3309653c59ae5d0e4c2cccd930921621a74f316c", "rules": [ @@ -1069,12 +925,6 @@ module.exports = { "no-undef" ] }, - "apps/fileman/fileman.app.js": { - "hash": "f378179e7dd3655ba7e9ce03e1f7fd5a2d1768ad7d9083b22e7d740405be842a", - "rules": [ - "no-undef" - ] - }, "apps/flappy/app.js": { "hash": "e24b0c5e0469070e02dae00887bf50569c2c141a80c7c356b36987ddf68ce9cc", "rules": [ @@ -1117,12 +967,6 @@ module.exports = { "no-undef" ] }, - "apps/coretemp/coretemp.js": { - "hash": "7230802388f9cbb7026ce0e94ced6656dc79a411ef7740279ec82eb4fc892d48", - "rules": [ - "no-undef" - ] - }, "apps/contourclock/lib.js": { "hash": "1f2c43f7eb0cdcf3ab09f242022820f6af2962ca48226b9cde15623e61f80458", "rules": [ @@ -1141,12 +985,6 @@ module.exports = { "no-undef" ] }, - "apps/calendar/calendar.js": { - "hash": "d4f0375fea397a1b93d39667e9f8eaf1a75ebd0462c216015352131360d30099", - "rules": [ - "no-undef" - ] - }, "apps/btmultimeter/app.js": { "hash": "6c403764899fece882b7d900780257f7cf661bc948547d6c6f0ca2c0966d67dc", "rules": [ @@ -1183,24 +1021,12 @@ module.exports = { "no-undef" ] }, - "apps/banglebridge/widget.js": { - "hash": "4ee8d6749e1d0e28c58ad871fd9f6ccbca2d716bb4fbd3511ba4c34a6a5897e1", - "rules": [ - "no-undef" - ] - }, "apps/bad/bad.app.js": { "hash": "d1354613102818190dd4e6e28fd715db7dc4d51b8e618cae61a3135529cc97eb", "rules": [ "no-undef" ] }, - "apps/aviatorclk/aviatorclk.app.js": { - "hash": "5bc629c86eada72533fc664e01a47e05f207baeeae2092323ae4d04bd1c9fe9a", - "rules": [ - "no-undef" - ] - }, "apps/authentiwatch/app.js": { "hash": "02aafe5b6f3f3dce979d5b04f4660f90261e0c893cb39e9eeb2cf0bdb2c256b8", "rules": [ @@ -1219,12 +1045,6 @@ module.exports = { "no-undef" ] }, - "apps/altimeter/app.js": { - "hash": "054ac328db51034aa339f1d10b4d264badd49438b95f08bc6fbfb90bd88c6ae0", - "rules": [ - "no-undef" - ] - }, "apps/alpinenav/app.js": { "hash": "f8e59724d282f7c5c989adf64974a3728dc521aa8fbe047b7c37dae09213095a", "rules": [ @@ -1304,7 +1124,7 @@ module.exports = { ] }, "apps/kineticscroll/boot.min.js": { - "hash": "1345b3c556f1a268a81c3a57825d096d9bbce9740217339aa6d79223d9daad4d", + "hash": "0814125a19aff5c608b9357926cd4a4c038334e31b0d07a70deefaf2c77959b9", "rules": [ "no-cond-assign" ] diff --git a/apps/locale/ChangeLog b/apps/locale/ChangeLog index 982103cd1..64e477529 100644 --- a/apps/locale/ChangeLog +++ b/apps/locale/ChangeLog @@ -21,3 +21,4 @@ 0.17: Fix regression where long month names were 'undefined' (fix #1641) 0.18: Fix lint warnings, change anv->janv for fr_BE and fr_CH 0.19: Deprecate currency information +0.20: Improve support for meridians diff --git a/apps/locale/locale.html b/apps/locale/locale.html index b198b1c4b..f26ac36ce 100644 --- a/apps/locale/locale.html +++ b/apps/locale/locale.html @@ -21,15 +21,17 @@

-

+

+

Then click

+ @@ -76,18 +79,36 @@ map.removeLayer(marker); } marker = new L.marker(latlon).addTo(map); + document.getElementById("select-hint").style.display="none"; document.getElementById("select").style.display=""; + document.getElementById("locate-marker").style.display=""; } map.on('click', function(e){ setPosition(e.latlng); }); + function convertMapToFile(map) { + return {lat: map.lat, lon: map.lng}; + } + + function convertFileToMap(file) { + return {lat: file.lat, lng: file.lon}; + } + + document.getElementById("locate-me").addEventListener("click", function() { + map.locate({setView: true, maxZoom: 16, enableHighAccuracy:true}); + }); + + document.getElementById("locate-marker").addEventListener("click", function() { + if (latlon && latlon.lng != null && latlon.lat != null) { + map.setView(latlon); + } + }); + document.getElementById("select").addEventListener("click", function() { - let settings = {}; // {"lat":48.8566,"lon":2.3522,"location":"Paris"} - settings.lat = latlon.lat; - settings.lon = latlon.lng; + let settings = convertMapToFile(latlon); // {"lat":48.8566,"lon":2.3522,"location":"Paris"} settings.location = "custom"; Util.showModal("Saving..."); Util.writeStorage("mylocation.json", JSON.stringify(settings), ()=>{ @@ -101,7 +122,7 @@ Util.readStorageJSON("mylocation.json", function(data) { if (data===undefined) return; // no file try { - setPosition(data); + setPosition(convertFileToMap(data)); } catch (e) { console.error(e); } diff --git a/apps/mywelcome/ChangeLog b/apps/mywelcome/ChangeLog index f2b54e42c..1062e6f62 100644 --- a/apps/mywelcome/ChangeLog +++ b/apps/mywelcome/ChangeLog @@ -15,3 +15,4 @@ 0.11: Skip double buffering, use 240x240 size 0.12: Fix swipe direction (#800) 0.13: Bangle.js 2 support +0.14: Brighter Christmas tree on Bangle.js 2 \ No newline at end of file diff --git a/apps/mywelcome/custom.html b/apps/mywelcome/custom.html index 340f178e8..513ffbb77 100644 --- a/apps/mywelcome/custom.html +++ b/apps/mywelcome/custom.html @@ -16,7 +16,7 @@

-

This is currently Christmas-themed, but more themes will be added in the future.

+

To turn the Bangle off so the Welcome screen runs at startup go to Settings -> Apps -> My Welcome and choose Turn off & run next

@@ -76,7 +76,7 @@ var ig = require("heatshrink").decompress(atob("jk0ggGDg93AAVwCYwMEBxAMFAAIaHuc/ // if (style=="Christmas") return `(function() { var isnow = require("heatshrink").decompress(atob("jEagQWTgfAAocf+gFDh4FDiARBggVB3AFBl3Agf8jfkn/AgX/v/9/+Agfv/2//YrBgfwh4wCgfghYFJCIYdFFIw1EIIpNFL44FFOIoAP")); - var itree = require("heatshrink").decompress(atob("mtWxH+ADHHDTI0aGuXH5vNGmhqvTYIzBGtoxF6fTG4g4oGgQyBAAZssGoI0Ga1g1FGdo01ZgIAEGmHHNoLSuAAN/rdb0YFBGlgCBGYIABA4YArGYY1CGn4znAAM6GeVd5PQ5Iyurc/vQ0oGZFAn+d4XC3d5GddiGYIEBy+7zoEBGlFhoEcsQ9GT08+oFk1mkGdaVBMgNArnJ6/KzswGs/J6GlrlbqtbvPC5PCy8wGohniMIPJvIpCqmX3e7vI0BqhqlMIY0DqhtBqoEBa0xgBMIIoEqoABGQwzfsIhBv4qHABM50vQGjg1CGaN66DoBGt1ioGd5LoBGjo1PGYNhvLoCa7wnBqgvGA4YzCAgN5GUAsCqoDBmAHCAYU/wPQ0oSDGcBiDqkwAYcxoFd5PX6GdGjrIIqtUAAc3jk5vPC4fCy5pef5I2BTQMcnAHBy+7y95T0oADnFk1ekBpI2aGRUin7NGAA9hsIzVsIgHTAKZBZoPJ5LNDGhBpXGolcwOsrtcA4TNB3bNDGb/+sVin9AoGe6HX5InEvN/TkP+5XQwM/sRsBzqWB4QuKGjvC6HQ4QdDvKWBZYMwmAuHmFUCYNbqibX3fD5O7qolEZQQ0FBwgKDqgJBGiphEDwNUEgJbBFIQqCAgYOCB4IzCnE6GyhYFGoQnDABYzGAAQ1UAAo2NBoQSBnOB0t/Gjo2EABIPCoGe6HX4QzTGRIAEqtVF4QEBBQc4oE4y/J5PCvIxeABk/oADBvO73eXTyAyZMwM/Awd5vIOFGslAr2Av4PLNcU/jmA6HX5I1KasFcn8dTIOd5PJ4SZGGiNhAAIyNn0ckU+ZYe7AAJpJEYJnNGZk+n9kw9cBAcwGoN5aZg1JJJQABm8/oEjoDKC5ALCrUwqh/NrvQ6HDGp04n9doEdoE/sQJBZQZhCqgABGZk6zw0K/1dnVAoNAFwOlCYL1FubJBy4GCGh1AnOX4XC3YzHFYOeCgdV5PQ5OdD4rKBqqYNGYlbv+X3edGY3CGgKMDAAO7JAJgDAClcr2BEYgADaIZ0DL4uXGbDuB6HX5I1GsP+sNhOgWXIhBmWd4Od5PK4TwFGIJoBAYI2BAD0/jlcQoO7AAJaEGQQADGr0/sjNEvOdAoZmDGgw2ZsVAkeAZpQACGZI2VsU/kVGn1bZoPJZogpGGhA4GfRYwBoGC1mlBQbNFFoo0JNxAGCEod/wM6oFAn9iv/J6/Kzo1Ey9/MZQAKCg4GCFgTDEvPCSwI0BC5I0RN4ocEYYPQ5OdHgeXSwTFKGaJyKFYPC3f+MIdbpzFLAD4zB/1OqtbqtOGgYArGAIADGl9UAAI0wGQN5GoQ0vvIABGoI0uGYQABqo0zNOg0uaQY0/GllOGn40//w=")); + var itree = require("heatshrink").decompress(atob("mtWwcBkmSpICFnAIHARV2CKFJk1sEyNO7cSEyFt22EEx2d23bCgPYChsnCIIUBxI7OEyKJCEyMk9o7BO6A7CEx+TEwKzQndhwxiQuMpklxHaGGjBiQkoDBEx+So0YsOZEyNJ//JJp9hy/+KBs5suWpO5kmEEx/bjVJwJNMEwNN0uWrI7NrN3/8ZsuRMRmW7d7/+CrNkExdP/lhw+ekOWggmLz/8hMpk0IkDIMn15O4QCCxIUKsmZkGCEwVYWBYjDAQWDzgUJqxxBAwdZnP/HZOVywmEw96vDsLEYLIBrM30mQKB+XvNgTxWUyUJOgMJn/+pLvKJoUIsGDj/5wwmJ8mSpCeBhM3k+RkgmJnBNDycYpMGjBiJpwDBEwP8wVZkuWogUHkomCsnf/wFCR4LFKydttPkDYKhBsTFJr9140SoImLpMpm3n/tky0JZAVkEw+f4dZtPmd4YUBrAmHz/1y2SomGd4OQjMgEw+Tk+YEYUhy0ZsAFBMQ8mpMChEgwEJsECgDLBprvGpxKDBwIXBAoNg4zIHdgcIgEACgOCv9keIIUFdgYCEs//zA7FyYDCHAQCDt1/gJNFrAmIm/GyVhxLXFrIbEhAwBtMl0zIFktlEw0Z/IFDZAq/ByxXE73/8oyBso7EybjBEweHttp/4FBCgJ3EnNkdIQpBm3WrVJCIMly1EEwkYCIMYsnfrDsBzAICsOBEwVJsmSjMgyaYB61IEYNJsoPB//JCgNGcYPXtu1w2ePoMZQAef/xQCy3btv/8UJlMkrLFBeoImB3MkHYX+OgOf8LIHsObjVIEwOZ/sZkMkSYLsDQgf9PQLIBqV5DoNJEw9g4/8UINY8uUzLFGAQdN5fkVQORnIRBYogCEs3WiVBBwLsEAQYmCkuTvtl0nZd4TFBCIQmFjux/6hBd4Y7CFI0m7dT/LsB8uWGINWooRFunf/o4ByA4BkqJBkniKANkp1ZtrLBt/+rNpk1ZsR/EKANEAQMf+OWj15BAdESgopBktln+xHAKnBOIOUVJFJrVJh1ZsBEBOIIRIAQUwyGCgAOKCg1hgIROAQNEiECEx8k8OGgg7QfYMJEx+Td4J0NAQdJ0hiQp0YTwIUP4MmyBiQjFhwJiQgmaoA7QsOGiA7PpkStLaIoAA=")); var W=g.getWidth(),H=g.getHeight(); var titleFont = g.getFonts().includes("12x20") ? "12x20" : "6x8:2"; var flakes = []; @@ -112,6 +112,8 @@ var ig = require("heatshrink").decompress(atob("jk0ggGDg93AAVwCYwMEBxAMFAAIaHuc/ setInterval(draw,50); })(); `; +// or an 8 bit tree, but 3 bit (above) renders better on Bangle.js 2 +// var itree = require("heatshrink").decompress(atob("mtWxH+ADHHDTI0aGuXH5vNGmhqvTYIzBGtoxF6fTG4g4oGgQyBAAZssGoI0Ga1g1FGdo01ZgIAEGmHHNoLSuAAN/rdb0YFBGlgCBGYIABA4YArGYY1CGn4znAAM6GeVd5PQ5Iyurc/vQ0oGZFAn+d4XC3d5GddiGYIEBy+7zoEBGlFhoEcsQ9GT08+oFk1mkGdaVBMgNArnJ6/KzswGs/J6GlrlbqtbvPC5PCy8wGohniMIPJvIpCqmX3e7vI0BqhqlMIY0DqhtBqoEBa0xgBMIIoEqoABGQwzfsIhBv4qHABM50vQGjg1CGaN66DoBGt1ioGd5LoBGjo1PGYNhvLoCa7wnBqgvGA4YzCAgN5GUAsCqoDBmAHCAYU/wPQ0oSDGcBiDqkwAYcxoFd5PX6GdGjrIIqtUAAc3jk5vPC4fCy5pef5I2BTQMcnAHBy+7y95T0oADnFk1ekBpI2aGRUin7NGAA9hsIzVsIgHTAKZBZoPJ5LNDGhBpXGolcwOsrtcA4TNB3bNDGb/+sVin9AoGe6HX5InEvN/TkP+5XQwM/sRsBzqWB4QuKGjvC6HQ4QdDvKWBZYMwmAuHmFUCYNbqibX3fD5O7qolEZQQ0FBwgKDqgJBGiphEDwNUEgJbBFIQqCAgYOCB4IzCnE6GyhYFGoQnDABYzGAAQ1UAAo2NBoQSBnOB0t/Gjo2EABIPCoGe6HX4QzTGRIAEqtVF4QEBBQc4oE4y/J5PCvIxeABk/oADBvO73eXTyAyZMwM/Awd5vIOFGslAr2Av4PLNcU/jmA6HX5I1KasFcn8dTIOd5PJ4SZGGiNhAAIyNn0ckU+ZYe7AAJpJEYJnNGZk+n9kw9cBAcwGoN5aZg1JJJQABm8/oEjoDKC5ALCrUwqh/NrvQ6HDGp04n9doEdoE/sQJBZQZhCqgABGZk6zw0K/1dnVAoNAFwOlCYL1FubJBy4GCGh1AnOX4XC3YzHFYOeCgdV5PQ5OdD4rKBqqYNGYlbv+X3edGY3CGgKMDAAO7JAJgDAClcr2BEYgADaIZ0DL4uXGbDuB6HX5I1GsP+sNhOgWXIhBmWd4Od5PK4TwFGIJoBAYI2BAD0/jlcQoO7AAJaEGQQADGr0/sjNEvOdAoZmDGgw2ZsVAkeAZpQACGZI2VsU/kVGn1bZoPJZogpGGhA4GfRYwBoGC1mlBQbNFFoo0JNxAGCEod/wM6oFAn9iv/J6/Kzo1Ey9/MZQAKCg4GCFgTDEvPCSwI0BC5I0RN4ocEYYPQ5OdHgeXSwTFKGaJyKFYPC3f+MIdbpzFLAD4zB/1OqtbqtOGgYArGAIADGl9UAAI0wGQN5GoQ0vvIABGoI0uGYQABqo0zNOg0uaQY0/GllOGn40//w=")) } // when 'try' is clicked, load the emulator... document.getElementById("try").addEventListener("click", function() { diff --git a/apps/mywelcome/metadata.json b/apps/mywelcome/metadata.json index b6d37d2e1..ca6c5c394 100644 --- a/apps/mywelcome/metadata.json +++ b/apps/mywelcome/metadata.json @@ -2,11 +2,12 @@ "id": "mywelcome", "name": "Customised Welcome", "shortName": "My Welcome", - "version": "0.13", - "description": "Appears at first boot and explains how to use Bangle.js. Like 'Welcome', but can be customised with a greeting", + "version": "0.14", + "description": "Appears at first boot and explains how to use Bangle.js. Like 'Welcome', but can be customised with a greeting for Christmas or Birthdays!", "icon": "app.png", - "tags": "start,welcome", + "tags": "start,welcome,birthday,christmas,xmas", "supports": ["BANGLEJS","BANGLEJS2"], + "provides_features" : ["welcome"], "custom": "custom.html", "screenshots": [{"url":"bangle1-customized-welcome-screenshot.png"}], "storage": [ diff --git a/apps/nesclock/settings.js b/apps/nesclock/settings.js index 0bbecc2ce..154b3b6b6 100644 --- a/apps/nesclock/settings.js +++ b/apps/nesclock/settings.js @@ -39,4 +39,4 @@ E.showMenu(mainmenu); -}); +}) diff --git a/apps/nightwatch/nightwatch.settings.js b/apps/nightwatch/nightwatch.settings.js index 744ebd8dc..f4afe2e85 100644 --- a/apps/nightwatch/nightwatch.settings.js +++ b/apps/nightwatch/nightwatch.settings.js @@ -22,4 +22,4 @@ } }, }); -}); +}) diff --git a/apps/noteify/ChangeLog b/apps/noteify/ChangeLog index a37a66731..175ec2fdc 100644 --- a/apps/noteify/ChangeLog +++ b/apps/noteify/ChangeLog @@ -1,3 +1,4 @@ 0.01: Initial version 0.02: Use default Bangle formatter for booleans 0.03: Drop duplicate alarm widget +0.04: Make notes available to clock info diff --git a/apps/noteify/README.md b/apps/noteify/README.md index dbdceb399..07035a10f 100644 --- a/apps/noteify/README.md +++ b/apps/noteify/README.md @@ -10,6 +10,7 @@ This app uses the [Scheduler library](https://banglejs.com/apps/?id=sched) and r * By selecting "set as alarm" or "set as timer", you can also use this note as a custom message for alerts from alarms and timers. Once you hit save, the alarm or timer is set. * Any alarms or timers you set will appear under "edit alarms/timers." If the alarm/timer is set to a note, the note will appear on the top of the menu. If an alarm/timer is set without a custom message, it will simply say Alarm or Timer on the top of the menu. * On the alarm/timer alert, only the first 30 characters of the note will appear - any more and you run the risk of pushing the sleep/ok buttons off-screen. +* Notes can be shown in a clock info area so you can leave messages for yourself. Swipe the clock info area left/right to reach the Noteify category, then swipe up/down to switch between notes. ## Images diff --git a/apps/noteify/clkinfo.js b/apps/noteify/clkinfo.js new file mode 100644 index 000000000..f4236a4b3 --- /dev/null +++ b/apps/noteify/clkinfo.js @@ -0,0 +1,12 @@ +(function() { + var notes = require("Storage").readJSON("noteify.json", true) || []; + return { + name: "Noteify", + items: notes.map((entry, i) => ({ + name: "Noteify "+i, + get: () => ({ text: entry.note }), + show: function() {}, + hide: function() {} + })) + }; +}) diff --git a/apps/noteify/metadata.json b/apps/noteify/metadata.json index 850628c46..464cda775 100644 --- a/apps/noteify/metadata.json +++ b/apps/noteify/metadata.json @@ -1,14 +1,15 @@ { "id": "noteify", "name": "Noteify", - "version": "0.03", - "description": "Write notes using an onscreen keyboard and use them as custom messages for alarms or timers.", + "version": "0.04", + "description": "Write notes using an onscreen keyboard and use them as custom messages for alarms, timers, or clock infos.", "icon": "app.png", - "tags": "tool,alarm", + "tags": "tool,alarm,clkinfo", "supports": ["BANGLEJS", "BANGLEJS2"], "readme": "README.md", "storage": [ {"name":"noteify.app.js","url":"app.js"}, + {"name":"noteify.clkinfo.js","url":"clkinfo.js"}, {"name":"noteify.img","url":"app-icon.js","evaluate":true} ], "data": [{"name":"noteify.json"}], diff --git a/apps/ohmcalc/metadata.json b/apps/ohmcalc/metadata.json index c72727a4c..2ab25947f 100644 --- a/apps/ohmcalc/metadata.json +++ b/apps/ohmcalc/metadata.json @@ -6,7 +6,7 @@ "description": "A smart and simple calculator for Ohm's Law calculations, designed specifically for Bangle.js 2 smartwatches. Handles voltage, current, resistance, and power calculations with smart logic to prevent invalid inputs.", "icon": "app.png", "type": "app", - "tags": "calculator, utilities, electric", + "tags": "calculator,utilities,electric", "supports": ["BANGLEJS2"], "readme": "README.md", "allow_emulator": true, diff --git a/apps/onewordclock/ChangeLog b/apps/onewordclock/ChangeLog new file mode 100644 index 000000000..6eedfa435 --- /dev/null +++ b/apps/onewordclock/ChangeLog @@ -0,0 +1 @@ +0.01: New app introduced to the app loader! diff --git a/apps/onewordclock/app-icon.js b/apps/onewordclock/app-icon.js new file mode 100644 index 000000000..6350359c9 --- /dev/null +++ b/apps/onewordclock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwgJC/AAMEjtogFQgEMjIFB6EAh0d/eH7dwAoNrx/X4Eaju7g/boAoKkACFh9f23BzswAoO38P/0EP78/wN/0EO70WwPf2EGDYKNCguAgFAlAFDgAFBg/d3F4v3ggvz/F8lXgg/x3F8nXAPBkHEgQABn+Xs1MAoN9393/wFBqu+r++AoN021W9ytYQIQACv3/j/bz+cv+/j/0/8cgECI4MQPYWUqoYCgP//4fDiAQCAAoA=")) \ No newline at end of file diff --git a/apps/onewordclock/app.js b/apps/onewordclock/app.js new file mode 100644 index 000000000..3fcf06051 --- /dev/null +++ b/apps/onewordclock/app.js @@ -0,0 +1,169 @@ +{ + // timeout used to update every minute + var drawTimeout; + require('Font4x5Numeric').add(Graphics); + + // Load settings + const SETTINGS_FILE = "onewordclock.settings.json"; + let settings = { + mode: "Named", + smallNumeralClock: true + }; + let stored = require('Storage').readJSON(SETTINGS_FILE, 1) || {}; + for (const key in stored) { + settings[key] = stored[key]; + } + + // https://www.espruino.com/Bangle.js+Locale + // schedule a draw for the next 3 minutes + const queueDraw = () => { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(() => { + drawTimeout = undefined; + draw(); + }, 180000 - (Date.now() % 180000)); + }; + + const HOUR_WORDS = [ + 'Midnight', + 'Early', + 'Quiet', + 'Still', + 'Dawn', + 'Earlybird', + 'Sunrise', + 'Morning', + 'Bright', + 'Active', + 'Busy', + 'Pre-noon', + 'Noon', + 'Post-noon', + 'Afternoon', + 'Siesta', + 'Breezy', + 'Evening', + 'Twilight', + 'Dinner', + 'Cozy', + 'Relax', + 'Quietude', + 'Night', + ]; + + const HOURS = [ + 'Twelve', + 'One', + 'Two', + 'Three', + 'Four', + 'Five', + 'Six', + 'Seven', + 'Eight', + 'Nine', + 'Ten', + 'Eleven', + 'Twelve', + 'Thirteen', + 'Fourteen', + 'Fifteen', + 'Sixteen', + 'Seventeen', + 'Eighteen', + 'Nineteen', + 'Twenty', + 'Twentyone', + 'Twentytwo', + 'Twentythree' + ]; + + const wordFromHour = (h) => { + return settings.mode === "Named" ? HOUR_WORDS[h] : HOURS[h]; + }; + + const wordsFromDayMonth = (day) => { + const DAY_WORD_ARRAY = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; + return DAY_WORD_ARRAY[day]; + }; + + const draw = () => { + var x = g.getWidth() / 2; + var y = g.getHeight() / 2; + g.reset(); + + var d = new Date(); + var h = d.getHours(); + var m = d.getMinutes(); + var s = d.getSeconds(); + var day = d.getDay(); + + var timeStr = wordFromHour(h); + var dateStr = wordsFromDayMonth(day); + + // draw time + g.setBgColor(g.theme.bg); + g.clear(); + + // Draw military time at the top only if smallNumeralClock is true + if (settings.smallNumeralClock) { + g.setColor(g.theme.bg2); + g.setFontAlign(0, 0).setFont('4x5Numeric', 2); + var militaryTime = ('0' + h).slice(-2) + ('0' + m).slice(-2); + g.drawString(militaryTime, x, 20); + } + + g.setFontAlign(-1, 0).setFont('Vector', 36); + + // Calculate exact progress through the hour (0 to 1) + var progress = (m + s / 60) / 60; + + // Get total width of the word and starting position + var totalWidth = g.stringWidth(timeStr); + var startX = x - totalWidth / 2; + + // Calculate the exact position where the color should change + var colorChangeX = startX + totalWidth * progress; + + // First draw the entire text in the uncolored version + g.setColor(g.theme.fg2); + g.drawString(timeStr, startX, y); + + // Then draw the colored portion + if (progress > 0) { + g.setClipRect(startX, 0, colorChangeX, g.getHeight()); + g.setColor(g.theme.bg2); + g.drawString(timeStr, startX, y); + // Reset clip rect to full screen + g.setClipRect(0, 0, g.getWidth(), g.getHeight()); + } + + // draw date at bottom of screen + g.setColor(g.theme.fg2); + g.setFontAlign(0, 0).setFont('Vector', 20); + g.drawString(g.wrapString(dateStr, g.getWidth()).join('\n'), x, g.getHeight() - 30); + + queueDraw(); + }; + + // Clear the screen once/, at startup + g.clear(); + // draw immediately at first, queue update + draw(); + // Stop updates when LCD is off, restart when on + Bangle.on('lcdPower', (on) => { + if (on) { + draw(); // draw immediately, queue redraw + } else { + // stop draw timer + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } + }); + + // Show launcher when middle button pressed + Bangle.setUI('clock'); + // Load widgets + Bangle.loadWidgets(); + Bangle.drawWidgets(); +} diff --git a/apps/onewordclock/app.png b/apps/onewordclock/app.png new file mode 100644 index 000000000..3580b4895 Binary files /dev/null and b/apps/onewordclock/app.png differ diff --git a/apps/onewordclock/metadata.json b/apps/onewordclock/metadata.json new file mode 100644 index 000000000..cddd0f080 --- /dev/null +++ b/apps/onewordclock/metadata.json @@ -0,0 +1,38 @@ +{ + "id": "onewordclock", + "name": "One Word Clock", + "shortName": "One Word", + "version": "0.01", + "description": "A unique clock that displays a single evocative word for each hour of the day", + "icon": "app.png", + "screenshots": [ + { + "url": "screenshot.png" + } + ], + "tags": "clock", + "type": "clock", + "supports": [ + "BANGLEJS2" + ], + "storage": [ + { + "name": "onewordclock.app.js", + "url": "app.js" + }, + { + "name": "onewordclock.img", + "url": "app-icon.js", + "evaluate": true + }, + { + "name": "onewordclock.settings.js", + "url": "settings.js" + } + ], + "data": [ + { + "name": "onewordclock.settings.json" + } + ] +} diff --git a/apps/onewordclock/screenshot.png b/apps/onewordclock/screenshot.png new file mode 100644 index 000000000..9da1df914 Binary files /dev/null and b/apps/onewordclock/screenshot.png differ diff --git a/apps/onewordclock/settings.js b/apps/onewordclock/settings.js new file mode 100644 index 000000000..54c090f5d --- /dev/null +++ b/apps/onewordclock/settings.js @@ -0,0 +1,40 @@ +(function (back) { + const SETTINGS_FILE = "onewordclock.settings.json"; + + // initialize with default settings... + const storage = require('Storage'); + let settings = { + mode: "Named", + smallNumeralClock: true + }; + let saved_settings = storage.readJSON(SETTINGS_FILE, 1) || settings; + for (const key in saved_settings) { + settings[key] = saved_settings[key]; + } + + function save() { + storage.write(SETTINGS_FILE, settings); + } + + var screenOptions = ["Named", "Hours"]; + E.showMenu({ + '': { 'title': 'One Word Clock' }, + '< Back': back, + 'Mode': { + value: 0 | screenOptions.indexOf(settings.mode), + min: 0, max: 1, + format: v => screenOptions[v], + onchange: v => { + settings.mode = screenOptions[v]; + save(); + }, + }, + 'Small Numeral Clock': { + value: settings.smallNumeralClock, + onchange: () => { + settings.smallNumeralClock = !settings.smallNumeralClock; + save(); + } + } + }); +}) \ No newline at end of file diff --git a/apps/openhaystack/ChangeLog b/apps/openhaystack/ChangeLog index 67d7bbabf..2cea1c67a 100644 --- a/apps/openhaystack/ChangeLog +++ b/apps/openhaystack/ChangeLog @@ -1,3 +1,5 @@ 0.01: New App! 0.02: Keep advertising when connected 0.03: Use ble_advert module to work with other BLE advert apps +0.04: Fix installation after broken in 0.03 (fix #3667) +0.05: Update battery status in advertising packet diff --git a/apps/openhaystack/custom.html b/apps/openhaystack/custom.html index 774b5e6cb..27353e4cb 100644 --- a/apps/openhaystack/custom.html +++ b/apps/openhaystack/custom.html @@ -38,7 +38,12 @@ https://github.com/seemoo-lab/openhaystack/issues/59#issuecomment-1303236903 { const key = E.toUint8Array(atob(${JSON.stringify(keyValue)})); // public key const mac = [ key[0] | 0b11000000, key[1], key[2], key[3], key[4], key[5] ].map(x => x.toString(16).padStart(2, '0')).join(':'); // mac address -const adv = [ 0x1e, 0xff, 0x4c, 0x00, 0x12, 0x19, 0x00, key[6], key[7], key[8], key[9], key[10], key[11], key[12], key[13], key[14], key[15], key[16], key[17], key[18], key[19], key[20], key[21], key[22], key[23], key[24], key[25], key[26], key[27], key[0] >> 6, 0x00 ]; // advertising packet +let batt = E.getBattery(); +if (batt > 80) batt = 0x0; // full +else if (batt > 50) batt = 0x50; // medium +else if (batt > 20) batt = 0xa0; // low +else batt = 0xf0; // critical +const adv = [ 0x1e, 0xff, 0x4c, 0x00, 0x12, 0x19, batt, key[6], key[7], key[8], key[9], key[10], key[11], key[12], key[13], key[14], key[15], key[16], key[17], key[18], key[19], key[20], key[21], key[22], key[23], key[24], key[25], key[26], key[27], key[0] >> 6, 0x00 ]; // advertising packet NRF.setAddress(mac); require("ble_advert").push(adv, {whenConnected: true, interval: 1000}); // advertise AirTag *and* normal device name (to remain connectable) } @@ -46,7 +51,7 @@ require("ble_advert").push(adv, {whenConnected: true, interval: 1000}); // adver // send finished app sendCustomizedApp({ storage:[ - {name:"openhaystack.boot.js", content:appJS}, + {name:"openhaystack.boot.js", content:appJS, url:"openhaystack.boot.js"/* not a real URL but this lets the App Loader know it's a JS file which should be parsed */}, ] }); }); diff --git a/apps/openhaystack/metadata.json b/apps/openhaystack/metadata.json index 712e7ebaf..f9ee1bc85 100644 --- a/apps/openhaystack/metadata.json +++ b/apps/openhaystack/metadata.json @@ -1,7 +1,7 @@ { "id": "openhaystack", "name": "OpenHaystack (AirTag)", "icon": "icon.png", - "version":"0.03", + "version":"0.05", "description": "Copy a base64 key from https://github.com/seemoo-lab/openhaystack and make your Bangle.js trackable as if it's an AirTag", "tags": "openhaystack,bluetooth,ble,tracking,airtag", "type": "bootloader", @@ -9,6 +9,6 @@ "readme": "README.md", "supports": ["BANGLEJS","BANGLEJS2"], "storage": [ - {"name":"openhaystack.boot.js"} + {"name":"openhaystack.boot.js" } ] } diff --git a/apps/openlocatebeacon/ChangeLog b/apps/openlocatebeacon/ChangeLog new file mode 100644 index 000000000..4a396d83f --- /dev/null +++ b/apps/openlocatebeacon/ChangeLog @@ -0,0 +1,4 @@ +0.01: New App! +0.02: Corrected NaN test for GPS +0.03: Removed remaining invalid references to Number.isFinite +0.04: Improved menu/display interaction diff --git a/apps/openlocatebeacon/README.md b/apps/openlocatebeacon/README.md new file mode 100644 index 000000000..944bb51bf --- /dev/null +++ b/apps/openlocatebeacon/README.md @@ -0,0 +1,19 @@ +# OpenLocate Beacon + +Collect geolocation sensor data from the Bangle.js 2's GPS and barometer, display the live readings on-screen, and broadcast in Bluetooth Low Energy (BLE) OpenLocate Beacon packets (LCI over BLE) to any listening devices in range. + +## Usage + +The advertising packets will be recognised by [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere/) open source middleware and any other program which observes the standard packet types. See our [Bangle.js Development Guide](https://reelyactive.github.io/diy/banglejs-dev/) for details. + +## Features + +Advertises packets with the OpenLocate Beacon geolocation element when a GPS fix is available, and packets with the name "Bangle.js" otherwise. + +## Requests + +[Contact reelyActive](https://www.reelyactive.com/contact/) for support/updates. + +## Creator + +Developed by [jeffyactive](https://github.com/jeffyactive) of [reelyActive](https://www.reelyactive.com) diff --git a/apps/openlocatebeacon/metadata.json b/apps/openlocatebeacon/metadata.json new file mode 100644 index 000000000..85f7e2fee --- /dev/null +++ b/apps/openlocatebeacon/metadata.json @@ -0,0 +1,19 @@ +{ + "id": "openlocatebeacon", + "name": "OpenLocate Beacon", + "shortName": "OpenLocate Beacon", + "version": "0.04", + "description": "Advertise GPS geolocation data using the OpenLocate Beacon packet specification.", + "icon": "openlocatebeacon.png", + "screenshots": [], + "type": "app", + "tags": "tool,sensors,bluetooth", + "supports" : [ "BANGLEJS2" ], + "allow_emulator": true, + "readme": "README.md", + "storage": [ + { "name": "openlocatebeacon.app.js", "url": "openlocatebeacon.js" }, + { "name": "openlocatebeacon.img", "url": "openlocatebeacon-icon.js", + "evaluate": true } + ] +} \ No newline at end of file diff --git a/apps/openlocatebeacon/openlocatebeacon-icon.js b/apps/openlocatebeacon/openlocatebeacon-icon.js new file mode 100644 index 000000000..7e838aaa0 --- /dev/null +++ b/apps/openlocatebeacon/openlocatebeacon-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwhHXAB+sr1dnMzmcPh4DBnNdr2sDyAsOropCABczroyaxE5FhoAFnOIFqutFqgxE1ouSrwdHnWIxGz2YPBAYIHBnQTHrwuQLgwsBURwyGnIWN2bmFnR4S1oxFmZyCFx0zLY2r0md4AACzuk1ZjGDoowKCAk6JwuBFggAFzuBOApiEmYuIBwjSE2ddvOcFxIABzl5rpWErxQJN4QuIPIN5FpYADvKlFGAivGHZAuSGBCDEFwg6EOoZnBFyQwCK4mzQg4IECIYuBqzqKehVWDwxWFLwc5M4czLxPB5HP5/I4JgJmYfDnJgFEwJeFG4MyLw4tB6wPB6wxBMA8yRAhgDHAOtY44FBq2cFw3Qa4nX6AwGziQBEIwAB1o1DHoyOG4PPFwoAB56SGSAKBGA4SVDBgc6AwKOG45eGMAXHSAwbBnSQGnIvD1psFF43IXgQAF6yQGF4SQDXQczdwezF5pfJF5uzF4bED1gACF5KPSKoMzEY0PgAAJuQdFMAIvH5wQGuQkKABVOzhgG57BE63PLw2cpwvVkgvGGAPI5/Q6HP5AuGF4MkF6pgIAAPB4/H4ILHLxsrMBbBHABlyLxcrF5ZgKABJeOqyRMMCVyEBlWwLyNywuPyzsNwPXeS6NTAAPX67AMSKCNNXwIvBSBqRBGBlyRpqOCAAIRNSJiNPRwQABqwwPF5IuPqwvD1gUOSJKNPgGsF4bBPgEqSI2clQYOXoYADlbCUXiErFwyRQgCREuQVPRoqRTkmWFwOWXh6NHGCaRBRqAuLGCIAQFxowgFx70ClYtZlbqJMUZcRAA1WFqdWFq5jESp0rLbAyJq0rGggFBqwsSA==")) \ No newline at end of file diff --git a/apps/openlocatebeacon/openlocatebeacon.js b/apps/openlocatebeacon/openlocatebeacon.js new file mode 100644 index 000000000..0fa60419e --- /dev/null +++ b/apps/openlocatebeacon/openlocatebeacon.js @@ -0,0 +1,121 @@ +/** + * Copyright reelyActive 2024 + * We believe in an open Internet of Things + */ + + +// Non-user-configurable constants +const APP_ID = 'openlocatebeacon'; +const ADVERTISING_OPTIONS = { showName: false, interval: 5000 }; + + +// Global variables +let bar, gps; +let sequenceNumber = 0; + + +// Menus +let mainMenu = { + "": { "title": "OpenLocateBcn" }, + "Lat": { value: null }, + "Lon": { value: null }, + "Altitude": { value: null }, + "Satellites": { value: null } +}; + + +// Encode the OpenLocate geo location element advertising packet +function encodeGeoLocationElement() { + let lci = new Uint8Array(16); + let seqFrag = ((sequenceNumber++ & 0x0f) << 4) + 0x01; + let rfc6225lat = toRfc6225Coordinate(gps.lat); + let rfc6225lon = toRfc6225Coordinate(gps.lon); + let rfc6225alt = toRfc6225Altitude(bar.altitude); + lci[0] = rfc6225lat.integer >> 7; + lci[1] = ((rfc6225lat.integer & 0xff) << 1) + (rfc6225lat.fraction >> 24); + lci[2] = (rfc6225lat.fraction >> 16) & 0xff; + lci[3] = (rfc6225lat.fraction >> 8) & 0xff; + lci[4] = rfc6225lat.fraction & 0xff; + lci[5] = rfc6225lon.integer >> 7; + lci[6] = ((rfc6225lon.integer & 0xff) << 1) + (rfc6225lon.fraction >> 24); + lci[7] = (rfc6225lon.fraction >> 16) & 0xff; + lci[8] = (rfc6225lon.fraction >> 8) & 0xff; + lci[9] = rfc6225lon.fraction & 0xff; + lci[10] = bar.altitude ? 0x10 : 0x00; + lci[11] = (rfc6225alt.integer >> 16) & 0xff; + lci[12] = (rfc6225alt.integer >> 8) & 0xff; + lci[13] = rfc6225alt.integer & 0xff; + lci[14] = rfc6225alt.fraction & 0xff; + lci[15] = 0x41; + + return [ + 0x02, 0x01, 0x06, // Flags + 0x16, 0x16, 0x94, 0xfd, 0x09, seqFrag, 0x30, lci[0], lci[1], lci[2], + lci[3], lci[4], lci[5], lci[6], lci[7], lci[8], lci[9], lci[10], lci[11], + lci[12], lci[13], lci[14], lci[15] + ]; +} + + +// Convert a latitude or longitude coordinate to RFC6225 +function toRfc6225Coordinate(coordinate) { + let integer = Math.floor(coordinate); + let fraction = Math.round((coordinate - integer) * 0x1ffffff); + + if(integer < 0) { + integer += 0x1ff + 1; + } + + return { integer: integer, fraction: fraction }; +} + + +// Convert altitude to RFC6225 +function toRfc6225Altitude(altitude) { + if(!altitude) { + return { integer: 0, fraction: 0 }; + } + + let integer = Math.floor(altitude); + let fraction = Math.round((altitude - integer) * 0xff); + + if(integer < 0) { + integer += 0x3fffff + 1; + } + + return { integer: integer, fraction: fraction }; +} + + +// Update barometer +Bangle.on('pressure', (newBar) => { + bar = newBar; + + mainMenu.Altitude.value = bar.altitude.toFixed(1) + 'm'; + E.showMenu(mainMenu); +}); + + +// Update GPS +Bangle.on('GPS', (newGps) => { + gps = newGps; + + mainMenu.Lat.value = gps.lat.toFixed(4); + mainMenu.Lon.value = gps.lon.toFixed(4); + mainMenu.Satellites.value = gps.satellites; + E.showMenu(mainMenu); + + if(!isNaN(gps.lat) && !isNaN(gps.lon)) { + NRF.setAdvertising(encodeGeoLocationElement(), ADVERTISING_OPTIONS); + } + else { + NRF.setAdvertising({}, { name: "Bangle.js" }); + } +}); + + +// On start: enable sensors and display main menu +g.clear(); +Bangle.setGPSPower(true, APP_ID); +Bangle.setBarometerPower(true, APP_ID); +E.showMenu(mainMenu); \ No newline at end of file diff --git a/apps/openlocatebeacon/openlocatebeacon.png b/apps/openlocatebeacon/openlocatebeacon.png new file mode 100644 index 000000000..b3294dae0 Binary files /dev/null and b/apps/openlocatebeacon/openlocatebeacon.png differ diff --git a/apps/openstmap/ChangeLog b/apps/openstmap/ChangeLog index ec2c19e42..d3278a583 100644 --- a/apps/openstmap/ChangeLog +++ b/apps/openstmap/ChangeLog @@ -36,3 +36,9 @@ 0.29: Keep exit at bottom of menu Speed up latLonToXY for track rendering 0.30: Minor code improvements +0.31: Reset draw colours before rendering (to allow black and white maps) +0.32: Move to non-deprecated track drawing using the recorder library + Add option to hide widgets +0.33: Map zoom by tapping is now only when tapping at each corner (helps with accidental zooming) + When GPS location is offscreen, draw a blue circle showing the direction to scroll + Added 'Autoscroll' option to automatically scroll the map when GPS location moves off it \ No newline at end of file diff --git a/apps/openstmap/README.md b/apps/openstmap/README.md index d492bae05..8c17cecf3 100644 --- a/apps/openstmap/README.md +++ b/apps/openstmap/README.md @@ -6,7 +6,7 @@ allows you to use the maps in your Bangle.js applications. ## Uploader -Once you've installed OpenStreepMap on your Bangle, find it +Once you've installed OpenStreetMap on your Bangle, find it in the App Loader and click the Disk icon next to it. A window will pop up showing what maps you have loaded. @@ -34,14 +34,33 @@ and marks the path that you've been travelling (if enabled), and displays waypoints in the watch (if dependencies exist). * Drag on the screen to move the map -* Click bottom left to zoom in, bottom right to zoom out +* Click at the bottom left corner to zoom in, bottom right to zoom out (or you can choose from the menu) * Press the button to bring up a menu, where you can zoom, go to GPS location, put the map back in its default location, or choose whether to draw the currently recording GPS track (from the `Recorder` app). -**Note:** If enabled, drawing the currently recorded GPS track can take a second -or two (which happens after you've finished scrolling the screen with your finger). +The map displays: +* Your current GPS location and angle (in blue) or a circle at the edge of the screen if your location is offscreen +* Your currently recorded/recording track in red (if the `Recorder` app is installed) +* Any waypoints as red markers (if the `Waypoint` app is installed) + +## Bangle.js App Settings + +Pressing the button while in the app and unlocked brings up the settings menu: + +* `Center GPS` - (if GPS lock available) centre the map on the GPS location +* `Zoom in` - zooms in on the map (tapping bottom left in the map also does this) +* `Zoom out` - zooms out on the map (tapping bottom right in the map also does this) +* `Draw Track` - if `Recorder` is installed this will draw the current GPS track in red +* `Draw cont. position` - will leaves a series of red dots on screen marking your previous GPS position (these disappear when you scroll) +* `Hide Widgets` - hide the widget bar to leave more space for the map +* `Autoscroll` - then the GPS marker starts going offscreen, scroll to show it again +* `Direction Source` - (Bangle.js 2 only) `None/GPS/Compass` When showing the direction with the GPS marker where to get the direction from. If `None` a GPS marker isn't shown +* `Reset Compass` - reset the compass (if calibration has gone wrong - turn in a circle immediately after to recalibrate) +* `Center Map` - Center the view on the current map (not GPS) +* `Record` - If `Recorder` app is installed, start/stop recording +* `Exit` - Exit to the Clock ## Library diff --git a/apps/openstmap/app.js b/apps/openstmap/app.js index 3882df946..428cae700 100644 --- a/apps/openstmap/app.js +++ b/apps/openstmap/app.js @@ -1,20 +1,23 @@ var m = require("openstmap"); -var HASWIDGETS = true; var R; var fix = {}; var mapVisible = false; -var hasScrolled = false; var settings = require("Storage").readJSON("openstmap.json",1)||{}; +var HASWIDGETS = !settings.noWidgets; var plotTrack; let checkMapPos = false; // Do we need to check the if the coordinates we have are valid -var startDrag = 0; +var startDrag = undefined; //< to detect a short tap when zooming +var hasRecorder = require("Storage").read("recorder")!=undefined; // do we have the recorder library? +var hasWaypoints = require("Storage").read("waypoints")!=undefined; // do we have the recorder library? +var labelFont = g.getFonts().includes("17")?"17":"6x8:2"; +var imgLoc, ovLoc, ovSize = 30; /*Math.ceil(Math.sqrt(imgLoc[0]*imgLoc[0]+imgLoc[1]*imgLoc[1]))*/ +var locOnscreen = undefined; // is the GPS location currently onscreen? if (Bangle.setLCDOverlay) { - // Icon for current location+direction: https://icons8.com/icon/11932/gps 24x24, 1 Bit + transparency + inverted - var imgLoc = require("heatshrink").decompress(atob("jEYwINLAQk8AQl+AQn/AQcB/+AAQUD//AAQUH//gAQUP//wAQUf//4j8AvA9IA==")); + // Icon for current location + direction (icon_gps.png, 2 bit bw, transparent) + imgLoc = atob("EBiCAVVQBVVVU8VVVVPFVVVDwVVVT/FVVU/xVVUP8FVVP/xVVT/8VVQ//BVU//8VVP//FVD//wVT///FU///xUP//8FP///xD/AP8D/BQ/w/BVD8PxVU/AAVVABVVVVVVVVVVQ=="); // overlay buffer for current location, a bit bigger then image so we can rotate - const ovSize = Math.ceil(Math.sqrt(imgLoc[0]*imgLoc[0]+imgLoc[1]*imgLoc[1])); - var ovLoc = Graphics.createArrayBuffer(ovSize,ovSize,imgLoc[2] & 0x7f,{msb:true}); + ovLoc = Graphics.createArrayBuffer(ovSize,ovSize,2,{msb:true}); } if (settings.lat !== undefined && settings.lon !== undefined && settings.scale !== undefined) { @@ -53,9 +56,9 @@ function redraw() { g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later WIDGETS["gpsrec"].plotTrack(m); } - if (HASWIDGETS && WIDGETS["recorder"] && WIDGETS["recorder"].plotTrack) { + if (hasRecorder) { g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later - plotTrack = WIDGETS["recorder"].plotTrack(m, { async : true, callback : function() { + plotTrack = require("recorder").plotTrack(m, { async : true, callback : function() { plotTrack = undefined; }}); } @@ -65,6 +68,7 @@ function redraw() { // Draw the POIs function drawPOI() { + if (!hasWaypoints) return; let waypoints; try { waypoints = require("waypoints").load(); @@ -72,16 +76,15 @@ function drawPOI() { // Waypoints module not available. return; } - g.setFont("Vector", 18); + if (!waypoints) return; + g; + var img = atob("ERnCAQD4/////x8AVWqqVVWoAKlVoAAClaAAAClgAqACaAJWAKgCVWAKAJVYAoAlVgCoAlYApgAqACVgAAApWAAACVWAAApVYAACVVYAApVVgACVVVgApVVWACVVVeAtVVXcDdVV3s7dVd3i3dVd3t3VVd3d1UA="); // icon_place.png optimal 2 bit + transparent + g.setFont(labelFont).setFontAlign(-1,0); waypoints.forEach((wp, idx) => { if (wp.lat === undefined || wp.lon === undefined) return; var p = m.latLonToXY(wp.lat, wp.lon); - var sz = 2; - g.setColor(0,0,0); - g.fillRect(p.x-sz, p.y-sz, p.x+sz, p.y+sz); - g.setColor(0,0,0); - g.drawString(wp.name, p.x, p.y); - //print(wp.name); + g.setColor("#fff").drawImage(img, p.x-8, p.y-22); + g.setColor(0).drawString(wp.name, p.x+8, p.y); }); } @@ -115,19 +118,35 @@ function drawLocation() { } var p = m.latLonToXY(fix.lat, fix.lon); - - ovLoc.clear(); - if (isInside(R, p, ovLoc.getWidth(), ovLoc.getHeight())) { // avoid drawing over widget area + ovLoc.setBgColor(1/*transparent*/).clear().setBgColor(0); + locOnscreen = isInside(R, p, ovSize, ovSize); + if (locOnscreen) { // if we're onscreen, draw the course const angle = settings.dirSrc === 1 ? fix.course : Bangle.getCompass().heading; - if (!isNaN(angle)) { - ovLoc.drawImage(imgLoc, ovLoc.getWidth()/2, ovLoc.getHeight()/2, {rotate: angle*Math.PI/180}); + if (isNaN(angle)) { + ovLoc.fillCircle(ovSize/2,ovSize/2,8); + } else { + ovLoc.drawImage(imgLoc, ovSize/2, ovSize/2, {rotate: angle*Math.PI/180}); } + } else { // if off-screen, draw a blue circle on the edge + var mx = R.w/2, my = R.h/2; + var dy = p.y - (R.y+my), dx = p.x - mx; + ovLoc.fillCircle(ovSize/2,ovSize/2,13); + if (Math.abs(dx)>Math.abs(dy)) { + dy = my * dy / Math.abs(dx); + dx = mx * Math.sign(dx); + } else { + if (dy<0) ovLoc.setBgColor(1/*transparent*/).clearRect(0,0,ovSize, (ovSize/2)-1); // so we don't overlap widgets! + dx = mx * dx / Math.abs(dy); + dy = my * Math.sign(dy); + } + p.x = mx+dx; + p.y = R.y+my+dy; } - Bangle.setLCDOverlay({width:ovLoc.getWidth(), height:ovLoc.getHeight(), - bpp:ovLoc.getBPP(), transparent:0, - palette:new Uint16Array([0, g.toColor("#00F")]), + Bangle.setLCDOverlay({width:ovSize, height:ovSize, + bpp:ovLoc.getBPP(), transparent:1, + palette:new Uint16Array([g.toColor("#FFF"), 0, 0, g.toColor("#00F")]), buffer:ovLoc.buffer - }, p.x-ovLoc.getWidth()/2, p.y-ovLoc.getHeight()/2); + }, p.x-ovSize/2, p.y-ovSize/2); this.hasOverlay = true; } @@ -135,7 +154,22 @@ function drawLocation() { Bangle.on('GPS',function(f) { fix=f; if (HASWIDGETS && WIDGETS["sats"]) WIDGETS["sats"].draw(WIDGETS["sats"]); - if (mapVisible) { + if (mapVisible) { // could be in settings + // Automatically scroll if GPS is going offscreen and not dragging + if (settings.autoscroll && fix.fix && startDrag===undefined) { + if (locOnscreen) { // if we were onscreen last time we drew the location + var p = m.latLonToXY(fix.lat, fix.lon); // where are we onscreen? + var sx=0,sy=0; + if (p.xR.x2-32) sx = -1; + if (p.y>R.y2-32) sy = -1; + if (sx||sy) { + scroll(sx*80,sy*80); + redraw(); + } + } + } drawMarker(); drawLocation(); } @@ -196,8 +230,17 @@ function showMenu() { value : !!settings.drawMarker, onchange : v => { settings.drawMarker=v; writeSettings(); } }, + /*LANG*/"Hide Widgets": { + value : !!settings.noWidgets, + onchange : v => { settings.noWidgets=v; writeSettings(); load("openstmap.app.js"); } + }, + /*LANG*/"Autoscroll": { + value : !!settings.autoscroll, + onchange : v => { settings.autoscroll=v; writeSettings(); } + }, }); + if (Bangle.setLCDOverlay) { menu[/*LANG*/"Direction source"] = { value: settings.dirSrc, @@ -223,12 +266,12 @@ function showMenu() { }; // If we have the recorder widget, add a menu item to start/stop recording - if (WIDGETS.recorder) { + if (hasRecorder) { menu[/*LANG*/"Record"] = { - value : WIDGETS.recorder.isRecording(), + value : require("recorder").isRecording(), onchange : isOn => { E.showMessage(/*LANG*/"Please Wait..."); - WIDGETS.recorder.setRecording(isOn).then(showMap); + require("recorder").setRecording(isOn).then(showMap); } }; } @@ -236,6 +279,13 @@ function showMenu() { E.showMenu(menu); } +function scroll(sx,sy) { + g.setClipRect(R.x,R.y,R.x2,R.y2); + g.scroll(sx,sy); + m.scroll(sx,sy); + g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1); // restore cliprect +} + function showMap() { mapVisible = true; g.reset().clearRect(R); @@ -243,27 +293,26 @@ function showMap() { Bangle.setUI({mode:"custom",drag:e=>{ if (plotTrack && plotTrack.stop) plotTrack.stop(); if (e.b) { - if (!startDrag) + if (startDrag===undefined) startDrag = getTime(); - g.setClipRect(R.x,R.y,R.x2,R.y2); - g.scroll(e.dx,e.dy); - m.scroll(e.dx,e.dy); - g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1); - hasScrolled = true; + if (e.dx || e.dy) { + scroll(e.dx,e.dy); + } drawLocation(); - } else if (hasScrolled) { + } else if (startDrag!==undefined) { const delta = getTime() - startDrag; - startDrag = 0; - hasScrolled = false; - if (delta < 0.2) { - if (e.y > g.getHeight() / 2) { - if (e.x < g.getWidth() / 2) { + startDrag = undefined; + if (delta < 0.2) { // short tap? + if (e.y > g.getHeight() - 32) { // at bottom egde? + if (e.x < 32) { // zoom in/out m.scale /= 2; - } else { + g.reset().clearRect(R); + } + if (e.x > g.getHeight() - 32) { m.scale *= 2; + g.reset().clearRect(R); } } - g.reset().clearRect(R); } redraw(); } diff --git a/apps/openstmap/icon_direction.png b/apps/openstmap/icon_direction.png new file mode 100644 index 000000000..b58a6840f Binary files /dev/null and b/apps/openstmap/icon_direction.png differ diff --git a/apps/openstmap/icon_place.png b/apps/openstmap/icon_place.png new file mode 100644 index 000000000..73e5dedbd Binary files /dev/null and b/apps/openstmap/icon_place.png differ diff --git a/apps/openstmap/interface.html b/apps/openstmap/interface.html index df5c0acc9..442c2009d 100644 --- a/apps/openstmap/interface.html +++ b/apps/openstmap/interface.html @@ -45,20 +45,22 @@
-
- 3 bit -
- Preview +
+
- -
+ +

- +
- + + + - diff --git a/lang/README.md b/lang/README.md index fcab3a58b..e3d9bbd3d 100644 --- a/lang/README.md +++ b/lang/README.md @@ -5,6 +5,8 @@ Any apps which have Strings in which are prefixed with `/*LANG*/` will be scanne language is set in the app loader the string will be replaced with a translation from the JSON in this directory. +See https://www.espruino.com/Bangle.js+Locale#app-translations for more information. + JSON in `unicode-based` contains characters that can't be rendered by the default font in Bangle.js. The `language_render.js` tool (below) renders the text to bitmaps and then writes them into the corresponding JSON file in this directory, so that the bitmaps (rather than @@ -12,5 +14,5 @@ just text) are included in apps instead. Check out https://github.com/espruino/EspruinoAppLoaderCore/tree/master/tools (available in `core/tools` in this repo) -* `language_scan.js` - scan for unhandled `/*LANG*/` strings and automatically translate them -* `language_render.js` - renders the JSON translations in the `unicode-based` folder to bitmaps, and writes them into the corresponding JSON file in this directory (see above) +* `../core/tools/language_scan.js` - scan for unhandled `/*LANG*/` strings and automatically translate them +* `../core/tools/language_render.js` - renders the JSON translations in the `unicode-based` folder to bitmaps, and writes them into the corresponding JSON file in this directory (see above) diff --git a/lang/da_DK.json b/lang/da_DK.json index 16c3db065..6f5943a2e 100644 --- a/lang/da_DK.json +++ b/lang/da_DK.json @@ -186,5 +186,10 @@ "quarter to *$2": "kvart i *$2", "ten to *$2": "ti i *$2", "five to *$2": "fem i *$2" + }, + "counter": { + "Swipe up to increase": "Swipe op for at tilføje", + "Swipe down to decrease": "Swipe ned for at fjerne", + "Press button to reset": "Tryk knap for at nulstille" } } diff --git a/lang/de_DE.json b/lang/de_DE.json index 9f9af6b18..5c21cb995 100644 --- a/lang/de_DE.json +++ b/lang/de_DE.json @@ -228,5 +228,34 @@ "quarter to *$2": "viertel vor *$2", "ten to *$2": "zehn vor *$2", "five to *$2": "fünf vor *$2" + }, + "zambretti": { + "//": "App-specific overrides", + "Settled Fine": "Beständig sonnig", + "Fine Weather": "Sonniges Wetter", + "Becoming Fine": "Es wird schöner", + "Fine Becoming Less Settled": "Sonnig, Tendenz unbeständiger", + "Fine, Possibly showers": "Sonnig, eventuell Schauer", + "Fairly Fine, Improving": "Heiter bis wolkig, Besserung zu erwarten", + "Fairly Fine, Possibly showers, early": "Heiter bis wolkig, anfangs evtl. Schauer", + "Fairly Fine Showery Later": "Heiter bis wolkig, später Regen", + "Showery Early, Improving": "Anfangs noch Schauer, dann Besserung", + "Changeable Mending": "Wechselhaft mit Schauern", + "Fairly Fine, Showers likely": "Heiter bis wolkig, vereinzelt Regen", + "Rather Unsettled Clearing Later": "Unbeständig, spaeter Aufklarung", + "Unsettled, Probably Improving": "Unbeständig, evtl. Besserung.", + "Showery Bright Intervals": "Regnerisch mit heiteren Phasen", + "Showery Becoming more unsettled": "Regnerisch, wird unbeständiger", + "Changeable some rain": "Wechselhaft mit etwas Regen", + "Unsettled, short fine Intervals": "Unbeständig mit heiteren Phasen", + "Unsettled, Rain later": "Unbeständig, später Regen", + "Unsettled, rain at times": "Unbeständig mit etwas Regen", + "Very Unsettled, Finer at times": "Wechselhaft und regnerisch", + "Rain at times, worse later.": "Gelegentlich Regen, Verschlechterung", + "Rain at times, becoming very unsettled": "Zuweilen Regen, sehr unbeständig", + "Rain at Frequent Intervals": "Häufiger Regen", + "Very Unsettled, Rain": "Regen, sehr unbeständig", + "Stormy, possibly improving": "Stürmisch, evtl. Besserung", + "Stormy, much rain": "Stürmisch mit viel Regen" } -} \ No newline at end of file +} diff --git a/loader.js b/loader.js index 1f3350656..b4de61aeb 100644 --- a/loader.js +++ b/loader.js @@ -16,7 +16,7 @@ if (window.location.host=="banglejs.com") { 'This is not the official Bangle.js App Loader - you can try the Official Version here.'; } -var RECOMMENDED_VERSION = "2v24"; +var RECOMMENDED_VERSION = "2v27"; // could check http://www.espruino.com/json/BANGLEJS.json for this // We're only interested in Bangles @@ -212,7 +212,7 @@ window.addEventListener('load', (event) => { el = document.getElementById("reinstallall"); if (el) el.addEventListener("click",event=>{ var promise = showPrompt("Reinstall","Really re-install all apps?").then(() => { - Comms.reset().then(_ => + startOperation({name:"Reinstall All Apps"}, () => Comms.reset().then(_ => getInstalledApps() ).then(installedapps => { console.log(installedapps); @@ -232,15 +232,14 @@ window.addEventListener('load', (event) => { ).catch(err=>{ Progress.hide({sticky:true}); showToast("App re-install failed, "+err,"error"); - }); + })); }); }); - // Button to install all default apps in one go el = document.getElementById("installdefault"); if (el) el.addEventListener("click", event=>{ - getInstalledApps().then(() => { + startOperation({name:"Install Default Apps"}, () => getInstalledApps().then(() => { if (device.id == "BANGLEJS") return httpGet("defaultapps_banglejs1.json"); if (device.id == "BANGLEJS2") @@ -251,15 +250,16 @@ window.addEventListener('load', (event) => { }).catch(err=>{ Progress.hide({sticky:true}); showToast("App Install failed, "+err,"error"); - }); + })); }); // Button to reset the Bangle's settings el = document.getElementById("defaultbanglesettings"); if (el) el.addEventListener("click", event=>{ showPrompt("Reset Settings","Really reset Bangle.js settings?").then(() => { - Comms.write("\x10require('Storage').erase('setting.json');load()\n"); - showToast("Settings reset!", "success"); + startOperation({name:"Reset Settings"}, () => + Comms.write("\x10require('Storage').erase('setting.json');load()\n").then(() => + showToast("Settings reset!", "success"))); }, function() { /* cancelled */ }); }); @@ -267,12 +267,16 @@ window.addEventListener('load', (event) => { // BLE Compatibility var selectBLECompat = document.getElementById("settings-ble-compat"); if (selectBLECompat) { - Puck.increaseMTU = !SETTINGS.bleCompat; + function setBLECompat(compat) { + if ("undefined"!==typeof Puck) Puck.increaseMTU = !compat; + if ("undefined"!==typeof UART) UART.increaseMTU = !compat; + } + setBLECompat(SETTINGS.bleCompat); selectBLECompat.checked = !!SETTINGS.bleCompat; selectBLECompat.addEventListener("change",event=>{ console.log("BLE compatibility mode "+(event.target.checked?"on":"off")); SETTINGS.bleCompat = event.target.checked; - Puck.increaseMTU = !SETTINGS.bleCompat; + setBLECompat(SETTINGS.bleCompat); saveSettings(); }); } @@ -329,6 +333,16 @@ window.addEventListener('load', (event) => { }); reloadLanguage(); }); + + if ((typeof Android === "undefined") && !navigator.bluetooth) { + console.warn("No Web Bluetooth on this platform"); + var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; + if (iOS) { + showToast(`iOS doesn't natively support Web Bluetooth. To use Web Bluetooth on iOS you'll need to download the WebBLE App`, "error", 1000000000); + } else { + showToast(`This Web Browser doesn't support Web Bluetooth.\nPlease click here to see instructions for enabling it`, "error", 1000000000); + } + } }); function onAppJSONLoaded() { diff --git a/modules/Layout.js b/modules/Layout.js index 0697b778b..5c66fc313 100644 --- a/modules/Layout.js +++ b/modules/Layout.js @@ -1,4 +1,4 @@ -/* Copyright (c) 2022 Bangle.js contributors. See the file LICENSE for copying permission. */ +/* Copyright (c) 2024 Bangle.js contributors. See the file LICENSE for copying permission. */ // See Layout.md for documentation @@ -9,7 +9,6 @@ */ - function Layout(layout, options) { this._l = this.l = layout; // Do we have >1 physical buttons? @@ -127,7 +126,7 @@ Layout.prototype.setUI = function() { Bangle.touchHandler = (_,e)=>touchHandler(this._l,e); Bangle.on('touch',Bangle.touchHandler); } -} +}; function prepareLazyRender(l, rectsToClear, drawList, rects, parentBg) { var bgCol = l.bgCol == null ? parentBg : g.toColor(l.bgCol); @@ -190,7 +189,7 @@ Layout.prototype.render = function (l) { btnborder = l.btnBorderCol!==undefined?l.btnBorderCol:gfx.theme.fg2, btnface = l.btnFaceCol!==undefined?l.btnFaceCol:gfx.theme.bg2; if(l.selected){ - btnface = gfx.theme.bgH, btnborder = gfx.theme.fgH; + btnface = gfx.theme.bgH; btnborder = gfx.theme.fgH; } gfx.setColor(btnface).fillPoly(poly).setColor(btnborder).drawPoly(poly); if (l.col!==undefined) gfx.setColor(l.col); @@ -208,10 +207,10 @@ Layout.prototype.render = function (l) { l.y + l.h/2, {scale: l.scale||undefined, rotate: Math.PI*0.5*(l.r||0)} ); - }, "custom":function(l){"ram"; l.render(l); + }, "custom":function(l){ "ram"; l.render(l); }, "h":function(l) { "ram"; l.c.forEach(render); - }, "v":function(l) { "ram"; l.c.forEach(render); } - }; + }, "v":function(l) { "ram"; l.c.forEach(render); + }}; if (this.lazy) { // we have to use 'var' here not 'let', otherwise the minifier @@ -232,22 +231,22 @@ Layout.prototype.render = function (l) { Layout.prototype.forgetLazyState = function () { this.rects = {}; -} +}; Layout.prototype.layout = function (l) { // l = current layout element - var cb = { + var floor = Math.floor, cb = { "h" : function(l) {"ram"; - var acc_w = l.x + (0|l.pad); - var accfillx = 0; - var fillx = l.c && l.c.reduce((a,l)=>a+(0|l.fillx),0); + var acc_w = l.x + (0|l.pad), + accfillx = 0, + fillx = l.c && l.c.reduce((a,l)=>a+(0|l.fillx),0); if (!fillx) { acc_w += (l.w-l._w)>>1; fillx=1; } var x = acc_w; l.c.forEach(c => { c.x = 0|x; acc_w += c._w; accfillx += 0|c.fillx; - x = acc_w + Math.floor(accfillx*(l.w-l._w)/fillx); + x = acc_w + floor(accfillx*(l.w-l._w)/fillx); c.w = 0|(x - c.x); c.h = 0|(c.filly ? l.h - (l.pad<<1) : c._h); c.y = 0|(l.y + (0|l.pad) + ((1+(0|c.valign))*(l.h-(l.pad<<1)-c.h)>>1)); @@ -255,16 +254,16 @@ Layout.prototype.layout = function (l) { }); }, "v" : function(l) {"ram"; - var acc_h = l.y + (0|l.pad); - var accfilly = 0; - var filly = l.c && l.c.reduce((a,l)=>a+(0|l.filly),0); + var acc_h = l.y + (0|l.pad), + accfilly = 0, + filly = l.c && l.c.reduce((a,l)=>a+(0|l.filly),0); if (!filly) { acc_h += (l.h-l._h)>>1; filly=1; } var y = acc_h; l.c.forEach(c => { c.y = 0|y; acc_h += c._h; accfilly += 0|c.filly; - y = acc_h + Math.floor(accfilly*(l.h-l._h)/filly); + y = acc_h + floor(accfilly*(l.h-l._h)/filly); c.h = 0|(y - c.y); c.w = 0|(c.fillx ? l.w - (l.pad<<1) : c._w); c.x = 0|(l.x + (0|l.pad) + ((1+(0|c.halign))*(l.w-(l.pad<<1)-c.w)>>1)); @@ -274,6 +273,7 @@ Layout.prototype.layout = function (l) { }; if (cb[l.type]) cb[l.type](l); }; + Layout.prototype.debug = function(l,c) { if (!l) l = this._l; c=c||1; @@ -283,31 +283,32 @@ Layout.prototype.debug = function(l,c) { c++; if (l.c) l.c.forEach(n => this.debug(n,c)); }; + Layout.prototype.update = function() { delete this.updateNeeded; - var gfx=g; // define locally, because this is faster + var gfx=g, max=Math.max, rnd=Math.round; // define locally, because this is faster // update sizes function updateMin(l) {"ram"; cb[l.type](l); if (l.r&1) { // rotation var t = l._w;l._w=l._h;l._h=t; } - l._w = Math.max(l._w + (l.pad<<1), 0|l.width); - l._h = Math.max(l._h + (l.pad<<1), 0|l.height); + l._w = max(l._w + (l.pad<<1), 0|l.width); + l._h = max(l._h + (l.pad<<1), 0|l.height); } var cb = { "txt" : function(l) {"ram"; if (l.font.endsWith("%")) - l.font = "Vector"+Math.round(gfx.getHeight()*l.font.slice(0,-1)/100); + l.font = "Vector"+rnd(gfx.getHeight()*l.font.slice(0,-1)/100); if (l.wrap) { l._h = l._w = 0; } else { - var m = g.setFont(l.font).stringMetrics(l.label); + var m = gfx.setFont(l.font).stringMetrics(l.label); l._w = m.width; l._h = m.height; } }, "btn": function(l) {"ram"; if (l.font && l.font.endsWith("%")) - l.font = "Vector"+Math.round(gfx.getHeight()*l.font.slice(0,-1)/100); + l.font = "Vector"+rnd(gfx.getHeight()*l.font.slice(0,-1)/100); var m = l.src?gfx.imageMetrics("function"==typeof l.src?l.src():l.src):gfx.setFont(l.font||"6x8:2").stringMetrics(l.label); l._h = 16 + m.height; l._w = 20 + m.width; @@ -325,19 +326,18 @@ Layout.prototype.update = function() { l._h = 0; }, "h": function(l) {"ram"; l.c.forEach(updateMin); - l._h = l.c.reduce((a,b)=>Math.max(a,b._h),0); + l._h = l.c.reduce((a,b)=>max(a,b._h),0); l._w = l.c.reduce((a,b)=>a+b._w,0); if (l.fillx == null && l.c.some(c=>c.fillx)) l.fillx = 1; if (l.filly == null && l.c.some(c=>c.filly)) l.filly = 1; }, "v": function(l) {"ram"; l.c.forEach(updateMin); l._h = l.c.reduce((a,b)=>a+b._h,0); - l._w = l.c.reduce((a,b)=>Math.max(a,b._w),0); + l._w = l.c.reduce((a,b)=>max(a,b._w),0); if (l.fillx == null && l.c.some(c=>c.fillx)) l.fillx = 1; if (l.filly == null && l.c.some(c=>c.filly)) l.filly = 1; } }; - var l = this._l; updateMin(l); delete cb; diff --git a/modules/Layout.md b/modules/Layout.md index 9a5eb6b81..5a457408a 100644 --- a/modules/Layout.md +++ b/modules/Layout.md @@ -3,6 +3,8 @@ Bangle.js Layout Library > Take a look at README.md for hints on developing with this library. +**Please see more complete documentation at https://www.espruino.com/Bangle.js+Layout** + Usage ----- @@ -85,6 +87,40 @@ Other functions: - `layout.setUI()` - Re-add any UI input handlers +Alignment +---------- + +You can align elements within their `h` or `v` containers with `halign` and `valign`, however within an element, text is always rendered centered. + +As a result, if you want to align text, you shouldn't use `fillx:1` in the text element as the element will then fill to all available space and won't align. + +```JS +var layout = new Layout( { + type:"v", c: [{ + type:"txt", + font:"20%", + fillx:0, // must be 0 for halign to work + filly:1, + halign:-1, // LEFT align + label:"Left" + }, { + type:"txt", + font:"20%", + fillx:0, + filly:1, + halign:0, // CENTER align + label:"Center" + }, { + type:"txt", + font:"20%", + fillx:0, + filly:1, + halign:1, // CERIGHTNTER align + label:"Right"}, + ] +}); +``` + Using with `E.showMenu`/`E.showPrompt`/etc -------------------------------------- diff --git a/modules/Layout.min.js b/modules/Layout.min.js index 043477fd5..4c64d078a 100644 --- a/modules/Layout.min.js +++ b/modules/Layout.min.js @@ -1,14 +1,14 @@ -function p(d,h){function b(e){"ram";e.id&&(a[e.id]=e);e.type||(e.type="");e.c&&e.c.forEach(b)}this._l=this.l=d;this.options=h||{};this.lazy=this.options.lazy||!1;this.physBtns=1;let f;if(2!=process.env.HWVERSION){this.physBtns=3;f=[];function e(l){"ram";"btn"==l.type&&f.push(l);l.c&&l.c.forEach(e)}e(d);f.length&&(this.physBtns=0,this.buttons=f,this.selectedButton=-1)}if(this.options.btns)if(d=this.options.btns,this.physBtns>=d.length){this.b=d;let e=Math.floor(Bangle.appRect.h/ -this.physBtns);for(2d.length;)d.push({label:""});this._l.width=g.getWidth()-8;this._l={type:"h",filly:1,c:[this._l,{type:"v",pad:1,filly:1,c:d.map(l=>(l.type="txt",l.font="6x8",l.height=e,l.r=1,l))}]}}else this._l.width=g.getWidth()-32,this._l={type:"h",c:[this._l,{type:"v",c:d.map(e=>(e.type="btn",e.filly=1,e.width=32,e.r=1,e))}]},f&&f.push.apply(f,this._l.c[1].c);this.setUI();var a=this;b(this._l);this.updateNeeded=!0}function t(d, -h,b,f,a){var e=null==d.bgCol?a:g.toColor(d.bgCol);if(e!=a||"txt"==d.type||"btn"==d.type||"img"==d.type||"custom"==d.type){var l=d.c;delete d.c;var k="H"+E.CRC32(E.toJS(d));l&&(d.c=l);delete h[k]||((f[k]=[d.x,d.y,d.x+d.w-1,d.y+d.h-1]).bg=null==a?g.theme.bg:a,b&&(b.push(d),b=null))}if(d.c)for(var c of d.c)t(c,h,b,f,e)}p.prototype.setUI=function(){Bangle.setUI();let d;this.buttons&&(Bangle.setUI({mode:"updown",back:this.options.back,remove:this.options.remove},h=>{var b=this.selectedButton,f=this.buttons.length; -if(void 0===h&&this.buttons[b])return this.buttons[b].cb();this.buttons[b]&&(delete this.buttons[b].selected,this.render(this.buttons[b]));b=(b+f+h)%f;this.buttons[b]&&(this.buttons[b].selected=1,this.render(this.buttons[b]));this.selectedButton=b}),d=!0);!this.options.back&&!this.options.remove||d||Bangle.setUI({mode:"custom",back:this.options.back,remove:this.options.remove});if(this.b){function h(b,f){.75=b.x&&f.y>=b.y&&f.x<=b.x+b.w&&f.y<=b.y+b.h&&(2==f.type&&b.cbl?b.cbl(f):b.cb&&b.cb(f));b.c&&b.c.forEach(a=>h(a,f))}Bangle.touchHandler= -(b,f)=>h(this._l,f);Bangle.on("touch",Bangle.touchHandler)}};p.prototype.render=function(d){function h(c){"ram";b.reset();void 0!==c.col&&b.setColor(c.col);void 0!==c.bgCol&&b.setBgColor(c.bgCol).clearRect(c.x,c.y,c.x+c.w-1,c.y+c.h-1);f[c.type](c)}d||(d=this._l);this.updateNeeded&&this.update();var b=g,f={"":function(){},txt:function(c){"ram";if(c.wrap){var m=b.setFont(c.font).setFontAlign(0,-1).wrapString(c.label,c.w),n=c.y+(c.h-b.getFontHeight()*m.length>>1);b.drawString(m.join("\n"),c.x+(c.w>> -1),n)}else b.setFont(c.font).setFontAlign(0,0,c.r).drawString(c.label,c.x+(c.w>>1),c.y+(c.h>>1))},btn:function(c){"ram";var m=c.x+(0|c.pad),n=c.y+(0|c.pad),q=c.w-(c.pad<<1),r=c.h-(c.pad<<1);m=[m,n+4,m+4,n,m+q-5,n,m+q-1,n+4,m+q-1,n+r-5,m+q-5,n+r-1,m+4,n+r-1,m,n+r-5,m,n+4];n=void 0!==c.btnBorderCol?c.btnBorderCol:b.theme.fg2;q=void 0!==c.btnFaceCol?c.btnFaceCol:b.theme.bg2;c.selected&&(q=b.theme.bgH,n=b.theme.fgH);b.setColor(q).fillPoly(m).setColor(n).drawPoly(m);void 0!==c.col&&b.setColor(c.col);c.src? -b.setBgColor(q).drawImage("function"==typeof c.src?c.src():c.src,c.x+c.w/2,c.y+c.h/2,{scale:c.scale||void 0,rotate:.5*Math.PI*(c.r||0)}):b.setFont(c.font||"6x8:2").setFontAlign(0,0,c.r).drawString(c.label,c.x+c.w/2,c.y+c.h/2)},img:function(c){"ram";b.drawImage("function"==typeof c.src?c.src():c.src,c.x+c.w/2,c.y+c.h/2,{scale:c.scale||void 0,rotate:.5*Math.PI*(c.r||0)})},custom:function(c){"ram";c.render(c)},h:function(c){"ram";c.c.forEach(h)},v:function(c){"ram";c.c.forEach(h)}};if(this.lazy){this.rects|| -(this.rects={});var a=this.rects.clone(),e=[];t(d,a,e,this.rects,null);for(var l in a)delete this.rects[l];d=Object.keys(a).map(c=>a[c]).reverse();for(var k of d)b.setBgColor(k.bg).clearRect.apply(g,k);e.forEach(h)}else h(d)};p.prototype.forgetLazyState=function(){this.rects={}};p.prototype.layout=function(d){var h={h:function(b){"ram";var f=b.x+(0|b.pad),a=0,e=b.c&&b.c.reduce((k,c)=>k+(0|c.fillx),0);e||(f+=b.w-b._w>>1,e=1);var l=f;b.c.forEach(k=>{k.x=0|l;f+=k._w;a+=0|k.fillx;l=f+Math.floor(a*(b.w- -b._w)/e);k.w=0|l-k.x;k.h=0|(k.filly?b.h-(b.pad<<1):k._h);k.y=0|b.y+(0|b.pad)+((1+(0|k.valign))*(b.h-(b.pad<<1)-k.h)>>1);if(k.c)h[k.type](k)})},v:function(b){"ram";var f=b.y+(0|b.pad),a=0,e=b.c&&b.c.reduce((k,c)=>k+(0|c.filly),0);e||(f+=b.h-b._h>>1,e=1);var l=f;b.c.forEach(k=>{k.y=0|l;f+=k._h;a+=0|k.filly;l=f+Math.floor(a*(b.h-b._h)/e);k.h=0|l-k.y;k.w=0|(k.fillx?b.w-(b.pad<<1):k._w);k.x=0|b.x+(0|b.pad)+((1+(0|k.halign))*(b.w-(b.pad<<1)-k.w)>>1);if(k.c)h[k.type](k)})}};if(h[d.type])h[d.type](d)};p.prototype.debug= -function(d,h){d||(d=this._l);h=h||1;g.setColor(h&1,h&2,h&4).drawRect(d.x+h-1,d.y+h-1,d.x+d.w-h,d.y+d.h-h);d.pad&&g.drawRect(d.x+d.pad-1,d.y+d.pad-1,d.x+d.w-d.pad,d.y+d.h-d.pad);h++;d.c&&d.c.forEach(b=>this.debug(b,h))};p.prototype.update=function(){function d(a){"ram";b[a.type](a);if(a.r&1){var e=a._w;a._w=a._h;a._h=e}a._w=Math.max(a._w+(a.pad<<1),0|a.width);a._h=Math.max(a._h+(a.pad<<1),0|a.height)}delete this.updateNeeded;var h=g,b={txt:function(a){"ram";a.font.endsWith("%")&&(a.font="Vector"+Math.round(h.getHeight()* -a.font.slice(0,-1)/100));if(a.wrap)a._h=a._w=0;else{var e=g.setFont(a.font).stringMetrics(a.label);a._w=e.width;a._h=e.height}},btn:function(a){"ram";a.font&&a.font.endsWith("%")&&(a.font="Vector"+Math.round(h.getHeight()*a.font.slice(0,-1)/100));var e=a.src?h.imageMetrics("function"==typeof a.src?a.src():a.src):h.setFont(a.font||"6x8:2").stringMetrics(a.label);a._h=16+e.height;a._w=20+e.width},img:function(a){"ram";var e=h.imageMetrics("function"==typeof a.src?a.src():a.src),l=a.scale||1;a._w=e.width* -l;a._h=e.height*l},"":function(a){"ram";a._w=0;a._h=0},custom:function(a){"ram";a._w=0;a._h=0},h:function(a){"ram";a.c.forEach(d);a._h=a.c.reduce((e,l)=>Math.max(e,l._h),0);a._w=a.c.reduce((e,l)=>e+l._w,0);null==a.fillx&&a.c.some(e=>e.fillx)&&(a.fillx=1);null==a.filly&&a.c.some(e=>e.filly)&&(a.filly=1)},v:function(a){"ram";a.c.forEach(d);a._h=a.c.reduce((e,l)=>e+l._h,0);a._w=a.c.reduce((e,l)=>Math.max(e,l._w),0);null==a.fillx&&a.c.some(e=>e.fillx)&&(a.fillx=1);null==a.filly&&a.c.some(e=>e.filly)&& -(a.filly=1)}},f=this._l;d(f);delete b;f.fillx||f.filly?(f.w=Bangle.appRect.w,f.h=Bangle.appRect.h,f.x=Bangle.appRect.x,f.y=Bangle.appRect.y):(f.w=f._w,f.h=f._h,f.x=Bangle.appRect.w-f.w>>1,f.y=Bangle.appRect.y+(Bangle.appRect.h-f.h>>1));this.layout(f)};p.prototype.clear=function(d){d||(d=this._l);g.reset();void 0!==d.bgCol&&g.setBgColor(d.bgCol);g.clearRect(d.x,d.y,d.x+d.w-1,d.y+d.h-1)};exports=p \ No newline at end of file +function p(c,h){function d(f){"ram";f.id&&(l[f.id]=f);f.type||(f.type="");f.c&&f.c.forEach(d)}this._l=this.l=c;this.options=h||{};this.lazy=this.options.lazy||!1;this.physBtns=1;let e;if(2!=process.env.HWVERSION){this.physBtns=3;e=[];function f(b){"ram";"btn"==b.type&&e.push(b);b.c&&b.c.forEach(f)}f(c);e.length&&(this.physBtns=0,this.buttons=e,this.selectedButton=-1)}if(this.options.btns)if(c=this.options.btns,this.physBtns>=c.length){this.b=c;let f=Math.floor(Bangle.appRect.h/ +this.physBtns);for(2c.length;)c.push({label:""});this._l.width=g.getWidth()-8;this._l={type:"h",filly:1,c:[this._l,{type:"v",pad:1,filly:1,c:c.map(b=>(b.type="txt",b.font="6x8",b.height=f,b.r=1,b))}]}}else this._l.width=g.getWidth()-32,this._l={type:"h",c:[this._l,{type:"v",c:c.map(f=>(f.type="btn",f.filly=1,f.width=32,f.r=1,f))}]},e&&e.push.apply(e,this._l.c[1].c);this.setUI();var l=this;d(this._l);this.updateNeeded=!0}function t(c, +h,d,e,l){var f=null==c.bgCol?l:g.toColor(c.bgCol);if(f!=l||"txt"==c.type||"btn"==c.type||"img"==c.type||"custom"==c.type){var b=c.c;delete c.c;var k="H"+E.CRC32(E.toJS(c));b&&(c.c=b);delete h[k]||((e[k]=[c.x,c.y,c.x+c.w-1,c.y+c.h-1]).bg=null==l?g.theme.bg:l,d&&(d.push(c),d=null))}if(c.c)for(var a of c.c)t(a,h,d,e,f)}p.prototype.setUI=function(){Bangle.setUI();let c;this.buttons&&(Bangle.setUI({mode:"updown",back:this.options.back,remove:this.options.remove},h=>{var d=this.selectedButton,e=this.buttons.length; +if(void 0===h&&this.buttons[d])return this.buttons[d].cb();this.buttons[d]&&(delete this.buttons[d].selected,this.render(this.buttons[d]));d=(d+e+h)%e;this.buttons[d]&&(this.buttons[d].selected=1,this.render(this.buttons[d]));this.selectedButton=d}),c=!0);!this.options.back&&!this.options.remove||c||Bangle.setUI({mode:"custom",back:this.options.back,remove:this.options.remove});if(this.b){function h(d,e){.75=d.x&&e.y>=d.y&&e.x<=d.x+d.w&&e.y<=d.y+d.h&&(2==e.type&&d.cbl?d.cbl(e):d.cb&&d.cb(e));d.c&&d.c.forEach(l=>h(l,e))}Bangle.touchHandler= +(d,e)=>h(this._l,e);Bangle.on("touch",Bangle.touchHandler)}};p.prototype.render=function(c){function h(a){"ram";d.reset();void 0!==a.col&&d.setColor(a.col);void 0!==a.bgCol&&d.setBgColor(a.bgCol).clearRect(a.x,a.y,a.x+a.w-1,a.y+a.h-1);e[a.type](a)}c||(c=this._l);this.updateNeeded&&this.update();var d=g,e={"":function(){},txt:function(a){"ram";if(a.wrap){var m=d.setFont(a.font).setFontAlign(0,-1).wrapString(a.label,a.w),n=a.y+(a.h-d.getFontHeight()*m.length>>1);d.drawString(m.join("\n"),a.x+(a.w>> +1),n)}else d.setFont(a.font).setFontAlign(0,0,a.r).drawString(a.label,a.x+(a.w>>1),a.y+(a.h>>1))},btn:function(a){"ram";var m=a.x+(0|a.pad),n=a.y+(0|a.pad),q=a.w-(a.pad<<1),r=a.h-(a.pad<<1);m=[m,n+4,m+4,n,m+q-5,n,m+q-1,n+4,m+q-1,n+r-5,m+q-5,n+r-1,m+4,n+r-1,m,n+r-5,m,n+4];n=void 0!==a.btnBorderCol?a.btnBorderCol:d.theme.fg2;q=void 0!==a.btnFaceCol?a.btnFaceCol:d.theme.bg2;a.selected&&(q=d.theme.bgH,n=d.theme.fgH);d.setColor(q).fillPoly(m).setColor(n).drawPoly(m);void 0!==a.col&&d.setColor(a.col);a.src? +d.setBgColor(q).drawImage("function"==typeof a.src?a.src():a.src,a.x+a.w/2,a.y+a.h/2,{scale:a.scale||void 0,rotate:.5*Math.PI*(a.r||0)}):d.setFont(a.font||"6x8:2").setFontAlign(0,0,a.r).drawString(a.label,a.x+a.w/2,a.y+a.h/2)},img:function(a){"ram";d.drawImage("function"==typeof a.src?a.src():a.src,a.x+a.w/2,a.y+a.h/2,{scale:a.scale||void 0,rotate:.5*Math.PI*(a.r||0)})},custom:function(a){"ram";a.render(a)},h:function(a){"ram";a.c.forEach(h)},v:function(a){"ram";a.c.forEach(h)}};if(this.lazy){this.rects|| +(this.rects={});var l=this.rects.clone(),f=[];t(c,l,f,this.rects,null);for(var b in l)delete this.rects[b];c=Object.keys(l).map(a=>l[a]).reverse();for(var k of c)d.setBgColor(k.bg).clearRect.apply(g,k);f.forEach(h)}else h(c)};p.prototype.forgetLazyState=function(){this.rects={}};p.prototype.layout=function(c){var h=Math.floor,d={h:function(e){"ram";var l=e.x+(0|e.pad),f=0,b=e.c&&e.c.reduce((a,m)=>a+(0|m.fillx),0);b||(l+=e.w-e._w>>1,b=1);var k=l;e.c.forEach(a=>{a.x=0|k;l+=a._w;f+=0|a.fillx;k=l+h(f* +(e.w-e._w)/b);a.w=0|k-a.x;a.h=0|(a.filly?e.h-(e.pad<<1):a._h);a.y=0|e.y+(0|e.pad)+((1+(0|a.valign))*(e.h-(e.pad<<1)-a.h)>>1);if(a.c)d[a.type](a)})},v:function(e){"ram";var l=e.y+(0|e.pad),f=0,b=e.c&&e.c.reduce((a,m)=>a+(0|m.filly),0);b||(l+=e.h-e._h>>1,b=1);var k=l;e.c.forEach(a=>{a.y=0|k;l+=a._h;f+=0|a.filly;k=l+h(f*(e.h-e._h)/b);a.h=0|k-a.y;a.w=0|(a.fillx?e.w-(e.pad<<1):a._w);a.x=0|e.x+(0|e.pad)+((1+(0|a.halign))*(e.w-(e.pad<<1)-a.w)>>1);if(a.c)d[a.type](a)})}};if(d[c.type])d[c.type](c)};p.prototype.debug= +function(c,h){c||(c=this._l);h=h||1;g.setColor(h&1,h&2,h&4).drawRect(c.x+h-1,c.y+h-1,c.x+c.w-h,c.y+c.h-h);c.pad&&g.drawRect(c.x+c.pad-1,c.y+c.pad-1,c.x+c.w-c.pad,c.y+c.h-c.pad);h++;c.c&&c.c.forEach(d=>this.debug(d,h))};p.prototype.update=function(){function c(b){"ram";l[b.type](b);if(b.r&1){var k=b._w;b._w=b._h;b._h=k}b._w=d(b._w+(b.pad<<1),0|b.width);b._h=d(b._h+(b.pad<<1),0|b.height)}delete this.updateNeeded;var h=g,d=Math.max,e=Math.round,l={txt:function(b){"ram";b.font.endsWith("%")&&(b.font= +"Vector"+e(h.getHeight()*b.font.slice(0,-1)/100));if(b.wrap)b._h=b._w=0;else{var k=h.setFont(b.font).stringMetrics(b.label);b._w=k.width;b._h=k.height}},btn:function(b){"ram";b.font&&b.font.endsWith("%")&&(b.font="Vector"+e(h.getHeight()*b.font.slice(0,-1)/100));var k=b.src?h.imageMetrics("function"==typeof b.src?b.src():b.src):h.setFont(b.font||"6x8:2").stringMetrics(b.label);b._h=16+k.height;b._w=20+k.width},img:function(b){"ram";var k=h.imageMetrics("function"==typeof b.src?b.src():b.src),a=b.scale|| +1;b._w=k.width*a;b._h=k.height*a},"":function(b){"ram";b._w=0;b._h=0},custom:function(b){"ram";b._w=0;b._h=0},h:function(b){"ram";b.c.forEach(c);b._h=b.c.reduce((k,a)=>d(k,a._h),0);b._w=b.c.reduce((k,a)=>k+a._w,0);null==b.fillx&&b.c.some(k=>k.fillx)&&(b.fillx=1);null==b.filly&&b.c.some(k=>k.filly)&&(b.filly=1)},v:function(b){"ram";b.c.forEach(c);b._h=b.c.reduce((k,a)=>k+a._h,0);b._w=b.c.reduce((k,a)=>d(k,a._w),0);null==b.fillx&&b.c.some(k=>k.fillx)&&(b.fillx=1);null==b.filly&&b.c.some(k=>k.filly)&& +(b.filly=1)}},f=this._l;c(f);delete l;f.fillx||f.filly?(f.w=Bangle.appRect.w,f.h=Bangle.appRect.h,f.x=Bangle.appRect.x,f.y=Bangle.appRect.y):(f.w=f._w,f.h=f._h,f.x=Bangle.appRect.w-f.w>>1,f.y=Bangle.appRect.y+(Bangle.appRect.h-f.h>>1));this.layout(f)};p.prototype.clear=function(c){c||(c=this._l);g.reset();void 0!==c.bgCol&&g.setBgColor(c.bgCol);g.clearRect(c.x,c.y,c.x+c.w-1,c.y+c.h-1)};exports=p \ No newline at end of file diff --git a/modules/ble_advert.js b/modules/ble_advert.js index 0a037cfd8..6ab47871c 100644 --- a/modules/ble_advert.js +++ b/modules/ble_advert.js @@ -12,7 +12,17 @@ var advertise = function (options) { } return obj; }; - NRF.setAdvertising(clone(Bangle.bleAdvert), options); + if (process.env.VERSION >= "2.26") { + options = options || {}; + if (!options.manufacturer) + options.manufacturer = false; + } + try { + NRF.setAdvertising(clone(Bangle.bleAdvert), options); + } + catch (e) { + console.log("ble_advert error", e); + } }; var manyAdv = function (bleAdvert) { return Array.isArray(bleAdvert) && typeof bleAdvert[0] === "object"; diff --git a/modules/ble_advert.ts b/modules/ble_advert.ts index c0b852f1d..9f0ac0765 100644 --- a/modules/ble_advert.ts +++ b/modules/ble_advert.ts @@ -21,6 +21,12 @@ const advertise = (options: SetAdvertisingOptions) => { } return obj; }; + /* 2v26 added manufacturer=0x0590 by default, but if we're advertising + extra stuff we'll want to explicitly remove that so there's space */ + if (process.env.VERSION >= "2.26") { + options = options||{}; + if (!options.manufacturer) options.manufacturer=false; + } // clone the object, to avoid firmware behaving like so: // bleAdvert = [Uint8Array, { [0x180f]: ... }] @@ -35,7 +41,11 @@ const advertise = (options: SetAdvertisingOptions) => { // taking effect for later calls. // // This also allows us to identify previous adverts correctly by id. - NRF.setAdvertising(clone((Bangle as BangleWithAdvert).bleAdvert), options); + try { + NRF.setAdvertising(clone((Bangle as BangleWithAdvert).bleAdvert), options); + } catch (e) { + console.log("ble_advert error", e); + } }; const manyAdv = (bleAdvert: BleAdvert | BleAdvert[] | undefined): bleAdvert is BleAdvert[] => { diff --git a/modules/exstats.js b/modules/exstats.js index 5cd0374a7..f5b9c6fff 100644 --- a/modules/exstats.js +++ b/modules/exstats.js @@ -158,8 +158,8 @@ Bangle.on("GPS", function(fix) { if (stats["pacea"]) stats["pacea"].emit("changed",stats["pacea"]); if (stats["pacec"]) stats["pacec"].emit("changed",stats["pacec"]); if (state.notify.dist.increment > 0 && state.notify.dist.next <= state.distance) { - stats["dist"].emit("notify",stats["dist"]); state.notify.dist.next = state.notify.dist.next + state.notify.dist.increment; + stats["dist"].emit("notify",stats["dist"]); } }); @@ -169,8 +169,8 @@ Bangle.on("step", function(steps) { state.stepHistory[0] += steps-state.lastSteps; state.lastSteps = steps; if (state.notify.step.increment > 0 && state.notify.step.next <= steps) { - stats["step"].emit("notify",stats["step"]); state.notify.step.next = state.notify.step.next + state.notify.step.increment; + stats["step"].emit("notify",stats["step"]); } }); Bangle.on("HRM", function(h) { @@ -229,7 +229,7 @@ exports.getStats = function(statIDs, options) { if (statIDs.includes("time")) { stats["time"]={ title : "Time", - getValue : function() { return Date.now()-state.startTime; }, + getValue : function() { return state.duration; }, getString : function() { return formatTime(this.getValue()) }, }; } @@ -322,22 +322,22 @@ exports.getStats = function(statIDs, options) { var now = Date.now(); state.duration += now - state.lastTime; // in ms state.lastTime = now; + if (stats["time"]) stats["time"].emit("changed",stats["time"]); // set cadence -> steps over last minute state.stepsPerMin = Math.round(60000 * E.sum(state.stepHistory) / Math.min(state.duration,60000)); if (stats["caden"]) stats["caden"].emit("changed",stats["caden"]); // move step history onwards state.stepHistory.set(state.stepHistory,1); state.stepHistory[0]=0; - if (stats["time"]) stats["time"].emit("changed",stats["time"]); // update BPM - if nothing valid in 60s remove the reading state.BPMage++; if (state.BPM && state.BPMage>60) { state.BPM = 0; if (stats["bpm"]) stats["bpm"].emit("changed",stats["bpm"]); } - if (state.notify.time.increment > 0 && state.notify.time.next <= now) { - stats["time"].emit("notify",stats["time"]); + if (state.notify.time.increment > 0 && state.notify.time.next <= state.duration) { state.notify.time.next = state.notify.time.next + state.notify.time.increment; + stats["time"].emit("notify",stats["time"]); } }, 1000); function reset() { diff --git a/modules/more_pickers.js b/modules/more_pickers.js index 596b36fdf..865ff689c 100644 --- a/modules/more_pickers.js +++ b/modules/more_pickers.js @@ -10,27 +10,37 @@ exports.doublePicker = function (options) { var v_1 = options.value_1; var v_2 = options.value_2; - function draw() { + function draw1() { + var txt_1 = options.format_1 ? options.format_1(v_1) : v_1; + g.setColor(g.theme.bg2) .fillRect(14, 60, 81, 166) - .fillRect(95, 60, 162, 166); - - g.setColor(g.theme.fg2) + .setColor(g.theme.fg2) .fillPoly([47.5, 68, 62.5, 83, 32.5, 83]) .fillPoly([47.5, 158, 62.5, 143, 32.5, 143]) - .fillPoly([128.5, 68, 143.5, 83, 113.5, 83]) - .fillPoly([128.5, 158, 143.5, 143, 113.5, 143]); - - var txt_1 = options.format_1 ? options.format_1(v_1) : v_1; + .setFontAlign(0, 0) + .setFontVector(Math.min(30, (R.w - 110) * 100 / g.setFontVector(100).stringWidth(txt_1))) + .drawString(txt_1, 47.5, 113); + } + function draw2() { var txt_2 = options.format_2 ? options.format_2(v_2) : v_2; - g.setFontAlign(0, 0) - .setFontVector(Math.min(30, (R.w - 110) * 100 / g.setFontVector(100).stringWidth(txt_1))) - .drawString(txt_1, 47.5, 113) + g.setColor(g.theme.bg2) + .fillRect(95, 60, 162, 166) + .setColor(g.theme.fg2) + .fillPoly([128.5, 68, 143.5, 83, 113.5, 83]) + .fillPoly([128.5, 158, 143.5, 143, 113.5, 143]) + .setFontAlign(0, 0) .setFontVector(Math.min(30, (R.w - 110) * 100 / g.setFontVector(100).stringWidth(txt_2))) - .drawString(txt_2, 128.5, 113) - .setFontVector(30) - .drawString(options.separator ?? "", 88, 110); + .drawString(txt_2, 128.5, 113); + } + function drawSeparator(){ + g.setFontVector(30).drawString(options.separator ?? "", 88, 110); + } + function drawAll() { + draw1(); + draw2(); + drawSeparator() } function cb(dir, x_part) { if (dir) { @@ -38,12 +48,14 @@ exports.doublePicker = function (options) { v_1 -= (dir || 1) * (options.step_1 || 1); if (options.min_1 !== undefined && v_1 < options.min_1) v_1 = options.wrap_1 ? options.max_1 : options.min_1; if (options.max_1 !== undefined && v_1 > options.max_1) v_1 = options.wrap_1 ? options.min_1 : options.max_1; + draw1(); } else { v_2 -= (dir || 1) * (options.step_2 || 1); if (options.min_2 !== undefined && v_2 < options.min_2) v_2 = options.wrap_2 ? options.max_2 : options.min_2; if (options.max_2 !== undefined && v_2 > options.max_2) v_2 = options.wrap_2 ? options.min_2 : options.max_2; + draw2(); } - draw(); + drawSeparator(); } else { // actually selected options.value_1 = v_1; options.value_2 = v_2; @@ -52,14 +64,14 @@ exports.doublePicker = function (options) { } } - draw(); + drawAll(); var dy = 0; Bangle.setUI({ mode: "custom", back: options.back, remove: options.remove, - redraw: draw, + redraw: drawAll, drag: e => { dy += e.dy; // after a certain amount of dragging up/down fire cb if (!e.b) dy = 0; @@ -101,51 +113,72 @@ exports.triplePicker = function (options) { var v_2 = options.value_2; var v_3 = options.value_3; - function draw() { + function draw1() { + var txt_1 = options.format_1 ? options.format_1(v_1) : v_1; + g.setColor(g.theme.bg2) .fillRect(8, 60, 56, 166) - .fillRect(64, 60, 112, 166) - .fillRect(120, 60, 168, 166); - - g.setColor(g.theme.fg2) + .setColor(g.theme.fg2) .fillPoly([32, 68, 47, 83, 17, 83]) .fillPoly([32, 158, 47, 143, 17, 143]) + .setFontAlign(0, 0) + .setFontVector(Math.min(30, (R.w - 130) * 100 / g.setFontVector(100).stringWidth(txt_1))) + .drawString(txt_1, 32, 113); + } + function draw2() { + var txt_2 = options.format_2 ? options.format_2(v_2) : v_2; + + g.setColor(g.theme.bg2) + .fillRect(64, 60, 112, 166) + .setColor(g.theme.fg2) .fillPoly([88, 68, 103, 83, 73, 83]) .fillPoly([88, 158, 103, 143, 73, 143]) - .fillPoly([144, 68, 159, 83, 129, 83]) - .fillPoly([144, 158, 159, 143, 129, 143]); - - var txt_1 = options.format_1 ? options.format_1(v_1) : v_1; - var txt_2 = options.format_2 ? options.format_2(v_2) : v_2; - var txt_3 = options.format_3 ? options.format_3(v_3) : v_3; - - g.setFontAlign(0, 0) - .setFontVector(Math.min(30, (R.w - 130) * 100 / g.setFontVector(100).stringWidth(txt_1))) - .drawString(txt_1, 32, 113) + .setFontAlign(0, 0) .setFontVector(Math.min(30, (R.w - 130) * 100 / g.setFontVector(100).stringWidth(txt_2))) - .drawString(txt_2, 88, 113) + .drawString(txt_2, 88, 113); + } + function draw3() { + var txt_3 = options.format_3 ? options.format_3(v_3) : v_3; + + g.setColor(g.theme.bg2) + .fillRect(120, 60, 168, 166) + .setColor(g.theme.fg2) + .fillPoly([144, 68, 159, 83, 129, 83]) + .fillPoly([144, 158, 159, 143, 129, 143]) + .setFontAlign(0, 0) .setFontVector(Math.min(30, (R.w - 130) * 100 / g.setFontVector(100).stringWidth(txt_3))) - .drawString(txt_3, 144, 113) - .setFontVector(30) + .drawString(txt_3, 144, 113); + } + function drawSeparators(){ + g.setFontVector(30) .drawString(options.separator_1 ?? "", 60, 113) .drawString(options.separator_2 ?? "", 116, 113); } + function drawAll() { + draw1(); + draw2(); + draw3(); + drawSeparators(); + } function cb(dir, x_part) { if (dir) { if (x_part == -1) { v_1 -= (dir || 1) * (options.step_1 || 1); if (options.min_1 !== undefined && v_1 < options.min_1) v_1 = options.wrap_1 ? options.max_1 : options.min_1; if (options.max_1 !== undefined && v_1 > options.max_1) v_1 = options.wrap_1 ? options.min_1 : options.max_1; + draw1(); } else if (x_part == 0) { v_2 -= (dir || 1) * (options.step_2 || 1); if (options.min_2 !== undefined && v_2 < options.min_2) v_2 = options.wrap_2 ? options.max_2 : options.min_3; if (options.max_2 !== undefined && v_2 > options.max_2) v_2 = options.wrap_2 ? options.min_2 : options.max_3; + draw2(); } else { v_3 -= (dir || 1) * (options.step_3 || 1); if (options.min_3 !== undefined && v_3 < options.min_3) v_3 = options.wrap_3 ? options.max_3 : options.min_3; if (options.max_3 !== undefined && v_3 > options.max_3) v_3 = options.wrap_3 ? options.min_3 : options.max_3; + draw3(); } - draw(); + drawSeparators(); } else { // actually selected options.value_1 = v_1; options.value_2 = v_2; @@ -155,14 +188,14 @@ exports.triplePicker = function (options) { } } - draw(); + drawAll(); var dy = 0; Bangle.setUI({ mode: "custom", back: options.back, remove: options.remove, - redraw: draw, + redraw: drawAll, drag: e => { dy += e.dy; // after a certain amount of dragging up/down fire cb if (!e.b) dy = 0; diff --git a/modules/time_utils.js b/modules/time_utils.js index 6a3ed6faf..0f503ad37 100644 --- a/modules/time_utils.js +++ b/modules/time_utils.js @@ -13,18 +13,13 @@ // Note that if a field is undefined then its value is zero. // -const ONE_SECOND = 1000; -const ONE_MINUTE = 60 * ONE_SECOND; -const ONE_HOUR = 60 * ONE_MINUTE; -const ONE_DAY = 24 * ONE_HOUR; - /** * @param {object} time {d, h, m, s} * @returns the milliseconds contained in the passed time object */ exports.encodeTime = (time) => { time = safeTime(time); - return time.d * ONE_DAY + time.h * ONE_HOUR + time.m * ONE_MINUTE + time.s * ONE_SECOND; + return time.d * 86400000 + time.h * 3600000 + time.m * 60000 + time.s * 1000; } // internal use, set to zero all the undefined fields @@ -38,26 +33,26 @@ function safeTime(time) { */ exports.decodeTime = (millis) => { if (typeof millis !== "number") throw "Only a number can be decoded"; - var d = Math.floor(millis / ONE_DAY); - millis -= d * ONE_DAY; - var h = Math.floor(millis / ONE_HOUR); - millis -= h * ONE_HOUR; - var m = Math.floor(millis / ONE_MINUTE); - millis -= m * ONE_MINUTE; - var s = Math.floor(millis / ONE_SECOND); + var d = Math.floor(millis / 86400000); + millis -= d * 86400000; + var h = Math.floor(millis / 3600000); + millis -= h * 3600000; + var m = Math.floor(millis / 60000); + millis -= m * 60000; + var s = Math.floor(millis / 1000); return { d: d, h: h, m: m, s: s }; } -/** +/** * @param {object|int} value {h, m} object or milliseconds * @returns an human-readable time string like "10:25" * @throws an exception if d != 0 or h > 23 or m > 59 */ exports.formatTime = (value) => { var time = safeTime(typeof value === "object" ? value : exports.decodeTime(value)); - if (time.d != 0) throw "days not supported here"; - if (time.h < 0 || time.h > 23) throw "Invalid value: must be 0 <= h <= 23"; - if (time.m < 0 || time.m > 59) throw "Invalid value: must be 0 <= m <= 59"; + time.h += time.d*24; + /*if (time.h < 0 || time.h > 23) throw "Invalid value: must be 0 <= h <= 23"; + if (time.m < 0 || time.m > 59) throw "Invalid value: must be 0 <= m <= 59";*/ return time.h + ":" + ("0" + time.m).substr(-2); } diff --git a/modules/widget_utils.js b/modules/widget_utils.js index 4f9b85835..376c2ceba 100644 --- a/modules/widget_utils.js +++ b/modules/widget_utils.js @@ -30,7 +30,7 @@ exports.show = function() { /// Remove anything not needed if the overlay was removed exports.cleanupOverlay = function() { exports.offset = -24; - Bangle.setLCDOverlay(undefined, {id: "widget_utils"}); + Bangle.setLCDOverlay && Bangle.setLCDOverlay(undefined, {id: "widget_utils"}); delete exports.autohide; delete Bangle.appRect; if (exports.animInterval) { @@ -92,15 +92,17 @@ exports.swipeOn = function(autohide) { const o = exports.offset; Bangle.appRect.y = o+24; Bangle.appRect.h = 1 + Bangle.appRect.y2 - Bangle.appRect.y; - if (o>-24) { - Bangle.setLCDOverlay(og, 0, o, { - id:"widget_utils", - remove:()=>{ - require("widget_utils").cleanupOverlay(); - } - }); - } else { - Bangle.setLCDOverlay(undefined, {id: "widget_utils"}); + if (Bangle.setLCDOverlay) { + if (o>-24) { + Bangle.setLCDOverlay(og, 0, o, { + id:"widget_utils", + remove:()=>{ + require("widget_utils").cleanupOverlay(); + } + }); + } else { + Bangle.setLCDOverlay(undefined, {id: "widget_utils"}); + } } } @@ -161,4 +163,4 @@ exports.swipeOn = function(autohide) { }; Bangle.on("swipe", exports.swipeHandler); Bangle.drawWidgets(); -}; \ No newline at end of file +}; diff --git a/package-lock.json b/package-lock.json index fd242623b..f30a41247 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,15 @@ "version": "0.0.1", "license": "MIT", "dependencies": { +<<<<<<< HEAD "acorn": "^7.2.0", "b": "^2.0.1", "png-js": "^1.0.0" +||||||| e51f7bfbe + "acorn": "^7.2.0" +======= + "acorn": "^8.0.0" +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^7.8.0", @@ -474,9 +480,10 @@ "dev": true }, "node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -1521,6 +1528,7 @@ "url": "https://opencollective.com/eslint" } }, +<<<<<<< HEAD "node_modules/espree/node_modules/acorn": { <<<<<<< HEAD "version": "8.11.2", @@ -1539,6 +1547,21 @@ "node": ">=0.4.0" } }, +||||||| e51f7bfbe + "node_modules/espree/node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, +======= +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 "node_modules/esquery": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", @@ -4271,9 +4294,9 @@ "dev": true }, "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==" }, "acorn-jsx": { "version": "5.3.2", @@ -4913,14 +4936,6 @@ "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.4.1" - }, - "dependencies": { - "acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", - "dev": true - } } }, "esquery": { diff --git a/package.json b/package.json index 26320d5c2..4619f46e1 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,14 @@ "update-local-apps": "apps/*/metadata.json" }, "dependencies": { +<<<<<<< HEAD "acorn": "^7.2.0", "b": "^2.0.1", "png-js": "^1.0.0" +||||||| e51f7bfbe + "acorn": "^7.2.0" +======= + "acorn": "^8.0.0" +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 } } diff --git a/tsconfig.json b/tsconfig.json index 5d46f672c..6b89e2bbd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,13 +17,13 @@ "declaration": false, "emitDeclarationOnly": false, "removeComments": true, - "noImplicitUseStrict": true, // disable "use strict" + //REMOVED "noImplicitUseStrict": true, // disable "use strict" "newLine": "lf", "noEmitHelpers": true, // we link to specific banglejs implementations "noEmitOnError": false, "preserveConstEnums": false, - "importsNotUsedAsValues": "error", + //REMOVED "importsNotUsedAsValues": "error", "preserveValueImports": false, // interop constraints @@ -43,9 +43,6 @@ "strictBindCallApply": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, - "noImplicitAny": true, - "noImplicitThis": true, - "useUnknownInCatchVariables": true, // simple type checking "noUnusedLocals": true, diff --git a/typescript/build.sh b/typescript/build.sh new file mode 100755 index 000000000..bf5493745 --- /dev/null +++ b/typescript/build.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +usage(){ + echo >&2 "Usage: $0" + exit 2 +} + +if test $# -ne 0 +then usage +fi + +cd "$(dirname "$0")" + +npm run build + +find ../apps -iname '*.ts' | + sed 's/\.ts$/.js/' | + grep -E 'clkinfo|setting' | + xargs perl -i -pe 's/;$// if eof' diff --git a/typescript/types/bangle_extensions.d.ts b/typescript/types/bangle_extensions.d.ts index e5d94d079..7dde51191 100644 --- a/typescript/types/bangle_extensions.d.ts +++ b/typescript/types/bangle_extensions.d.ts @@ -8,3 +8,5 @@ type BangleEvents = { ["#ondrag"]?: BangleHandler, ["#onstroke"]?: BangleHandler<(event: { xy: Uint8Array, stroke?: string }) => void>, }; + +declare var settings: {}; // settings is commonly used by apps, so declare it here to avoid overwriting it in boot/clkinfo/widgets/etc diff --git a/typescript/types/exstats.d.ts b/typescript/types/exstats.d.ts new file mode 100644 index 000000000..7e980882d --- /dev/null +++ b/typescript/types/exstats.d.ts @@ -0,0 +1,83 @@ +declare module ExStats { + type StatsId = "time" | "dist" | "step" | "bpm" | "maxbpm" | "pacea" | "pacec" | "speed" | "caden" | "altg" | "altb"; + + function getList(): { name: string, id: StatsId }[]; + + function getStats( + ids: Ids[], + options?: Options + ): StatsInst; + + type Options = { + paceLength?: number, + notify?: NotifyInput, + }; + + type Notify = { + [key in Ids & ("dist" | "step" | "time")]: { + increment: number, + next: number, + } + }; + + type NotifyInput = { + [K in keyof Notify]?: + Omit< + Notify[K], "next" + > & { + next?: number, + }; + }; + + type StatsInst = { + stats: Stats, + state: State, + start(): void, + stop(): void, + resume(): void, + }; + + type State = { + notify: Notify, + + active: boolean, + duration: number, + startTime: number, + lastTime: number, + + BPM: number, + BPMage: number, + maxBPM: number, + + alt: number | undefined, + alti: number, + + avrSpeed: number, + curSpeed: number, + distance: number, + + startSteps: number, + lastSteps: number, + stepHistory: Uint8Array, + stepsPerMin: number, + + thisGPS: GPSFix | {}, + lastGPS: GPSFix | {}, + }; + + type Stats = { + [key in Ids]: Stat + }; + + type Stat = { + title: string, + getValue(): number, + getString(): string, + id: StatsId, + + on(what: "changed", cb: (stat: Stat) => void): void; + + // emitted by dist|step|time + on(what: "notify", cb: (stat: Stat) => void): void; + }; +} diff --git a/typescript/types/info.d.ts b/typescript/types/info.d.ts index c305b0261..21014ff8f 100644 --- a/typescript/types/info.d.ts +++ b/typescript/types/info.d.ts @@ -14,4 +14,4 @@ type AppInfo = { type AppType = "app" | "clock" | "widget" | "module" | "bootloader" | "settings" | "clkinfo" | "RAM" | "launch" | "textinput" | "scheduler" | - "notify" | "locale"; + "notify" | "locale" | "defaultconfig"; diff --git a/typescript/types/layout.d.ts b/typescript/types/layout.d.ts index 55ddd7135..e15d86b64 100644 --- a/typescript/types/layout.d.ts +++ b/typescript/types/layout.d.ts @@ -7,7 +7,16 @@ type ExtractIds = [Depth] extends [never] ? never : (T extends { id?: infer Id extends string } - ? { [k in Id]: { -readonly [P in keyof T]: T[P] extends string ? string : T[P] } } + ? { + [k in Id]: { + -readonly [P in keyof T]: + T[P] extends string + ? string + : T[P] extends number + ? number | undefined + : T[P] + } + } : never) | ( @@ -144,6 +153,6 @@ declare module Layout { r?: Rotation, } | { type: "custom", - render: (h: RenderedHierarchy) => void, + render: (this: RenderedHierarchy, h: RenderedHierarchy) => void, }; } diff --git a/typescript/types/main.d.ts b/typescript/types/main.d.ts index 7c3883f0f..3bbaf4759 100644 --- a/typescript/types/main.d.ts +++ b/typescript/types/main.d.ts @@ -5,6 +5,155 @@ // TYPES +<<<<<<< HEAD +||||||| e51f7bfbe +/** + * Menu item that holds a boolean value. + */ +type MenuBooleanItem = { + value: boolean; + format?: (value: boolean) => string; + onchange?: (value: boolean) => void; +}; + +/** + * Menu item that holds a numerical value. + */ +type MenuNumberItem = { + value: number; + format?: (value: number) => string; + onchange?: (value: number) => void; + step?: number; + min?: number; + max?: number; + wrap?: boolean; +}; + +/** + * Options passed to a menu. + */ +type MenuOptions = { + title?: string; + back?: () => void; + selected?: number; + fontHeight?: number; + scroll?: number; + x?: number; + y?: number; + x2?: number; + y2?: number; + cB?: number; + cF?: number; + cHB?: number; + cHF?: number; + predraw?: (g: Graphics) => void; + preflip?: (g: Graphics, less: boolean, more: boolean) => void; +}; + +/** + * Object containing data about a menu to pass to `E.showMenu`. + */ +type Menu = { + ""?: MenuOptions; + [key: string]: + | MenuOptions + | (() => void) + | MenuBooleanItem + | MenuNumberItem + | { value: string; onchange?: () => void } + | undefined; +}; + +/** + * Menu instance. + */ +type MenuInstance = { + draw: () => void; + move: (n: number) => void; + select: () => void; +}; + +======= +type AES_CCM_EncryptResult = { + data: ArrayBuffer, + tag: ArrayBuffer, +}; + +/** + * Menu item that holds a boolean value. + */ +type MenuBooleanItem = { + value: boolean; + format?: (value: boolean) => string; + onchange?: (value: boolean, evt?: TouchCallbackXY) => void; +}; + +/** + * Menu item that holds a numerical value. + */ +type MenuNumberItem = { + value: number; + format?: (value: number) => string; + onchange?: (value: number, evt?: TouchCallbackXY) => void; + step?: number; + min?: number; + max?: number; + wrap?: boolean; +}; + +/** + * Options passed to a menu. + */ +type MenuOptions = { + title?: string; + back?: () => void; + remove?: () => void; + selected?: number; + fontHeight?: number; + scroll?: number; + x?: number; + y?: number; + x2?: number; + y2?: number; + cB?: number; + cF?: number; + cHB?: number; + cHF?: number; + predraw?: (g: Graphics) => void; + preflip?: (g: Graphics, less: boolean, more: boolean) => void; +}; + +/** + * Object containing data about a menu to pass to `E.showMenu`. + */ +type Menu = { + ""?: MenuOptions; + [key: string]: + | MenuOptions + | ((e?: TouchCallbackXY) => void) + | MenuBooleanItem + | MenuNumberItem + | { value: string; onchange?: (value: unknown, evt?: TouchCallbackXY) => void } + | undefined; +}; + +/** + * Menu instance. + */ +type MenuInstance = { + draw: () => void; + scroller?: MenuScroller; // BangleJS 2 +}; + +/** + * Menu scroller. + */ +type MenuScroller = { + scroll: number; +}; + + +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 declare const BTN1: Pin; declare const BTN2: Pin; declare const BTN3: Pin; @@ -73,7 +222,8 @@ type TapAxis = -2 | -1 | 0 | 1 | 2; type SwipeCallback = (directionLR: -1 | 0 | 1, directionUD?: -1 | 0 | 1) => void; -type TouchCallback = (button: number, xy?: { x: number, y: number }) => void; +type TouchCallbackXY = { x: number, y: number, type: 0 | 2 }; +type TouchCallback = (button?: number, xy?: TouchCallbackXY) => void; type DragCallback = (event: { x: number; @@ -408,6 +558,7 @@ type PipeOptions = { // CLASSES /** +<<<<<<< HEAD * Class containing utility functions for the * [ESP32](http://www.espruino.com/ESP32) * @url http://www.espruino.com/Reference#ESP32 @@ -655,6 +806,379 @@ declare class Timer { } /** +||||||| e51f7bfbe + * A class to support some simple Queue handling for RTOS queues + * @url http://www.espruino.com/Reference#Queue + */ +declare class Queue { + /** + * Creates a Queue Object + * @constructor + * + * @param {any} queueName - Name of the queue + * @returns {any} A Queue object + * @url http://www.espruino.com/Reference#l_Queue_Queue + */ + static new(queueName: any): any; + + /** + * reads one character from queue, if available + * @url http://www.espruino.com/Reference#l_Queue_read + */ + read(): void; + + /** + * Writes one character to queue + * + * @param {any} char - char to be send + * @url http://www.espruino.com/Reference#l_Queue_writeChar + */ + writeChar(char: any): void; + + /** + * logs list of queues + * @url http://www.espruino.com/Reference#l_Queue_log + */ + log(): void; +} + +/** + * A class to support some simple Task handling for RTOS tasks + * @url http://www.espruino.com/Reference#Task + */ +declare class Task { + /** + * Creates a Task Object + * @constructor + * + * @param {any} taskName - Name of the task + * @returns {any} A Task object + * @url http://www.espruino.com/Reference#l_Task_Task + */ + static new(taskName: any): any; + + /** + * Suspend task, be careful not to suspend Espruino task itself + * @url http://www.espruino.com/Reference#l_Task_suspend + */ + suspend(): void; + + /** + * Resumes a suspended task + * @url http://www.espruino.com/Reference#l_Task_resume + */ + resume(): void; + + /** + * returns name of actual task + * @returns {any} Name of current task + * @url http://www.espruino.com/Reference#l_Task_getCurrent + */ + getCurrent(): any; + + /** + * Sends a binary notify to task + * @url http://www.espruino.com/Reference#l_Task_notify + */ + notify(): void; + + /** + * logs list of tasks + * @url http://www.espruino.com/Reference#l_Task_log + */ + log(): void; +} + +/** + * A class to handle Timer on base of ESP32 Timer + * @url http://www.espruino.com/Reference#Timer + */ +declare class Timer { + /** + * Creates a Timer Object + * @constructor + * + * @param {any} timerName - Timer Name + * @param {number} group - Timer group + * @param {number} index - Timer index + * @param {number} isrIndex - isr (0 = Espruino, 1 = test) + * @returns {any} A Timer Object + * @url http://www.espruino.com/Reference#l_Timer_Timer + */ + static new(timerName: any, group: number, index: number, isrIndex: number): any; + + /** + * Starts a timer + * + * @param {number} duration - duration of timmer in micro secs + * @url http://www.espruino.com/Reference#l_Timer_start + */ + start(duration: number): void; + + /** + * Reschedules a timer, needs to be started at least once + * + * @param {number} duration - duration of timmer in micro secs + * @url http://www.espruino.com/Reference#l_Timer_reschedule + */ + reschedule(duration: number): void; + + /** + * logs list of timers + * @url http://www.espruino.com/Reference#l_Timer_log + */ + log(): void; +} + +/** + * Class containing utility functions for the + * [ESP32](http://www.espruino.com/ESP32) + * @url http://www.espruino.com/Reference#ESP32 + */ +declare class ESP32 { + /** + * + * @param {Pin} pin - Pin for Analog read + * @param {number} atten - Attenuate factor + * @url http://www.espruino.com/Reference#l_ESP32_setAtten + */ + static setAtten(pin: Pin, atten: number): void; + + /** + * Perform a hardware reset/reboot of the ESP32. + * @url http://www.espruino.com/Reference#l_ESP32_reboot + */ + static reboot(): void; + + /** + * Put device in deepsleep state for "us" microseconds. + * + * @param {number} us - Sleeptime in us + * @url http://www.espruino.com/Reference#l_ESP32_deepSleep + */ + static deepSleep(us: number): void; + + /** + * Put device in deepsleep state until interrupted by pin "pin". + * Eligible pin numbers are restricted to those [GPIOs designated + * as RTC GPIOs](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/gpio.html#gpio-summary). + * + * @param {Pin} pin - Pin to trigger wakeup + * @param {number} level - Logic level to trigger + * @url http://www.espruino.com/Reference#l_ESP32_deepSleepExt0 + */ + static deepSleepExt0(pin: Pin, level: number): void; + + /** + * Put device in deepsleep state until interrupted by pins in the "pinVar" array. + * The trigger "mode" determines the pin state which will wake up the device. + * Valid modes are: + * * `0: ESP_EXT1_WAKEUP_ALL_LOW` - all nominated pins must be set LOW to trigger wakeup + * * `1: ESP_EXT1_WAKEUP_ANY_HIGH` - any of nominated pins set HIGH will trigger wakeup + * Eligible pin numbers are restricted to those [GPIOs designated + * as RTC GPIOs](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/gpio.html#gpio-summary). + * + * @param {any} pinVar - Array of Pins to trigger wakeup + * @param {number} mode - Trigger mode + * @url http://www.espruino.com/Reference#l_ESP32_deepSleepExt1 + */ + static deepSleepExt1(pinVar: any, mode: number): void; + + /** + * Returns a variable identifying the cause of wakeup from deep sleep. + * Possible causes include: + * * `0: ESP_SLEEP_WAKEUP_UNDEFINED` - reset was not caused by exit from deep sleep + * * `2: ESP_SLEEP_WAKEUP_EXT0` - Wakeup caused by external signal using RTC_IO + * * `3: ESP_SLEEP_WAKEUP_EXT1` - Wakeup caused by external signal using RTC_CNTL + * * `4: ESP_SLEEP_WAKEUP_TIMER` - Wakeup caused by timer + * * `5: ESP_SLEEP_WAKEUP_TOUCHPAD` - Wakeup caused by touchpad + * * `6: ESP_SLEEP_WAKEUP_ULP` - Wakeup caused by ULP program + * @returns {number} The cause of the ESP32's wakeup from sleep + * @url http://www.espruino.com/Reference#l_ESP32_getWakeupCause + */ + static getWakeupCause(): number; + + /** + * Returns an object that contains details about the state of the ESP32 with the + * following fields: + * * `sdkVersion` - Version of the SDK. + * * `freeHeap` - Amount of free heap in bytes. + * * `BLE` - Status of BLE, enabled if true. + * * `Wifi` - Status of Wifi, enabled if true. + * * `minHeap` - Minimum heap, calculated by heap_caps_get_minimum_free_size + * @returns {any} The state of the ESP32 + * @url http://www.espruino.com/Reference#l_ESP32_getState + */ + static getState(): any; + + /** + * + * @param {number} level - which events should be shown (GAP=1, GATTS=2, GATTC=4). Use 255 for everything + * @url http://www.espruino.com/Reference#l_ESP32_setBLE_Debug + */ + static setBLE_Debug(level: number): void; + + /** + * Switches Bluetooth off/on, removes saved code from Flash, resets the board, and + * on restart creates jsVars depending on available heap (actual additional 1800) + * + * @param {boolean} enable - switches Bluetooth on or off + * @url http://www.espruino.com/Reference#l_ESP32_enableBLE + */ + static enableBLE(enable: boolean): void; + + /** + * Switches Wifi off/on, removes saved code from Flash, resets the board, and on + * restart creates jsVars depending on available heap (actual additional 3900) + * + * @param {boolean} enable - switches Wifi on or off + * @url http://www.espruino.com/Reference#l_ESP32_enableWifi + */ + static enableWifi(enable: boolean): void; + + /** + * This function is useful for ESP32 [OTA Updates](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/ota.html) + * Normally Espruino is uploaded to the `factory` partition so this isn't so useful, + * but it is possible to upload Espruino to the `ota_0` partition (or ota_1 if a different table has been added). + * If this is the case, you can use this function to mark the currently running version of Espruino as good or bad. + * * If set as valid, Espruino will continue running, and the fact that everything is ok is written to flash + * * If set as invalid (false) Espruino will mark itself as not working properly and will reboot. The ESP32 bootloader + * will then start and will load any other partition it can find that is marked as ok. + * + * @param {boolean} isValid - Set whether this app is valid or not. If `isValid==false` the device will reboot. + * @url http://www.espruino.com/Reference#l_ESP32_setOTAValid + */ + static setOTAValid(isValid: boolean): void; + + +} + +/** +======= + * Class containing utility functions for the + * [ESP32](http://www.espruino.com/ESP32) + * @url http://www.espruino.com/Reference#ESP32 + */ +declare class ESP32 { + /** + * + * @param {Pin} pin - Pin for Analog read + * @param {number} atten - Attenuate factor + * @url http://www.espruino.com/Reference#l_ESP32_setAtten + */ + static setAtten(pin: Pin, atten: number): void; + + /** + * Perform a hardware reset/reboot of the ESP32. + * @url http://www.espruino.com/Reference#l_ESP32_reboot + */ + static reboot(): void; + + /** + * Put device in deepsleep state for "us" microseconds. + * + * @param {number} us - Sleeptime in us + * @url http://www.espruino.com/Reference#l_ESP32_deepSleep + */ + static deepSleep(us: number): void; + + /** + * Put device in deepsleep state until interrupted by pin "pin". + * Eligible pin numbers are restricted to those [GPIOs designated + * as RTC GPIOs](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/gpio.html#gpio-summary). + * + * @param {Pin} pin - Pin to trigger wakeup + * @param {number} level - Logic level to trigger + * @url http://www.espruino.com/Reference#l_ESP32_deepSleepExt0 + */ + static deepSleepExt0(pin: Pin, level: number): void; + + /** + * Put device in deepsleep state until interrupted by pins in the "pinVar" array. + * The trigger "mode" determines the pin state which will wake up the device. + * Valid modes are: + * * `0: ESP_EXT1_WAKEUP_ALL_LOW` - all nominated pins must be set LOW to trigger wakeup + * * `1: ESP_EXT1_WAKEUP_ANY_HIGH` - any of nominated pins set HIGH will trigger wakeup + * Eligible pin numbers are restricted to those [GPIOs designated + * as RTC GPIOs](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/gpio.html#gpio-summary). + * + * @param {any} pinVar - Array of Pins to trigger wakeup + * @param {number} mode - Trigger mode + * @url http://www.espruino.com/Reference#l_ESP32_deepSleepExt1 + */ + static deepSleepExt1(pinVar: any, mode: number): void; + + /** + * Returns a variable identifying the cause of wakeup from deep sleep. + * Possible causes include: + * * `0: ESP_SLEEP_WAKEUP_UNDEFINED` - reset was not caused by exit from deep sleep + * * `2: ESP_SLEEP_WAKEUP_EXT0` - Wakeup caused by external signal using RTC_IO + * * `3: ESP_SLEEP_WAKEUP_EXT1` - Wakeup caused by external signal using RTC_CNTL + * * `4: ESP_SLEEP_WAKEUP_TIMER` - Wakeup caused by timer + * * `5: ESP_SLEEP_WAKEUP_TOUCHPAD` - Wakeup caused by touchpad + * * `6: ESP_SLEEP_WAKEUP_ULP` - Wakeup caused by ULP program + * @returns {number} The cause of the ESP32's wakeup from sleep + * @url http://www.espruino.com/Reference#l_ESP32_getWakeupCause + */ + static getWakeupCause(): number; + + /** + * Returns an object that contains details about the state of the ESP32 with the + * following fields: + * * `sdkVersion` - Version of the SDK. + * * `freeHeap` - Amount of free heap in bytes. + * * `BLE` - Status of BLE, enabled if true. + * * `Wifi` - Status of Wifi, enabled if true. + * * `minHeap` - Minimum heap, calculated by heap_caps_get_minimum_free_size + * @returns {any} The state of the ESP32 + * @url http://www.espruino.com/Reference#l_ESP32_getState + */ + static getState(): any; + + /** + * + * @param {number} level - which events should be shown (GAP=1, GATTS=2, GATTC=4). Use 255 for everything + * @url http://www.espruino.com/Reference#l_ESP32_setBLE_Debug + */ + static setBLE_Debug(level: number): void; + + /** + * Switches Bluetooth off/on, removes saved code from Flash, resets the board, and + * on restart creates jsVars depending on available heap (actual additional 1800) + * + * @param {boolean} enable - switches Bluetooth on or off + * @url http://www.espruino.com/Reference#l_ESP32_enableBLE + */ + static enableBLE(enable: ShortBoolean): void; + + /** + * Switches Wifi off/on, removes saved code from Flash, resets the board, and on + * restart creates jsVars depending on available heap (actual additional 3900) + * + * @param {boolean} enable - switches Wifi on or off + * @url http://www.espruino.com/Reference#l_ESP32_enableWifi + */ + static enableWifi(enable: ShortBoolean): void; + + /** + * This function is useful for ESP32 [OTA Updates](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/ota.html) + * Normally Espruino is uploaded to the `factory` partition so this isn't so useful, + * but it is possible to upload Espruino to the `ota_0` partition (or ota_1 if a different table has been added). + * If this is the case, you can use this function to mark the currently running version of Espruino as good or bad. + * * If set as valid, Espruino will continue running, and the fact that everything is ok is written to flash + * * If set as invalid (false) Espruino will mark itself as not working properly and will reboot. The ESP32 bootloader + * will then start and will load any other partition it can find that is marked as ok. + * + * @param {boolean} isValid - Set whether this app is valid or not. If `isValid==false` the device will reboot. + * @url http://www.espruino.com/Reference#l_ESP32_setOTAValid + */ + static setOTAValid(isValid: ShortBoolean): void; + + +} + +/** +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * This is a built-in class to allow you to use the ESP8266 NodeMCU boards' pin * namings to access pins. It is only available on ESP8266-based boards. * @url http://www.espruino.com/Reference#NodeMCU @@ -876,6 +1400,7 @@ declare class Nucleo { } /** +<<<<<<< HEAD * Class containing utility functions for the [Bangle.js Smart * Watch](http://www.espruino.com/Bangle.js) * @url http://www.espruino.com/Reference#Bangle @@ -3801,6 +4326,1424 @@ declare class NRF { } /** +||||||| e51f7bfbe + * The NRF class is for controlling functionality of the Nordic nRF51/nRF52 chips. + * Most functionality is related to Bluetooth Low Energy, however there are also + * some functions related to NFC that apply to NRF52-based devices. + * @url http://www.espruino.com/Reference#NRF + */ +declare class NRF { + /** + * @returns {any} An object + * @url http://www.espruino.com/Reference#l_NRF_getSecurityStatus + */ + static getSecurityStatus(): NRFSecurityStatus; + + /** + * @returns {any} An object + * @url http://www.espruino.com/Reference#l_NRF_getAddress + */ + static getAddress(): any; + + /** + * + * @param {any} data - The service (and characteristics) to advertise + * @param {any} options - Optional object containing options + * @url http://www.espruino.com/Reference#l_NRF_setServices + */ + static setServices(data: any, options: any): void; + + /** + * + * @param {any} data - The data to advertise as an object - see below for more info + * @param {any} [options] - [optional] An object of options + * @url http://www.espruino.com/Reference#l_NRF_setAdvertising + */ + static setAdvertising(data: any, options?: any): void; + + /** + * Called when a host device connects to Espruino. The first argument contains the + * address. + * @param {string} event - The event to listen to. + * @param {(addr: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `addr` The address of the device that has connected + * @url http://www.espruino.com/Reference#l_NRF_connect + */ + static on(event: "connect", callback: (addr: any) => void): void; + + /** + * Called when a host device disconnects from Espruino. + * The most common reason is: + * * 19 - `REMOTE_USER_TERMINATED_CONNECTION` + * * 22 - `LOCAL_HOST_TERMINATED_CONNECTION` + * @param {string} event - The event to listen to. + * @param {(reason: number) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `reason` The reason code reported back by the BLE stack - see Nordic's [`ble_hci.h` file](https://github.com/espruino/Espruino/blob/master/targetlibs/nrf5x_12/components/softdevice/s132/headers/ble_hci.h#L71) for more information + * @url http://www.espruino.com/Reference#l_NRF_disconnect + */ + static on(event: "disconnect", callback: (reason: number) => void): void; + + /** + * Called when the Nordic Bluetooth stack (softdevice) generates an error. In pretty + * much all cases an Exception will also have been thrown. + * @param {string} event - The event to listen to. + * @param {(msg: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `msg` The error string + * @url http://www.espruino.com/Reference#l_NRF_error + */ + static on(event: "error", callback: (msg: any) => void): void; + + /** + * (Added in 2v19) Called when a central device connects to Espruino, pairs, and sends a passkey that Espruino should display. + * For this to be used, you'll have to specify that your device has a display using `NRF.setSecurity({mitm:1, display:1});` + * For instance: + * ``` + * NRF.setSecurity({mitm:1, display:1}); + * NRF.on("passkey", key => print("Enter PIN: ",passkey)); + * ``` + * It is also possible to specify a static passkey with `NRF.setSecurity({passkey:"123456", mitm:1, display:1});` + * in which case no `passkey` event handler is needed (this method works on Espruino 2v02 and later) + * **Note:** A similar event, [`BluetoothDevice.on("passkey", ...)`](http://www.espruino.com/Reference#l_BluetoothDevice_passkey) is available + * for when Espruino is connecting *to* another device (central mode). + * @param {string} event - The event to listen to. + * @param {(passkey: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `passkey` A 6 character numeric String to be displayed + * @url http://www.espruino.com/Reference#l_NRF_passkey + */ + static on(event: "passkey", callback: (passkey: any) => void): void; + + /** + * Contains updates on the security of the current Bluetooth link. + * See Nordic's `ble_gap_evt_auth_status_t` structure for more information. + * @param {string} event - The event to listen to. + * @param {(status: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `status` An object containing `{auth_status,bonded,lv4,kdist_own,kdist_peer} + * @url http://www.espruino.com/Reference#l_NRF_security + */ + static on(event: "security", callback: (status: any) => void): void; + + /** + * Called when Bluetooth advertising starts or stops on Espruino + * @param {string} event - The event to listen to. + * @param {(isAdvertising: boolean) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `isAdvertising` Whether we are advertising or not + * @url http://www.espruino.com/Reference#l_NRF_advertising + */ + static on(event: "advertising", callback: (isAdvertising: boolean) => void): void; + + /** + * Called during the bonding process to update on status + * `status` is one of: + * * `"request"` - Bonding has been requested in code via `NRF.startBonding` + * * `"start"` - The bonding procedure has started + * * `"success"` - The bonding procedure has succeeded (`NRF.startBonding`'s promise resolves) + * * `"fail"` - The bonding procedure has failed (`NRF.startBonding`'s promise rejects) + * @param {string} event - The event to listen to. + * @param {(status: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `status` One of `'request'/'start'/'success'/'fail'` + * @url http://www.espruino.com/Reference#l_NRF_bond + */ + static on(event: "bond", callback: (status: any) => void): void; + + /** + * Called with a single byte value when Espruino is set up as a HID device and the + * computer it is connected to sends a HID report back to Espruino. This is usually + * used for handling indications such as the Caps Lock LED. + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_HID + */ + static on(event: "HID", callback: () => void): void; + + /** + * Called with discovered services when discovery is finished + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_servicesDiscover + */ + static on(event: "servicesDiscover", callback: () => void): void; + + /** + * Called with discovered characteristics when discovery is finished + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_characteristicsDiscover + */ + static on(event: "characteristicsDiscover", callback: () => void): void; + + /** + * Called when an NFC field is detected + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_NFCon + */ + static on(event: "NFCon", callback: () => void): void; + + /** + * Called when an NFC field is no longer detected + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_NFCoff + */ + static on(event: "NFCoff", callback: () => void): void; + + /** + * When NFC is started with `NRF.nfcStart`, this is fired when NFC data is + * received. It doesn't get called if NFC is started with `NRF.nfcURL` or + * `NRF.nfcRaw` + * @param {string} event - The event to listen to. + * @param {(arr: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `arr` An ArrayBuffer containign the received data + * @url http://www.espruino.com/Reference#l_NRF_NFCrx + */ + static on(event: "NFCrx", callback: (arr: any) => void): void; + + /** + * If a device is connected to Espruino, disconnect from it. + * @url http://www.espruino.com/Reference#l_NRF_disconnect + */ + static disconnect(): void; + + /** + * Disable Bluetooth advertising and disconnect from any device that connected to + * Puck.js as a peripheral (this won't affect any devices that Puck.js initiated + * connections to). + * This makes Puck.js undiscoverable, so it can't be connected to. + * Use `NRF.wake()` to wake up and make Puck.js connectable again. + * @url http://www.espruino.com/Reference#l_NRF_sleep + */ + static sleep(): void; + + /** + * Enable Bluetooth advertising (this is enabled by default), which allows other + * devices to discover and connect to Puck.js. + * Use `NRF.sleep()` to disable advertising. + * @url http://www.espruino.com/Reference#l_NRF_wake + */ + static wake(): void; + + /** + * Restart the Bluetooth softdevice (if there is currently a BLE connection, it + * will queue a restart to be done when the connection closes). + * You shouldn't need to call this function in normal usage. However, Nordic's BLE + * softdevice has some settings that cannot be reset. For example there are only a + * certain number of unique UUIDs. Once these are all used the only option is to + * restart the softdevice to clear them all out. + * + * @param {any} [callback] - [optional] A function to be called while the softdevice is uninitialised. Use with caution - accessing console/bluetooth will almost certainly result in a crash. + * @url http://www.espruino.com/Reference#l_NRF_restart + */ + static restart(callback?: any): void; + + /** + * Delete all data stored for all peers (bonding data used for secure connections). This cannot be done + * while a connection is active, so if there is a connection it will be postponed until everything is disconnected + * (which can be done by calling `NRF.disconnect()` and waiting). + * Booting your device while holding all buttons down together should also have the same effect. + * + * @param {any} [callback] - [optional] A function to be called while the softdevice is uninitialised. Use with caution - accessing console/bluetooth will almost certainly result in a crash. + * @url http://www.espruino.com/Reference#l_NRF_eraseBonds + */ + static eraseBonds(callback?: any): void; + + /** + * Get this device's default or current Bluetooth MAC address. + * For Puck.js, the last 5 characters of this (e.g. `ee:ff`) are used in the + * device's advertised Bluetooth name. + * + * @param {boolean} current - If true, return the current address rather than the default + * @returns {any} MAC address - a string of the form 'aa:bb:cc:dd:ee:ff' + * @url http://www.espruino.com/Reference#l_NRF_getAddress + */ + static getAddress(current: boolean): any; + + /** + * Set this device's default Bluetooth MAC address: + * ``` + * NRF.setAddress("ff:ee:dd:cc:bb:aa random"); + * ``` + * Addresses take the form: + * * `"ff:ee:dd:cc:bb:aa"` or `"ff:ee:dd:cc:bb:aa public"` for a public address + * * `"ff:ee:dd:cc:bb:aa random"` for a random static address (the default for + * Espruino) + * This may throw a `INVALID_BLE_ADDR` error if the upper two bits of the address + * don't match the address type. + * To change the address, Espruino must restart the softdevice. It will only do so + * when it is disconnected from other devices. + * + * @param {any} addr - The address to use (as a string) + * @url http://www.espruino.com/Reference#l_NRF_setAddress + */ + static setAddress(addr: any): void; + + /** + * Try to resolve a **bonded** peer's address from a random private resolvable address. If the peer + * is not bonded, there will be no IRK and `undefined` will be returned. + * A bunch of devices, especially smartphones, implement address randomisation and periodically change + * their bluetooth address to prevent being tracked. + * If such a device uses a "random private resolvable address", that address is generated + * with the help of an identity resolving key (IRK) that is exchanged during bonding. + * If we know the IRK of a device, we can check if an address was potentially generated by that device. + * The following will check an address against the IRKs of all bonded devices, + * and return the actual address of a bonded device if the given address was likely generated using that device's IRK: + * ``` + * NRF.on('connect',addr=> { + * // addr could be "aa:bb:cc:dd:ee:ff private-resolvable" + * if (addr.endsWith("private-resolvable")) { + * let resolved = NRF.resolveAddress(addr); + * // resolved is "aa:bb:cc:dd:ee:ff public" + * if (resolved) addr = resolved; + * } + * console.log("Device connected: ", addr); + * }) + * ``` + * You can get the current connection's address using `NRF.getSecurityStatus().connected_addr`, + * so can for instance do `NRF.resolveAddress(NRF.getSecurityStatus().connected_addr)`. + * + * @param {any} options - The address that should be resolved. + * @returns {any} The resolved address, or `undefined` if it couldn't be resolved. + * @url http://www.espruino.com/Reference#l_NRF_resolveAddress + */ + static resolveAddress(options: any): any; + + /** + * Get the battery level in volts (the voltage that the NRF chip is running off + * of). + * This is the battery level of the device itself - it has nothing to with any + * device that might be connected. + * @returns {number} Battery level in volts + * @url http://www.espruino.com/Reference#l_NRF_getBattery + */ + static getBattery(): number; + + /** + * Change the data that Espruino advertises. + * Data can be of the form `{ UUID : data_as_byte_array }`. The UUID should be a + * [Bluetooth Service + * ID](https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx). + * For example to return battery level at 95%, do: + * ``` + * NRF.setAdvertising({ + * 0x180F : [95] // Service data 0x180F = 95 + * }); + * ``` + * Or you could report the current temperature: + * ``` + * setInterval(function() { + * NRF.setAdvertising({ + * 0x1809 : [Math.round(E.getTemperature())] + * }); + * }, 30000); + * ``` + * If you specify a value for the object key, Service Data is advertised. However + * if you specify `undefined`, the Service UUID is advertised: + * ``` + * NRF.setAdvertising({ + * 0x180D : undefined // Advertise service UUID 0x180D (HRM) + * }); + * ``` + * Service UUIDs can also be supplied in the second argument of `NRF.setServices`, + * but those go in the scan response packet. + * You can also supply the raw advertising data in an array. For example to + * advertise as an Eddystone beacon: + * ``` + * NRF.setAdvertising([0x03, // Length of Service List + * 0x03, // Param: Service List + * 0xAA, 0xFE, // Eddystone ID + * 0x13, // Length of Service Data + * 0x16, // Service Data + * 0xAA, 0xFE, // Eddystone ID + * 0x10, // Frame type: URL + * 0xF8, // Power + * 0x03, // https:// + * 'g','o','o','.','g','l','/','B','3','J','0','O','c'], + * {interval:100}); + * ``` + * (However for Eddystone we'd advise that you use the [Espruino Eddystone + * library](/Puck.js+Eddystone)) + * **Note:** When specifying data as an array, certain advertising options such as + * `discoverable` and `showName` won't have any effect. + * **Note:** The size of Bluetooth LE advertising packets is limited to 31 bytes. + * If you want to advertise more data, consider using an array for `data` (See + * below), or `NRF.setScanResponse`. + * You can even specify an array of arrays or objects, in which case each + * advertising packet will be used in turn - for instance to make your device + * advertise battery level and its name as well as both Eddystone and iBeacon : + * ``` + * NRF.setAdvertising([ + * {0x180F : [E.getBattery()]}, // normal advertising, with battery % + * require("ble_ibeacon").get(...), // iBeacon + * require("ble_eddystone").get(...), // eddystone + * ], {interval:300}); + * ``` + * `options` is an object, which can contain: + * ``` + * { + * name: "Hello" // The name of the device + * showName: true/false // include full name, or nothing + * discoverable: true/false // general discoverable, or limited - default is limited + * connectable: true/false // whether device is connectable - default is true + * scannable : true/false // whether device can be scanned for scan response packets - default is true + * whenConnected : true/false // keep advertising when connected (nRF52 only) + * // switches to advertising as non-connectable when it is connected + * interval: 600 // Advertising interval in msec, between 20 and 10000 (default is 375ms) + * manufacturer: 0x0590 // IF sending manufacturer data, this is the manufacturer ID + * manufacturerData: [...] // IF sending manufacturer data, this is an array of data + * phy: "1mbps/2mbps/coded" // (NRF52833/NRF52840 only) use the long-range coded phy for transmission (1mbps default) + * } + * ``` + * Setting `connectable` and `scannable` to false gives the lowest power + * consumption as the BLE radio doesn't have to listen after sending advertising. + * **NOTE:** Non-`connectable` advertising can't have an advertising interval less + * than 100ms according to the BLE spec. + * So for instance to set the name of Puck.js without advertising any other data + * you can just use the command: + * ``` + * NRF.setAdvertising({},{name:"Hello"}); + * ``` + * You can also specify 'manufacturer data', which is another form of advertising + * data. We've registered the Manufacturer ID 0x0590 (as Pur3 Ltd) for use with + * *Official Espruino devices* - use it to advertise whatever data you'd like, but + * we'd recommend using JSON. + * For example by not advertising a device name you can send up to 24 bytes of JSON + * on Espruino's manufacturer ID: + * ``` + * var data = {a:1,b:2}; + * NRF.setAdvertising({},{ + * showName:false, + * manufacturer:0x0590, + * manufacturerData:JSON.stringify(data) + * }); + * ``` + * If you're using [EspruinoHub](https://github.com/espruino/EspruinoHub) then it + * will automatically decode this into the following MQTT topics: + * * `/ble/advertise/ma:c_:_a:dd:re:ss/espruino` -> `{"a":10,"b":15}` + * * `/ble/advertise/ma:c_:_a:dd:re:ss/a` -> `1` + * * `/ble/advertise/ma:c_:_a:dd:re:ss/b` -> `2` + * Note that **you only have 24 characters available for JSON**, so try to use the + * shortest field names possible and avoid floating point values that can be very + * long when converted to a String. + * + * @param {any} data - The service data to advertise as an object - see below for more info + * @param {any} [options] - [optional] Object of options + * @url http://www.espruino.com/Reference#l_NRF_setAdvertising + */ + static setAdvertising(data: any, options?: any): void; + + /** + * This is just like `NRF.setAdvertising`, except instead of advertising the data, + * it returns the packet that would be advertised as an array. + * + * @param {any} data - The data to advertise as an object + * @param {any} [options] - [optional] An object of options + * @returns {any} An array containing the advertising data + * @url http://www.espruino.com/Reference#l_NRF_getAdvertisingData + */ + static getAdvertisingData(data: any, options?: any): any; + + /** + * The raw scan response data should be supplied as an array. For example to return + * "Sample" for the device name: + * ``` + * NRF.setScanResponse([0x07, // Length of Data + * 0x09, // Param: Complete Local Name + * 'S', 'a', 'm', 'p', 'l', 'e']); + * ``` + * **Note:** `NRF.setServices(..., {advertise:[ ... ]})` writes advertised services + * into the scan response - so you can't use both `advertise` and `NRF.setServices` + * or one will overwrite the other. + * + * @param {any} data - The data to for the scan response + * @url http://www.espruino.com/Reference#l_NRF_setScanResponse + */ + static setScanResponse(data: any): void; + + /** + * Change the services and characteristics Espruino advertises. + * If you want to **change** the value of a characteristic, you need to use + * `NRF.updateServices()` instead + * To expose some information on Characteristic `ABCD` on service `BCDE` you could + * do: + * ``` + * NRF.setServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "Hello", + * readable : true + * } + * } + * }); + * ``` + * Or to allow the 3 LEDs to be controlled by writing numbers 0 to 7 to a + * characteristic, you can do the following. `evt.data` is an ArrayBuffer. + * ``` + * NRF.setServices({ + * 0xBCDE : { + * 0xABCD : { + * writable : true, + * onWrite : function(evt) { + * digitalWrite([LED3,LED2,LED1], evt.data[0]); + * } + * } + * } + * }); + * ``` + * You can supply many different options: + * ``` + * NRF.setServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "Hello", // optional + * maxLen : 5, // optional (otherwise is length of initial value) + * broadcast : false, // optional, default is false + * readable : true, // optional, default is false + * writable : true, // optional, default is false + * notify : true, // optional, default is false + * indicate : true, // optional, default is false + * description: "My Characteristic", // optional, default is null, + * security: { // optional - see NRF.setSecurity + * read: { // optional + * encrypted: false, // optional, default is false + * mitm: false, // optional, default is false + * lesc: false, // optional, default is false + * signed: false // optional, default is false + * }, + * write: { // optional + * encrypted: true, // optional, default is false + * mitm: false, // optional, default is false + * lesc: false, // optional, default is false + * signed: false // optional, default is false + * } + * }, + * onWrite : function(evt) { // optional + * console.log("Got ", evt.data); // an ArrayBuffer + * }, + * onWriteDesc : function(evt) { // optional - called when the 'cccd' descriptor is written + * // for example this is called when notifications are requested by the client: + * console.log("Notifications enabled = ", evt.data[0]&1); + * } + * } + * // more characteristics allowed + * } + * // more services allowed + * }); + * ``` + * **Note:** UUIDs can be integers between `0` and `0xFFFF`, strings of the form + * `"ABCD"`, or strings of the form `"ABCDABCD-ABCD-ABCD-ABCD-ABCDABCDABCD"` + * `options` can be of the form: + * ``` + * NRF.setServices(undefined, { + * hid : new Uint8Array(...), // optional, default is undefined. Enable BLE HID support + * uart : true, // optional, default is true. Enable BLE UART support + * advertise: [ '180D' ] // optional, list of service UUIDs to advertise + * ancs : true, // optional, Bangle.js-only, enable Apple ANCS support for notifications (see `NRF.ancs*`) + * ams : true // optional, Bangle.js-only, enable Apple AMS support for media control (see `NRF.ams*`) + * cts : true // optional, Bangle.js-only, enable Apple Current Time Service support (see `NRF.ctsGetTime`) + * }); + * ``` + * To enable BLE HID, you must set `hid` to an array which is the BLE report + * descriptor. The easiest way to do this is to use the `ble_hid_controls` or + * `ble_hid_keyboard` modules. + * **Note:** Just creating a service doesn't mean that the service will be + * advertised. It will only be available after a device connects. To advertise, + * specify the UUIDs you wish to advertise in the `advertise` field of the second + * `options` argument. For example this will create and advertise a heart rate + * service: + * ``` + * NRF.setServices({ + * 0x180D: { // heart_rate + * 0x2A37: { // heart_rate_measurement + * notify: true, + * value : [0x06, heartrate], + * } + * } + * }, { advertise: [ '180D' ] }); + * ``` + * You may specify 128 bit UUIDs to advertise, however you may get a `DATA_SIZE` + * exception because there is insufficient space in the Bluetooth LE advertising + * packet for the 128 bit UART UUID as well as the UUID you specified. In this case + * you can add `uart:false` after the `advertise` element to disable the UART, + * however you then be unable to connect to Puck.js's console via Bluetooth. + * If you absolutely require two or more 128 bit UUIDs then you will have to + * specify your own raw advertising data packets with `NRF.setAdvertising` + * **Note:** The services on Espruino can only be modified when there is no device + * connected to it as it requires a restart of the Bluetooth stack. **iOS devices + * will 'cache' the list of services** so apps like NRF Connect may incorrectly + * display the old services even after you have modified them. To fix this, disable + * and re-enable Bluetooth on your iOS device, or use an Android device to run NRF + * Connect. + * **Note:** Not all combinations of security configuration values are valid, the + * valid combinations are: encrypted, encrypted + mitm, lesc, signed, signed + + * mitm. See `NRF.setSecurity` for more information. + * + * @param {any} data - The service (and characteristics) to advertise + * @param {any} [options] - [optional] Object containing options + * @url http://www.espruino.com/Reference#l_NRF_setServices + */ + static setServices(data: { [key: number]: { [key: number]: { value?: string, maxLen?: number, broadcast?: boolean, readable?: boolean, writable?: boolean, notify?: boolean, indicate?: boolean, description?: string, security?: { read?: { encrypted?: boolean, mitm?: boolean, lesc?: boolean, signed?: boolean }, write?: { encrypted?: boolean, mitm?: boolean, lesc?: boolean, signed?: boolean } }, onWrite?: (evt: { data: ArrayBuffer }) => void } } }, options?: any): void; + + /** + * Update values for the services and characteristics Espruino advertises. Only + * services and characteristics previously declared using `NRF.setServices` are + * affected. + * To update the '0xABCD' characteristic in the '0xBCDE' service: + * ``` + * NRF.updateServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "World" + * } + * } + * }); + * ``` + * You can also use 128 bit UUIDs, for example + * `"b7920001-3c1b-4b40-869f-3c0db9be80c6"`. + * To define a service and characteristic and then notify connected clients of a + * change to it when a button is pressed: + * ``` + * NRF.setServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "Hello", + * maxLen : 20, + * notify: true + * } + * } + * }); + * setWatch(function() { + * NRF.updateServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "World!", + * notify: true + * } + * } + * }); + * }, BTN, { repeat:true, edge:"rising", debounce: 50 }); + * ``` + * This only works if the characteristic was created with `notify: true` using + * `NRF.setServices`, otherwise the characteristic will be updated but no + * notification will be sent. + * Also note that `maxLen` was specified. If it wasn't then the maximum length of + * the characteristic would have been 5 - the length of `"Hello"`. + * To indicate (i.e. notify with ACK) connected clients of a change to the '0xABCD' + * characteristic in the '0xBCDE' service: + * ``` + * NRF.updateServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "World", + * indicate: true + * } + * } + * }); + * ``` + * This only works if the characteristic was created with `indicate: true` using + * `NRF.setServices`, otherwise the characteristic will be updated but no + * notification will be sent. + * **Note:** See `NRF.setServices` for more information + * + * @param {any} data - The service (and characteristics) to update + * @url http://www.espruino.com/Reference#l_NRF_updateServices + */ + static updateServices(data: any): void; + + /** + * Start/stop listening for BLE advertising packets within range. Returns a + * `BluetoothDevice` for each advertising packet. **By default this is not an active + * scan, so Scan Response advertising data is not included (see below)** + * ``` + * // Start scanning + * packets=10; + * NRF.setScan(function(d) { + * packets--; + * if (packets<=0) + * NRF.setScan(); // stop scanning + * else + * console.log(d); // print packet info + * }); + * ``` + * Each `BluetoothDevice` will look a bit like: + * ``` + * BluetoothDevice { + * "id": "aa:bb:cc:dd:ee:ff", // address + * "rssi": -89, // signal strength + * "services": [ "128bit-uuid", ... ], // zero or more service UUIDs + * "data": new Uint8Array([ ... ]).buffer, // ArrayBuffer of returned data + * "serviceData" : { "0123" : [ 1 ] }, // if service data is in 'data', it's extracted here + * "manufacturer" : 0x1234, // if manufacturer data is in 'data', the 16 bit manufacturer ID is extracted here + * "manufacturerData" : new Uint8Array([...]).buffer, // if manufacturer data is in 'data', the data is extracted here as an ArrayBuffer + * "name": "DeviceName" // the advertised device name + * } + * ``` + * You can also supply a set of filters (as described in `NRF.requestDevice`) as a + * second argument, which will allow you to filter the devices you get a callback + * for. This helps to cut down on the time spent processing JavaScript code in + * areas with a lot of Bluetooth advertisements. For example to find only devices + * with the manufacturer data `0x0590` (Espruino's ID) you could do: + * ``` + * NRF.setScan(function(d) { + * console.log(d.manufacturerData); + * }, { filters: [{ manufacturerData:{0x0590:{}} }] }); + * ``` + * You can also specify `active:true` in the second argument to perform active + * scanning (this requests scan response packets) from any devices it finds. + * **Note:** Using a filter in `setScan` filters each advertising packet + * individually. As a result, if you filter based on a service UUID and a device + * advertises with multiple packets (or a scan response when `active:true`) only + * the packets matching the filter are returned. To aggregate multiple packets you + * can use `NRF.findDevices`. + * **Note:** BLE advertising packets can arrive quickly - faster than you'll be + * able to print them to the console. It's best only to print a few, or to use a + * function like `NRF.findDevices(..)` which will collate a list of available + * devices. + * **Note:** Using setScan turns the radio's receive mode on constantly. This can + * draw a *lot* of power (12mA or so), so you should use it sparingly or you can + * run your battery down quickly. + * + * @param {any} callback - The callback to call with received advertising packets, or undefined to stop + * @param {any} [options] - [optional] An object `{filters: ...}` (as would be passed to `NRF.requestDevice`) to filter devices by + * @url http://www.espruino.com/Reference#l_NRF_setScan + */ + static setScan(callback: any, options?: any): void; + + /** + * This function can be used to quickly filter through Bluetooth devices. + * For instance if you wish to scan for multiple different types of device at the + * same time then you could use `NRF.findDevices` with all the filters you're + * interested in. When scanning is finished you can then use `NRF.filterDevices` to + * pick out just the devices of interest. + * ``` + * // the two types of device we're interested in + * var filter1 = [{serviceData:{"fe95":{}}}]; + * var filter2 = [{namePrefix:"Pixl.js"}]; + * // the following filter will return both types of device + * var allFilters = filter1.concat(filter2); + * // now scan for both types of device, and filter them out afterwards + * NRF.findDevices(function(devices) { + * var devices1 = NRF.filterDevices(devices, filter1); + * var devices2 = NRF.filterDevices(devices, filter2); + * // ... + * }, {filters : allFilters}); + * ``` + * + * @param {any} devices - An array of `BluetoothDevice` objects, from `NRF.findDevices` or similar + * @param {any} filters - A list of filters (as would be passed to `NRF.requestDevice`) to filter devices by + * @returns {any} An array of `BluetoothDevice` objects that match the given filters + * @url http://www.espruino.com/Reference#l_NRF_filterDevices + */ + static filterDevices(devices: any, filters: any): any; + + /** + * Utility function to return a list of BLE devices detected in range. Behind the + * scenes, this uses `NRF.setScan(...)` and collates the results. + * ``` + * NRF.findDevices(function(devices) { + * console.log(devices); + * }, 1000); + * ``` + * prints something like: + * ``` + * [ + * BluetoothDevice { + * "id" : "e7:e0:57:ad:36:a2 random", + * "rssi": -45, + * "services": [ "4567" ], + * "serviceData" : { "0123" : [ 1 ] }, + * "manufacturer" : 1424, + * "manufacturerData" : new Uint8Array([ ... ]).buffer, + * "data": new ArrayBuffer([ ... ]).buffer, + * "name": "Puck.js 36a2" + * }, + * BluetoothDevice { + * "id": "c0:52:3f:50:42:c9 random", + * "rssi": -65, + * "data": new ArrayBuffer([ ... ]), + * "name": "Puck.js 8f57" + * } + * ] + * ``` + * For more information on the structure returned, see `NRF.setScan`. + * If you want to scan only for specific devices you can replace the timeout with + * an object of the form `{filters: ..., timeout : ..., active: bool}` using the + * filters described in `NRF.requestDevice`. For example to search for devices with + * Espruino's `manufacturerData`: + * ``` + * NRF.findDevices(function(devices) { + * ... + * }, {timeout : 2000, filters : [{ manufacturerData:{0x0590:{}} }] }); + * ``` + * You could then use + * [`BluetoothDevice.gatt.connect(...)`](/Reference#l_BluetoothRemoteGATTServer_connect) + * on the device returned to make a connection. + * You can also use [`NRF.connect(...)`](/Reference#l_NRF_connect) on just the `id` + * string returned, which may be useful if you always want to connect to a specific + * device. + * **Note:** Using findDevices turns the radio's receive mode on for 2000ms (or + * however long you specify). This can draw a *lot* of power (12mA or so), so you + * should use it sparingly or you can run your battery down quickly. + * **Note:** The 'data' field contains the data of *the last packet received*. + * There may have been more packets. To get data for each packet individually use + * `NRF.setScan` instead. + * + * @param {any} callback - The callback to call with received advertising packets (as `BluetoothDevice`), or undefined to stop + * @param {any} [options] - [optional] A time in milliseconds to scan for (defaults to 2000), Or an optional object `{filters: ..., timeout : ..., active: bool}` (as would be passed to `NRF.requestDevice`) to filter devices by + * @url http://www.espruino.com/Reference#l_NRF_findDevices + */ + static findDevices(callback: (devices: BluetoothDevice[]) => void, options?: number | { filters?: NRFFilters[], timeout?: number, active?: boolean }): void; + + /** + * Start/stop listening for RSSI values on the currently active connection (where + * This device is a peripheral and is being connected to by a 'central' device) + * ``` + * // Start scanning + * NRF.setRSSIHandler(function(rssi) { + * console.log(rssi); // prints -85 (or similar) + * }); + * // Stop Scanning + * NRF.setRSSIHandler(); + * ``` + * RSSI is the 'Received Signal Strength Indication' in dBm + * + * @param {any} callback - The callback to call with the RSSI value, or undefined to stop + * @url http://www.espruino.com/Reference#l_NRF_setRSSIHandler + */ + static setRSSIHandler(callback: any): void; + + /** + * Set the BLE radio transmit power. The default TX power is 0 dBm, and + * + * @param {number} power - Transmit power. Accepted values are -40(nRF52 only), -30(nRF51 only), -20, -16, -12, -8, -4, 0, and 4 dBm. On nRF52840 (eg Bangle.js 2) 5/6/7/8 dBm are available too. Others will give an error code. + * @url http://www.espruino.com/Reference#l_NRF_setTxPower + */ + static setTxPower(power: number): void; + + /** + * **THIS IS DEPRECATED** - please use `NRF.setConnectionInterval` for peripheral + * and `NRF.connect(addr, options)`/`BluetoothRemoteGATTServer.connect(options)` + * for central connections. + * This sets the connection parameters - these affect the transfer speed and power + * usage when the device is connected. + * * When not low power, the connection interval is between 7.5 and 20ms + * * When low power, the connection interval is between 500 and 1000ms + * When low power connection is enabled, transfers of data over Bluetooth will be + * very slow, however power usage while connected will be drastically decreased. + * This will only take effect after the connection is disconnected and + * re-established. + * + * @param {boolean} lowPower - Whether the connection is low power or not + * @url http://www.espruino.com/Reference#l_NRF_setLowPowerConnection + */ + static setLowPowerConnection(lowPower: boolean): void; + + /** + * Enables NFC and starts advertising the given URL. For example: + * ``` + * NRF.nfcURL("http://espruino.com"); + * ``` + * + * @param {any} url - The URL string to expose on NFC, or `undefined` to disable NFC + * @url http://www.espruino.com/Reference#l_NRF_nfcURL + */ + static nfcURL(url: any): void; + + /** + * Enables NFC and with an out of band 16 byte pairing key. + * For example the following will enable out of band pairing on BLE such that the + * device will pair when you tap the phone against it: + * ``` + * var bleKey = [0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00]; + * NRF.on('security',s=>print("security",JSON.stringify(s))); + * NRF.nfcPair(bleKey); + * NRF.setSecurity({oob:bleKey, mitm:true}); + * ``` + * + * @param {any} key - 16 byte out of band key + * @url http://www.espruino.com/Reference#l_NRF_nfcPair + */ + static nfcPair(key: any): void; + + /** + * Enables NFC with a record that will launch the given android app. + * For example: + * ``` + * NRF.nfcAndroidApp("no.nordicsemi.android.nrftoolbox") + * ``` + * + * @param {any} app - The unique identifier of the given Android App + * @url http://www.espruino.com/Reference#l_NRF_nfcAndroidApp + */ + static nfcAndroidApp(app: any): void; + + /** + * Enables NFC and starts advertising with Raw data. For example: + * ``` + * NRF.nfcRaw(new Uint8Array([193, 1, 0, 0, 0, 13, 85, 3, 101, 115, 112, 114, 117, 105, 110, 111, 46, 99, 111, 109])); + * // same as NRF.nfcURL("http://espruino.com"); + * ``` + * + * @param {any} payload - The NFC NDEF message to deliver to the reader + * @url http://www.espruino.com/Reference#l_NRF_nfcRaw + */ + static nfcRaw(payload: any): void; + + /** + * **Advanced NFC Functionality.** If you just want to advertise a URL, use + * `NRF.nfcURL` instead. + * Enables NFC and starts advertising. `NFCrx` events will be fired when data is + * received. + * ``` + * NRF.nfcStart(); + * ``` + * + * @param {any} payload - Optional 7 byte UID + * @returns {any} Internal tag memory (first 10 bytes of tag data) + * @url http://www.espruino.com/Reference#l_NRF_nfcStart + */ + static nfcStart(payload: any): any; + + /** + * **Advanced NFC Functionality.** If you just want to advertise a URL, use + * `NRF.nfcURL` instead. + * Disables NFC. + * ``` + * NRF.nfcStop(); + * ``` + * + * @url http://www.espruino.com/Reference#l_NRF_nfcStop + */ + static nfcStop(): void; + + /** + * **Advanced NFC Functionality.** If you just want to advertise a URL, use + * `NRF.nfcURL` instead. + * Acknowledges the last frame and optionally transmits a response. If payload is + * an array, then a array.length byte nfc frame is sent. If payload is a int, then + * a 4bit ACK/NACK is sent. **Note:** ```nfcSend``` should always be called after + * an ```NFCrx``` event. + * ``` + * NRF.nfcSend(new Uint8Array([0x01, 0x02, ...])); + * // or + * NRF.nfcSend(0x0A); + * // or + * NRF.nfcSend(); + * ``` + * + * @param {any} payload - Optional tx data + * @url http://www.espruino.com/Reference#l_NRF_nfcSend + */ + static nfcSend(payload: any): void; + + /** + * Send a USB HID report. HID must first be enabled with `NRF.setServices({}, {hid: + * hid_report})` + * + * @param {any} data - Input report data as an array + * @param {any} callback - A callback function to be called when the data is sent + * @url http://www.espruino.com/Reference#l_NRF_sendHIDReport + */ + static sendHIDReport(data: number[], callback?: () => void): void + + /** + * Check if Apple Notification Center Service (ANCS) is currently active on the BLE + * connection + * + * @returns {boolean} True if Apple Notification Center Service (ANCS) has been initialised and is active + * @url http://www.espruino.com/Reference#l_NRF_ancsIsActive + */ + static ancsIsActive(): boolean; + + /** + * Send an ANCS action for a specific Notification UID. Corresponds to + * posaction/negaction in the 'ANCS' event that was received + * + * @param {number} uid - The UID of the notification to respond to + * @param {boolean} positive - `true` for positive action, `false` for negative + * @url http://www.espruino.com/Reference#l_NRF_ancsAction + */ + static ancsAction(uid: number, positive: boolean): void; + + /** + * Get ANCS info for a notification event received via `E.ANCS`, e.g.: + * ``` + * E.on('ANCS', event => { + * NRF.ancsGetNotificationInfo( event.uid ).then(a=>print("Notify",E.toJS(a))); + * }); + * ``` + * Returns: + * ``` + * { + * "uid" : integer, + * "appId": string, + * "title": string, + * "subtitle": string, + * "message": string, + * "messageSize": string, + * "date": string, + * "posAction": string, + * "negAction": string + * } + * ``` + * + * @param {number} uid - The UID of the notification to get information for + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_ancsGetNotificationInfo + */ + static ancsGetNotificationInfo(uid: number): Promise; + + /** + * Get ANCS info for an app (app id is available via `NRF.ancsGetNotificationInfo`) + * Promise returns: + * ``` + * { + * "uid" : int, + * "appId" : string, + * "title" : string, + * "subtitle" : string, + * "message" : string, + * "messageSize" : string, + * "date" : string, + * "posAction" : string, + * "negAction" : string, + * "name" : string, + * } + * ``` + * + * @param {any} id - The app ID to get information for + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_ancsGetAppInfo + */ + static ancsGetAppInfo(id: any): Promise; + + /** + * Check if Apple Media Service (AMS) is currently active on the BLE connection + * + * @returns {boolean} True if Apple Media Service (AMS) has been initialised and is active + * @url http://www.espruino.com/Reference#l_NRF_amsIsActive + */ + static amsIsActive(): boolean; + + /** + * Get Apple Media Service (AMS) info for the current media player. "playbackinfo" + * returns a concatenation of three comma-separated values: + * - PlaybackState: a string that represents the integer value of the playback + * state: + * - PlaybackStatePaused = 0 + * - PlaybackStatePlaying = 1 + * - PlaybackStateRewinding = 2 + * - PlaybackStateFastForwarding = 3 + * - PlaybackRate: a string that represents the floating point value of the + * playback rate. + * - ElapsedTime: a string that represents the floating point value of the elapsed + * time of the current track, in seconds + * + * @param {any} id - Either 'name', 'playbackinfo' or 'volume' + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_amsGetPlayerInfo + */ + static amsGetPlayerInfo(id: any): Promise; + + /** + * Get Apple Media Service (AMS) info for the currently-playing track + * + * @param {any} id - Either 'artist', 'album', 'title' or 'duration' + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_amsGetTrackInfo + */ + static amsGetTrackInfo(id: any): Promise; + + /** + * Send an AMS command to an Apple Media Service device to control music playback + * Command is one of play, pause, playpause, next, prev, volup, voldown, repeat, + * shuffle, skipforward, skipback, like, dislike, bookmark + * + * @param {any} id - For example, 'play', 'pause', 'volup' or 'voldown' + * @url http://www.espruino.com/Reference#l_NRF_amsCommand + */ + static amsCommand(id: any): void; + + /** + * Check if Apple Current Time Service (CTS) is currently active on the BLE connection + * + * @returns {boolean} True if Apple Current Time Service (CTS) has been initialised and is active + * @url http://www.espruino.com/Reference#l_NRF_ctsIsActive + */ + static ctsIsActive(): boolean; + + /** + * Returns time information from the Current Time Service + * (if requested with `NRF.ctsGetTime` and is activated by calling `NRF.setServices(..., {..., cts:true})`) + * ``` + * { + * date : // Date object with the current date + * day : // if known, 0=sun,1=mon (matches JS `Date`) + * reason : [ // reason for the date change + * "external", // External time change + * "manual", // Manual update + * "timezone", // Timezone changed + * "DST", // Daylight savings + * ] + * timezone // if LTI characteristic exists, this is the timezone + * dst // if LTI characteristic exists, this is the dst adjustment + * } + * ``` + * For instance this can be used as follows to update Espruino's time: + * ``` + * E.on('CTS',e=>{ + * setTime(e.date.getTime()/1000); + * }); + * NRF.ctsGetTime(); // also returns a promise with CTS info + * ``` + * @param {string} event - The event to listen to. + * @param {(info: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `info` An object (see below) + * @url http://www.espruino.com/Reference#l_NRF_CTS + */ + static on(event: "CTS", callback: (info: any) => void): void; + + /** + * Read the time from CTS - creates an `NRF.on('CTS', ...)` event as well + * ``` + * NRF.ctsGetTime(); // also returns a promise + * ``` + * @returns {any} A `Promise` that is resolved (or rejected) when time is received + * @url http://www.espruino.com/Reference#l_NRF_ctsGetTime + */ + static ctsGetTime(): Promise; + + /** + * Search for available devices matching the given filters. Since we have no UI + * here, Espruino will pick the FIRST device it finds, or it'll call `catch`. + * `options` can have the following fields: + * * `filters` - a list of filters that a device must match before it is returned + * (see below) + * * `timeout` - the maximum time to scan for in milliseconds (scanning stops when + * a match is found. e.g. `NRF.requestDevice({ timeout:2000, filters: [ ... ] })` + * * `active` - whether to perform active scanning (requesting 'scan response' + * packets from any devices that are found). e.g. `NRF.requestDevice({ active:true, + * filters: [ ... ] })` + * * `phy` - (NRF52833/NRF52840 only) the type of Bluetooth signals to scan for (can + * be `"1mbps/coded/both/2mbps"`) + * * `1mbps` (default) - standard Bluetooth LE advertising + * * `coded` - long range + * * `both` - standard and long range + * * `2mbps` - high speed 2mbps (not working) + * * `extended` - (NRF52833/NRF52840 only) support receiving extended-length advertising + * packets (default=true if phy isn't `"1mbps"`) + * * `extended` - (NRF52833/NRF52840 only) support receiving extended-length advertising + * packets (default=true if phy isn't `"1mbps"`) + * * `window` - (2v22+) how long we scan for in milliseconds (default 100ms) + * * `interval` - (2v22+) how often we scan in milliseconds (default 100ms) - `window=interval=100`(default) is all the time. When + * scanning on both `1mbps` and `coded`, `interval` needs to be twice `window`. + * **NOTE:** `timeout` and `active` are not part of the Web Bluetooth standard. + * The following filter types are implemented: + * * `services` - list of services as strings (all of which must match). 128 bit + * services must be in the form '01230123-0123-0123-0123-012301230123' + * * `name` - exact device name + * * `namePrefix` - starting characters of device name + * * `id` - exact device address (`id:"e9:53:86:09:89:99 random"`) (this is + * Espruino-specific, and is not part of the Web Bluetooth spec) + * * `serviceData` - an object containing service characteristics which must all + * match (`serviceData:{"1809":{}}`). Matching of actual service data is not + * supported yet. + * * `manufacturerData` - an object containing manufacturer UUIDs which must all + * match (`manufacturerData:{0x0590:{}}`). Matching of actual manufacturer data + * is not supported yet. + * ``` + * NRF.requestDevice({ filters: [{ namePrefix: 'Puck.js' }] }).then(function(device) { ... }); + * // or + * NRF.requestDevice({ filters: [{ services: ['1823'] }] }).then(function(device) { ... }); + * // or + * NRF.requestDevice({ filters: [{ manufacturerData:{0x0590:{}} }] }).then(function(device) { ... }); + * ``` + * As a full example, to send data to another Puck.js to turn an LED on: + * ``` + * var gatt; + * NRF.requestDevice({ filters: [{ namePrefix: 'Puck.js' }] }).then(function(device) { + * return device.gatt.connect(); + * }).then(function(g) { + * gatt = g; + * return gatt.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e"); + * }).then(function(service) { + * return service.getCharacteristic("6e400002-b5a3-f393-e0a9-e50e24dcca9e"); + * }).then(function(characteristic) { + * return characteristic.writeValue("LED1.set()\n"); + * }).then(function() { + * gatt.disconnect(); + * console.log("Done!"); + * }); + * ``` + * Or slightly more concisely, using ES6 arrow functions: + * ``` + * var gatt; + * NRF.requestDevice({ filters: [{ namePrefix: 'Puck.js' }]}).then( + * device => device.gatt.connect()).then( + * g => (gatt=g).getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e")).then( + * service => service.getCharacteristic("6e400002-b5a3-f393-e0a9-e50e24dcca9e")).then( + * characteristic => characteristic.writeValue("LED1.reset()\n")).then( + * () => { gatt.disconnect(); console.log("Done!"); } ); + * ``` + * Note that you have to keep track of the `gatt` variable so that you can + * disconnect the Bluetooth connection when you're done. + * **Note:** Using a filter in `NRF.requestDevice` filters each advertising packet + * individually. As soon as a matching advertisement is received, + * `NRF.requestDevice` resolves the promise and stops scanning. This means that if + * you filter based on a service UUID and a device advertises with multiple packets + * (or a scan response when `active:true`) only the packet matching the filter is + * returned - you may not get the device's name is that was in a separate packet. + * To aggregate multiple packets you can use `NRF.findDevices`. + * + * @param {any} options - Options used to filter the device to use + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_requestDevice + */ + static requestDevice(options?: { filters?: NRFFilters[], timeout?: number, active?: boolean, phy?: string, extended?: boolean }): Promise; + + /** + * Connect to a BLE device by MAC address. Returns a promise, the argument of which + * is the `BluetoothRemoteGATTServer` connection. + * ``` + * NRF.connect("aa:bb:cc:dd:ee").then(function(server) { + * // ... + * }); + * ``` + * This has the same effect as calling `BluetoothDevice.gatt.connect` on a + * `BluetoothDevice` requested using `NRF.requestDevice`. It just allows you to + * specify the address directly (without having to scan). + * You can use it as follows - this would connect to another Puck device and turn + * its LED on: + * ``` + * var gatt; + * NRF.connect("aa:bb:cc:dd:ee random").then(function(g) { + * gatt = g; + * return gatt.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e"); + * }).then(function(service) { + * return service.getCharacteristic("6e400002-b5a3-f393-e0a9-e50e24dcca9e"); + * }).then(function(characteristic) { + * return characteristic.writeValue("LED1.set()\n"); + * }).then(function() { + * gatt.disconnect(); + * console.log("Done!"); + * }); + * ``` + * **Note:** Espruino Bluetooth devices use a type of BLE address known as 'random + * static', which is different to a 'public' address. To connect to an Espruino + * device you'll need to use an address string of the form `"aa:bb:cc:dd:ee + * random"` rather than just `"aa:bb:cc:dd:ee"`. If you scan for devices with + * `NRF.findDevices`/`NRF.setScan` then addresses are already reported in the + * correct format. + * + * @param {any} mac - The MAC address to connect to + * @param {any} options - (Espruino-specific) An object of connection options (see `BluetoothRemoteGATTServer.connect` for full details) + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_connect + */ + static connect(mac: any, options: any): Promise; + + /** + * If set to true, whenever a device bonds it will be added to the whitelist. + * When set to false, the whitelist is cleared and newly bonded devices will not be + * added to the whitelist. + * **Note:** This is remembered between `reset()`s but isn't remembered after + * power-on (you'll have to add it to `onInit()`. + * + * @param {boolean} whitelisting - Are we using a whitelist? (default false) + * @url http://www.espruino.com/Reference#l_NRF_setWhitelist + */ + static setWhitelist(whitelisting: boolean): void; + + /** + * When connected, Bluetooth LE devices communicate at a set interval. Lowering the + * interval (e.g. more packets/second) means a lower delay when sending data, higher + * bandwidth, but also more power consumption. + * By default, when connected as a peripheral Espruino automatically adjusts the + * connection interval. When connected it's as fast as possible (7.5ms) but when + * idle for over a minute it drops to 200ms. On continued activity (>1 BLE + * operation) the interval is raised to 7.5ms again. + * The options for `interval` are: + * * `undefined` / `"auto"` : (default) automatically adjust connection interval + * * `100` : set min and max connection interval to the same number (between 7.5ms + * and 4000ms) + * * `{minInterval:20, maxInterval:100}` : set min and max connection interval as a + * range + * This configuration is not remembered during a `save()` - you will have to re-set + * it via `onInit`. + * **Note:** If connecting to another device (as Central), you can use an extra + * argument to `NRF.connect` or `BluetoothRemoteGATTServer.connect` to specify a + * connection interval. + * **Note:** This overwrites any changes imposed by the deprecated + * `NRF.setLowPowerConnection` + * + * @param {any} interval - The connection interval to use (see below) + * @url http://www.espruino.com/Reference#l_NRF_setConnectionInterval + */ + static setConnectionInterval(interval: any): void; + + /** + * Sets the security options used when connecting/pairing. This applies to both + * central *and* peripheral mode. + * ``` + * NRF.setSecurity({ + * display : bool // default false, can this device display a passkey on a screen/etc? + * // - sent via the `BluetoothDevice.passkey` event + * keyboard : bool // default false, can this device enter a passkey + * // - request sent via the `BluetoothDevice.passkeyRequest` event + * pair : bool // default true, allow other devices to pair with this device + * bond : bool // default true, Perform bonding + * // This stores info from pairing in flash and allows reconnecting without having to pair each time + * mitm : bool // default false, Man In The Middle protection + * lesc : bool // default false, LE Secure Connections + * passkey : // default "", or a 6 digit passkey to use (display must be true for this) + * oob : [0..15] // if specified, Out Of Band pairing is enabled and + * // the 16 byte pairing code supplied here is used + * encryptUart : bool // default false (unless oob or passkey specified) + * // This sets the BLE UART service such that it + * // is encrypted and can only be used from a paired connection + * privacy : // default false, true to enable with (ideally sensible) defaults, + * // or an object defining BLE privacy / random address options - see below for more info + * // only available if Espruino was compiled with private address support (like for example on Bangle.js 2) + * }); + * ``` + * **NOTE:** Some combinations of arguments will cause an error. For example + * supplying a passkey without `display:1` is not allowed. If `display:1` is set + * you do not require a physical display, the user just needs to know the passkey + * you supplied. + * For instance, to require pairing and to specify a passkey, use: + * ``` + * NRF.setSecurity({passkey:"123456", mitm:1, display:1}); + * ``` + * Or to require pairing and to display a PIN that the connecting device + * provides, use: + * ``` + * NRF.setSecurity({mitm:1, display:1}); + * NRF.on("passkey", key => print("Enter PIN: ", key)); + * ``` + * However, while most devices will request a passkey for pairing at this point it + * is still possible for a device to connect without requiring one (e.g. using the + * 'NRF Connect' app). + * To force a passkey you need to protect each characteristic you define with + * `NRF.setSecurity`. For instance the following code will *require* that the + * passkey `123456` is entered before the characteristic + * `9d020002-bf5f-1d1a-b52a-fe52091d5b12` can be read. + * ``` + * NRF.setSecurity({passkey:"123456", mitm:1, display:1}); + * NRF.setServices({ + * "9d020001-bf5f-1d1a-b52a-fe52091d5b12" : { + * "9d020002-bf5f-1d1a-b52a-fe52091d5b12" : { + * // readable always + * value : "Not Secret" + * }, + * "9d020003-bf5f-1d1a-b52a-fe52091d5b12" : { + * // readable only once bonded + * value : "Secret", + * readable : true, + * security: { + * read: { + * mitm: true, + * encrypted: true + * } + * } + * }, + * "9d020004-bf5f-1d1a-b52a-fe52091d5b12" : { + * // readable always + * // writable only once bonded + * value : "Readable", + * readable : true, + * writable : true, + * onWrite : function(evt) { + * console.log("Wrote ", evt.data); + * }, + * security: { + * write: { + * mitm: true, + * encrypted: true + * } + * } + * } + * } + * }); + * ``` + * **Note:** If `passkey` or `oob` is specified, the Nordic UART service (if + * enabled) will automatically be set to require encryption, but otherwise it is + * open. + * On Bangle.js 2, the `privacy` parameter can be used to set this device's BLE privacy / random address settings. + * The privacy feature provides a way to avoid being tracked over a period of time. + * This works by replacing the real BLE address with a random private address, + * that automatically changes at a specified interval. + * If a `"random_private_resolvable"` address is used, that address is generated with the help + * of an identity resolving key (IRK), that is exchanged during bonding. + * This allows a bonded device to still identify another device that is using a random private resolvable address. + * Note that, while this can help against being tracked, there are other ways a Bluetooth device can reveal its identity. + * For example, the name or services it advertises may be unique enough. + * ``` + * NRF.setSecurity({ + * privacy: { + * mode : "off"/"device_privacy"/"network_privacy" // The privacy mode that should be used. + * addr_type : "random_private_resolvable"/"random_private_non_resolvable" // The type of address to use. + * addr_cycle_s : int // How often the address should change, in seconds. + * } + * }); + * // enabled with (ideally sensible) defaults of: + * // mode: device_privacy + * // addr_type: random_private_resolvable + * // addr_cycle_s: 0 (use default address change interval) + * NRF.setSecurity({ + * privacy: 1 + * }); + * ``` + * `mode` can be one of: + * * `"off"` - Use the real address. + * * `"device_privacy"` - Use a private address. + * * `"network_privacy"` - Use a private address, + * and reject a peer that uses its real address if we know that peer's IRK. + * If `mode` is `"off"`, all other fields are ignored and become optional. + * `addr_type` can be one of: + * * `"random_private_resolvable"` - Address that can be resolved by a bonded peer that knows our IRK. + * * `"random_private_non_resolvable"` - Address that cannot be resolved. + * `addr_cycle_s` must be an integer. Pass `0` to use the default address change interval. + * The default is usually to change the address every 15 minutes (or 900 seconds). + * + * @param {any} options - An object containing security-related options (see below) + * @url http://www.espruino.com/Reference#l_NRF_setSecurity + */ + static setSecurity(options: any): void; + + /** + * Return an object with information about the security state of the current + * peripheral connection: + * ``` + * { + * connected // The connection is active (not disconnected). + * encrypted // Communication on this link is encrypted. + * mitm_protected // The encrypted communication is also protected against man-in-the-middle attacks. + * bonded // The peer is bonded with us + * advertising // Are we currently advertising? + * connected_addr // If connected=true, the MAC address of the currently connected device + * privacy // Current BLE privacy / random address settings. + * // Only present if Espruino was compiled with private address support (like for example on Bangle.js 2). + * } + * ``` + * If there is no active connection, `{connected:false}` will be returned. + * See `NRF.setSecurity` for information about negotiating a secure connection. + * @returns {any} An object + * @url http://www.espruino.com/Reference#l_NRF_getSecurityStatus + */ + static getSecurityStatus(): NRFSecurityStatus; + + /** + * + * @param {boolean} forceRepair - True if we should force repairing even if there is already valid pairing info + * @returns {any} A promise + * @url http://www.espruino.com/Reference#l_NRF_startBonding + */ + static startBonding(forceRepair: boolean): any; + + +} + +/** +======= +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * This class provides functionality to recognise gestures drawn on a touchscreen. * It is only built into Bangle.js 2. * Usage: @@ -3839,6 +5782,7 @@ declare class Unistroke { } /** +<<<<<<< HEAD * This class provides Graphics operations that can be applied to a surface. * Use Graphics.createXXX to create a graphics object that renders in the way you * want. See [the Graphics page](https://www.espruino.com/Graphics) for more @@ -3847,15 +5791,74 @@ declare class Unistroke { * type `Graphics`. For instance to draw a line you'd type: * ```g.drawLine(0,0,100,100)``` * @url http://www.espruino.com/Reference#Graphics +||||||| e51f7bfbe + * Class containing AES encryption/decryption + * **Note:** This library is currently only included in builds for boards where + * there is space. For other boards there is `crypto.js` which implements SHA1 in + * JS. + * @url http://www.espruino.com/Reference#AES +======= + * Class containing utility functions for the Qwiic connectors + * on the [Jolt.js Smart Bluetooth driver](http://www.espruino.com/Jolt.js). + * Each class (available from `Jolt.Q0`/`Jolt.Q1`/`Jolt.Q2`/`Jolt.Q3`) + * has `sda` and `scl` fields with the pins for SDA and SCL on them. + * On Jolt.js, the four Qwiic connectors can be individually powered: + * * Q0/Q1 - GND is switched with a 500mA FET. The `fet` field contains the pin that controls the FET + * * Q2/Q3 - all 4 pins are connected to GPIO. `gnd` and `vcc` fields contain the pins for GND and VCC + * To control the power, use `Qwiic.setPower`, for example: `Jolt.Q0.setPower(true)` + * @url http://www.espruino.com/Reference#Qwiic + */ +declare class Qwiic { + + + /** + * This turns power for the given Qwiic connector on or off. See `Qwiic` for more information. + * + * @param {boolean} isOn - Whether the Qwiic connector is to be on or not + * @returns {any} The same Qwiic object (for call chaining) + * @url http://www.espruino.com/Reference#l_Qwiic_setPower + */ + setPower(isOn: ShortBoolean): any; + + /** + * @returns {any} An I2C object using this Qwiic connector, already set up + * @url http://www.espruino.com/Reference#l_Qwiic_i2c + */ + i2c: any; +} + +/** + * Class containing AES encryption/decryption + * **Note:** This library is currently only included in builds for boards where + * there is space. For other boards there is `crypto.js` which implements SHA1 in + * JS. + * @url http://www.espruino.com/Reference#AES +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 */ declare class Graphics { /** +<<<<<<< HEAD * On devices like Pixl.js or HYSTM boards that contain a built-in display this * will return an instance of the graphics class that can be used to access that * display. * Internally, this is stored as a member called `gfx` inside the 'hiddenRoot'. * @returns {any} An instance of `Graphics` or undefined * @url http://www.espruino.com/Reference#l_Graphics_getInstance +||||||| e51f7bfbe + * + * @param {any} passphrase - Message to encrypt + * @param {any} key - Key to encrypt message - must be an ArrayBuffer of 128, 192, or 256 BITS + * @param {any} [options] - [optional] An object, may specify `{ iv : new Uint8Array(16), mode : 'CBC|CFB|CTR|OFB|ECB' }` + * @returns {any} Returns an ArrayBuffer + * @url http://www.espruino.com/Reference#l_AES_encrypt +======= + * + * @param {any} passphrase - Message to encrypt + * @param {any} key - Key to encrypt message - must be an `ArrayBuffer` of 128, 192, or 256 BITS + * @param {any} [options] - [optional] An object, may specify `{ iv : new Uint8Array(16), mode : 'CBC|CFB|CTR|OFB|ECB' }` + * @returns {any} Returns an `ArrayBuffer` + * @url http://www.espruino.com/Reference#l_AES_encrypt +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 */ static getInstance(): Graphics | undefined @@ -3863,6 +5866,7 @@ declare class Graphics { * Create a Graphics object that renders to an Array Buffer. This will have a field * called 'buffer' that can get used to get at the buffer itself * +<<<<<<< HEAD * @param {number} width - Pixels wide * @param {number} height - Pixels high * @param {number} bpp - Number of bits per pixel @@ -3875,6 +5879,19 @@ declare class Graphics { * `color_order` = re-orders the colour values that are supplied via setColor * @returns {any} The new Graphics object * @url http://www.espruino.com/Reference#l_Graphics_createArrayBuffer +||||||| e51f7bfbe + * @param {any} passphrase - Message to decrypt + * @param {any} key - Key to encrypt message - must be an ArrayBuffer of 128, 192, or 256 BITS + * @param {any} [options] - [optional] An object, may specify `{ iv : new Uint8Array(16), mode : 'CBC|CFB|CTR|OFB|ECB' }` + * @returns {any} Returns an ArrayBuffer + * @url http://www.espruino.com/Reference#l_AES_decrypt +======= + * @param {any} passphrase - Message to decrypt + * @param {any} key - Key to encrypt message - must be an `ArrayBuffer` of 128, 192, or 256 BITS + * @param {any} [options] - [optional] An object, may specify `{ iv : new Uint8Array(16), mode : 'CBC|CFB|CTR|OFB|ECB' }` + * @returns {any} Returns an `ArrayBuffer` + * @url http://www.espruino.com/Reference#l_AES_decrypt +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 */ static createArrayBuffer(width: number, height: number, bpp: number, options?: { zigzag?: boolean, vertical_byte?: boolean, msb?: boolean, color_order?: "rgb" | "rbg" | "brg" | "bgr" | "grb" | "gbr" }): Graphics; @@ -3894,6 +5911,57 @@ declare class Graphics { ======= static decrypt(passphrase: any, key: any, options?: any): ArrayBuffer; + /** + * Encrypt a message with a key using AES in CCM authenticated encryption mode. + * This returns an object with the encrypted data and a generated tag for message authentication. + * Usage example: + * ``` + * let message = "Hello World!"; + * let key = [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]; + * let nonce = [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66]; + * let tagLength = 4; + * let result = AES.ccmEncrypt(message, key, nonce, tagLength); + * ``` + * The `result` object should now have a `data` and `tag` attribute; both are needed for decrypting and verifying the message: + * ``` + * { + * data: [206, 98, 239, 219, 146, 157, 59, 123, 102, 92, 118, 209], + * tag: [230, 153, 191, 142] + * } + * ``` + * + * @param {any} message - Message to encrypt + * @param {any} key - Key to encrypt message - an `ArrayBuffer` of 128 BITS + * @param {any} iv - nonce (initialization vector) - an `ArrayBuffer` of 7 to 13 bytes + * @param {any} tagLen - Length of tag to generate in bytes - must be one of 4, 6, 8, 10, 12, 14 or 16 + * @returns {any} An object + * @url http://www.espruino.com/Reference#l_AES_ccmEncrypt + */ + static ccmEncrypt(message: any, key: any, iv: any, tagLen: any): AES_CCM_EncryptResult; + + /** + * Decrypt and authenticate an AES CCM encrypted message with an associated tag. + * Usage example: + * ``` + * let message = "Hello World!"; + * let key = [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]; + * let nonce = [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66]; + * let tagLength = 4; + * let result = AES.ccmEncrypt(message, key, nonce, tagLength); + * let decrypted = AES.ccmDecrypt(result.data, key, nonce, result.tag); + * let decryptedMessage = String.fromCharCode.apply(null, decrypted); + * ``` + * The `decryptedMessage` variable should now contain "Hello World!". + * + * @param {any} message - Message to decrypt + * @param {any} key - Key to decrypt message - an `ArrayBuffer` of 128 BITS + * @param {any} iv - Nonce (initialization vector) - an `ArrayBuffer` of 7 to 13 bytes + * @param {any} tag - Tag that came with the message - an `ArrayBuffer` + * @returns {any} Decrypted message, or null on error (for example if the tag doesn't match) + * @url http://www.espruino.com/Reference#l_AES_ccmDecrypt + */ + static ccmDecrypt(message: any, key: any, iv: any, tag: any): any; + } @@ -3936,7 +6004,7 @@ declare class Pixl { * @param {boolean} isOn - True if the LCD should be on, false if not * @url http://www.espruino.com/Reference#l_Pixl_setLCDPower */ - static setLCDPower(isOn: boolean): void; + static setLCDPower(isOn: ShortBoolean): void; /** * Writes a command directly to the ST7567 LCD controller @@ -3958,95 +6026,6 @@ declare class Pixl { static menu(menu: Menu): MenuInstance; -} - -/** - * This class exists in order to interface Espruino with fast-moving trigger - * wheels. Trigger wheels are physical discs with evenly spaced teeth cut into - * them, and often with one or two teeth next to each other missing. A sensor sends - * a signal whenever a tooth passed by, and this allows a device to measure not - * only RPM, but absolute position. - * This class is currently in testing - it is NOT AVAILABLE on normal boards. - * @url http://www.espruino.com/Reference#Trig - */ -declare class Trig { - /** - * Get the position of the trigger wheel at the given time (from getTime) - * - * @param {number} time - The time at which to find the position - * @returns {number} The position of the trigger wheel in degrees - as a floating point number - * @url http://www.espruino.com/Reference#l_Trig_getPosAtTime - */ - static getPosAtTime(time: number): number; - - /** - * Initialise the trigger class - * - * @param {Pin} pin - The pin to use for triggering - * @param {any} options - Additional options as an object. defaults are: ```{teethTotal:60,teethMissing:2,minRPM:30,keyPosition:0}``` - * @url http://www.espruino.com/Reference#l_Trig_setup - */ - static setup(pin: Pin, options: any): void; - - /** - * Set a trigger for a certain point in the cycle - * - * @param {number} num - The trigger number (0..7) - * @param {number} pos - The position (in degrees) to fire the trigger at - * @param {any} pins - An array of pins to pulse (max 4) - * @param {number} pulseLength - The time (in msec) to pulse for - * @url http://www.espruino.com/Reference#l_Trig_setTrigger - */ - static setTrigger(num: number, pos: number, pins: any, pulseLength: number): void; - - /** - * Disable a trigger - * - * @param {number} num - The trigger number (0..7) - * @url http://www.espruino.com/Reference#l_Trig_killTrigger - */ - static killTrigger(num: number): void; - - /** - * Get the current state of a trigger - * - * @param {number} num - The trigger number (0..7) - * @returns {any} A structure containing all information about the trigger - * @url http://www.espruino.com/Reference#l_Trig_getTrigger - */ - static getTrigger(num: number): any; - - /** - * Get the RPM of the trigger wheel - * @returns {number} The current RPM of the trigger wheel - * @url http://www.espruino.com/Reference#l_Trig_getRPM - */ - static getRPM(): number; - - /** - * Get the current error flags from the trigger wheel - and zero them - * @returns {number} The error flags - * @url http://www.espruino.com/Reference#l_Trig_getErrors - */ - static getErrors(): number; - - /** - * Get the current error flags from the trigger wheel - and zero them - * @returns {any} An array of error strings - * @url http://www.espruino.com/Reference#l_Trig_getErrorArray - */ - static getErrorArray(): any; - - -} - -/** - * @url http://www.espruino.com/Reference#Dickens - */ -declare class Dickens { - - - } /** @@ -4066,7 +6045,7 @@ declare class url { * @returns {any} An object containing options for ```http.request``` or ```http.get```. Contains `method`, `host`, `path`, `pathname`, `search`, `port` and `query` * @url http://www.espruino.com/Reference#l_url_parse */ - static parse(urlStr: any, parseQuery: boolean): any; + static parse(urlStr: any, parseQuery: ShortBoolean): any; } @@ -4492,7 +6471,47 @@ declare class Socket { * @returns {number} The color index represented by the blended colors * @url http://www.espruino.com/Reference#l_Graphics_blendColor */ +<<<<<<< HEAD blendColor(col_a: ColorResolvable, col_b: ColorResolvable, amt: number): number; +||||||| e51f7bfbe + end(data: any): void; +} + +/** + * An actual socket connection - allowing transmit/receive of TCP data + * @url http://www.espruino.com/Reference#dgramSocket + */ +declare class dgramSocket { + /** + * The 'message' event is called when a datagram message is received. If a handler + * is defined with `X.on('message', function(msg) { ... })` then it will be called` + * @param {string} event - The event to listen to. + * @param {(msg: any, rinfo: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `msg` A string containing the received message + * * `rinfo` Sender address,port containing information + * @url http://www.espruino.com/Reference#l_dgramSocket_message + */ + static on(event: "message", callback: (msg: any, rinfo: any) => void): void; +======= + end(data: any): void; +} + +/** + * An actual socket connection - allowing transmit/receive of TCP data + * @url http://www.espruino.com/Reference#dgramSocket + */ +declare class dgramSocket { + /** + * The 'message' event is called when a datagram message is received. If a handler + * is defined with `X.on('message', function(msg) { ... })` then it will be called + * @param {string} event - The event to listen to. + * @param {(msg: any, rinfo: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `msg` A string containing the received message + * * `rinfo` Sender address,port containing information + * @url http://www.espruino.com/Reference#l_dgramSocket_message + */ + static on(event: "message", callback: (msg: any, rinfo: any) => void): void; +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 /** * Set the color to use for subsequent drawing operations. @@ -6097,6 +8116,8 @@ declare class WioLTE { * Set the WIO's LED ======= * Turn on the magnetometer, take a single reading, and then turn it off again. + * If the magnetometer is already on (with `Puck.magOn()`) then the last reading + * is returned. * An object of the form `{x,y,z}` is returned containing magnetometer readings. * Due to residual magnetism in the Puck and magnetometer itself, with no magnetic * field the Puck will not return `{x:0,y:0,z:0}`. @@ -6135,7 +8156,7 @@ declare class WioLTE { * Check out [the Puck.js page on the * magnetometer](http://www.espruino.com/Puck.js#on-board-peripherals) for more * information. - * ```JS + * ``` * Puck.magOn(10); // 10 Hz * Puck.on('mag', function(e) { * print(e); @@ -6154,7 +8175,7 @@ declare class WioLTE { * Called after `Puck.accelOn()` every time accelerometer data is sampled. There is * one argument which is an object of the form `{acc:{x,y,z}, gyro:{x,y,z}}` * containing the data. - * ```JS + * ``` * Puck.accelOn(12.5); // default 12.5Hz * Puck.on('accel', function(e) { * print(e); @@ -6486,60 +8507,12 @@ declare class Jolt { } -/** - * Class containing utility functions for the Qwiic connectors - * on the [Jolt.js Smart Bluetooth driver](http://www.espruino.com/Jolt.js). - * Each class (available from `Jolt.Q0`/`Jolt.Q1`/`Jolt.Q2`/`Jolt.Q3`) - * has `sda` and `scl` fields with the pins for SDA and SCL on them. - * On Jolt.js, the four Qwiic connectors can be individually powered: - * * Q0/Q1 - GND is switched with a 500mA FET. The `fet` field contains the pin that controls the FET - * * Q2/Q3 - all 4 pins are connected to GPIO. `gnd` and `vcc` fields contain the pins for GND and VCC - * To control the power, use `Qwiic.setPower`, for example: `Jolt.Q0.setPower(true)` - * @url http://www.espruino.com/Reference#Qwiic - */ -declare class Qwiic { - - - /** - * This turns power for the given Qwiic connector on or off. See `Qwiic` for more information. - * - * @param {boolean} isOn - Whether the Qwiic connector is to be on or not - * @returns {any} The same Qwiic object (for call chaining) - * @url http://www.espruino.com/Reference#l_Qwiic_setPower - */ - setPower(isOn: boolean): any; - - /** - * @returns {any} An I2C object using this Qwiic connector, already set up - * @url http://www.espruino.com/Reference#l_Qwiic_i2c - */ - i2c: any; -} - /** * Class containing utility functions for the [Bangle.js Smart * Watch](http://www.espruino.com/Bangle.js) * @url http://www.espruino.com/Reference#Bangle */ declare class Bangle { - /** - * @url http://www.espruino.com/Reference#l_Bangle_drawWidgets - */ - static drawWidgets(): void; - - /** - * @url http://www.espruino.com/Reference#l_Bangle_setUI - */ - static setUI(): void; - - /** - * Sets the rotation of the LCD display (relative to its nominal orientation) - * - * @param {number} d - The number of degrees to the LCD display (0, 90, 180 or 270) - * @url http://www.espruino.com/Reference#l_Bangle_setLCDRotation - */ - static setLCDRotation(d: number): void; - /** * Accelerometer data available with `{x,y,z,diff,mag}` object as a parameter. * * `x` is X axis (left-right) in `g` @@ -6577,11 +8550,11 @@ declare class Bangle { /** * Has the watch been moved so that it is face-up, or not face up? * @param {string} event - The event to listen to. - * @param {(up: boolean) => void} callback - A function that is executed when the event occurs. Its arguments are: + * @param {(up: ShortBoolean) => void} callback - A function that is executed when the event occurs. Its arguments are: * * `up` `true` if face-up * @url http://www.espruino.com/Reference#l_Bangle_faceUp */ - static on(event: "faceUp", callback: (up: boolean) => void): void; + static on(event: "faceUp", callback: (up: ShortBoolean) => void): void; /** * This event happens when the watch has been twisted around it's axis - for @@ -6596,11 +8569,11 @@ declare class Bangle { /** * Is the battery charging or not? * @param {string} event - The event to listen to. - * @param {(charging: boolean) => void} callback - A function that is executed when the event occurs. Its arguments are: + * @param {(charging: ShortBoolean) => void} callback - A function that is executed when the event occurs. Its arguments are: * * `charging` `true` if charging * @url http://www.espruino.com/Reference#l_Bangle_charging */ - static on(event: "charging", callback: (charging: boolean) => void): void; + static on(event: "charging", callback: (charging: ShortBoolean) => void): void; /** * Magnetometer/Compass data available with `{x,y,z,dx,dy,dz,heading}` object as a @@ -6625,7 +8598,7 @@ declare class Bangle { * Raw NMEA GPS / u-blox data messages received as a string * To get this event you must turn the GPS on with `Bangle.setGPSPower(1)`. * @param {string} event - The event to listen to. - * @param {(nmea: any, dataLoss: boolean) => void} callback - A function that is executed when the event occurs. Its arguments are: + * @param {(nmea: any, dataLoss: ShortBoolean) => void} callback - A function that is executed when the event occurs. Its arguments are: * * `nmea` A string containing the raw NMEA data from the GPS * * `dataLoss` This is set to true if some lines of GPS data have previously been lost (eg because system was too busy to queue up a GPS-raw event) * @url http://www.espruino.com/Reference#l_Bangle_GPS-raw @@ -6719,31 +8692,31 @@ declare class Bangle { * Has the screen been turned on or off? Can be used to stop tasks that are no * longer useful if nothing is displayed. Also see `Bangle.isLCDOn()` * @param {string} event - The event to listen to. - * @param {(on: boolean) => void} callback - A function that is executed when the event occurs. Its arguments are: + * @param {(on: ShortBoolean) => void} callback - A function that is executed when the event occurs. Its arguments are: * * `on` `true` if screen is on * @url http://www.espruino.com/Reference#l_Bangle_lcdPower */ - static on(event: "lcdPower", callback: (on: boolean) => void): void; + static on(event: "lcdPower", callback: (on: ShortBoolean) => void): void; /** * Has the backlight been turned on or off? Can be used to stop tasks that are no * longer useful if want to see in sun screen only. Also see `Bangle.isBacklightOn()` * @param {string} event - The event to listen to. - * @param {(on: boolean) => void} callback - A function that is executed when the event occurs. Its arguments are: + * @param {(on: ShortBoolean) => void} callback - A function that is executed when the event occurs. Its arguments are: * * `on` `true` if backlight is on * @url http://www.espruino.com/Reference#l_Bangle_backlight */ - static on(event: "backlight", callback: (on: boolean) => void): void; + static on(event: "backlight", callback: (on: ShortBoolean) => void): void; /** * Has the screen been locked? Also see `Bangle.isLocked()` * @param {string} event - The event to listen to. - * @param {(on: boolean, reason: string) => void} callback - A function that is executed when the event occurs. Its arguments are: + * @param {(on: ShortBoolean, reason: string) => void} callback - A function that is executed when the event occurs. Its arguments are: * * `on` `true` if screen is locked, `false` if it is unlocked and touchscreen/buttons will work * * `reason` (2v20 onwards) If known, the reason for locking/unlocking - 'button','js','tap','doubleTap','faceUp','twist','timeout' * @url http://www.espruino.com/Reference#l_Bangle_lock */ - static on(event: "lock", callback: (on: boolean, reason: string) => void): void; + static on(event: "lock", callback: (on: ShortBoolean, reason: string) => void): void; /** * If the watch is tapped, this event contains information on the way it was @@ -6880,7 +8853,7 @@ declare class Bangle { * @param {boolean} isOn - True if the LCD backlight should be on, false if not * @url http://www.espruino.com/Reference#l_Bangle_setBacklight */ - static setBacklight(isOn: boolean): void; + static setBacklight(isOn: ShortBoolean): void; /** * This function can be used to turn Bangle.js's LCD off or on. @@ -6899,7 +8872,7 @@ declare class Bangle { * @param {boolean} isOn - True if the LCD should be on, false if not * @url http://www.espruino.com/Reference#l_Bangle_setLCDPower */ - static setLCDPower(isOn: boolean): void; + static setLCDPower(isOn: ShortBoolean): void; /** * This function can be used to adjust the brightness of Bangle.js's display, and @@ -7086,6 +9059,9 @@ declare class Bangle { * off * * `btnLoadTimeout` how many milliseconds does the home button have to be pressed * for before the clock is reloaded? 1500ms default, or 0 means never. + * * `manualWatchdog` if set, this disables automatic kicking of the watchdog timer + * from the interrupt (when the button isn't held). You will then have to manually + * call `E.kickWatchdog()` from your code or the watch will reset after ~5 seconds. * * `hrmPollInterval` set the requested poll interval (in milliseconds) for the * heart rate monitor. On Bangle.js 2 only 10,20,40,80,160,200 ms are supported, * and polling rate may not be exact. The algorithm's filtering is tuned for @@ -7098,8 +9074,7 @@ declare class Bangle { * * `hrmGreenAdjust` - (Bangle.js 2, 2v19+) if false (default is true) the green LED intensity won't be adjusted to get the HRM sensor 'exposure' correct. This is reset when the HRM is initialised with `Bangle.setHRMPower`. * * `hrmWearDetect` - (Bangle.js 2, 2v19+) if false (default is true) HRM readings won't be turned off if the watch isn't on your arm (based on HRM proximity sensor). This is reset when the HRM is initialised with `Bangle.setHRMPower`. * * `hrmPushEnv` - (Bangle.js 2, 2v19+) if true (default is false) HRM environment readings will be produced as `Bangle.on(`HRM-env`, ...)` events. This is reset when the HRM is initialised with `Bangle.setHRMPower`. - * * `seaLevelPressure` (Bangle.js 2) Normally 1013.25 millibars - this is used for - * calculating altitude with the pressure sensor + * * `seaLevelPressure` (Bangle.js 2) Default 1013.25 millibars - this is used when calculating altitude from pressure sensor values from `Bangle.getPressure`/`pressure` events. * * `lcdBufferPtr` (Bangle.js 2 2v21+) Return a pointer to the first pixel of the 3 bit graphics buffer used by Bangle.js for the screen (stride = 178 bytes) * * `lcdDoubleRefresh` (Bangle.js 2 2v22+) If enabled, pulses EXTCOMIN twice per poll interval (avoids off-axis flicker) * Where accelerations are used they are in internal units, where `8192 = 1g` @@ -7139,7 +9114,7 @@ declare class Bangle { * @param {boolean} isLocked - `true` if the Bangle is locked (no user input allowed) * @url http://www.espruino.com/Reference#l_Bangle_setLocked */ - static setLocked(isLocked: boolean): void; + static setLocked(isLocked: ShortBoolean): void; /** * Also see the `Bangle.lock` event @@ -7329,6 +9304,8 @@ declare class Bangle { * * `steps` is the number of steps during this period * * `bpm` the best BPM reading from HRM sensor during this period * * `bpmConfidence` best BPM confidence (0-100%) during this period + * * `bpmMin`/`bpmMax` (2v26+) the minimum/maximum BPM reading from HRM sensor during this period (where confidence is over 90) + * * `activity` (2v26+) the currently assumed activity, one of "UNKNOWN","NOT_WORN","WALKING","EXERCISE" * * @param {any} range - What time period to return data for, see below: * @returns {any} Returns an object containing various health info @@ -7373,9 +9350,11 @@ declare class Bangle { static touchWr(reg: number, data: number): void; /** - * Reads a register from the touch controller - * **Note:** On Espruino 2v06 and before this function only returns a number (`cnt` - * is ignored). + * Reads a register from the touch controller. See https://github.com/espruino/Espruino/issues/2146#issuecomment-2554296721 for a list + * of registers. When the touchscreen is off (eg the Bangle is locked) then reading from any register will return `255` (`0xFF`) - + * so ensure the Bangle is unlocked with `Bangle.setLocked(false)` before trying to read or write. + * For example `print(Bangle.touchRd(0xa7).toString(16))` returns the `ChipID` register, which is `0xB4` (CST816S) on older Bangles or `0xB6` (CST816D) on newer ones. + * **Note:** On Espruino 2v06 and before this function only returns a number (`cnt` is ignored). * * @param {number} reg - Register number to read * @param {number} cnt - If specified, returns an array of the given length (max 128). If not (or 0) it returns a number @@ -7436,11 +9415,13 @@ declare class Bangle { /** * Read temperature, pressure and altitude data. A promise is returned which will - * be resolved with `{temperature, pressure, altitude}`. + * be resolved with `{temperature (C), pressure (hPa), altitude (meters)}`. * If the Barometer has been turned on with `Bangle.setBarometerPower` then this * will return with the *next* reading as of 2v21 (or the existing reading on 2v20 or earlier). If the Barometer is off, * conversions take between 500-750ms. - * Altitude assumes a sea-level pressure of 1013.25 hPa + * Altitude assumes a sea-level pressure of 1013.25 hPa, but this cal be adjusted with + * a call to `Bangle.setOptions({ seaLevelPressure : 1013.25 })` - the Bangle.js Settings + * app contains a tool to adjust it. * If there's no pressure device (for example, the emulator), * this returns `undefined`, rather than a Promise. * ``` @@ -7679,7 +9660,7 @@ declare class Bangle { * @param {boolean} noReboot - Do not reboot the watch when done (default false, so will reboot) * @url http://www.espruino.com/Reference#l_Bangle_factoryReset */ - static factoryReset(noReboot: boolean): void; + static factoryReset(noReboot: ShortBoolean): void; /** * Returns the rectangle on the screen that is currently reserved for the app. @@ -7693,45 +9674,1402 @@ declare class Bangle { } /** - * Class containing utility functions for accessing IO on the hexagonal badge - * @url http://www.espruino.com/Reference#Badge + * The NRF class is for controlling functionality of the Nordic nRF51/nRF52 chips. + * Most functionality is related to Bluetooth Low Energy, however there are also + * some functions related to NFC that apply to NRF52-based devices. + * @url http://www.espruino.com/Reference#NRF */ -declare class Badge { +declare class NRF { /** - * Capacitive sense - the higher the capacitance, the higher the number returned. - * Supply a corner number between 1 and 6, and an integer value will be returned - * that is proportional to the capacitance - * - * @param {number} corner - The corner to use - * @returns {number} Capacitive sense counter - * @url http://www.espruino.com/Reference#l_Badge_capSense + * Called when a host device connects to Espruino. The first argument contains the + * address. + * @param {string} event - The event to listen to. + * @param {(addr: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `addr` The address of the device that has connected + * @url http://www.espruino.com/Reference#l_NRF_connect */ - static capSense(corner: number): number; + static on(event: "connect", callback: (addr: any) => void): void; /** - * **DEPRECATED** - Please use `E.getBattery()` instead. - * Return an approximate battery percentage remaining based on a normal CR2032 - * battery (2.8 - 2.2v) - * @returns {number} A percentage between 0 and 100 - * @url http://www.espruino.com/Reference#l_Badge_getBatteryPercentage + * Called when a host device disconnects from Espruino. + * The most common reason is: + * * 19 - `REMOTE_USER_TERMINATED_CONNECTION` + * * 22 - `LOCAL_HOST_TERMINATED_CONNECTION` + * @param {string} event - The event to listen to. + * @param {(reason: number) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `reason` The reason code reported back by the BLE stack - see Nordic's [`ble_hci.h` file](https://github.com/espruino/Espruino/blob/master/targetlibs/nrf5x_12/components/softdevice/s132/headers/ble_hci.h#L71) for more information + * @url http://www.espruino.com/Reference#l_NRF_disconnect */ - static getBatteryPercentage(): number; + static on(event: "disconnect", callback: (reason: number) => void): void; /** - * Set the LCD's contrast - * - * @param {number} c - Contrast between 0 and 1 - * @url http://www.espruino.com/Reference#l_Badge_setContrast + * Called when the Nordic Bluetooth stack (softdevice) generates an error. In pretty + * much all cases an Exception will also have been thrown. + * @param {string} event - The event to listen to. + * @param {(msg: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `msg` The error string + * @url http://www.espruino.com/Reference#l_NRF_error */ +<<<<<<< HEAD static setContrast(c: number): void; >>>>>>> 7a3e0d2e7e1acef8ad643a9b7cc35f240aab9488 +||||||| e51f7bfbe + static setContrast(c: number): void; +======= + static on(event: "error", callback: (msg: any) => void): void; + + /** + * (Added in 2v19) Called when a central device connects to Espruino, pairs, and sends a passkey that Espruino should display. + * For this to be used, you'll have to specify that your device has a display using `NRF.setSecurity({mitm:1, display:1});` + * For instance: + * ``` + * NRF.setSecurity({mitm:1, display:1}); + * NRF.on("passkey", key => print("Enter PIN: ",passkey)); + * ``` + * It is also possible to specify a static passkey with `NRF.setSecurity({passkey:"123456", mitm:1, display:1});` + * in which case no `passkey` event handler is needed (this method works on Espruino 2v02 and later) + * **Note:** A similar event, [`BluetoothDevice.on("passkey", ...)`](http://www.espruino.com/Reference#l_BluetoothDevice_passkey) is available + * for when Espruino is connecting *to* another device (central mode). + * @param {string} event - The event to listen to. + * @param {(passkey: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `passkey` A 6 character numeric String to be displayed + * @url http://www.espruino.com/Reference#l_NRF_passkey + */ + static on(event: "passkey", callback: (passkey: any) => void): void; + + /** + * Contains updates on the security of the current Bluetooth link. + * See Nordic's `ble_gap_evt_auth_status_t` structure for more information. + * @param {string} event - The event to listen to. + * @param {(status: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `status` An object containing `{auth_status,bonded,lv4,kdist_own,kdist_peer}` + * @url http://www.espruino.com/Reference#l_NRF_security + */ + static on(event: "security", callback: (status: any) => void): void; + + /** + * Called when Bluetooth advertising starts or stops on Espruino + * @param {string} event - The event to listen to. + * @param {(isAdvertising: ShortBoolean) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `isAdvertising` Whether we are advertising or not + * @url http://www.espruino.com/Reference#l_NRF_advertising + */ + static on(event: "advertising", callback: (isAdvertising: ShortBoolean) => void): void; + + /** + * Called during the bonding process to update on status + * `status` is one of: + * * `"request"` - Bonding has been requested in code via `NRF.startBonding` + * * `"start"` - The bonding procedure has started + * * `"success"` - The bonding procedure has succeeded (`NRF.startBonding`'s promise resolves) + * * `"fail"` - The bonding procedure has failed (`NRF.startBonding`'s promise rejects) + * @param {string} event - The event to listen to. + * @param {(status: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `status` One of `'request'/'start'/'success'/'fail'` + * @url http://www.espruino.com/Reference#l_NRF_bond + */ + static on(event: "bond", callback: (status: any) => void): void; + + /** + * Called with a single byte value when Espruino is set up as a HID device and the + * computer it is connected to sends a HID report back to Espruino. This is usually + * used for handling indications such as the Caps Lock LED. + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_HID + */ + static on(event: "HID", callback: () => void): void; + + /** + * Called with discovered services when discovery is finished + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_servicesDiscover + */ + static on(event: "servicesDiscover", callback: () => void): void; + + /** + * Called with discovered characteristics when discovery is finished + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_characteristicsDiscover + */ + static on(event: "characteristicsDiscover", callback: () => void): void; + + /** + * Called when an NFC field is detected + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_NFCon + */ + static on(event: "NFCon", callback: () => void): void; + + /** + * Called when an NFC field is no longer detected + * @param {string} event - The event to listen to. + * @param {() => void} callback - A function that is executed when the event occurs. + * @url http://www.espruino.com/Reference#l_NRF_NFCoff + */ + static on(event: "NFCoff", callback: () => void): void; + + /** + * When NFC is started with `NRF.nfcStart`, this is fired when NFC data is + * received. It doesn't get called if NFC is started with `NRF.nfcURL` or + * `NRF.nfcRaw` + * @param {string} event - The event to listen to. + * @param {(arr: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `arr` An ArrayBuffer containign the received data + * @url http://www.espruino.com/Reference#l_NRF_NFCrx + */ + static on(event: "NFCrx", callback: (arr: any) => void): void; + + /** + * If a device is connected to Espruino, disconnect from it. + * @url http://www.espruino.com/Reference#l_NRF_disconnect + */ + static disconnect(): void; + + /** + * Disable Bluetooth advertising and disconnect from any device that connected to + * Puck.js as a peripheral (this won't affect any devices that Puck.js initiated + * connections to). + * This makes Puck.js undiscoverable, so it can't be connected to. + * Use `NRF.wake()` to wake up and make Puck.js connectable again. + * @url http://www.espruino.com/Reference#l_NRF_sleep + */ + static sleep(): void; + + /** + * Enable Bluetooth advertising (this is enabled by default), which allows other + * devices to discover and connect to Puck.js. + * Use `NRF.sleep()` to disable advertising. + * @url http://www.espruino.com/Reference#l_NRF_wake + */ + static wake(): void; + + /** + * Restart the Bluetooth softdevice (if there is currently a BLE connection, it + * will queue a restart to be done when the connection closes). + * You shouldn't need to call this function in normal usage. However, Nordic's BLE + * softdevice has some settings that cannot be reset. For example there are only a + * certain number of unique UUIDs. Once these are all used the only option is to + * restart the softdevice to clear them all out. + * + * @param {any} [callback] - [optional] A function to be called while the softdevice is uninitialised. Use with caution - accessing console/bluetooth will almost certainly result in a crash. + * @url http://www.espruino.com/Reference#l_NRF_restart + */ + static restart(callback?: any): void; + + /** + * Delete all data stored for all peers (bonding data used for secure connections). This cannot be done + * while a connection is active, so if there is a connection it will be postponed until everything is disconnected + * (which can be done by calling `NRF.disconnect()` and waiting). + * Booting your device while holding all buttons down together should also have the same effect. + * + * @param {any} [callback] - [optional] A function to be called while the softdevice is uninitialised. Use with caution - accessing console/bluetooth will almost certainly result in a crash. + * @url http://www.espruino.com/Reference#l_NRF_eraseBonds + */ + static eraseBonds(callback?: any): void; + + /** + * Get this device's default or current Bluetooth MAC address. + * For Puck.js, the last 5 characters of this (e.g. `ee:ff`) are used in the + * device's advertised Bluetooth name. + * + * @param {boolean} current - If true, return the current address rather than the default + * @returns {any} MAC address - a string of the form 'aa:bb:cc:dd:ee:ff' + * @url http://www.espruino.com/Reference#l_NRF_getAddress + */ + static getAddress(current: ShortBoolean): any; + + /** + * Set this device's default Bluetooth MAC address: + * ``` + * NRF.setAddress("ff:ee:dd:cc:bb:aa random"); + * ``` + * Addresses take the form: + * * `"ff:ee:dd:cc:bb:aa"` or `"ff:ee:dd:cc:bb:aa public"` for a public address + * * `"ff:ee:dd:cc:bb:aa random"` for a random static address (the default for + * Espruino) + * This may throw a `INVALID_BLE_ADDR` error if the upper two bits of the address + * don't match the address type. + * To change the address, Espruino must restart the softdevice. It will only do so + * when it is disconnected from other devices. + * + * @param {any} addr - The address to use (as a string) + * @url http://www.espruino.com/Reference#l_NRF_setAddress + */ + static setAddress(addr: any): void; + + /** + * Try to resolve a **bonded** peer's address from a random private resolvable address. If the peer + * is not bonded, there will be no IRK and `undefined` will be returned. + * A bunch of devices, especially smartphones, implement address randomisation and periodically change + * their bluetooth address to prevent being tracked. + * If such a device uses a "random private resolvable address", that address is generated + * with the help of an identity resolving key (IRK) that is exchanged during bonding. + * If we know the IRK of a device, we can check if an address was potentially generated by that device. + * The following will check an address against the IRKs of all bonded devices, + * and return the actual address of a bonded device if the given address was likely generated using that device's IRK: + * ``` + * NRF.on('connect',addr=> { + * // addr could be "aa:bb:cc:dd:ee:ff private-resolvable" + * if (addr.endsWith("private-resolvable")) { + * let resolved = NRF.resolveAddress(addr); + * // resolved is "aa:bb:cc:dd:ee:ff public" + * if (resolved) addr = resolved; + * } + * console.log("Device connected: ", addr); + * }) + * ``` + * You can get the current connection's address using `NRF.getSecurityStatus().connected_addr`, + * so can for instance do `NRF.resolveAddress(NRF.getSecurityStatus().connected_addr)`. + * + * @param {any} options - The address that should be resolved. + * @returns {any} The resolved address, or `undefined` if it couldn't be resolved. + * @url http://www.espruino.com/Reference#l_NRF_resolveAddress + */ + static resolveAddress(options: any): any; + + /** + * Get the battery level in volts (the voltage that the NRF chip is running off + * of). + * This is the battery level of the device itself - it has nothing to with any + * device that might be connected. + * @returns {number} Battery level in volts + * @url http://www.espruino.com/Reference#l_NRF_getBattery + */ + static getBattery(): number; + + /** + * Change the data that Espruino advertises. + * Data can be of the form `{ UUID : data_as_byte_array }`. The UUID should be a + * [Bluetooth Service + * ID](https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx). + * For example to return battery level at 95%, do: + * ``` + * NRF.setAdvertising({ + * 0x180F : [95] // Service data 0x180F = 95 + * }); + * ``` + * Or you could report the current temperature: + * ``` + * setInterval(function() { + * NRF.setAdvertising({ + * 0x1809 : [Math.round(E.getTemperature())] + * }); + * }, 30000); + * ``` + * If you specify a value for the object key, Service Data is advertised. However + * if you specify `undefined`, the Service UUID is advertised: + * ``` + * NRF.setAdvertising({ + * 0x180D : undefined // Advertise service UUID 0x180D (HRM) + * }); + * ``` + * Service UUIDs can also be supplied in the second argument of `NRF.setServices`, + * but those go in the scan response packet. + * You can also supply the raw advertising data in an array. For example to + * advertise as an Eddystone beacon: + * ``` + * NRF.setAdvertising([0x03, // Length of Service List + * 0x03, // Param: Service List + * 0xAA, 0xFE, // Eddystone ID + * 0x13, // Length of Service Data + * 0x16, // Service Data + * 0xAA, 0xFE, // Eddystone ID + * 0x10, // Frame type: URL + * 0xF8, // Power + * 0x03, // https:// + * 'g','o','o','.','g','l','/','B','3','J','0','O','c'], + * {interval:100}); + * ``` + * (However for Eddystone we'd advise that you use the [Espruino Eddystone + * library](/Puck.js+Eddystone)) + * **Note:** When specifying data as an array, certain advertising options such as + * `discoverable` and `showName` won't have any effect. + * **Note:** The size of Bluetooth LE advertising packets is limited to 31 bytes. + * If you want to advertise more data, consider using an array for `data` (See + * below), or `NRF.setScanResponse`. + * You can even specify an array of arrays or objects, in which case each + * advertising packet will be used in turn - for instance to make your device + * advertise battery level and its name as well as both Eddystone and iBeacon : + * ``` + * NRF.setAdvertising([ + * {0x180F : [E.getBattery()]}, // normal advertising, with battery % + * require("ble_ibeacon").get(...), // iBeacon + * require("ble_eddystone").get(...), // eddystone + * ], {interval:300}); + * ``` + * `options` is an object, which can contain: + * ``` + * { + * name: "Hello" // The name of the device + * showName: true/false // include full name, or nothing + * discoverable: true/false // general discoverable, or limited - default is limited + * connectable: true/false // whether device is connectable - default is true + * scannable : true/false // whether device can be scanned for scan response packets - default is true + * whenConnected : true/false // keep advertising when connected (nRF52 only) + * // switches to advertising as non-connectable when it is connected + * interval: 600 // Advertising interval in msec, between 20 and 10000 (default is 375ms) + * manufacturer: 0x0590 // IF sending manufacturer data, this is the manufacturer ID + * manufacturerData: [...] // IF sending manufacturer data, this is an array of data + * phy: "1mbps/2mbps/coded" // (NRF52833/NRF52840 only) use the long-range coded phy for transmission (1mbps default) + * } + * ``` + * Setting `connectable` and `scannable` to false gives the lowest power + * consumption as the BLE radio doesn't have to listen after sending advertising. + * **NOTE:** Non-`connectable` advertising can't have an advertising interval less + * than 100ms according to the BLE spec. + * So for instance to set the name of Puck.js without advertising any other data + * you can just use the command: + * ``` + * NRF.setAdvertising({},{name:"Hello"}); + * ``` + * You can also specify 'manufacturer data', which is another form of advertising + * data. We've registered the Manufacturer ID 0x0590 (as Pur3 Ltd) for use with + * *Official Espruino devices* - use it to advertise whatever data you'd like, but + * we'd recommend using JSON. + * For example by not advertising a device name you can send up to 24 bytes of JSON + * on Espruino's manufacturer ID: + * ``` + * var data = {a:1,b:2}; + * NRF.setAdvertising({},{ + * showName:false, + * manufacturer:0x0590, + * manufacturerData:JSON.stringify(data) + * }); + * ``` + * If you're using [EspruinoHub](https://github.com/espruino/EspruinoHub) then it + * will automatically decode this into the following MQTT topics: + * * `/ble/advertise/ma:c_:_a:dd:re:ss/espruino` -> `{"a":10,"b":15}` + * * `/ble/advertise/ma:c_:_a:dd:re:ss/a` -> `1` + * * `/ble/advertise/ma:c_:_a:dd:re:ss/b` -> `2` + * Note that **you only have 24 characters available for JSON**, so try to use the + * shortest field names possible and avoid floating point values that can be very + * long when converted to a String. + * + * @param {any} data - The service data to advertise as an object - see below for more info + * @param {any} [options] - [optional] Object of options + * @url http://www.espruino.com/Reference#l_NRF_setAdvertising + */ + static setAdvertising(data: any, options?: any): void; + + /** + * This is just like `NRF.setAdvertising`, except instead of advertising the data, + * it returns the packet that would be advertised as an array. + * + * @param {any} data - The data to advertise as an object + * @param {any} [options] - [optional] An object of options + * @returns {any} An array containing the advertising data + * @url http://www.espruino.com/Reference#l_NRF_getAdvertisingData + */ + static getAdvertisingData(data: any, options?: any): any; + + /** + * The raw scan response data should be supplied as an array. For example to return + * "Sample" for the device name: + * ``` + * NRF.setScanResponse([0x07, // Length of Data + * 0x09, // Param: Complete Local Name + * 'S', 'a', 'm', 'p', 'l', 'e']); + * ``` + * **Note:** `NRF.setServices(..., {advertise:[ ... ]})` writes advertised services + * into the scan response - so you can't use both `advertise` and `NRF.setServices` + * or one will overwrite the other. + * + * @param {any} data - The data to for the scan response + * @url http://www.espruino.com/Reference#l_NRF_setScanResponse + */ + static setScanResponse(data: any): void; + + /** + * Change the services and characteristics Espruino advertises. + * If you want to **change** the value of a characteristic, you need to use + * `NRF.updateServices()` instead + * To expose some information on Characteristic `ABCD` on service `BCDE` you could + * do: + * ``` + * NRF.setServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "Hello", + * readable : true + * } + * } + * }); + * ``` + * Or to allow the 3 LEDs to be controlled by writing numbers 0 to 7 to a + * characteristic, you can do the following. `evt.data` is an ArrayBuffer. + * ``` + * NRF.setServices({ + * 0xBCDE : { + * 0xABCD : { + * writable : true, + * onWrite : function(evt) { + * digitalWrite([LED3,LED2,LED1], evt.data[0]); + * } + * } + * } + * }); + * ``` + * You can supply many different options: + * ``` + * NRF.setServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "Hello", // optional + * maxLen : 5, // optional (otherwise is length of initial value) + * broadcast : false, // optional, default is false + * readable : true, // optional, default is false + * writable : true, // optional, default is false + * notify : true, // optional, default is false + * indicate : true, // optional, default is false + * description: "My Characteristic", // optional, default is null, + * security: { // optional - see NRF.setSecurity + * read: { // optional + * encrypted: false, // optional, default is false + * mitm: false, // optional, default is false + * lesc: false, // optional, default is false + * signed: false // optional, default is false + * }, + * write: { // optional + * encrypted: true, // optional, default is false + * mitm: false, // optional, default is false + * lesc: false, // optional, default is false + * signed: false // optional, default is false + * } + * }, + * onWrite : function(evt) { // optional + * console.log("Got ", evt.data); // an ArrayBuffer + * }, + * onWriteDesc : function(evt) { // optional - called when the 'cccd' descriptor is written + * // for example this is called when notifications are requested by the client: + * console.log("Notifications enabled = ", evt.data[0]&1); + * } + * } + * // more characteristics allowed + * } + * // more services allowed + * }); + * ``` + * **Note:** UUIDs can be integers between `0` and `0xFFFF`, strings of the form + * `"ABCD"`, or strings of the form `"ABCDABCD-ABCD-ABCD-ABCD-ABCDABCDABCD"` + * `options` can be of the form: + * ``` + * NRF.setServices(undefined, { + * hid : new Uint8Array(...), // optional, default is undefined. Enable BLE HID support + * uart : true, // optional, default is true. Enable BLE UART support + * advertise: [ '180D' ] // optional, list of service UUIDs to advertise + * ancs : true, // optional, Bangle.js-only, enable Apple ANCS support for notifications (see `NRF.ancs*`) + * ams : true // optional, Bangle.js-only, enable Apple AMS support for media control (see `NRF.ams*`) + * cts : true // optional, Bangle.js-only, enable Apple Current Time Service support (see `NRF.ctsGetTime`) + * }); + * ``` + * To enable BLE HID, you must set `hid` to an array which is the BLE report + * descriptor. The easiest way to do this is to use the `ble_hid_controls` or + * `ble_hid_keyboard` modules. + * **Note:** Just creating a service doesn't mean that the service will be + * advertised. It will only be available after a device connects. To advertise, + * specify the UUIDs you wish to advertise in the `advertise` field of the second + * `options` argument. For example this will create and advertise a heart rate + * service: + * ``` + * NRF.setServices({ + * 0x180D: { // heart_rate + * 0x2A37: { // heart_rate_measurement + * notify: true, + * value : [0x06, heartrate], + * } + * } + * }, { advertise: [ '180D' ] }); + * ``` + * You may specify 128 bit UUIDs to advertise, however you may get a `DATA_SIZE` + * exception because there is insufficient space in the Bluetooth LE advertising + * packet for the 128 bit UART UUID as well as the UUID you specified. In this case + * you can add `uart:false` after the `advertise` element to disable the UART, + * however you then be unable to connect to Puck.js's console via Bluetooth. + * If you absolutely require two or more 128 bit UUIDs then you will have to + * specify your own raw advertising data packets with `NRF.setAdvertising` + * **Note:** The services on Espruino can only be modified when there is no device + * connected to it as it requires a restart of the Bluetooth stack. **iOS devices + * will 'cache' the list of services** so apps like NRF Connect may incorrectly + * display the old services even after you have modified them. To fix this, disable + * and re-enable Bluetooth on your iOS device, or use an Android device to run NRF + * Connect. + * **Note:** Not all combinations of security configuration values are valid, the + * valid combinations are: encrypted, encrypted + mitm, lesc, signed, signed + + * mitm. See `NRF.setSecurity` for more information. + * + * @param {any} data - The service (and characteristics) to advertise + * @param {any} [options] - [optional] Object containing options + * @url http://www.espruino.com/Reference#l_NRF_setServices + */ + static setServices(data: { [key: number]: { [key: number]: { value?: string, maxLen?: number, broadcast?: boolean, readable?: boolean, writable?: boolean, notify?: boolean, indicate?: boolean, description?: string, security?: { read?: { encrypted?: boolean, mitm?: boolean, lesc?: boolean, signed?: boolean }, write?: { encrypted?: boolean, mitm?: boolean, lesc?: boolean, signed?: boolean } }, onWrite?: (evt: { data: ArrayBuffer }) => void } } }, options?: any): void; + + /** + * Update values for the services and characteristics Espruino advertises. Only + * services and characteristics previously declared using `NRF.setServices` are + * affected. + * To update the '0xABCD' characteristic in the '0xBCDE' service: + * ``` + * NRF.updateServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "World" + * } + * } + * }); + * ``` + * You can also use 128 bit UUIDs, for example + * `"b7920001-3c1b-4b40-869f-3c0db9be80c6"`. + * To define a service and characteristic and then notify connected clients of a + * change to it when a button is pressed: + * ``` + * NRF.setServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "Hello", + * maxLen : 20, + * notify: true + * } + * } + * }); + * setWatch(function() { + * NRF.updateServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "World!", + * notify: true + * } + * } + * }); + * }, BTN, { repeat:true, edge:"rising", debounce: 50 }); + * ``` + * This only works if the characteristic was created with `notify: true` using + * `NRF.setServices`, otherwise the characteristic will be updated but no + * notification will be sent. + * Also note that `maxLen` was specified. If it wasn't then the maximum length of + * the characteristic would have been 5 - the length of `"Hello"`. + * To indicate (i.e. notify with ACK) connected clients of a change to the '0xABCD' + * characteristic in the '0xBCDE' service: + * ``` + * NRF.updateServices({ + * 0xBCDE : { + * 0xABCD : { + * value : "World", + * indicate: true + * } + * } + * }); + * ``` + * This only works if the characteristic was created with `indicate: true` using + * `NRF.setServices`, otherwise the characteristic will be updated but no + * notification will be sent. + * **Note:** See `NRF.setServices` for more information + * + * @param {any} data - The service (and characteristics) to update + * @url http://www.espruino.com/Reference#l_NRF_updateServices + */ + static updateServices(data: any): void; + + /** + * Start/stop listening for BLE advertising packets within range. Returns a + * `BluetoothDevice` for each advertising packet. **By default this is not an active + * scan, so Scan Response advertising data is not included (see below)** + * ``` + * // Start scanning + * packets=10; + * NRF.setScan(function(d) { + * packets--; + * if (packets<=0) + * NRF.setScan(); // stop scanning + * else + * console.log(d); // print packet info + * }); + * ``` + * Each `BluetoothDevice` will look a bit like: + * ``` + * BluetoothDevice { + * "id": "aa:bb:cc:dd:ee:ff", // address + * "rssi": -89, // signal strength + * "services": [ "128bit-uuid", ... ], // zero or more service UUIDs + * "data": new Uint8Array([ ... ]).buffer, // ArrayBuffer of returned data + * "serviceData" : { "0123" : [ 1 ] }, // if service data is in 'data', it's extracted here + * "manufacturer" : 0x1234, // if manufacturer data is in 'data', the 16 bit manufacturer ID is extracted here + * "manufacturerData" : new Uint8Array([...]).buffer, // if manufacturer data is in 'data', the data is extracted here as an ArrayBuffer + * "name": "DeviceName" // the advertised device name + * } + * ``` + * You can also supply a set of filters (as described in `NRF.requestDevice`) as a + * second argument, which will allow you to filter the devices you get a callback + * for. This helps to cut down on the time spent processing JavaScript code in + * areas with a lot of Bluetooth advertisements. For example to find only devices + * with the manufacturer data `0x0590` (Espruino's ID) you could do: + * ``` + * NRF.setScan(function(d) { + * console.log(d.manufacturerData); + * }, { filters: [{ manufacturerData:{0x0590:{}} }] }); + * ``` + * You can also specify `active:true` in the second argument to perform active + * scanning (this requests scan response packets) from any devices it finds. + * **Note:** Using a filter in `setScan` filters each advertising packet + * individually. As a result, if you filter based on a service UUID and a device + * advertises with multiple packets (or a scan response when `active:true`) only + * the packets matching the filter are returned. To aggregate multiple packets you + * can use `NRF.findDevices`. + * **Note:** BLE advertising packets can arrive quickly - faster than you'll be + * able to print them to the console. It's best only to print a few, or to use a + * function like `NRF.findDevices(..)` which will collate a list of available + * devices. + * **Note:** Using setScan turns the radio's receive mode on constantly. This can + * draw a *lot* of power (12mA or so), so you should use it sparingly or you can + * run your battery down quickly. + * + * @param {any} callback - The callback to call with received advertising packets, or undefined to stop + * @param {any} [options] - [optional] An object `{filters: ...}` (as would be passed to `NRF.requestDevice`) to filter devices by + * @url http://www.espruino.com/Reference#l_NRF_setScan + */ + static setScan(callback: any, options?: any): void; + + /** + * This function can be used to quickly filter through Bluetooth devices. + * For instance if you wish to scan for multiple different types of device at the + * same time then you could use `NRF.findDevices` with all the filters you're + * interested in. When scanning is finished you can then use `NRF.filterDevices` to + * pick out just the devices of interest. + * ``` + * // the two types of device we're interested in + * var filter1 = [{serviceData:{"fe95":{}}}]; + * var filter2 = [{namePrefix:"Pixl.js"}]; + * // the following filter will return both types of device + * var allFilters = filter1.concat(filter2); + * // now scan for both types of device, and filter them out afterwards + * NRF.findDevices(function(devices) { + * var devices1 = NRF.filterDevices(devices, filter1); + * var devices2 = NRF.filterDevices(devices, filter2); + * // ... + * }, {filters : allFilters}); + * ``` + * + * @param {any} devices - An array of `BluetoothDevice` objects, from `NRF.findDevices` or similar + * @param {any} filters - A list of filters (as would be passed to `NRF.requestDevice`) to filter devices by + * @returns {any} An array of `BluetoothDevice` objects that match the given filters + * @url http://www.espruino.com/Reference#l_NRF_filterDevices + */ + static filterDevices(devices: any, filters: any): any; + + /** + * Utility function to return a list of BLE devices detected in range. Behind the + * scenes, this uses `NRF.setScan(...)` and collates the results. + * ``` + * NRF.findDevices(function(devices) { + * console.log(devices); + * }, 1000); + * ``` + * prints something like: + * ``` + * [ + * BluetoothDevice { + * "id" : "e7:e0:57:ad:36:a2 random", + * "rssi": -45, + * "services": [ "4567" ], + * "serviceData" : { "0123" : [ 1 ] }, + * "manufacturer" : 1424, + * "manufacturerData" : new Uint8Array([ ... ]).buffer, + * "data": new ArrayBuffer([ ... ]).buffer, + * "name": "Puck.js 36a2" + * }, + * BluetoothDevice { + * "id": "c0:52:3f:50:42:c9 random", + * "rssi": -65, + * "data": new ArrayBuffer([ ... ]), + * "name": "Puck.js 8f57" + * } + * ] + * ``` + * For more information on the structure returned, see `NRF.setScan`. + * If you want to scan only for specific devices you can replace the timeout with + * an object of the form `{filters: ..., timeout : ..., active: bool}` using the + * filters described in `NRF.requestDevice`. For example to search for devices with + * Espruino's `manufacturerData`: + * ``` + * NRF.findDevices(function(devices) { + * ... + * }, {timeout : 2000, filters : [{ manufacturerData:{0x0590:{}} }] }); + * ``` + * You could then use + * [`BluetoothDevice.gatt.connect(...)`](/Reference#l_BluetoothRemoteGATTServer_connect) + * on the device returned to make a connection. + * You can also use [`NRF.connect(...)`](/Reference#l_NRF_connect) on just the `id` + * string returned, which may be useful if you always want to connect to a specific + * device. + * **Note:** Using findDevices turns the radio's receive mode on for 2000ms (or + * however long you specify). This can draw a *lot* of power (12mA or so), so you + * should use it sparingly or you can run your battery down quickly. + * **Note:** The 'data' field contains the data of *the last packet received*. + * There may have been more packets. To get data for each packet individually use + * `NRF.setScan` instead. + * + * @param {any} callback - The callback to call with received advertising packets (as `BluetoothDevice`), or undefined to stop + * @param {any} [options] - [optional] A time in milliseconds to scan for (defaults to 2000), Or an optional object `{filters: ..., timeout : ..., active: bool}` (as would be passed to `NRF.requestDevice`) to filter devices by + * @url http://www.espruino.com/Reference#l_NRF_findDevices + */ + static findDevices(callback: (devices: BluetoothDevice[]) => void, options?: number | { filters?: NRFFilters[], timeout?: number, active?: boolean }): void; + + /** + * Start/stop listening for RSSI values on the currently active connection (where + * This device is a peripheral and is being connected to by a 'central' device) + * ``` + * // Start scanning + * NRF.setRSSIHandler(function(rssi) { + * console.log(rssi); // prints -85 (or similar) + * }); + * // Stop Scanning + * NRF.setRSSIHandler(); + * ``` + * RSSI is the 'Received Signal Strength Indication' in dBm + * + * @param {any} callback - The callback to call with the RSSI value, or undefined to stop + * @url http://www.espruino.com/Reference#l_NRF_setRSSIHandler + */ + static setRSSIHandler(callback: any): void; + + /** + * Set the BLE radio transmit power. The default TX power is 0 dBm, and + * + * @param {number} power - Transmit power. Accepted values are -40(nRF52 only), -30(nRF51 only), -20, -16, -12, -8, -4, 0, and 4 dBm. On nRF52840 (eg Bangle.js 2) 5/6/7/8 dBm are available too. Others will give an error code. + * @url http://www.espruino.com/Reference#l_NRF_setTxPower + */ + static setTxPower(power: number): void; + + /** + * **THIS IS DEPRECATED** - please use `NRF.setConnectionInterval` for peripheral + * and `NRF.connect(address, options)`/`BluetoothRemoteGATTServer.connect(options)` + * for central connections. + * This sets the connection parameters - these affect the transfer speed and power + * usage when the device is connected. + * * When not low power, the connection interval is between 7.5 and 20ms + * * When low power, the connection interval is between 500 and 1000ms + * When low power connection is enabled, transfers of data over Bluetooth will be + * very slow, however power usage while connected will be drastically decreased. + * This will only take effect after the connection is disconnected and + * re-established. + * + * @param {boolean} lowPower - Whether the connection is low power or not + * @url http://www.espruino.com/Reference#l_NRF_setLowPowerConnection + */ + static setLowPowerConnection(lowPower: ShortBoolean): void; + + /** + * Enables NFC and starts advertising the given URL. For example: + * ``` + * NRF.nfcURL("http://espruino.com"); + * ``` + * + * @param {any} url - The URL string to expose on NFC, or `undefined` to disable NFC + * @url http://www.espruino.com/Reference#l_NRF_nfcURL + */ + static nfcURL(url: any): void; + + /** + * Enables NFC and with an out of band 16 byte pairing key. + * For example the following will enable out of band pairing on BLE such that the + * device will pair when you tap the phone against it: + * ``` + * var bleKey = [0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00]; + * NRF.on('security',s=>print("security",JSON.stringify(s))); + * NRF.nfcPair(bleKey); + * NRF.setSecurity({oob:bleKey, mitm:true}); + * ``` + * + * @param {any} key - 16 byte out of band key + * @url http://www.espruino.com/Reference#l_NRF_nfcPair + */ + static nfcPair(key: any): void; + + /** + * Enables NFC with a record that will launch the given android app. + * For example: + * ``` + * NRF.nfcAndroidApp("no.nordicsemi.android.nrftoolbox") + * ``` + * + * @param {any} app - The unique identifier of the given Android App + * @url http://www.espruino.com/Reference#l_NRF_nfcAndroidApp + */ + static nfcAndroidApp(app: any): void; + + /** + * Enables NFC and starts advertising with Raw data. For example: + * ``` + * NRF.nfcRaw(new Uint8Array([193, 1, 0, 0, 0, 13, 85, 3, 101, 115, 112, 114, 117, 105, 110, 111, 46, 99, 111, 109])); + * // same as NRF.nfcURL("http://espruino.com"); + * ``` + * + * @param {any} payload - The NFC NDEF message to deliver to the reader + * @url http://www.espruino.com/Reference#l_NRF_nfcRaw + */ + static nfcRaw(payload: any): void; + + /** + * **Advanced NFC Functionality.** If you just want to advertise a URL, use + * `NRF.nfcURL` instead. + * Enables NFC and starts advertising. `NFCrx` events will be fired when data is + * received. + * ``` + * NRF.nfcStart(); + * ``` + * + * @param {any} payload - Optional 7 byte UID + * @returns {any} Internal tag memory (first 10 bytes of tag data) + * @url http://www.espruino.com/Reference#l_NRF_nfcStart + */ + static nfcStart(payload: any): any; + + /** + * **Advanced NFC Functionality.** If you just want to advertise a URL, use + * `NRF.nfcURL` instead. + * Disables NFC. + * ``` + * NRF.nfcStop(); + * ``` + * + * @url http://www.espruino.com/Reference#l_NRF_nfcStop + */ + static nfcStop(): void; + + /** + * **Advanced NFC Functionality.** If you just want to advertise a URL, use + * `NRF.nfcURL` instead. + * Acknowledges the last frame and optionally transmits a response. If payload is + * an array, then a array.length byte nfc frame is sent. If payload is a int, then + * a 4bit ACK/NACK is sent. **Note:** ```nfcSend``` should always be called after + * an ```NFCrx``` event. + * ``` + * NRF.nfcSend(new Uint8Array([0x01, 0x02, ...])); + * // or + * NRF.nfcSend(0x0A); + * // or + * NRF.nfcSend(); + * ``` + * + * @param {any} payload - Optional tx data + * @url http://www.espruino.com/Reference#l_NRF_nfcSend + */ + static nfcSend(payload: any): void; + + /** + * Send a USB HID report. HID must first be enabled with `NRF.setServices({}, {hid: + * hid_report})` + * + * @param {any} data - Input report data as an array + * @param {any} callback - A callback function to be called when the data is sent + * @url http://www.espruino.com/Reference#l_NRF_sendHIDReport + */ + static sendHIDReport(data: number[], callback?: () => void): void + + /** + * Check if Apple Notification Center Service (ANCS) is currently active on the BLE + * connection + * + * @returns {boolean} True if Apple Notification Center Service (ANCS) has been initialised and is active + * @url http://www.espruino.com/Reference#l_NRF_ancsIsActive + */ + static ancsIsActive(): boolean; + + /** + * Send an ANCS action for a specific Notification UID. Corresponds to + * posaction/negaction in the 'ANCS' event that was received + * + * @param {number} uid - The UID of the notification to respond to + * @param {boolean} positive - `true` for positive action, `false` for negative + * @url http://www.espruino.com/Reference#l_NRF_ancsAction + */ + static ancsAction(uid: number, positive: ShortBoolean): void; + + /** + * Get ANCS info for a notification event received via `E.ANCS`, e.g.: + * ``` + * E.on('ANCS', event => { + * NRF.ancsGetNotificationInfo( event.uid ).then(a=>print("Notify",E.toJS(a))); + * }); + * ``` + * Returns: + * ``` + * { + * "uid" : integer, + * "appId": string, + * "title": string, + * "subtitle": string, + * "message": string, + * "messageSize": string, + * "date": string, + * "posAction": string, + * "negAction": string + * } + * ``` + * + * @param {number} uid - The UID of the notification to get information for + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_ancsGetNotificationInfo + */ + static ancsGetNotificationInfo(uid: number): Promise; + + /** + * Get ANCS info for an app (app id is available via `NRF.ancsGetNotificationInfo`) + * Promise returns: + * ``` + * { + * "uid" : int, + * "appId" : string, + * "title" : string, + * "subtitle" : string, + * "message" : string, + * "messageSize" : string, + * "date" : string, + * "posAction" : string, + * "negAction" : string, + * "name" : string, + * } + * ``` + * + * @param {any} id - The app ID to get information for + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_ancsGetAppInfo + */ + static ancsGetAppInfo(id: any): Promise; + + /** + * Check if Apple Media Service (AMS) is currently active on the BLE connection + * + * @returns {boolean} True if Apple Media Service (AMS) has been initialised and is active + * @url http://www.espruino.com/Reference#l_NRF_amsIsActive + */ + static amsIsActive(): boolean; + + /** + * Get Apple Media Service (AMS) info for the current media player. "playbackinfo" + * returns a concatenation of three comma-separated values: + * - PlaybackState: a string that represents the integer value of the playback + * state: + * - PlaybackStatePaused = 0 + * - PlaybackStatePlaying = 1 + * - PlaybackStateRewinding = 2 + * - PlaybackStateFastForwarding = 3 + * - PlaybackRate: a string that represents the floating point value of the + * playback rate. + * - ElapsedTime: a string that represents the floating point value of the elapsed + * time of the current track, in seconds + * + * @param {any} id - Either 'name', 'playbackinfo' or 'volume' + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_amsGetPlayerInfo + */ + static amsGetPlayerInfo(id: any): Promise; + + /** + * Get Apple Media Service (AMS) info for the currently-playing track + * + * @param {any} id - Either 'artist', 'album', 'title' or 'duration' + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_amsGetTrackInfo + */ + static amsGetTrackInfo(id: any): Promise; + + /** + * Send an AMS command to an Apple Media Service device to control music playback + * Command is one of play, pause, playpause, next, prev, volup, voldown, repeat, + * shuffle, skipforward, skipback, like, dislike, bookmark + * + * @param {any} id - For example, 'play', 'pause', 'volup' or 'voldown' + * @url http://www.espruino.com/Reference#l_NRF_amsCommand + */ + static amsCommand(id: any): void; + + /** + * Check if Apple Current Time Service (CTS) is currently active on the BLE connection + * + * @returns {boolean} True if Apple Current Time Service (CTS) has been initialised and is active + * @url http://www.espruino.com/Reference#l_NRF_ctsIsActive + */ + static ctsIsActive(): boolean; + + /** + * Returns time information from the Current Time Service + * (if requested with `NRF.ctsGetTime` and is activated by calling `NRF.setServices(..., {..., cts:true})`) + * ``` + * { + * date : // Date object with the current date + * day : // if known, 0=sun,1=mon (matches JS `Date`) + * reason : [ // reason for the date change + * "external", // External time change + * "manual", // Manual update + * "timezone", // Timezone changed + * "DST", // Daylight savings + * ] + * timezone // if LTI characteristic exists, this is the timezone + * dst // if LTI characteristic exists, this is the dst adjustment + * } + * ``` + * For instance this can be used as follows to update Espruino's time: + * ``` + * E.on('CTS',e=>{ + * setTime(e.date.getTime()/1000); + * }); + * NRF.ctsGetTime(); // also returns a promise with CTS info + * ``` + * @param {string} event - The event to listen to. + * @param {(info: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `info` An object (see below) + * @url http://www.espruino.com/Reference#l_NRF_CTS + */ + static on(event: "CTS", callback: (info: any) => void): void; + + /** + * Read the time from CTS - creates an `NRF.on('CTS', ...)` event as well + * ``` + * NRF.ctsGetTime(); // also returns a promise + * ``` + * @returns {any} A `Promise` that is resolved (or rejected) when time is received + * @url http://www.espruino.com/Reference#l_NRF_ctsGetTime + */ + static ctsGetTime(): Promise; + + /** + * Search for available devices matching the given filters. Since we have no UI + * here, Espruino will pick the FIRST device it finds, or it'll call `catch`. + * `options` can have the following fields: + * * `filters` - a list of filters that a device must match before it is returned + * (see below) + * * `timeout` - the maximum time to scan for in milliseconds (scanning stops when + * a match is found. e.g. `NRF.requestDevice({ timeout:2000, filters: [ ... ] })` + * * `active` - whether to perform active scanning (requesting 'scan response' + * packets from any devices that are found). e.g. `NRF.requestDevice({ active:true, + * filters: [ ... ] })` + * * `phy` - (NRF52833/NRF52840 only) the type of Bluetooth signals to scan for (can + * be `"1mbps/coded/both/2mbps"`) + * * `1mbps` (default) - standard Bluetooth LE advertising + * * `coded` - long range + * * `both` - standard and long range + * * `2mbps` - high speed 2mbps (not working) + * * `extended` - (NRF52833/NRF52840 only) support receiving extended-length advertising + * packets (default=true if phy isn't `"1mbps"`) + * * `extended` - (NRF52833/NRF52840 only) support receiving extended-length advertising + * packets (default=true if phy isn't `"1mbps"`) + * * `window` - (2v22+) how long we scan for in milliseconds (default 100ms) + * * `interval` - (2v22+) how often we scan in milliseconds (default 100ms) - `window=interval=100`(default) is all the time. When + * scanning on both `1mbps` and `coded`, `interval` needs to be twice `window`. + * **NOTE:** `timeout` and `active` are not part of the Web Bluetooth standard. + * The following filter types are implemented: + * * `services` - list of services as strings (all of which must match). 128 bit + * services must be in the form '01230123-0123-0123-0123-012301230123' + * * `name` - exact device name + * * `namePrefix` - starting characters of device name + * * `id` - exact device address (`id:"e9:53:86:09:89:99 random"`) (this is + * Espruino-specific, and is not part of the Web Bluetooth spec) + * * `serviceData` - an object containing **lowercase** service characteristics which must all + * match (`serviceData:{"1809":{}}`). Matching of actual service data is not + * supported yet. + * * `manufacturerData` - an object containing manufacturer UUIDs which must all + * match (`manufacturerData:{0x0590:{}}`). Matching of actual manufacturer data + * is not supported yet. + * ``` + * NRF.requestDevice({ filters: [{ namePrefix: 'Puck.js' }] }).then(function(device) { ... }); + * // or + * NRF.requestDevice({ filters: [{ services: ['1823'] }] }).then(function(device) { ... }); + * // or + * NRF.requestDevice({ filters: [{ manufacturerData:{0x0590:{}} }] }).then(function(device) { ... }); + * ``` + * As a full example, to send data to another Puck.js to turn an LED on: + * ``` + * var gatt; + * NRF.requestDevice({ filters: [{ namePrefix: 'Puck.js' }] }).then(function(device) { + * return device.gatt.connect(); + * }).then(function(g) { + * gatt = g; + * return gatt.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e"); + * }).then(function(service) { + * return service.getCharacteristic("6e400002-b5a3-f393-e0a9-e50e24dcca9e"); + * }).then(function(characteristic) { + * return characteristic.writeValue("LED1.set()\n"); + * }).then(function() { + * gatt.disconnect(); + * console.log("Done!"); + * }); + * ``` + * Or slightly more concisely, using ES6 arrow functions: + * ``` + * var gatt; + * NRF.requestDevice({ filters: [{ namePrefix: 'Puck.js' }]}).then( + * device => device.gatt.connect()).then( + * g => (gatt=g).getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e")).then( + * service => service.getCharacteristic("6e400002-b5a3-f393-e0a9-e50e24dcca9e")).then( + * characteristic => characteristic.writeValue("LED1.reset()\n")).then( + * () => { gatt.disconnect(); console.log("Done!"); } ); + * ``` + * Note that you have to keep track of the `gatt` variable so that you can + * disconnect the Bluetooth connection when you're done. + * **Note:** Using a filter in `NRF.requestDevice` filters each advertising packet + * individually. As soon as a matching advertisement is received, + * `NRF.requestDevice` resolves the promise and stops scanning. This means that if + * you filter based on a service UUID and a device advertises with multiple packets + * (or a scan response when `active:true`) only the packet matching the filter is + * returned - you may not get the device's name is that was in a separate packet. + * To aggregate multiple packets you can use `NRF.findDevices`. + * + * @param {any} options - Options used to filter the device to use + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_requestDevice + */ + static requestDevice(options?: { filters?: NRFFilters[], timeout?: number, active?: boolean, phy?: string, extended?: boolean }): Promise; + + /** + * Connect to a BLE device by MAC address. Returns a promise, the argument of which + * is the `BluetoothRemoteGATTServer` connection. + * ``` + * NRF.connect("aa:bb:cc:dd:ee").then(function(server) { + * // ... + * }); + * ``` + * This has the same effect as calling `BluetoothDevice.gatt.connect` on a + * `BluetoothDevice` requested using `NRF.requestDevice`. It just allows you to + * specify the address directly (without having to scan). + * You can use it as follows - this would connect to another Puck device and turn + * its LED on: + * ``` + * var gatt; + * NRF.connect("aa:bb:cc:dd:ee random").then(function(g) { + * gatt = g; + * return gatt.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e"); + * }).then(function(service) { + * return service.getCharacteristic("6e400002-b5a3-f393-e0a9-e50e24dcca9e"); + * }).then(function(characteristic) { + * return characteristic.writeValue("LED1.set()\n"); + * }).then(function() { + * gatt.disconnect(); + * console.log("Done!"); + * }); + * ``` + * **Note:** Espruino Bluetooth devices use a type of BLE address known as 'random + * static', which is different to a 'public' address. To connect to an Espruino + * device you'll need to use an address string of the form `"aa:bb:cc:dd:ee + * random"` rather than just `"aa:bb:cc:dd:ee"`. If you scan for devices with + * `NRF.findDevices`/`NRF.setScan` then addresses are already reported in the + * correct format. + * + * @param {any} mac - The MAC address to connect to + * @param {any} options - (Espruino-specific) An object of connection options (see `BluetoothRemoteGATTServer.connect` for full details) + * @returns {any} A `Promise` that is resolved (or rejected) when the connection is complete + * @url http://www.espruino.com/Reference#l_NRF_connect + */ + static connect(mac: any, options: any): Promise; + + /** + * If set to true, whenever a device bonds it will be added to the whitelist. + * When set to false, the whitelist is cleared and newly bonded devices will not be + * added to the whitelist. + * **Note:** This is remembered between `reset()`s but isn't remembered after + * power-on (you'll have to add it to `onInit()`. + * + * @param {boolean} whitelisting - Are we using a whitelist? (default false) + * @url http://www.espruino.com/Reference#l_NRF_setWhitelist + */ + static setWhitelist(whitelisting: ShortBoolean): void; + + /** + * When connected, Bluetooth LE devices communicate at a set interval. Lowering the + * interval (e.g. more packets/second) means a lower delay when sending data, higher + * bandwidth, but also more power consumption. + * By default, when connected as a peripheral Espruino automatically adjusts the + * connection interval. When connected it's as fast as possible (7.5ms) but when + * idle for over a minute it drops to 200ms. On continued activity (>1 BLE + * operation) the interval is raised to 7.5ms again. + * The options for `interval` are: + * * `undefined` / `"auto"` : (default) automatically adjust connection interval + * * `100` : set min and max connection interval to the same number (between 7.5ms + * and 4000ms) + * * `{minInterval:20, maxInterval:100}` : set min and max connection interval as a + * range + * This configuration is not remembered during a `save()` - you will have to re-set + * it via `onInit`. + * **Note:** If connecting to another device (as Central), you can use an extra + * argument to `NRF.connect` or `BluetoothRemoteGATTServer.connect` to specify a + * connection interval. + * **Note:** This overwrites any changes imposed by the deprecated + * `NRF.setLowPowerConnection` + * + * @param {any} interval - The connection interval to use (see below) + * @url http://www.espruino.com/Reference#l_NRF_setConnectionInterval + */ + static setConnectionInterval(interval: any): void; + + /** + * Sets the security options used when connecting/pairing. This applies to both + * central *and* peripheral mode. + * ``` + * NRF.setSecurity({ + * display : bool // default false, can this device display a passkey on a screen/etc? + * // - sent via the `BluetoothDevice.passkey` event + * keyboard : bool // default false, can this device enter a passkey + * // - request sent via the `BluetoothDevice.passkeyRequest` event + * pair : bool // default true, allow other devices to pair with this device + * bond : bool // default true, Perform bonding + * // This stores info from pairing in flash and allows reconnecting without having to pair each time + * mitm : bool // default false, Man In The Middle protection + * lesc : bool // default false, LE Secure Connections + * passkey : // default "", or a 6 digit passkey to use (display must be true for this) + * oob : [0..15] // if specified, Out Of Band pairing is enabled and + * // the 16 byte pairing code supplied here is used + * encryptUart : bool // default false (unless oob or passkey specified) + * // This sets the BLE UART service such that it + * // is encrypted and can only be used from a paired connection + * privacy : // default false, true to enable with (ideally sensible) defaults, + * // or an object defining BLE privacy / random address options - see below for more info + * // only available if Espruino was compiled with private address support (like for example on Bangle.js 2) + * }); + * ``` + * **NOTE:** Some combinations of arguments will cause an error. For example + * supplying a passkey without `display:1` is not allowed. If `display:1` is set + * you do not require a physical display, the user just needs to know the passkey + * you supplied. + * For instance, to require pairing and to specify a passkey, use: + * ``` + * NRF.setSecurity({passkey:"123456", mitm:1, display:1}); + * ``` + * Or to require pairing and to display a PIN that the connecting device + * provides, use: + * ``` + * NRF.setSecurity({mitm:1, display:1}); + * NRF.on("passkey", key => print("Enter PIN: ", key)); + * ``` + * However, while most devices will request a passkey for pairing at this point it + * is still possible for a device to connect without requiring one (e.g. using the + * 'NRF Connect' app). + * To force a passkey you need to protect each characteristic you define with + * `NRF.setSecurity`. For instance the following code will *require* that the + * passkey `123456` is entered before the characteristic + * `9d020002-bf5f-1d1a-b52a-fe52091d5b12` can be read. + * ``` + * NRF.setSecurity({passkey:"123456", mitm:1, display:1}); + * NRF.setServices({ + * "9d020001-bf5f-1d1a-b52a-fe52091d5b12" : { + * "9d020002-bf5f-1d1a-b52a-fe52091d5b12" : { + * // readable always + * value : "Not Secret" + * }, + * "9d020003-bf5f-1d1a-b52a-fe52091d5b12" : { + * // readable only once bonded + * value : "Secret", + * readable : true, + * security: { + * read: { + * mitm: true, + * encrypted: true + * } + * } + * }, + * "9d020004-bf5f-1d1a-b52a-fe52091d5b12" : { + * // readable always + * // writable only once bonded + * value : "Readable", + * readable : true, + * writable : true, + * onWrite : function(evt) { + * console.log("Wrote ", evt.data); + * }, + * security: { + * write: { + * mitm: true, + * encrypted: true + * } + * } + * } + * } + * }); + * ``` + * **Note:** If `passkey` or `oob` is specified, the Nordic UART service (if + * enabled) will automatically be set to require encryption, but otherwise it is + * open. + * On Bangle.js 2, the `privacy` parameter can be used to set this device's BLE privacy / random address settings. + * The privacy feature provides a way to avoid being tracked over a period of time. + * This works by replacing the real BLE address with a random private address, + * that automatically changes at a specified interval. + * If a `"random_private_resolvable"` address is used, that address is generated with the help + * of an identity resolving key (IRK), that is exchanged during bonding. + * This allows a bonded device to still identify another device that is using a random private resolvable address. + * Note that, while this can help against being tracked, there are other ways a Bluetooth device can reveal its identity. + * For example, the name or services it advertises may be unique enough. + * ``` + * NRF.setSecurity({ + * privacy: { + * mode : "off"/"device_privacy"/"network_privacy" // The privacy mode that should be used. + * addr_type : "random_private_resolvable"/"random_private_non_resolvable" // The type of address to use. + * addr_cycle_s : int // How often the address should change, in seconds. + * } + * }); + * // enabled with (ideally sensible) defaults of: + * // mode: device_privacy + * // addr_type: random_private_resolvable + * // addr_cycle_s: 0 (use default address change interval) + * NRF.setSecurity({ + * privacy: 1 + * }); + * ``` + * `mode` can be one of: + * * `"off"` - Use the real address. + * * `"device_privacy"` - Use a private address. + * * `"network_privacy"` - Use a private address, + * and reject a peer that uses its real address if we know that peer's IRK. + * If `mode` is `"off"`, all other fields are ignored and become optional. + * `addr_type` can be one of: + * * `"random_private_resolvable"` - Address that can be resolved by a bonded peer that knows our IRK. + * * `"random_private_non_resolvable"` - Address that cannot be resolved. + * `addr_cycle_s` must be an integer. Pass `0` to use the default address change interval. + * The default is usually to change the address every 15 minutes (or 900 seconds). + * + * @param {any} options - An object containing security-related options (see below) + * @url http://www.espruino.com/Reference#l_NRF_setSecurity + */ + static setSecurity(options: any): void; + + /** + * Return an object with information about the security state of the current + * peripheral connection: + * ``` + * { + * connected // The connection is active (not disconnected). + * encrypted // Communication on this link is encrypted. + * mitm_protected // The encrypted communication is also protected against man-in-the-middle attacks. + * bonded // The peer is bonded with us + * advertising // Are we currently advertising? + * connected_addr // If connected=true, the MAC address of the currently connected device + * privacy // Current BLE privacy / random address settings. + * // Only present if Espruino was compiled with private address support (like for example on Bangle.js 2). + * } + * ``` + * If there is no active connection, `{connected:false}` will be returned. + * See `NRF.setSecurity` for information about negotiating a secure connection. + * @returns {any} An object + * @url http://www.espruino.com/Reference#l_NRF_getSecurityStatus + */ + static getSecurityStatus(): NRFSecurityStatus; + + /** + * + * @param {boolean} forceRepair - True if we should force repairing even if there is already valid pairing info + * @returns {any} A promise + * @url http://www.espruino.com/Reference#l_NRF_startBonding + */ + static startBonding(forceRepair: ShortBoolean): any; +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 } /** * A Web Bluetooth-style device - you can request one using - * `NRF.requestDevice(address)` + * `NRF.requestDevice(options)` * For example: * ``` * var gatt; @@ -7925,7 +11263,7 @@ declare class BluetoothRemoteGATTServer { * @returns {any} A `Promise` that is resolved (or rejected) when the bonding is complete * @url http://www.espruino.com/Reference#l_BluetoothRemoteGATTServer_startBonding */ - startBonding(forceRePair: boolean): Promise; + startBonding(forceRePair: ShortBoolean): Promise; /** * Return an object with information about the security state of the current @@ -8431,21 +11769,102 @@ declare class TFMicroInterpreter { interface StringConstructor { /** +<<<<<<< HEAD * Return the character(s) represented by the given character code(s). +||||||| e51f7bfbe + * On devices like Pixl.js or HYSTM boards that contain a built-in display this + * will return an instance of the graphics class that can be used to access that + * display. + * Internally, this is stored as a member called `gfx` inside the 'hiddenRoot'. + * @returns {any} An instance of `Graphics` or undefined + * @url http://www.espruino.com/Reference#l_Graphics_getInstance + */ + static getInstance(): Graphics | undefined + + /** + * Create a Graphics object that renders to an Array Buffer. This will have a field + * called 'buffer' that can get used to get at the buffer itself +======= + * On devices like Pixl.js or HYSTM boards that contain a built-in display this + * will return an instance of the graphics class that can be used to access that + * display. + * Internally, this is stored as a member called `gfx` inside the 'hiddenRoot'. + * @returns {any} An instance of `Graphics` or undefined + * @url http://www.espruino.com/Reference#l_Graphics_getInstance + */ + static getInstance(): Graphics | undefined + + /** + * Create a `Graphics` object that renders to an `ArrayBuffer`. This will have a field + * called `'buffer'` that can get used to get at the buffer itself +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * +<<<<<<< HEAD * @param {any} code - One or more character codes to create a string from (range 0-255). * @returns {any} The character * @url http://www.espruino.com/Reference#l_String_fromCharCode +||||||| e51f7bfbe + * @param {number} width - Pixels wide + * @param {number} height - Pixels high + * @param {number} bpp - Number of bits per pixel + * @param {any} options + * An object of other options. `{ zigzag : true/false(default), vertical_byte : true/false(default), msb : true/false(default), color_order: 'rgb'(default),'bgr',etc }` + * `zigzag` = whether to alternate the direction of scanlines for rows + * `vertical_byte` = whether to align bits in a byte vertically or not + * `msb` = when bits<8, store pixels most significant bit first, when bits>8, store most significant byte first + * `interleavex` = Pixels 0,2,4,etc are from the top half of the image, 1,3,5,etc from the bottom half. Used for P3 LED panels. + * `color_order` = re-orders the colour values that are supplied via setColor + * @returns {any} The new Graphics object + * @url http://www.espruino.com/Reference#l_Graphics_createArrayBuffer +======= + * @param {number} width - Pixels wide + * @param {number} height - Pixels high + * @param {number} bpp - Number of bits per pixel + * @param {any} options + * An object of other options. `{ zigzag : true/false(default), vertical_byte : true/false(default), msb : true/false(default), color_order: 'rgb'(default),'bgr',etc }` + * `zigzag` = whether to alternate the direction of scanlines for rows + * `vertical_byte` = whether to align bits in a byte vertically or not + * `msb` = when bits<8, store pixels most significant bit first, when bits>8, store most significant byte first (as of 2v25, msb:true is default) + * `interleavex` = Pixels 0,2,4,etc are from the top half of the image, 1,3,5,etc from the bottom half. Used for P3 LED panels. + * `color_order` = re-orders the colour values that are supplied via setColor + * `buffer` = if specified, createArrayBuffer won't create a new buffer but will use the given one + * @returns {any} The new `Graphics` object + * @url http://www.espruino.com/Reference#l_Graphics_createArrayBuffer +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 */ fromCharCode(...code: any[]): any; /** +<<<<<<< HEAD * Create a new String * @constructor +||||||| e51f7bfbe + * Create a Graphics object that renders by calling a JavaScript callback function + * to draw pixels +======= + * Create a `Graphics` object that renders by calling a JavaScript callback function + * to draw pixels +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * +<<<<<<< HEAD * @param {any} str - A value to turn into a string. If undefined or not supplied, an empty String is created. * @returns {any} A String * @url http://www.espruino.com/Reference#l_String_String +||||||| e51f7bfbe + * @param {number} width - Pixels wide + * @param {number} height - Pixels high + * @param {number} bpp - Number of bits per pixel + * @param {any} callback - A function of the form ```function(x,y,col)``` that is called whenever a pixel needs to be drawn, or an object with: ```{setPixel:function(x,y,col),fillRect:function(x1,y1,x2,y2,col)}```. All arguments are already bounds checked. + * @returns {any} The new Graphics object + * @url http://www.espruino.com/Reference#l_Graphics_createCallback +======= + * @param {number} width - Pixels wide + * @param {number} height - Pixels high + * @param {number} bpp - Number of bits per pixel + * @param {any} callback - A function of the form ```function(x,y,col)``` that is called whenever a pixel needs to be drawn, or an object with: ```{setPixel:function(x,y,col),fillRect:function(x1,y1,x2,y2,col)}```. All arguments are already bounds checked. + * @returns {any} The new `Graphics` object + * @url http://www.espruino.com/Reference#l_Graphics_createCallback +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 */ new(...str: any[]): any; (arg?: any): string; @@ -8460,11 +11879,31 @@ interface String { length: any; /** +<<<<<<< HEAD * Return a single character at the given position in the String. +||||||| e51f7bfbe + * Create a Graphics object that renders to SDL window (Linux-based devices only) +======= + * Create a `Graphics` object that renders to SDL window (Linux-based devices only) +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * +<<<<<<< HEAD * @param {number} pos - The character number in the string. Negative values return characters from end of string (-1 = last char) * @returns {any} The character in the string * @url http://www.espruino.com/Reference#l_String_charAt +||||||| e51f7bfbe + * @param {number} width - Pixels wide + * @param {number} height - Pixels high + * @param {number} bpp - Bits per pixel (8,16,24 or 32 supported) + * @returns {any} The new Graphics object + * @url http://www.espruino.com/Reference#l_Graphics_createSDL +======= + * @param {number} width - Pixels wide + * @param {number} height - Pixels high + * @param {number} bpp - Bits per pixel (8,16,24 or 32 supported) + * @returns {any} The new `Graphics` object + * @url http://www.espruino.com/Reference#l_Graphics_createSDL +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 */ charAt(pos: number): any; @@ -8504,38 +11943,31 @@ interface String { static createImage(str: string): ImageObject; /** - * Draw a filled arc between two angles + * Set the current font * - * @param {number} a1 - Angle 1 (radians) - * @param {number} a2 - Angle 2 (radians) - * @param {number} r - Radius + * @param {number} scale - The scale factor, default=1 (2=2x size) * @returns {any} The instance of Graphics this was called on, to allow call chaining - * @url http://www.espruino.com/Reference#l_Graphics_fillArc + * @url http://www.espruino.com/Reference#l_Graphics_setFont17 */ - fillArc(a1: number, a2: number, r: number): Graphics; + setFont17(scale: number): Graphics; /** - * Draw rectangle between angles a-ar and a+ar, and radius r1/r2 + * Set the current font * - * @param {number} a - Angle (radians) - * @param {number} ar - Angle either side (radians) - * @param {number} r1 - Radius - * @param {number} r2 - Radius + * @param {number} scale - The scale factor, default=1 (2=2x size) * @returns {any} The instance of Graphics this was called on, to allow call chaining - * @url http://www.espruino.com/Reference#l_Graphics_fillSeg + * @url http://www.espruino.com/Reference#l_Graphics_setFont28 */ - fillSeg(a: number, ar: number, r1: number, r2: number): Graphics; + setFont28(scale: number): Graphics; /** - * Draw A line between angles a-ar and a+ar at radius r + * Set the current font * - * @param {number} a - Angle (radians) - * @param {number} ar - Angle either side (radians) - * @param {number} r - Radius + * @param {number} scale - The scale factor, default=1 (2=2x size) * @returns {any} The instance of Graphics this was called on, to allow call chaining - * @url http://www.espruino.com/Reference#l_Graphics_drawSeg + * @url http://www.espruino.com/Reference#l_Graphics_setFont22 */ - drawSeg(a: number, ar: number, r: number): Graphics; + setFont22(scale: number): Graphics; /** * Set the current font @@ -8555,6 +11987,15 @@ interface String { */ setFont6x15(scale: number): Graphics; + /** + * Set the current font + * + * @param {number} scale - The scale factor, default=1 (2=2x size) + * @returns {any} The instance of Graphics this was called on, to allow call chaining + * @url http://www.espruino.com/Reference#l_Graphics_setFont14 + */ + setFont14(scale: number): Graphics; + /** * On instances of graphics that drive a display with an offscreen buffer, calling * this function will copy the contents of the offscreen buffer to the screen. @@ -8573,10 +12014,10 @@ interface String { * @param {boolean} [all] - [optional] (only on some devices) If `true` then copy all pixels, not just those that have changed. * @url http://www.espruino.com/Reference#l_Graphics_flip */ - flip(all?: boolean): void; + flip(all?: ShortBoolean): void; /** - * On Graphics instances with an offscreen buffer, this is an `ArrayBuffer` that + * On `Graphics` instances with an offscreen buffer, this is an `ArrayBuffer` that * provides access to the underlying pixel data. * ``` * g=Graphics.createArrayBuffer(8,8,8) @@ -8592,32 +12033,32 @@ interface String { * 0, 0, 0, 0, 0, 0, 255, 0, * 0, 0, 0, 0, 0, 0, 0, 255]) * ``` - * @returns {any} An ArrayBuffer (or not defined on Graphics instances not created with `Graphics.createArrayBuffer`) + * @returns {any} An ArrayBuffer (or not defined on `Graphics` instances not created with `Graphics.createArrayBuffer`) * @url http://www.espruino.com/Reference#l_Graphics_buffer */ buffer: IsBuffer extends true ? ArrayBuffer : undefined /** - * The width of this Graphics instance - * @returns {number} The width of this Graphics instance + * The width of this `Graphics` instance + * @returns {number} The width of this `Graphics` instance * @url http://www.espruino.com/Reference#l_Graphics_getWidth */ getWidth(): number; /** - * The height of this Graphics instance - * @returns {number} The height of this Graphics instance + * The height of this `Graphics` instance + * @returns {number} The height of this `Graphics` instance * @url http://www.espruino.com/Reference#l_Graphics_getHeight */ getHeight(): number; /** - * The number of bits per pixel of this Graphics instance + * The number of bits per pixel of this `Graphics` instance * **Note:** Bangle.js 2 behaves a little differently here. The display is 3 bit, * so `getBPP` returns 3 and `asBMP`/`asImage`/etc return 3 bit images. However in * order to allow dithering, the colors returned by `Graphics.getColor` and * `Graphics.theme` are actually 16 bits. - * @returns {number} The bits per pixel of this Graphics instance + * @returns {number} The bits per pixel of this `Graphics` instance * @url http://www.espruino.com/Reference#l_Graphics_getBPP */ getBPP(): number; @@ -8637,7 +12078,7 @@ interface String { * @returns {any} The instance of Graphics this was called on, to allow call chaining * @url http://www.espruino.com/Reference#l_Graphics_clear */ - clear(reset?: boolean): Graphics; + clear(reset?: ShortBoolean): Graphics; /** * Fill a rectangular area in the Foreground Color @@ -8782,7 +12223,7 @@ interface String { * g.toColor(1,0,0) => 0xF800 * ``` * - * @param {any} r - Red (between 0 and 1) **OR** an integer representing the color in the current bit depth and color order **OR** a hexidecimal color string of the form `'#rrggbb' or `'#rgb'` + * @param {any} r - Red (between 0 and 1) **OR** an integer representing the color in the current bit depth and color order **OR** a hexidecimal color string of the form `'#rrggbb'` or `'#rgb'` * @param {any} g - Green (between 0 and 1) * @param {any} b - Blue (between 0 and 1) * @returns {number} The color index represented by the arguments @@ -8998,7 +12439,7 @@ interface String { /** * Return the width and height in pixels of a string of text in the current font. The object returned contains: - * ```JS + * ``` * { * width, // Width of the string in pixels * height, // Height of the string in pixels @@ -9029,6 +12470,34 @@ interface String { */ wrapString(str: string, maxWidth: number): string[]; + /** + * Works out which font to use, and sets the current font to it. + * Usage: + * ``` + * g.findFont("Hello World", { + * w : 100, // optional: width available (default = screen width) + * h : 100, // optional: height available (default = screen height) + * min : 10, // optional: min font height + * max : 30, // optional: max font height + * wrap : true // optional: allow word wrap? + * trim : true // optional: trim to the specified height, add '...' + * }); + * ``` + * Returns: + * ``` + * { + * text : "Hello\nWorld" + * font : "..." + * } + * ``` + * + * @param {any} text - The text to render + * @param {any} options - Options for finding the required font + * @returns {any} An object containing info about the font + * @url http://www.espruino.com/Reference#l_Graphics_findFont + */ + findFont(text: any, options: any): any; + /** * Draw a string of text in the current font. * ``` @@ -9238,8 +12707,8 @@ interface String { * * A String where the the first few bytes are: * `width,height,bpp,[transparent,]image_bytes...`. If a transparent colour is * specified the top bit of `bpp` should be set. - * * An ArrayBuffer Graphics object (if `bpp<8`, `msb:true` must be set) - this is - * disabled on devices without much flash memory available. If a Graphics object + * * An ArrayBuffer `Graphics` object (if `bpp<8`, `msb:true` must be set) - this is + * disabled on devices without much flash memory available. If a `Graphics` object * is supplied, it can also contain transparent/palette fields as if it were * an image. * See https://www.espruino.com/Graphics#images-bitmaps for more information about @@ -9316,14 +12785,19 @@ interface String { drawImages(layers: { x: number, y: number, image: Image, scale?: number, rotate?: number, center?: boolean, repeat?: boolean, nobounds?: boolean }[], options?: { x: number, y: number, width: number, height: number }): Graphics; /** - * Return this Graphics object as an Image that can be used with + * Return this `Graphics` object as an Image that can be used with * `Graphics.drawImage`. Check out [the Graphics reference * page](http://www.espruino.com/Graphics#images-bitmaps) for more information on * images. * Will return undefined if data can't be allocated for the image. + * `options` can be either: + * * `undefined` or `"object"` - return an image object + * * `string` - return the image as a string + * * (in 2v26 onwards) `{type:undefined/"object"/"string", x,y,w,h}` - Return only a part of the image as an object/string. * The image data itself will be referenced rather than copied if: * * An image `object` was requested (not `string`) - * * The Graphics instance was created with `Graphics.createArrayBuffer` + * * `x`/`y` are 0 and `w`/`h` are the graphics's height + * * The `Graphics` instance was created with `Graphics.createArrayBuffer` * * Is 8 bpp *OR* the `{msb:true}` option was given * * No other format options (zigzag/etc) were given * Otherwise data will be copied, which takes up more space and may be quite slow. @@ -9337,12 +12811,14 @@ interface String { * var im = gfx.asImage("string"); * ``` * - * @param {any} type - The type of image to return. Either `object`/undefined to return an image object, or `string` to return an image string + * @param {any} options - The type of image to return as a string, or an object `{x,y,w,h,type}` (see below) * @returns {any} An Image that can be used with `Graphics.drawImage` * @url http://www.espruino.com/Reference#l_Graphics_asImage */ asImage(type?: "object"): ImageObject; asImage(type: "string"): string; + asImage(layers: { type?: "object", x?: number, y?: number, w?: number, h?: number }): ImageObject; + asImage(layers: { type: "string", x?: number, y?: number, w?: number, h?: number }): string; /** * Return the area of the Graphics canvas that has been modified, and optionally @@ -9389,7 +12865,7 @@ interface String { blit(options: { x1: number, y1: number, x2: number, y2: number, w: number, h: number, setModified?: boolean }): Graphics; /** - * Create a Windows BMP file from this Graphics instance, and return it as a + * Create a Windows BMP file from this `Graphics` instance, and return it as a * String. * @returns {any} A String representing the Graphics as a Windows BMP file (or 'undefined' if not possible) * @url http://www.espruino.com/Reference#l_Graphics_asBMP @@ -9412,9 +12888,9 @@ interface String { * inline automatically. * This is identical to `console.log(g.asURL())` - it is just a convenient function * for easy debugging and producing screenshots of what is currently in the - * Graphics instance. - * **Note:** This may not work on some bit depths of Graphics instances. It will - * also not work for the main Graphics instance of Bangle.js 1 as the graphics on + * `Graphics` instance. + * **Note:** This may not work on some bit depths of `Graphics` instances. It will + * also not work for the main `Graphics` instance of Bangle.js 1 as the graphics on * Bangle.js 1 are stored in write-only memory. * @url http://www.espruino.com/Reference#l_Graphics_dump */ @@ -9450,7 +12926,17 @@ interface String { indexOf(substring: any, fromIndex: any): number; /** +<<<<<<< HEAD * Return the last index of substring in this string, or -1 if not found +||||||| e51f7bfbe + * Flood fills the given Graphics instance out from a particular point. + * **Note:** This only works on Graphics instances that support readback with `getPixel`. It + * is also not capable of filling over dithered patterns (eg non-solid colours on Bangle.js 2) +======= + * Flood fills the given `Graphics` instance out from a particular point. + * **Note:** This only works on `Graphics` instances that support readback with `getPixel`. It + * is also not capable of filling over dithered patterns (eg non-solid colours on Bangle.js 2) +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * * @param {any} substring - The string to search for * @param {any} fromIndex - Index to search from @@ -9473,7 +12959,45 @@ interface String { * input: "abcdefabcdef" * ] * ``` +<<<<<<< HEAD * 'Global' RegExp matches just return an array of matches (with no indices): +||||||| e51f7bfbe + * These values can then be passed to `g.setColor`/`g.setBgColor` for example + * `g.setColor(g.theme.fg2)`. When the Graphics instance is reset, the background + * color is automatically set to `g.theme.bg` and foreground is set to + * `g.theme.fg`. + * On Bangle.js these values can be changed by writing updated values to `theme` in + * `settings.js` and reloading the app - or they can be changed temporarily by + * calling `Graphics.setTheme` + * @returns {any} An object containing the current 'theme' (see below) + * @url http://www.espruino.com/Reference#l_Graphics_theme + */ + theme: Theme; + + /** + * Set the global colour scheme. On Bangle.js, this is reloaded from + * `settings.json` for each new app loaded. + * See `Graphics.theme` for the fields that can be provided. For instance you can + * change the background to red using: +======= + * These values can then be passed to `g.setColor`/`g.setBgColor` for example + * `g.setColor(g.theme.fg2)`. When the `Graphics` instance is reset, the background + * color is automatically set to `g.theme.bg` and foreground is set to + * `g.theme.fg`. + * On Bangle.js these values can be changed by writing updated values to `theme` in + * `settings.js` and reloading the app - or they can be changed temporarily by + * calling `Graphics.setTheme` + * @returns {any} An object containing the current 'theme' (see below) + * @url http://www.espruino.com/Reference#l_Graphics_theme + */ + theme: Theme; + + /** + * Set the global colour scheme. On Bangle.js, this is reloaded from + * `settings.json` for each new app loaded. + * See `Graphics.theme` for the fields that can be provided. For instance you can + * change the background to red using: +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * ``` * "abcdefabcdef".match(/bcd/g) = [ * "bcd", @@ -9646,8 +13170,8 @@ interface String { setTheme(theme: { [key in keyof Theme]?: Theme[key] extends number ? ColorResolvable : Theme[key] }): Graphics; /** - * Perform a filter on the current Graphics instance. Requires the Graphics - * instance to support readback (eg `getPixel` should work), and only uses + * Perform a filter on the current `Graphics` instance. Requires the Graphics + * instance to support readback (eg `.getPixel` should work), and only uses * 8 bit values for buffer and filter. * ``` * g.filter([ // a gaussian filter @@ -9687,16 +13211,308 @@ declare const String: StringConstructor interface RegExpConstructor { /** +<<<<<<< HEAD * Creates a RegExp object, for handling Regular Expressions +||||||| e51f7bfbe + * Set the WIO's LED + * + * @param {number} red - 0-255, red LED intensity + * @param {number} green - 0-255, green LED intensity + * @param {number} blue - 0-255, blue LED intensity + * @url http://www.espruino.com/Reference#l_WioLTE_LED + */ + static LED(red: number, green: number, blue: number): void; + + /** + * Set the power of Grove connectors, except for `D38` and `D39` which are always + * on. + * + * @param {boolean} onoff - Whether to turn the Grove connectors power on or off (D38/D39 are always powered) + * @url http://www.espruino.com/Reference#l_WioLTE_setGrovePower + */ + static setGrovePower(onoff: boolean): void; + + /** + * Turn power to the WIO's LED on or off. + * Turning the LED on won't immediately display a color - that must be done with + * `WioLTE.LED(r,g,b)` + * + * @param {boolean} onoff - true = on, false = off + * @url http://www.espruino.com/Reference#l_WioLTE_setLEDPower + */ + static setLEDPower(onoff: boolean): void; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_D38 + */ + static D38: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_D20 + */ + static D20: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_A6 + */ + static A6: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_I2C + */ + static I2C: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_UART + */ + static UART: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_A4 + */ + static A4: any; + + +} + +/** + * This class handles waveforms. In Espruino, a Waveform is a set of data that you + * want to input or output. + * @url http://www.espruino.com/Reference#Waveform + */ +declare class Waveform { + /** + * Create a waveform class. This allows high speed input and output of waveforms. + * It has an internal variable called `buffer` (as well as `buffer2` when + * double-buffered - see `options` below) which contains the data to input/output. + * When double-buffered, a 'buffer' event will be emitted each time a buffer is + * finished with (the argument is that buffer). When the recording stops, a + * 'finish' event will be emitted (with the first argument as the buffer). +======= + * Set the WIO's LED + * + * @param {number} red - 0-255, red LED intensity + * @param {number} green - 0-255, green LED intensity + * @param {number} blue - 0-255, blue LED intensity + * @url http://www.espruino.com/Reference#l_WioLTE_LED + */ + static LED(red: number, green: number, blue: number): void; + + /** + * Set the power of Grove connectors, except for `D38` and `D39` which are always + * on. + * + * @param {boolean} onoff - Whether to turn the Grove connectors power on or off (D38/D39 are always powered) + * @url http://www.espruino.com/Reference#l_WioLTE_setGrovePower + */ + static setGrovePower(onoff: ShortBoolean): void; + + /** + * Turn power to the WIO's LED on or off. + * Turning the LED on won't immediately display a color - that must be done with + * `WioLTE.LED(r,g,b)` + * + * @param {boolean} onoff - true = on, false = off + * @url http://www.espruino.com/Reference#l_WioLTE_setLEDPower + */ + static setLEDPower(onoff: ShortBoolean): void; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_D38 + */ + static D38: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_D20 + */ + static D20: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_A6 + */ + static A6: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_I2C + */ + static I2C: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_UART + */ + static UART: any; + + /** + * @returns {any} + * @url http://www.espruino.com/Reference#l_WioLTE_A4 + */ + static A4: any; + + +} + +/** + * This class handles waveforms. In Espruino, a Waveform is a set of data that you + * want to input or output. + * @url http://www.espruino.com/Reference#Waveform + */ +declare class Waveform { + /** + * Event emitted when playback has finished + * @param {string} event - The event to listen to. + * @param {(buffer: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `buffer` the last played buffer + * @url http://www.espruino.com/Reference#l_Waveform_finish + */ + static on(event: "finish", callback: (buffer: any) => void): void; + + /** + * When in double-buffered mode, this event is emitted when the `Waveform` class swaps to playing a new buffer - so you should then fill this current buffer up with new data. + * @param {string} event - The event to listen to. + * @param {(buffer: any) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `buffer` the last played buffer (which now needs to be filled ready for playback) + * @url http://www.espruino.com/Reference#l_Waveform_buffer + */ + static on(event: "buffer", callback: (buffer: any) => void): void; + + /** + * Create a waveform class. This allows high speed input and output of waveforms. + * It has an internal variable called `buffer` (as well as `buffer2` when + * double-buffered - see `options` below) which contains the data to input/output. + * Options can contain: + * ``` + * { + * doubleBuffer : bool // whether to allocate two buffers or not (default false) + * bits : 8/16 // the amount of bits to use (default 8). + * } + * ``` + * When double-buffered, a 'buffer' event will be emitted each time a buffer is + * finished with (the argument is that buffer). When the recording stops, a + * 'finish' event will be emitted (with the first argument as the buffer). + * ``` + * // Output a sine wave + * var w = new Waveform(1000); + * for (var i=0;i<1000;i++) w.buffer[i]=128+120*Math.sin(i/2); + * analogWrite(H0, 0.5, {freq:80000}); // set up H0 to output an analog value by PWM + * w.on("finish", () => print("Done!")) + * w.startOutput(H0,8000); // start playback + * ``` + * ``` + * // On 2v25, from Storage + * var f = require("Storage").read("sound.pcm"); + * var w = new Waveform(E.toArrayBuffer(f)); + * w.on("finish", () => print("Done!")) + * w.startOutput(H0,8000); // start playback + * ``` + * See https://www.espruino.com/Waveform for more examples. +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * @constructor * +<<<<<<< HEAD * @param {any} regex - A regular expression as a string * @param {any} flags - Flags for the regular expression as a string * @returns {any} A RegExp object * @url http://www.espruino.com/Reference#l_RegExp_RegExp +||||||| e51f7bfbe + * @param {number} samples - The number of samples + * @param {any} options - Optional options struct `{doubleBuffer:bool, bits : 8/16}` where: `doubleBuffer` is whether to allocate two buffers or not (default false), and bits is the amount of bits to use (default 8). + * @returns {any} An Waveform object + * @url http://www.espruino.com/Reference#l_Waveform_Waveform +======= + * @param {any} samples - The number of samples to allocate as an integer, *or* an arraybuffer (2v25+) containing the samples + * @param {any} [options] - [optional] options struct `{ doubleBuffer:bool, bits : 8/16 }` (see below) + * @returns {any} An Waveform object + * @url http://www.espruino.com/Reference#l_Waveform_Waveform +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 */ +<<<<<<< HEAD new(...value: any[]): RegExp; (value: any): RegExp; +||||||| e51f7bfbe + static new(samples: number, options: any): any; + + /** + * Will start outputting the waveform on the given pin - the pin must have + * previously been initialised with analogWrite. If not repeating, it'll emit a + * `finish` event when it is done. + * + * @param {Pin} output - The pin to output on + * @param {number} freq - The frequency to output each sample at + * @param {any} options - Optional options struct `{time:float,repeat:bool}` where: `time` is the that the waveform with start output at, e.g. `getTime()+1` (otherwise it is immediate), `repeat` is a boolean specifying whether to repeat the give sample + * @url http://www.espruino.com/Reference#l_Waveform_startOutput + */ + startOutput(output: Pin, freq: number, options: any): void; + + /** + * Will start inputting the waveform on the given pin that supports analog. If not + * repeating, it'll emit a `finish` event when it is done. + * + * @param {Pin} output - The pin to output on + * @param {number} freq - The frequency to output each sample at + * @param {any} options - Optional options struct `{time:float,repeat:bool}` where: `time` is the that the waveform with start output at, e.g. `getTime()+1` (otherwise it is immediate), `repeat` is a boolean specifying whether to repeat the give sample + * @url http://www.espruino.com/Reference#l_Waveform_startInput + */ + startInput(output: Pin, freq: number, options: any): void; + + /** + * Stop a waveform that is currently outputting + * @url http://www.espruino.com/Reference#l_Waveform_stop + */ + stop(): void; +======= + static new(samples: any, options?: any): any; + + /** + * Will start outputting the waveform on the given pin - the pin must have + * previously been initialised with analogWrite. If not repeating, it'll emit a + * `finish` event when it is done. + * ``` + * { + * time : float, // the that the waveform with start output at, e.g. `getTime()+1` (otherwise it is immediate) + * repeat : bool, // whether to repeat the given sample + * npin : Pin, // If specified, the waveform is output across two pins (see below) + * } + * ``` + * Using `npin` allows you to split the Waveform output between two pins and hence avoid + * any DC bias (or need to capacitor), for instance you could attach a speaker to `H0` and + * `H1` on Jolt.js. When the value in the waveform was at 50% both outputs would be 0, + * below 50% the signal would be on `npin` with `pin` as 0, and above 50% it would be on `pin` with `npin` as 0. + * + * @param {Pin} output - The pin to output on + * @param {number} freq - The frequency to output each sample at + * @param {any} [options] - [optional] options struct `{time:float, repeat:bool, npin:Pin}` (see below) + * @url http://www.espruino.com/Reference#l_Waveform_startOutput + */ + startOutput(output: Pin, freq: number, options?: any): void; + + /** + * Will start inputting the waveform on the given pin that supports analog. If not + * repeating, it'll emit a `finish` event when it is done. + * + * @param {Pin} output - The pin to output on + * @param {number} freq - The frequency to output each sample at + * @param {any} [options] - [optional] options struct `{time:float,repeat:bool}` where: `time` is the that the waveform with start output at, e.g. `getTime()+1` (otherwise it is immediate), `repeat` is a boolean specifying whether to repeat the give sample + * @url http://www.espruino.com/Reference#l_Waveform_startInput + */ + startInput(output: Pin, freq: number, options?: any): void; + + /** + * Stop a waveform that is currently outputting + * @url http://www.espruino.com/Reference#l_Waveform_stop + */ + stop(): void; +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 } interface RegExp { @@ -10102,8 +13918,8 @@ interface Uint8ArrayConstructor { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer) - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`) + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Uint8Array_Uint8Array */ @@ -10127,8 +13943,8 @@ interface Uint8ClampedArrayConstructor { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer) - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`) + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Uint8ClampedArray_Uint8ClampedArray */ @@ -10150,8 +13966,8 @@ interface Int8ArrayConstructor { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer) - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`) + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Int8Array_Int8Array */ @@ -10173,8 +13989,8 @@ interface Uint16ArrayConstructor { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer) - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`) + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Uint16Array_Uint16Array */ @@ -10196,8 +14012,8 @@ interface Int16ArrayConstructor { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer) - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`) + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Int16Array_Int16Array */ @@ -10228,8 +14044,8 @@ declare class Uint24Array { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer) - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`) + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Uint24Array_Uint24Array */ @@ -10249,8 +14065,8 @@ interface Uint32ArrayConstructor { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer) - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`) + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Uint32Array_Uint32Array */ @@ -10272,8 +14088,8 @@ interface Int32ArrayConstructor { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer) - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`) + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Int32Array_Int32Array */ @@ -10295,8 +14111,8 @@ interface Float32ArrayConstructor { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer) - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`) + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Float32Array_Float32Array */ @@ -10318,8 +14134,8 @@ interface Float64ArrayConstructor { * @constructor * * @param {any} arr - The array or typed array to base this off, or an integer which is the array length - * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an ArrayBuffer). Maximum 65535. - * @param {number} length - The length (ONLY IF the first argument was an ArrayBuffer) + * @param {number} byteOffset - The byte offset in the ArrayBuffer (ONLY IF the first argument was an `ArrayBuffer`). Maximum 65535. + * @param {number} length - The length (ONLY IF the first argument was an `ArrayBuffer`) * @returns {any} A typed array * @url http://www.espruino.com/Reference#l_Float64Array_Float64Array */ @@ -10579,7 +14395,578 @@ interface Date { * Array(length)``` * @url http://www.espruino.com/Reference#Array */ +<<<<<<< HEAD declare const Array: ArrayConstructor +||||||| e51f7bfbe +declare const Date: DateConstructor + +interface MathConstructor { + /** + * @returns {number} The value of E - 2.718281828459045 + * @url http://www.espruino.com/Reference#l_Math_E + */ + E: number; + + /** + * @returns {number} The value of PI - 3.141592653589793 + * @url http://www.espruino.com/Reference#l_Math_PI + */ + PI: number; + + /** + * @returns {number} The natural logarithm of 2 - 0.6931471805599453 + * @url http://www.espruino.com/Reference#l_Math_LN2 + */ + LN2: number; + + /** + * @returns {number} The natural logarithm of 10 - 2.302585092994046 + * @url http://www.espruino.com/Reference#l_Math_LN10 + */ + LN10: number; + + /** + * @returns {number} The base 2 logarithm of e - 1.4426950408889634 + * @url http://www.espruino.com/Reference#l_Math_LOG2E + */ + LOG2E: number; + + /** + * @returns {number} The base 10 logarithm of e - 0.4342944819032518 + * @url http://www.espruino.com/Reference#l_Math_LOG10E + */ + LOG10E: number; + + /** + * @returns {number} The square root of 2 - 1.4142135623730951 + * @url http://www.espruino.com/Reference#l_Math_SQRT2 + */ + SQRT2: number; + + /** + * @returns {number} The square root of 1/2 - 0.7071067811865476 + * @url http://www.espruino.com/Reference#l_Math_SQRT1_2 + */ + SQRT1_2: number; + + /** + * + * @param {number} x - A floating point value + * @returns {number} The absolute value of x (eg, ```Math.abs(2)==2```, but also ```Math.abs(-2)==2```) + * @url http://www.espruino.com/Reference#l_Math_abs + */ + abs(x: number): number; + + /** + * + * @param {number} x - The value to get the arc cosine of + * @returns {number} The arc cosine of x, between 0 and PI + * @url http://www.espruino.com/Reference#l_Math_acos + */ + acos(x: number): number; + + /** + * + * @param {number} x - The value to get the arc sine of + * @returns {number} The arc sine of x, between -PI/2 and PI/2 + * @url http://www.espruino.com/Reference#l_Math_asin + */ + asin(x: number): number; + + /** + * + * @param {number} x - The value to get the arc tangent of + * @returns {number} The arc tangent of x, between -PI/2 and PI/2 + * @url http://www.espruino.com/Reference#l_Math_atan + */ + atan(x: number): number; + + /** + * + * @param {number} y - The Y-part of the angle to get the arc tangent of + * @param {number} x - The X-part of the angle to get the arc tangent of + * @returns {number} The arctangent of Y/X, between -PI and PI + * @url http://www.espruino.com/Reference#l_Math_atan2 + */ + atan2(y: number, x: number): number; + + /** + * + * @param {number} theta - The angle to get the cosine of + * @returns {number} The cosine of theta + * @url http://www.espruino.com/Reference#l_Math_cos + */ + cos(theta: number): number; + + /** + * + * @param {number} x - The value to raise to the power + * @param {number} y - The power x should be raised to + * @returns {number} x raised to the power y (x^y) + * @url http://www.espruino.com/Reference#l_Math_pow + */ + pow(x: number, y: number): number; + + /** + * @returns {number} A random number between 0 and 1 + * @url http://www.espruino.com/Reference#l_Math_random + */ + random(): number; + + /** + * + * @param {number} x - The value to round + * @returns {any} x, rounded to the nearest integer + * @url http://www.espruino.com/Reference#l_Math_round + */ + round(x: number): any; + + /** + * + * @param {number} theta - The angle to get the sine of + * @returns {number} The sine of theta + * @url http://www.espruino.com/Reference#l_Math_sin + */ + sin(theta: number): number; + + /** + * + * @param {number} theta - The angle to get the tangent of + * @returns {number} The tangent of theta + * @url http://www.espruino.com/Reference#l_Math_tan + */ + tan(theta: number): number; + + /** + * + * @param {number} x - The value to take the square root of + * @returns {number} The square root of x + * @url http://www.espruino.com/Reference#l_Math_sqrt + */ + sqrt(x: number): number; + + /** + * + * @param {number} x - The value to round up + * @returns {number} x, rounded upwards to the nearest integer + * @url http://www.espruino.com/Reference#l_Math_ceil + */ + ceil(x: number): number; + + /** + * + * @param {number} x - The value to round down + * @returns {number} x, rounded downwards to the nearest integer + * @url http://www.espruino.com/Reference#l_Math_floor + */ + floor(x: number): number; + + /** + * + * @param {number} x - The value raise E to the power of + * @returns {number} E^x + * @url http://www.espruino.com/Reference#l_Math_exp + */ + exp(x: number): number; + + /** + * + * @param {number} x - The value to take the logarithm (base E) root of + * @returns {number} The log (base E) of x + * @url http://www.espruino.com/Reference#l_Math_log + */ + log(x: number): number; + + /** + * DEPRECATED - Please use `E.clip()` instead. Clip a number to be between min and + * max (inclusive) + * + * @param {number} x - A floating point value to clip + * @param {number} min - The smallest the value should be + * @param {number} max - The largest the value should be + * @returns {number} The value of x, clipped so as not to be below min or above max. + * @url http://www.espruino.com/Reference#l_Math_clip + */ + clip(x: number, min: number, max: number): number; + + /** + * DEPRECATED - This is not part of standard JavaScript libraries + * Wrap a number around if it is less than 0 or greater than or equal to max. For + * instance you might do: ```Math.wrap(angleInDegrees, 360)``` + * + * @param {number} x - A floating point value to wrap + * @param {number} max - The largest the value should be + * @returns {number} The value of x, wrapped so as not to be below min or above max. + * @url http://www.espruino.com/Reference#l_Math_wrap + */ + wrap(x: number, max: number): number; + + /** + * Find the minimum of a series of numbers + * + * @param {any} args - Floating point values to clip + * @returns {number} The minimum of the supplied values + * @url http://www.espruino.com/Reference#l_Math_min + */ + min(...args: any[]): number; + + /** + * Find the maximum of a series of numbers + * + * @param {any} args - Floating point values to clip + * @returns {number} The maximum of the supplied values + * @url http://www.espruino.com/Reference#l_Math_max + */ + max(...args: any[]): number; + + /** + * + * @param {number} x - The value to get the sign from + * @returns {number} sign on x - -1, 1, or 0 + * @url http://www.espruino.com/Reference#l_Math_sign + */ + sign(x: number): number; +} + +interface Math { + +} + +/** + * This is a standard JavaScript class that contains useful Maths routines + * @url http://www.espruino.com/Reference#Math + */ +declare const Math: MathConstructor + +/** + * Built-in class that caches the modules used by the `require` command + * @url http://www.espruino.com/Reference#Modules + */ +declare class Modules { + /** + * Return an array of module names that have been cached + * @returns {any} An array of module names + * @url http://www.espruino.com/Reference#l_Modules_getCached + */ + static getCached(): any; + + /** + * Remove the given module from the list of cached modules + * + * @param {any} id - The module name to remove + * @url http://www.espruino.com/Reference#l_Modules_removeCached + */ + static removeCached(id: any): void; + + /** + * Remove all cached modules + * @url http://www.espruino.com/Reference#l_Modules_removeAllCached + */ + static removeAllCached(): void; + + /** + * Add the given module to the cache + * + * @param {any} id - The module name to add + * @param {any} sourcecode - The module's sourcecode + * @url http://www.espruino.com/Reference#l_Modules_addCached + */ + static addCached(id: any, sourcecode: any): void; + + +} +======= +declare const Date: DateConstructor + +interface MathConstructor { + /** + * @returns {number} The value of E - 2.718281828459045 + * @url http://www.espruino.com/Reference#l_Math_E + */ + E: number; + + /** + * @returns {number} The value of PI - 3.141592653589793 + * @url http://www.espruino.com/Reference#l_Math_PI + */ + PI: number; + + /** + * @returns {number} The natural logarithm of 2 - 0.6931471805599453 + * @url http://www.espruino.com/Reference#l_Math_LN2 + */ + LN2: number; + + /** + * @returns {number} The natural logarithm of 10 - 2.302585092994046 + * @url http://www.espruino.com/Reference#l_Math_LN10 + */ + LN10: number; + + /** + * @returns {number} The base 2 logarithm of e - 1.4426950408889634 + * @url http://www.espruino.com/Reference#l_Math_LOG2E + */ + LOG2E: number; + + /** + * @returns {number} The base 10 logarithm of e - 0.4342944819032518 + * @url http://www.espruino.com/Reference#l_Math_LOG10E + */ + LOG10E: number; + + /** + * @returns {number} The square root of 2 - 1.4142135623730951 + * @url http://www.espruino.com/Reference#l_Math_SQRT2 + */ + SQRT2: number; + + /** + * @returns {number} The square root of 1/2 - 0.7071067811865476 + * @url http://www.espruino.com/Reference#l_Math_SQRT1_2 + */ + SQRT1_2: number; + + /** + * + * @param {number} x - A floating point value + * @returns {number} The absolute value of x (eg, ```Math.abs(2)==2```, but also ```Math.abs(-2)==2```) + * @url http://www.espruino.com/Reference#l_Math_abs + */ + abs(x: number): number; + + /** + * + * @param {number} x - The value to get the arc cosine of + * @returns {number} The arc cosine of x, between 0 and PI + * @url http://www.espruino.com/Reference#l_Math_acos + */ + acos(x: number): number; + + /** + * + * @param {number} x - The value to get the arc sine of + * @returns {number} The arc sine of x, between -PI/2 and PI/2 + * @url http://www.espruino.com/Reference#l_Math_asin + */ + asin(x: number): number; + + /** + * + * @param {number} x - The value to get the arc tangent of + * @returns {number} The arc tangent of x, between -PI/2 and PI/2 + * @url http://www.espruino.com/Reference#l_Math_atan + */ + atan(x: number): number; + + /** + * + * @param {number} y - The Y-part of the angle to get the arc tangent of + * @param {number} x - The X-part of the angle to get the arc tangent of + * @returns {number} The arctangent of Y/X, between -PI and PI + * @url http://www.espruino.com/Reference#l_Math_atan2 + */ + atan2(y: number, x: number): number; + + /** + * + * @param {number} theta - The angle to get the cosine of + * @returns {number} The cosine of theta + * @url http://www.espruino.com/Reference#l_Math_cos + */ + cos(theta: number): number; + + /** + * + * @param {number} x - The value to raise to the power + * @param {number} y - The power x should be raised to + * @returns {number} x raised to the power y (x^y) + * @url http://www.espruino.com/Reference#l_Math_pow + */ + pow(x: number, y: number): number; + + /** + * @returns {number} A random number X, where `0 <= X < 1` + * @url http://www.espruino.com/Reference#l_Math_random + */ + random(): number; + + /** + * (Added in 2v25) Returns a random integer `X`, where `0 <= X < range`, or `-2147483648 <= X <= 2147483647` if `range <= 0` or `undefined` + * If `range` is supplied, this value is created using `modulo` of a 31 bit integer, so as `val` gets larger (24+ bits) + * the values produced will be less randomly distributed, and no values above `0x7FFFFFFF` will ever be returned. + * If `val==undefined` or `val<=0` a **32 bit** random number will be returned as an int (`-2147483648` .. `2147483647`). + * **Note:** this is not part of the JS spec, but is included in Espruino as it makes a lot of sense on embedded targets + * + * @param {number} range - How big a random number do we want + * @returns {number} A random integer + * @url http://www.espruino.com/Reference#l_Math_randInt + */ + randInt(range: number): number; + + /** + * + * @param {number} x - The value to round + * @returns {any} x, rounded to the nearest integer + * @url http://www.espruino.com/Reference#l_Math_round + */ + round(x: number): any; + + /** + * + * @param {number} theta - The angle to get the sine of + * @returns {number} The sine of theta + * @url http://www.espruino.com/Reference#l_Math_sin + */ + sin(theta: number): number; + + /** + * + * @param {number} theta - The angle to get the tangent of + * @returns {number} The tangent of theta + * @url http://www.espruino.com/Reference#l_Math_tan + */ + tan(theta: number): number; + + /** + * + * @param {number} x - The value to take the square root of + * @returns {number} The square root of x + * @url http://www.espruino.com/Reference#l_Math_sqrt + */ + sqrt(x: number): number; + + /** + * + * @param {number} x - The value to round up + * @returns {number} x, rounded upwards to the nearest integer + * @url http://www.espruino.com/Reference#l_Math_ceil + */ + ceil(x: number): number; + + /** + * + * @param {number} x - The value to round down + * @returns {number} x, rounded downwards to the nearest integer + * @url http://www.espruino.com/Reference#l_Math_floor + */ + floor(x: number): number; + + /** + * + * @param {number} x - The value raise E to the power of + * @returns {number} E^x + * @url http://www.espruino.com/Reference#l_Math_exp + */ + exp(x: number): number; + + /** + * + * @param {number} x - The value to take the logarithm (base E) root of + * @returns {number} The log (base E) of x + * @url http://www.espruino.com/Reference#l_Math_log + */ + log(x: number): number; + + /** + * DEPRECATED - Please use `E.clip()` instead. Clip a number to be between min and + * max (inclusive) + * + * @param {number} x - A floating point value to clip + * @param {number} min - The smallest the value should be + * @param {number} max - The largest the value should be + * @returns {number} The value of x, clipped so as not to be below min or above max. + * @url http://www.espruino.com/Reference#l_Math_clip + */ + clip(x: number, min: number, max: number): number; + + /** + * DEPRECATED - This is not part of standard JavaScript libraries + * Wrap a number around if it is less than 0 or greater than or equal to max. For + * instance you might do: ```Math.wrap(angleInDegrees, 360)``` + * + * @param {number} x - A floating point value to wrap + * @param {number} max - The largest the value should be + * @returns {number} The value of x, wrapped so as not to be below min or above max. + * @url http://www.espruino.com/Reference#l_Math_wrap + */ + wrap(x: number, max: number): number; + + /** + * Find the minimum of a series of numbers + * + * @param {any} args - Floating point values to clip + * @returns {number} The minimum of the supplied values + * @url http://www.espruino.com/Reference#l_Math_min + */ + min(...args: any[]): number; + + /** + * Find the maximum of a series of numbers + * + * @param {any} args - Floating point values to clip + * @returns {number} The maximum of the supplied values + * @url http://www.espruino.com/Reference#l_Math_max + */ + max(...args: any[]): number; + + /** + * + * @param {number} x - The value to get the sign from + * @returns {number} sign on x - -1, 1, or 0 + * @url http://www.espruino.com/Reference#l_Math_sign + */ + sign(x: number): number; +} + +interface Math { + +} + +/** + * This is a standard JavaScript class that contains useful Maths routines + * @url http://www.espruino.com/Reference#Math + */ +declare const Math: MathConstructor + +/** + * Built-in class that caches the modules used by the `require` command + * @url http://www.espruino.com/Reference#Modules + */ +declare class Modules { + /** + * Return an array of module names that have been cached + * @returns {any} An array of module names + * @url http://www.espruino.com/Reference#l_Modules_getCached + */ + static getCached(): any; + + /** + * Remove the given module from the list of cached modules + * + * @param {any} id - The module name to remove + * @url http://www.espruino.com/Reference#l_Modules_removeCached + */ + static removeCached(id: any): void; + + /** + * Remove all cached modules + * @url http://www.espruino.com/Reference#l_Modules_removeAllCached + */ + static removeAllCached(): void; + + /** + * Add the given module to the cache + * + * @param {any} id - The module name to add + * @param {any} sourcecode - The module's sourcecode + * @url http://www.espruino.com/Reference#l_Modules_addCached + */ + static addCached(id: any, sourcecode: any): void; + + +} +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 /** * This is the built-in JavaScript class for Espruino utility functions. @@ -10704,21 +15091,6 @@ declare class E { */ static showAlert(message?: string, options?: string): Promise; - /** - * @url http://www.espruino.com/Reference#l_E_showMenu - */ - static showMenu(): void; - - /** - * @url http://www.espruino.com/Reference#l_E_showPrompt - */ - static showPrompt(): void; - - /** - * @url http://www.espruino.com/Reference#l_E_showMessage - */ - static showMessage(): void; - /** * Setup the filesystem so that subsequent calls to `E.openFile` and * `require('fs').*` will use an SD card on the supplied SPI device and pin. @@ -10764,36 +15136,6 @@ declare class E { */ static openFile(path: any, mode: any): File; - /** - * Change the parameters used for the flash filesystem. The default address is the - * last 1Mb of 4Mb Flash, 0x300000, with total size of 1Mb. - * Before first use the media needs to be formatted. - * ``` - * fs=require("fs"); - * try { - * fs.readdirSync(); - * } catch (e) { //'Uncaught Error: Unable to mount media : NO_FILESYSTEM' - * console.log('Formatting FS - only need to do once'); - * E.flashFatFS({ format: true }); - * } - * fs.writeFileSync("bang.txt", "This is the way the world ends\nnot with a bang but a whimper.\n"); - * fs.readdirSync(); - * ``` - * This will create a drive of 100 * 4096 bytes at 0x300000. Be careful with the - * selection of flash addresses as you can overwrite firmware! You only need to - * format once, as each will erase the content. - * `E.flashFatFS({ addr:0x300000,sectors:100,format:true });` - * - * @param {any} [options] - * [optional] An object `{ addr : int=0x300000, sectors : int=256, format : bool=false }` - * addr : start address in flash - * sectors: number of sectors to use - * format: Format the media - * @returns {boolean} True on success, or false on failure - * @url http://www.espruino.com/Reference#l_E_flashFatFS - */ - static flashFatFS(options?: any): boolean; - /** * Display a menu on the screen, and set up the buttons to navigate through it. * Supply an object containing menu items. When an item is selected, the function @@ -10841,6 +15183,10 @@ declare class E { * menu is removed * * (Bangle.js 2) `scroll : int` - an integer specifying how much the initial * menu should be scrolled by + * * (Bangle.js 2) The mapped functions can consider the touch event that interacted with the entry: + * `"Entry" : function(touch) { ... }` + * * This is also true of `onchange` mapped functions in entry objects: + * `onchange : (value, touch) => { ... }` * * The object returned by `E.showMenu` contains: * * (Bangle.js 2) `scroller` - the object returned by `E.showScroller` - * `scroller.scroll` returns the amount the menu is currently scrolled by @@ -10920,7 +15266,8 @@ declare class E { * title: "Hello", // optional Title * buttons : {"Ok":true,"Cancel":false}, // optional list of button text & return value * img: "image_string" // optional image string to draw - * remove: function() { } // Bangle.js: optional function to be called when the prompt is removed + * remove: function() { } // Bangle.js: optional function to be called when the prompt is removed# + * buttonHeight : 30, // Bangle.js2: optional height to force the buttons to be * } * ``` * @@ -10929,7 +15276,7 @@ declare class E { * @returns {any} A promise that is resolved when 'Ok' is pressed * @url http://www.espruino.com/Reference#l_E_showPrompt */ - static showPrompt(message: string, options?: { title?: string, buttons?: { [key: string]: T }, image?: string, remove?: () => void }): Promise; + static showPrompt(message: string, options?: { title?: string, buttons?: { [key: string]: T }, buttonHeight?: number, image?: string, remove?: () => void }): Promise; static showPrompt(): void; /** @@ -10944,6 +15291,7 @@ declare class E { * draw : function(idx, rect) { ... } * // a function to call when the item is selected, touch parameter is only relevant * // for Bangle.js 2 and contains the coordinates touched inside the selected item + * // as well as the type of the touch - see `Bangle.touch`. * select : function(idx, touch) { ... } * // optional function to be called when 'back' is tapped * back : function() { ...} @@ -11499,6 +15847,35 @@ declare class E { */ static kickWatchdog(): void; + /** + * Called when a bit rises or falls above a set level. See `E.setComparator` for setup. + * @param {string} event - The event to listen to. + * @param {(dir: number) => void} callback - A function that is executed when the event occurs. Its arguments are: + * * `dir` The direction of the pin's state change + * @url http://www.espruino.com/Reference#l_E_comparator + */ + static on(event: "comparator", callback: (dir: number) => void): void; + + /** + * (Added 2v25) Enable the nRF52 chip's `LPCOMP` hardware. When enabled, it creates an `E.on("comparator", ...)` + * event whenever the pin supplied rises or falls past the setpoint given (with 50mv hysteresis). + * ``` + * E.setComparator(D28, 8/16); // compare with VDD/2 + * E.on("comparator", e => { + * print(e); // 1 for up, or -1 for down + * }); + * ``` + * **Note:** There is just one LPCOMP, so you can only enable the comparator on one pin. + * **On [Jolt.js](https://www.espruino.com/Jolt.js):** when using `E.setComparator` on the analog pins on the + * Terminal block (`H0`/`H2`/`H4`/`H6`), the `level` you give needs to be in volts. Because the comparator only + * works in 16 steps, you can only detect multiples of 1.37v (1.37/2.74/4.11/etc) + * + * @param {Pin} pin - The `Pin` to enable the comparator on + * @param {number} level - The level to trigger on, or `undefined` to disable. (see below for [Jolt.js](https://www.espruino.com/Jolt.js)) + * @url http://www.espruino.com/Reference#l_E_setComparator + */ + static setComparator(pin: Pin, level: number): void; + /** * Get and reset the error flags. Returns an array that can contain: * `'FIFO_FULL'`: The receive FIFO filled up and data was lost. This could be state @@ -11587,7 +15964,7 @@ declare class E { * Note that this is an ArrayBuffer, not a Uint8Array. To get one of those, do: * `new Uint8Array(E.toArrayBuffer('....'))`. * - * @param {any} str - The string to convert to an ArrayBuffer + * @param {any} str - The string to convert to an `ArrayBuffer` * @returns {any} An ArrayBuffer that uses the given string * @url http://www.espruino.com/Reference#l_E_toArrayBuffer */ @@ -11604,12 +15981,16 @@ declare class E { * flat string of the same length, the backing string will be returned without * doing a copy or other allocation. The same applies if there's a single argument * which is itself a flat string. - * ```JS + * ``` * E.toString(0,1,2,"Hi",3) * "\0\1\2Hi\3" + * ``` + * ``` * E.toString(1,2,{data:[3,4], count:4},5,6) * "\1\2\3\4\3\4\3\4\3\4\5\6" - * >E.toString(1,2,{callback : () => "Hello World"},5,6) + * ``` + * ``` + * E.toString(1,2,{callback : () => "Hello World"},5,6) * ="\1\2Hello World\5\6" * ``` * **Note:** Prior to Espruino 2v18 `E.toString` would always return a flat string, @@ -11686,7 +16067,7 @@ declare class E { static isUTF8(str: any): boolean; /** - * This creates a Uint8Array from the given arguments. These are handled as + * This creates a `Uint8Array` from the given arguments. These are handled as * follows: * * `Number` -> read as an integer, using the lowest 8 bits * * `String` -> use each character's numeric value (e.g. @@ -11710,7 +16091,7 @@ declare class E { * =new Uint8Array([104, 105, 1, 2, 3]) * ``` * - * @param {any} args - The arguments to convert to a Uint8Array + * @param {any} args - The arguments to convert to a `Uint8Array` * @returns {any} A Uint8Array * @url http://www.espruino.com/Reference#l_E_toUint8Array */ @@ -11799,6 +16180,23 @@ declare class E { */ static setClock(options: number | { M: number, N: number, P: number, Q: number, latency?: number, PCLK?: number, PCLK2?: number }): number; + /** + * On boards other than STM32 this currently just returns `undefined` + * ### STM32 + * See `E.setClock` for more information. + * Returns: + * ``` + * { + * sysclk, hclk, pclk1, pclk2, // various clocks in Hz + * M, N, P, Q, PCLK1, PCLK2 // STM32F4: currently set divisors + * RTCCLKSource : "LSI/LSE/HSE_Div#" // STM32F4 source for RTC clock + * } + * ``` + * @returns {any} An object containing information about the current clock + * @url http://www.espruino.com/Reference#l_E_getClock + */ + static getClock(): any; + /** * Changes the device that the JS console (otherwise known as the REPL) is attached * to. If the console is on a device, that device can be used for programming @@ -11938,7 +16336,7 @@ declare class E { * @returns {number} The address of the given variable * @url http://www.espruino.com/Reference#l_E_getAddressOf */ - static getAddressOf(v: any, flatAddress: boolean): number; + static getAddressOf(v: any, flatAddress: ShortBoolean): number; /** * Take each element of the `from` array, look it up in `map` (or call @@ -12195,6 +16593,15 @@ declare class E { */ static reboot(): void; + /** + * Forces a hard reboot of the microcontroller into DFU mode. + * If this is an ST device, this will be the ST DFU mode. + * If this device has an UF2 bootloader, it will reappear as a USB drive, onto which you can copy new firmware. + * **Note:** The device will stay in DFU mode until it is power-cycled or reset. + * @url http://www.espruino.com/Reference#l_E_rebootToDFU + */ + static rebootToDFU(): void; + /** * USB HID will only take effect next time you unplug and re-plug your Espruino. If * you're disconnecting it from power you'll have to make sure you have `save()`d @@ -12271,7 +16678,7 @@ declare class E { * @returns {number} The RTC prescaler's current value * @url http://www.espruino.com/Reference#l_E_getRTCPrescaler */ - static getRTCPrescaler(calibrate: boolean): number; + static getRTCPrescaler(calibrate: ShortBoolean): number; /** * This function returns an object detailing the current **estimated** power usage @@ -12409,12 +16816,32 @@ declare class Pin { * @param {number} time - Time at which to write * @url http://www.espruino.com/Reference#l_Pin_writeAtTime */ +<<<<<<< HEAD writeAtTime(value: boolean, time: number): void; +||||||| e51f7bfbe + write(data: any, power: boolean): void; +======= + write(data: any, power: ShortBoolean): void; +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 /** +<<<<<<< HEAD * Return the current mode of the given pin. See `pinMode` for more information. * @returns {any} The pin mode, as a string * @url http://www.espruino.com/Reference#l_Pin_getMode +||||||| e51f7bfbe + * Read a byte + * + * @param {any} [count] - [optional] The amount of bytes to read + * @returns {any} The byte that was read, or a Uint8Array if count was specified and >=0 + * @url http://www.espruino.com/Reference#l_OneWire_read +======= + * Read a byte + * + * @param {any} [count] - [optional] The amount of bytes to read + * @returns {any} The byte that was read, or a `Uint8Array` if count was specified and >=0 + * @url http://www.espruino.com/Reference#l_OneWire_read +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 */ getMode(): any; @@ -13400,6 +17827,566 @@ interface Function { */ declare const Function: FunctionConstructor +<<<<<<< HEAD +||||||| e51f7bfbe +interface ArrayConstructor { + /** + * Returns true if the provided object is an array + * + * @param {any} var - The variable to be tested + * @returns {boolean} True if var is an array, false if not. + * @url http://www.espruino.com/Reference#l_Array_isArray + */ + isArray(arg: any): arg is any[]; + + /** + * Create an Array. Either give it one integer argument (>=0) which is the length + * of the array, or any number of arguments + * @constructor + * + * @param {any} args - The length of the array OR any number of items to add to the array + * @returns {any} An Array + * @url http://www.espruino.com/Reference#l_Array_Array + */ + new(arrayLength?: number): any[]; + new(arrayLength: number): T[]; + new(...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; +} + +interface Array { + /** + * Convert the Array to a string + * + * @param {any} radix - unused + * @returns {any} A String representing the array + * @url http://www.espruino.com/Reference#l_Array_toString + */ + toString(): string; + + /** + * Find the length of the array + * @returns {any} The length of the array + * @url http://www.espruino.com/Reference#l_Array_length + */ + length: number; + + /** + * Return the index of the value in the array, or -1 + * + * @param {any} value - The value to check for + * @param {number} [startIndex] - [optional] the index to search from, or 0 if not specified + * @returns {any} the index of the value in the array, or -1 + * @url http://www.espruino.com/Reference#l_Array_indexOf + */ + indexOf(value: T, startIndex?: number): number; + + /** + * Return `true` if the array includes the value, `false` otherwise + * + * @param {any} value - The value to check for + * @param {number} [startIndex] - [optional] the index to search from, or 0 if not specified + * @returns {boolean} `true` if the array includes the value, `false` otherwise + * @url http://www.espruino.com/Reference#l_Array_includes + */ + includes(value: T, startIndex?: number): boolean; + + /** + * Join all elements of this array together into one string, using 'separator' + * between them. e.g. ```[1,2,3].join(' ')=='1 2 3'``` + * + * @param {any} separator - The separator + * @returns {any} A String representing the Joined array + * @url http://www.espruino.com/Reference#l_Array_join + */ + join(separator?: string): string; + + /** + * Push a new value onto the end of this array' + * This is the opposite of `[1,2,3].unshift(0)`, which adds one or more elements to + * the beginning of the array. + * + * @param {any} arguments - One or more arguments to add + * @returns {number} The new size of the array + * @url http://www.espruino.com/Reference#l_Array_push + */ + push(...arguments: T[]): number; + + /** + * Remove and return the value on the end of this array. + * This is the opposite of `[1,2,3].shift()`, which removes an element from the + * beginning of the array. + * @returns {any} The value that is popped off + * @url http://www.espruino.com/Reference#l_Array_pop + */ + pop(): T | undefined; + + /** + * Return an array which is made from the following: ```A.map(function) = + * [function(A[0]), function(A[1]), ...]``` + * + * @param {any} function - Function used to map one item to another + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @returns {any} An array containing the results + * @url http://www.espruino.com/Reference#l_Array_map + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Executes a provided function once per array element. + * + * @param {any} function - Function to be executed + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @url http://www.espruino.com/Reference#l_Array_forEach + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Return an array which contains only those elements for which the callback + * function returns 'true' + * + * @param {any} function - Function to be executed + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @returns {any} An array containing the results + * @url http://www.espruino.com/Reference#l_Array_filter + */ + filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; + filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; + + /** + * Return the array element where `function` returns `true`, or `undefined` if it + * doesn't returns `true` for any element. + * ``` + * ["Hello","There","World"].find(a=>a[0]=="T") + * // returns "There" + * ``` + * + * @param {any} function - Function to be executed + * @returns {any} The array element where `function` returns `true`, or `undefined` + * @url http://www.espruino.com/Reference#l_Array_find + */ + find(predicate: (this: void, value: T, index: number, obj: T[]) => value is S): S | undefined; + find(predicate: (value: T, index: number, obj: T[]) => unknown): T | undefined; + + /** + * Return the array element's index where `function` returns `true`, or `-1` if it + * doesn't returns `true` for any element. + * ``` + * ["Hello","There","World"].findIndex(a=>a[0]=="T") + * // returns 1 + * ``` + * + * @param {any} function - Function to be executed + * @returns {any} The array element's index where `function` returns `true`, or `-1` + * @url http://www.espruino.com/Reference#l_Array_findIndex + */ + findIndex(predicate: (value: T, index: number, obj: T[]) => unknown): number; + + /** + * Return 'true' if the callback returns 'true' for any of the elements in the + * array + * + * @param {any} function - Function to be executed + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @returns {any} A boolean containing the result + * @url http://www.espruino.com/Reference#l_Array_some + */ + some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + + /** + * Return 'true' if the callback returns 'true' for every element in the array + * + * @param {any} function - Function to be executed + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @returns {any} A boolean containing the result + * @url http://www.espruino.com/Reference#l_Array_every + */ + every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + + /** + * Execute `previousValue=initialValue` and then `previousValue = + * callback(previousValue, currentValue, index, array)` for each element in the + * array, and finally return previousValue. + * + * @param {any} callback - Function used to reduce the array + * @param {any} initialValue - if specified, the initial value to pass to the function + * @returns {any} The value returned by the last function called + * @url http://www.espruino.com/Reference#l_Array_reduce + */ + reduce(callback: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + + /** + * Both remove and add items to an array + * + * @param {number} index - Index at which to start changing the array. If negative, will begin that many elements from the end + * @param {any} howMany - An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed. + * @param {any} elements - One or more items to add to the array + * @returns {any} An array containing the removed elements. If only one element is removed, an array of one element is returned. + * @url http://www.espruino.com/Reference#l_Array_splice + */ + splice(index: number, howMany?: number, ...elements: T[]): T[]; + + /** + * Remove and return the first element of the array. + * This is the opposite of `[1,2,3].pop()`, which takes an element off the end. + * + * @returns {any} The element that was removed + * @url http://www.espruino.com/Reference#l_Array_shift + */ + shift(): T | undefined; + + /** + * Add one or more items to the start of the array, and return its new length. + * This is the opposite of `[1,2,3].push(4)`, which puts one or more elements on + * the end. + * + * @param {any} elements - One or more items to add to the beginning of the array + * @returns {number} The new array length + * @url http://www.espruino.com/Reference#l_Array_unshift + */ + unshift(...elements: T[]): number; + + /** + * Return a copy of a portion of this array (in a new array) + * + * @param {number} start - Start index + * @param {any} [end] - [optional] End index + * @returns {any} A new array + * @url http://www.espruino.com/Reference#l_Array_slice + */ + slice(start?: number, end?: number): T[]; + + /** + * Do an in-place quicksort of the array + * + * @param {any} var - A function to use to compare array elements (or undefined) + * @returns {any} This array object + * @url http://www.espruino.com/Reference#l_Array_sort + */ + sort(compareFn?: (a: T, b: T) => number): T[]; + + /** + * Create a new array, containing the elements from this one and any arguments, if + * any argument is an array then those elements will be added. + * + * @param {any} args - Any items to add to the array + * @returns {any} An Array + * @url http://www.espruino.com/Reference#l_Array_concat + */ + concat(...args: (T | T[])[]): T[]; + + /** + * Fill this array with the given value, for every index `>= start` and `< end` + * + * @param {any} value - The value to fill the array with + * @param {number} start - Optional. The index to start from (or 0). If start is negative, it is treated as length+start where length is the length of the array + * @param {any} end - Optional. The index to end at (or the array length). If end is negative, it is treated as length+end. + * @returns {any} This array + * @url http://www.espruino.com/Reference#l_Array_fill + */ + fill(value: T, start: number, end?: number): T[]; + + /** + * Reverse all elements in this array (in place) + * @returns {any} The array, but reversed. + * @url http://www.espruino.com/Reference#l_Array_reverse + */ + reverse(): T[]; + + [index: number]: T +} + +======= +interface ArrayConstructor { + /** + * Returns true if the provided object is an array + * + * @param {any} var - The variable to be tested + * @returns {boolean} True if var is an array, false if not. + * @url http://www.espruino.com/Reference#l_Array_isArray + */ + isArray(arg: any): arg is any[]; + + /** + * Create an Array. Either give it one integer argument (>=0) which is the length + * of the array, or any number of arguments + * @constructor + * + * @param {any} args - The length of the array OR any number of items to add to the array + * @returns {any} An Array + * @url http://www.espruino.com/Reference#l_Array_Array + */ + new(arrayLength?: number): any[]; + new(arrayLength: number): T[]; + new(...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; +} + +interface Array { + /** + * Convert the Array to a string + * + * @param {any} radix - unused + * @returns {any} A String representing the array + * @url http://www.espruino.com/Reference#l_Array_toString + */ + toString(): string; + + /** + * Find the length of the array + * @returns {any} The length of the array + * @url http://www.espruino.com/Reference#l_Array_length + */ + length: number; + + /** + * Return the index of the value in the array, or -1 + * + * @param {any} value - The value to check for + * @param {number} [startIndex] - [optional] the index to search from, or 0 if not specified + * @returns {any} the index of the value in the array, or -1 + * @url http://www.espruino.com/Reference#l_Array_indexOf + */ + indexOf(value: T, startIndex?: number): number; + + /** + * Return `true` if the array includes the value, `false` otherwise + * + * @param {any} value - The value to check for + * @param {number} [startIndex] - [optional] the index to search from, or 0 if not specified + * @returns {boolean} `true` if the array includes the value, `false` otherwise + * @url http://www.espruino.com/Reference#l_Array_includes + */ + includes(value: T, startIndex?: number): boolean; + + /** + * Join all elements of this array together into one string, using 'separator' + * between them. e.g. ```[1,2,3].join(' ')=='1 2 3'``` + * + * @param {any} separator - The separator + * @returns {any} A String representing the Joined array + * @url http://www.espruino.com/Reference#l_Array_join + */ + join(separator?: string): string; + + /** + * Push a new value onto the end of this array' + * This is the opposite of `[1,2,3].unshift(0)`, which adds one or more elements to + * the beginning of the array. + * + * @param {any} arguments - One or more arguments to add + * @returns {number} The new size of the array + * @url http://www.espruino.com/Reference#l_Array_push + */ + push(...arguments: T[]): number; + + /** + * Remove and return the value on the end of this array. + * This is the opposite of `[1,2,3].shift()`, which removes an element from the + * beginning of the array. + * @returns {any} The value that is popped off + * @url http://www.espruino.com/Reference#l_Array_pop + */ + pop(): T | undefined; + + /** + * Return an array which is made from the following: ```A.map(function) = + * [function(A[0]), function(A[1]), ...]``` + * **Note:** Do not modify the array you're iterating over from inside the callback (`a.map(()=>a.push(0))`). + * It will cause non-spec-compliant behaviour. + * + * @param {any} function - Function used to map one item to another + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @returns {any} An array containing the results + * @url http://www.espruino.com/Reference#l_Array_map + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Executes a provided function once per array element. + * **Note:** Do not modify the array you're iterating over from inside the callback (`a.forEach(()=>a.push(0))`). + * It will cause non-spec-compliant behaviour. + * + * @param {any} function - Function to be executed + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @url http://www.espruino.com/Reference#l_Array_forEach + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Return an array which contains only those elements for which the callback + * function returns 'true' + * **Note:** Do not modify the array you're iterating over from inside the callback (`a.filter(()=>a.push(0))`). + * It will cause non-spec-compliant behaviour. + * + * @param {any} function - Function to be executed + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @returns {any} An array containing the results + * @url http://www.espruino.com/Reference#l_Array_filter + */ + filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; + filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; + + /** + * Return the array element where `function` returns `true`, or `undefined` if it + * doesn't returns `true` for any element. + * ``` + * ["Hello","There","World"].find(a=>a[0]=="T") + * // returns "There" + * ``` + * **Note:** Do not modify the array you're iterating over from inside the callback (`a.find(()=>a.push(0))`). + * It will cause non-spec-compliant behaviour. + * + * @param {any} function - Function to be executed + * @returns {any} The array element where `function` returns `true`, or `undefined` + * @url http://www.espruino.com/Reference#l_Array_find + */ + find(predicate: (this: void, value: T, index: number, obj: T[]) => value is S): S | undefined; + find(predicate: (value: T, index: number, obj: T[]) => unknown): T | undefined; + + /** + * Return the array element's index where `function` returns `true`, or `-1` if it + * doesn't returns `true` for any element. + * ``` + * ["Hello","There","World"].findIndex(a=>a[0]=="T") + * // returns 1 + * ``` + * **Note:** Do not modify the array you're iterating over from inside the callback (`a.findIndex(()=>a.push(0))`). + * It will cause non-spec-compliant behaviour. + * + * @param {any} function - Function to be executed + * @returns {any} The array element's index where `function` returns `true`, or `-1` + * @url http://www.espruino.com/Reference#l_Array_findIndex + */ + findIndex(predicate: (value: T, index: number, obj: T[]) => unknown): number; + + /** + * Return 'true' if the callback returns 'true' for any of the elements in the + * array + * **Note:** Do not modify the array you're iterating over from inside the callback (`a.some(()=>a.push(0))`). + * It will cause non-spec-compliant behaviour. + * + * @param {any} function - Function to be executed + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @returns {any} A boolean containing the result + * @url http://www.espruino.com/Reference#l_Array_some + */ + some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + + /** + * Return 'true' if the callback returns 'true' for every element in the array + * **Note:** Do not modify the array you're iterating over from inside the callback (`a.every(()=>a.push(0))`). + * It will cause non-spec-compliant behaviour. + * + * @param {any} function - Function to be executed + * @param {any} [thisArg] - [optional] If specified, the function is called with 'this' set to thisArg + * @returns {any} A boolean containing the result + * @url http://www.espruino.com/Reference#l_Array_every + */ + every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + + /** + * Execute `previousValue=initialValue` and then `previousValue = + * callback(previousValue, currentValue, index, array)` for each element in the + * array, and finally return previousValue. + * **Note:** Do not modify the array you're iterating over from inside the callback (`a.reduce(()=>a.push(0))`). + * It will cause non-spec-compliant behaviour. + * + * @param {any} callback - Function used to reduce the array + * @param {any} initialValue - if specified, the initial value to pass to the function + * @returns {any} The value returned by the last function called + * @url http://www.espruino.com/Reference#l_Array_reduce + */ + reduce(callback: (previousValue: O, currentValue: T, currentIndex: number, array: T[]) => O, initialValue?: O): O; + + /** + * Both remove and add items to an array + * + * @param {number} index - Index at which to start changing the array. If negative, will begin that many elements from the end + * @param {any} howMany - An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed. + * @param {any} elements - One or more items to add to the array + * @returns {any} An array containing the removed elements. If only one element is removed, an array of one element is returned. + * @url http://www.espruino.com/Reference#l_Array_splice + */ + splice(index: number, howMany?: number, ...elements: T[]): T[]; + + /** + * Remove and return the first element of the array. + * This is the opposite of `[1,2,3].pop()`, which takes an element off the end. + * + * @returns {any} The element that was removed + * @url http://www.espruino.com/Reference#l_Array_shift + */ + shift(): T | undefined; + + /** + * Add one or more items to the start of the array, and return its new length. + * This is the opposite of `[1,2,3].push(4)`, which puts one or more elements on + * the end. + * + * @param {any} elements - One or more items to add to the beginning of the array + * @returns {number} The new array length + * @url http://www.espruino.com/Reference#l_Array_unshift + */ + unshift(...elements: T[]): number; + + /** + * Return a copy of a portion of this array (in a new array) + * + * @param {number} start - Start index + * @param {any} [end] - [optional] End index + * @returns {any} A new array + * @url http://www.espruino.com/Reference#l_Array_slice + */ + slice(start?: number, end?: number): T[]; + + /** + * Do an in-place quicksort of the array + * **Note:** Do not modify the array you're iterating over from inside the callback (`a.sort(()=>a.push(0))`). + * It will cause non-spec-compliant behaviour. + * + * @param {any} var - A function to use to compare array elements (or undefined) + * @returns {any} This array object + * @url http://www.espruino.com/Reference#l_Array_sort + */ + sort(compareFn?: (a: T, b: T) => number): T[]; + + /** + * Create a new array, containing the elements from this one and any arguments, if + * any argument is an array then those elements will be added. + * + * @param {any} args - Any items to add to the array + * @returns {any} An Array + * @url http://www.espruino.com/Reference#l_Array_concat + */ + concat(...args: (T | T[])[]): T[]; + + /** + * Fill this array with the given value, for every index `>= start` and `< end` + * + * @param {any} value - The value to fill the array with + * @param {number} start - Optional. The index to start from (or 0). If start is negative, it is treated as length+start where length is the length of the array + * @param {any} end - Optional. The index to end at (or the array length). If end is negative, it is treated as length+end. + * @returns {any} This array + * @url http://www.espruino.com/Reference#l_Array_fill + */ + fill(value: T, start: number, end?: number): T[]; + + /** + * Reverse all elements in this array (in place) + * @returns {any} The array, but reversed. + * @url http://www.espruino.com/Reference#l_Array_reverse + */ + reverse(): T[]; + + [index: number]: T +} + +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 /** * Built-in class that caches the modules used by the `require` command * @url http://www.espruino.com/Reference#Modules @@ -13457,8 +18444,6 @@ interface JSONConstructor { /** * Parse the given JSON string into a JavaScript object - * NOTE: This implementation uses eval() internally, and as such it is unsafe as it - * can allow arbitrary JS commands to be executed. * * @param {any} string - A JSON string * @returns {any} The JavaScript object created by parsing the data string @@ -15003,19 +19988,19 @@ declare class I2C { writeTo(address: any, ...data: any[]): void; /** - * Request bytes from the given slave device, and return them as a Uint8Array + * Request bytes from the given slave device, and return them as a `Uint8Array` * (packed array of bytes). This is like using Arduino Wire's requestFrom, * available and read functions. Sends a STOP unless `{address:X, stop:false}` is used. * * @param {any} address - The 7 bit address of the device to request bytes from, or an object of the form `{address:12, stop:false}` to send this data without a STOP signal. * @param {number} quantity - The number of bytes to request - * @returns {any} The data that was returned - as a Uint8Array + * @returns {any} The data that was returned - as a `Uint8Array` * @url http://www.espruino.com/Reference#l_I2C_readFrom */ readFrom(address: any, quantity: number): Uint8Array; /** - * Request bytes from a register on the given I2C slave device, and return them as a Uint8Array + * Request bytes from a register on the given I2C slave device, and return them as a `Uint8Array` * (packed array of bytes). * This is the same as calling `I2C.writeTo` and `I2C.readFrom`: * ``` @@ -15028,7 +20013,7 @@ declare class I2C { * @param {number} address - The 7 bit address of the device to request bytes from * @param {number} reg - The register on the device to read bytes from * @param {number} quantity - The number of bytes to request - * @returns {any} The data that was returned - as a Uint8Array + * @returns {any} The data that was returned - as a `Uint8Array` * @url http://www.espruino.com/Reference#l_I2C_readReg */ readReg(address: number, reg: number, quantity: number): Uint8Array; @@ -15385,7 +20370,7 @@ declare class Serial { * @param {boolean} force - Whether to force the console to this port * @url http://www.espruino.com/Reference#l_Serial_setConsole */ - setConsole(force: boolean): void; + setConsole(force: ShortBoolean): void; /** * Setup this Serial port with the given baud rate and options. @@ -15462,7 +20447,7 @@ declare class Serial { /** * Print a line to the serial port with a newline (`\r\n`) at the end of it. * **Note:** This function converts data to a string first, e.g. - * `Serial.print([1,2,3])` is equivalent to `Serial.print("1,2,3"). If you'd like + * `Serial.print([1,2,3])` is equivalent to `Serial.print("1,2,3")`. If you'd like * to write raw bytes, use `Serial.write`. * * @param {any} string - A String to print @@ -15532,6 +20517,16 @@ declare class Serial { * @url http://www.espruino.com/Reference#l_Serial_flush */ flush(): void; + + /** + * (Added 2v25) Is the given Serial device connected? + * * USB/Bluetooth/Telnet/etc: Is this connected? + * * Serial1/etc: Has the device been initialised? + * * LoopbackA/LoopbackB/Terminal: always return true + * @returns {boolean} `true` if connected/initialised, false otherwise + * @url http://www.espruino.com/Reference#l_Serial_isConnected + */ + isConnected(): boolean; } /** @@ -16108,7 +21103,7 @@ declare class Pin { * @param {boolean} value - Whether to set output high (true/1) or low (false/0) * @url http://www.espruino.com/Reference#l_Pin_write */ - write(value: boolean): void; + write(value: ShortBoolean): void; /** * Sets the output state of the pin to the parameter given at the specified time. @@ -16116,10 +21111,10 @@ declare class Pin { * you need to use `pin.write(0)` or `pinMode(pin, 'output')` first. * * @param {boolean} value - Whether to set output high (true/1) or low (false/0) - * @param {number} time - Time at which to write + * @param {number} time - Time at which to write (in seconds) * @url http://www.espruino.com/Reference#l_Pin_writeAtTime */ - writeAtTime(value: boolean, time: number): void; + writeAtTime(value: ShortBoolean, time: number): void; /** * Return the current mode of the given pin. See `pinMode` for more information. @@ -16159,11 +21154,11 @@ declare class Pin { * @param {any} time - A time in milliseconds, or an array of times (in which case a square wave will be output starting with a pulse of 'value') * @url http://www.espruino.com/Reference#l_Pin_pulse */ - pulse(value: boolean, time: any): void; + pulse(value: ShortBoolean, time: any): void; /** * (Added in 2v20) Get the analogue value of the given pin. See `analogRead` for more information. - * @returns {number} The analog Value of the Pin between 0 and 1 + * @returns {number} The analog value of the `Pin` between 0(GND) and 1(VCC) * @url http://www.espruino.com/Reference#l_Pin_analog */ analog(): number; @@ -16189,12 +21184,14 @@ declare class Pin { * Get information about this pin and its capabilities. Of the form: * ``` * { - * "port" : "A", // the Pin's port on the chip - * "num" : 12, // the Pin's number - * "in_addr" : 0x..., // (if available) the address of the pin's input address in bit-banded memory (can be used with peek) - * "out_addr" : 0x..., // (if available) the address of the pin's output address in bit-banded memory (can be used with poke) - * "analog" : { ADCs : [1], channel : 12 }, // If analog input is available - * "functions" : { + * "port" : "A", // the Pin's port on the chip + * "num" : 12, // the Pin's number + * "mode" : (2v25+) // string: the pin's mode (same as Pin.getMode()) + * "output" : (2v25+) // 0/1: the state of the pin's output register + * "in_addr" : 0x..., // (if available) the address of the pin's input address in bit-banded memory (can be used with peek) + * "out_addr" : 0x..., // (if available) the address of the pin's output address in bit-banded memory (can be used with poke) + * "analog" : { ADCs : [1], channel : 12 }, // If analog input is available + * "functions" : { * "TIM1":{type:"CH1, af:0}, * "I2C3":{type:"SCL", af:1} * } @@ -16370,6 +21367,13 @@ declare function compass(): any; */ declare const FET: Pin; +/** + * In memory serial I/O device accessible via SWD debugger. + * Uses SEGGER RTT so it can be used with openocd and other SEGGER compatible tools. + * @url http://www.espruino.com/Reference#l__global_SWDCON + */ +declare const SWDCON: Serial; + /** * `Q0` and `Q1` Qwiic connectors can have their power controlled by a 500mA FET (`Q0.fet`) which switches GND. * The `sda` and `scl` pins on this port are also analog inputs - use `analogRead(Q0.sda)`/etc @@ -16447,6 +21451,7 @@ declare const LED1: any; declare const LED2: any; /** +<<<<<<< HEAD >>>>>>> a038233fa68c36b0b5a462df9da1255b24d4a091 * The pin connected to the 'A' button. Reads as `1` when pressed, `0` when not * @returns {Pin} @@ -16586,6 +21591,163 @@ declare const IOEXT3: Pin; * after booting, `__FILE__` is not set. * @returns {any} The filename of the JavaScript that is currently executing * @url http://www.espruino.com/Reference#l__global___FILE__ +||||||| e51f7bfbe + * The pin connected to the 'A' button. Reads as `1` when pressed, `0` when not + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_BTNA + */ +declare const BTNA: Pin; + +/** + * The pin connected to the 'B' button. Reads as `1` when pressed, `0` when not + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_BTNB + */ +declare const BTNB: Pin; + +/** + * The pin connected to the up button. Reads as `1` when pressed, `0` when not + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_BTNU + */ +declare const BTNU: Pin; + +/** + * The pin connected to the down button. Reads as `1` when pressed, `0` when not + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_BTND + */ +declare const BTND: Pin; + +/** + * The pin connected to the left button. Reads as `1` when pressed, `0` when not + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_BTNL + */ +declare const BTNL: Pin; + +/** + * The pin connected to the right button. Reads as `1` when pressed, `0` when not + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_BTNR + */ +declare const BTNR: Pin; + +/** + * The pin connected to Corner #1 + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_CORNER1 + */ +declare const CORNER1: Pin; + +/** + * The pin connected to Corner #2 + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_CORNER2 + */ +declare const CORNER2: Pin; + +/** + * The pin connected to Corner #3 + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_CORNER3 + */ +declare const CORNER3: Pin; + +/** + * The pin connected to Corner #4 + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_CORNER4 + */ +declare const CORNER4: Pin; + +/** + * The pin connected to Corner #5 + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_CORNER5 + */ +declare const CORNER5: Pin; + +/** + * The pin connected to Corner #6 + * @returns {Pin} + * @url http://www.espruino.com/Reference#l__global_CORNER6 + */ +declare const CORNER6: Pin; + +/** + * The Bluetooth Serial port - used when data is sent or received over Bluetooth + * Smart on nRF51/nRF52 chips. + * @url http://www.espruino.com/Reference#l__global_Bluetooth + */ +declare const Bluetooth: Serial; + +/** + * @returns {Pin} A Pin + * @url http://www.espruino.com/Reference#l__global_MOS1 + */ +declare const MOS1: Pin; + +/** + * @returns {Pin} A Pin + * @url http://www.espruino.com/Reference#l__global_MOS2 + */ +declare const MOS2: Pin; + +/** + * @returns {Pin} A Pin + * @url http://www.espruino.com/Reference#l__global_MOS3 + */ +declare const MOS3: Pin; + +/** + * @returns {Pin} A Pin + * @url http://www.espruino.com/Reference#l__global_MOS4 + */ +declare const MOS4: Pin; + +/** + * @returns {Pin} A Pin + * @url http://www.espruino.com/Reference#l__global_IOEXT0 + */ +declare const IOEXT0: Pin; + +/** + * @returns {Pin} A Pin + * @url http://www.espruino.com/Reference#l__global_IOEXT1 + */ +declare const IOEXT1: Pin; + +/** + * @returns {Pin} A Pin + * @url http://www.espruino.com/Reference#l__global_IOEXT2 + */ +declare const IOEXT2: Pin; + +/** + * @returns {Pin} A Pin + * @url http://www.espruino.com/Reference#l__global_IOEXT3 + */ +declare const IOEXT3: Pin; + +/** + * A simple VT100 terminal emulator. + * When data is sent to the `Terminal` object, `Graphics.getInstance()` is called + * and if an instance of `Graphics` is found then characters are written to it. + * @url http://www.espruino.com/Reference#l__global_Terminal +======= + * The Bluetooth Serial port - used when data is sent or received over Bluetooth + * Smart on nRF51/nRF52 chips. + * @url http://www.espruino.com/Reference#l__global_Bluetooth + */ +declare const Bluetooth: Serial; + +/** + * A simple VT100 terminal emulator. + * When data is sent to the `Terminal` object, `Graphics.getInstance()` is called + * and if an instance of `Graphics` is found then characters are written to it. + * @url http://www.espruino.com/Reference#l__global_Terminal +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 */ declare const __FILE__: any; @@ -17263,7 +22425,7 @@ declare function setSleepIndicator(pin: any): void; * @param {boolean} sleep * @url http://www.espruino.com/Reference#l__global_setDeepSleep */ -declare function setDeepSleep(sleep: boolean): void; +declare function setDeepSleep(sleep: ShortBoolean): void; /** * Output current interpreter state in a text form such that it can be copied to a @@ -17341,7 +22503,7 @@ declare function save(): void; * @param {boolean} clearFlash - Remove saved code from flash as well * @url http://www.espruino.com/Reference#l__global_reset */ -declare function reset(clearFlash: boolean): void; +declare function reset(clearFlash: ShortBoolean): void; /** * Fill the console with the contents of the given function, so you can edit it. @@ -17361,7 +22523,7 @@ declare function edit(funcName: any): void; * @param {boolean} echoOn * @url http://www.espruino.com/Reference#l__global_echo */ -declare function echo(echoOn: boolean): void; +declare function echo(echoOn: ShortBoolean): void; /** * Return the current system time in Seconds (as a floating point number) @@ -17507,7 +22669,7 @@ declare function changeInterval(id: IntervalId, time: number): void; * Read 8 bits of memory at the given location - DANGEROUS! * * @param {number} addr - The address in memory to read - * @param {number} [count] - [optional] the number of items to read. If >1 a Uint8Array will be returned. + * @param {number} [count] - [optional] the number of items to read. If >1 a `Uint8Array` will be returned. * @returns {any} The value of memory at the given location * @url http://www.espruino.com/Reference#l__global_peek8 */ @@ -17527,7 +22689,7 @@ declare function poke8(addr: number, value: number | number[]): void; * Read 16 bits of memory at the given location - DANGEROUS! * * @param {number} addr - The address in memory to read - * @param {number} [count] - [optional] the number of items to read. If >1 a Uint16Array will be returned. + * @param {number} [count] - [optional] the number of items to read. If >1 a `Uint16Array` will be returned. * @returns {any} The value of memory at the given location * @url http://www.espruino.com/Reference#l__global_peek16 */ @@ -17547,7 +22709,7 @@ declare function poke16(addr: number, value: number | number[]): void; * Read 32 bits of memory at the given location - DANGEROUS! * * @param {number} addr - The address in memory to read - * @param {number} [count] - [optional] the number of items to read. If >1 a Uint32Array will be returned. + * @param {number} [count] - [optional] the number of items to read. If >1 a `Uint32Array` will be returned. * @returns {any} The value of memory at the given location * @url http://www.espruino.com/Reference#l__global_peek32 */ @@ -17565,6 +22727,9 @@ declare function poke32(addr: number, value: number | number[]): void; /** * Get the analogue value of the given pin. + * * The value is normally greater than or equal to 0, however in some cases nRF52-based boards can produce values + * less than 0 when the ADC voltage is slightly less than the chip's internal GND. + * * The value returned will always be *less* than 1, even when the ADC reads full range. For example a 12 bit ADC may return 4095 as a full-range value, but this is divided by 4096 to produce `analogRead`'s output value. * This is different to Arduino which only returns an integer between 0 and 1023 * However only pins connected to an ADC will work (see the datasheet) * **Note:** if you didn't call `pinMode` beforehand then this function will also @@ -17576,7 +22741,7 @@ declare function poke32(addr: number, value: number | number[]): void; * @param {Pin} pin * The pin to use * You can find out which pins to use by looking at [your board's reference page](#boards) and searching for pins with the `ADC` markers. - * @returns {number} The Analog Value of the Pin between 0(GND) and 1(VCC). See below. + * @returns {number} The analog value of the `Pin` between 0(GND) and 1(VCC). See below. * @url http://www.espruino.com/Reference#l__global_analogRead */ declare function analogRead(pin: Pin): number; @@ -17764,7 +22929,7 @@ declare function shiftOut(pins: Pin | Pin[], options: { clk?: Pin, clkPol?: bool * // setting irq:true will call that function in the interrupt itself * irq : false(default) * // Advanced: If specified, the given pin will be read whenever the watch is called - * // and the state will be included as a 'data' field in the callback + * // and the state will be included as a 'data' field in the callback (`debounce:0` is required) * data : pin * // Advanced: On Nordic devices, a watch may be 'high' or 'low' accuracy. By default low * // accuracy is used (which is better for power consumption), but this means that @@ -17781,7 +22946,7 @@ declare function shiftOut(pins: Pin | Pin[], options: { clk?: Pin, clkPol?: bool * When using `edge:'rising'` or `edge:'falling'`, this is not the same as when * the function was last called. * * `data` is included if `data:pin` was specified in the options, and can be - * used for reading in clocked data + * used for reading in clocked data. It will only work if `debounce:0` is used * For instance, if you want to measure the length of a positive pulse you could * use `setWatch(function(e) { console.log(e.time-e.lastTime); }, BTN, { * repeat:true, edge:'falling' });`. This will only be called on the falling edge @@ -17826,6 +22991,7 @@ declare const global: { acceleration: typeof acceleration; compass: typeof compass; FET: typeof FET; + SWDCON: typeof SWDCON; Q0: typeof Q0; Q1: typeof Q1; Q2: typeof Q2; @@ -17834,27 +23000,7 @@ declare const global: { LED: typeof LED; LED1: typeof LED1; LED2: typeof LED2; - BTNA: typeof BTNA; - BTNB: typeof BTNB; - BTNU: typeof BTNU; - BTND: typeof BTND; - BTNL: typeof BTNL; - BTNR: typeof BTNR; - CORNER1: typeof CORNER1; - CORNER2: typeof CORNER2; - CORNER3: typeof CORNER3; - CORNER4: typeof CORNER4; - CORNER5: typeof CORNER5; - CORNER6: typeof CORNER6; Bluetooth: typeof Bluetooth; - MOS1: typeof MOS1; - MOS2: typeof MOS2; - MOS3: typeof MOS3; - MOS4: typeof MOS4; - IOEXT0: typeof IOEXT0; - IOEXT1: typeof IOEXT1; - IOEXT2: typeof IOEXT2; - IOEXT3: typeof IOEXT3; Terminal: typeof Terminal; setBusyIndicator: typeof setBusyIndicator; setSleepIndicator: typeof setSleepIndicator; @@ -18169,7 +23315,7 @@ declare module "ESP8266" { * @param {boolean} enable - Enable or disable the debug logging. * @url http://www.espruino.com/Reference#l_ESP8266_logDebug */ - function logDebug(enable: boolean): void; + function logDebug(enable: ShortBoolean): void; /** * Set the debug logging mode. It can be disabled (which frees ~1.2KB of heap), @@ -18218,10 +23364,9 @@ declare module "ESP8266" { * * `cpuFrequency` - CPU operating frequency in Mhz. * * `freeHeap` - Amount of free heap in bytes. * * `maxCon` - Maximum number of concurrent connections. - * * `flashMap` - Configured flash size&map: '512KB:256/256' .. '4MB:512/512' + * * `flashMap` - Configured flash size&map: '512KB:256/256' .. `'4MB:512/512'` * * `flashKB` - Configured flash size in KB as integer - * * `flashChip` - Type of flash chip as string with manufacturer & chip, ex: '0xEF - * 0x4016` + * * `flashChip` - Type of flash chip as string with manufacturer & chip, ex: `'0xEF 0x4016'` * @returns {any} The state of the ESP8266 * @url http://www.espruino.com/Reference#l_ESP8266_getState */ @@ -18287,6 +23432,160 @@ declare module "ESP8266" { } /** +<<<<<<< HEAD +||||||| e51f7bfbe + * Cryptographic functions + * **Note:** This library is currently only included in builds for boards where + * there is space. For other boards there is `crypto.js` which implements SHA1 in + * JS. + * @url http://www.espruino.com/Reference#crypto + */ +declare module "crypto" { + /** + * Class containing AES encryption/decryption + * @returns {any} + * @url http://www.espruino.com/Reference#l_crypto_AES + */ + const AES: AES; + + /** + * Performs a SHA1 hash and returns the result as a 20 byte ArrayBuffer. + * **Note:** On some boards (currently only Espruino Original) there isn't space + * for a fully unrolled SHA1 implementation so a slower all-JS implementation is + * used instead. + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 20 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA1 + */ + function SHA1(message: any): ArrayBuffer; + + /** + * Performs a SHA224 hash and returns the result as a 28 byte ArrayBuffer + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 20 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA224 + */ + function SHA224(message: any): ArrayBuffer; + + /** + * Performs a SHA256 hash and returns the result as a 32 byte ArrayBuffer + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 20 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA256 + */ + function SHA256(message: any): ArrayBuffer; + + /** + * Performs a SHA384 hash and returns the result as a 48 byte ArrayBuffer + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 20 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA384 + */ + function SHA384(message: any): ArrayBuffer; + + /** + * Performs a SHA512 hash and returns the result as a 64 byte ArrayBuffer + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 32 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA512 + */ + function SHA512(message: any): ArrayBuffer; + + /** + * Password-Based Key Derivation Function 2 algorithm, using SHA512 + * + * @param {any} passphrase - Passphrase + * @param {any} salt - Salt for turning passphrase into a key + * @param {any} options - Object of Options, `{ keySize: 8 (in 32 bit words), iterations: 10, hasher: 'SHA1'/'SHA224'/'SHA256'/'SHA384'/'SHA512' }` + * @returns {any} Returns an ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_PBKDF2 + */ + function PBKDF2(passphrase: any, salt: any, options: any): ArrayBuffer; +} + +/** +======= + * Cryptographic functions + * **Note:** This library is currently only included in builds for boards where + * there is space. For other boards there is `crypto.js` which implements SHA1 in + * JS. + * @url http://www.espruino.com/Reference#crypto + */ +declare module "crypto" { + /** + * Class containing AES encryption/decryption + * @returns {any} + * @url http://www.espruino.com/Reference#l_crypto_AES + */ + const AES: AES; + + /** + * Performs a SHA1 hash and returns the result as a 20 byte ArrayBuffer. + * **Note:** On some boards (currently only Espruino Original) there isn't space + * for a fully unrolled SHA1 implementation so a slower all-JS implementation is + * used instead. + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 20 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA1 + */ + function SHA1(message: any): ArrayBuffer; + + /** + * Performs a SHA224 hash and returns the result as a 28 byte ArrayBuffer + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 20 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA224 + */ + function SHA224(message: any): ArrayBuffer; + + /** + * Performs a SHA256 hash and returns the result as a 32 byte ArrayBuffer + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 20 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA256 + */ + function SHA256(message: any): ArrayBuffer; + + /** + * Performs a SHA384 hash and returns the result as a 48 byte ArrayBuffer + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 20 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA384 + */ + function SHA384(message: any): ArrayBuffer; + + /** + * Performs a SHA512 hash and returns the result as a 64 byte ArrayBuffer + * + * @param {any} message - The message to apply the hash to + * @returns {any} Returns a 32 byte ArrayBuffer + * @url http://www.espruino.com/Reference#l_crypto_SHA512 + */ + function SHA512(message: any): ArrayBuffer; + + /** + * Password-Based Key Derivation Function 2 algorithm, using SHA512 + * + * @param {any} passphrase - Passphrase + * @param {any} salt - Salt for turning passphrase into a key + * @param {any} options - Object of Options, `{ keySize: 8 (in 32 bit words), iterations: 10, hasher: 'SHA1'/'SHA224'/'SHA256'/'SHA384'/'SHA512' }` + * @returns {any} Returns an `ArrayBuffer` + * @url http://www.espruino.com/Reference#l_crypto_PBKDF2 + */ + function PBKDF2(passphrase: any, salt: any, options: any): ArrayBuffer; +} + +/** +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * This library allows you to write to Neopixel/WS281x/APA10x/SK6812 LED strips * These use a high speed single-wire protocol which needs platform-specific * implementation on some devices - hence this library to simplify things. @@ -18506,7 +23805,7 @@ declare module "tls" { * * Just specify the filename (<=100 characters) and it will be loaded and parsed * if you have an SD card connected. For instance `options.key = "key.pem";` * * Specify a function, which will be called to retrieve the data. For instance - * `options.key = function() { eeprom.load_my_info(); }; + * `options.key = function() { eeprom.load_my_info(); };` * For more information about generating and using certificates, see: * https://engineering.circle.com/https-authorized-certs-with-node-js/ * (You'll need to use 2048 bit certificates as opposed to 4096 bit shown above) @@ -19040,6 +24339,207 @@ declare module "NetworkJS" { } /** +<<<<<<< HEAD +||||||| e51f7bfbe + * This library allows you to create http servers and make http requests + * In order to use this, you will need an extra module to get network connectivity + * such as the [TI CC3000](/CC3000) or [WIZnet W5500](/WIZnet). + * This is designed to be a cut-down version of the [node.js + * library](http://nodejs.org/api/http.html). Please see the [Internet](/Internet) + * page for more information on how to use it. + * @url http://www.espruino.com/Reference#http + */ +declare module "http" { + /** + * Create an HTTP Server + * When a request to the server is made, the callback is called. In the callback + * you can use the methods on the response (`httpSRs`) to send data. You can also + * add `request.on('data',function() { ... })` to listen for POSTed data + * + * @param {any} callback - A function(request,response) that will be called when a connection is made + * @returns {any} Returns a new httpSrv object + * @url http://www.espruino.com/Reference#l_http_createServer + */ + function createServer(callback: any): httpSrv; + + /** + * Create an HTTP Request - `end()` must be called on it to complete the operation. + * `options` is of the form: + * ``` + * var options = { + * host: 'example.com', // host name + * port: 80, // (optional) port, defaults to 80 + * path: '/', // path sent to server + * method: 'GET', // HTTP command sent to server (must be uppercase 'GET', 'POST', etc) + * protocol: 'http:', // optional protocol - https: or http: + * headers: { key : value, key : value } // (optional) HTTP headers + * }; + * var req = require("http").request(options, function(res) { + * res.on('data', function(data) { + * console.log("HTTP> "+data); + * }); + * res.on('close', function(data) { + * console.log("Connection closed"); + * }); + * }); + * // You can req.write(...) here if your request requires data to be sent. + * req.end(); // called to finish the HTTP request and get the response + * ``` + * You can easily pre-populate `options` from a URL using `var options = + * url.parse("http://www.example.com/foo.html")` + * There's an example of using [`http.request` for HTTP POST + * here](/Internet#http-post) + * **Note:** if TLS/HTTPS is enabled, options can have `ca`, `key` and `cert` + * fields. See `tls.connect` for more information about these and how to use them. + * + * @param {any} options - An object containing host,port,path,method,headers fields (and also ca,key,cert if HTTPS is enabled) + * @param {any} callback - A function(res) that will be called when a connection is made. You can then call `res.on('data', function(data) { ... })` and `res.on('close', function() { ... })` to deal with the response. + * @returns {any} Returns a new httpCRq object + * @url http://www.espruino.com/Reference#l_http_request + */ + function request(options: any, callback: any): httpCRq; + + /** + * Request a webpage over HTTP - a convenience function for `http.request()` that + * makes sure the HTTP command is 'GET', and that calls `end` automatically. + * ``` + * require("http").get("http://pur3.co.uk/hello.txt", function(res) { + * res.on('data', function(data) { + * console.log("HTTP> "+data); + * }); + * res.on('close', function(data) { + * console.log("Connection closed"); + * }); + * }); + * ``` + * See `http.request()` and [the Internet page](/Internet) and ` for more usage + * examples. + * + * @param {any} options - A simple URL, or an object containing host,port,path,method fields + * @param {any} callback - A function(res) that will be called when a connection is made. You can then call `res.on('data', function(data) { ... })` and `res.on('close', function() { ... })` to deal with the response. + * @returns {any} Returns a new httpCRq object + * @url http://www.espruino.com/Reference#l_http_get + */ + function get(options: any, callback: any): httpCRq; +} + +/** + * Library for communication with the WIZnet Ethernet module + * @url http://www.espruino.com/Reference#WIZnet + */ +declare module "WIZnet" { + /** + * Initialise the WIZnet module and return an Ethernet object + * + * @param {any} spi - Device to use for SPI (or undefined to use the default) + * @param {Pin} cs - The pin to use for Chip Select + * @returns {any} An Ethernet Object + * @url http://www.espruino.com/Reference#l_WIZnet_connect + */ + function connect(spi: any, cs: Pin): Ethernet; +} + +/** +======= + * This library allows you to create http servers and make http requests + * In order to use this, you will need an extra module to get network connectivity + * such as the [TI CC3000](/CC3000) or [WIZnet W5500](/WIZnet). + * This is designed to be a cut-down version of the [node.js + * library](http://nodejs.org/api/http.html). Please see the [Internet](/Internet) + * page for more information on how to use it. + * @url http://www.espruino.com/Reference#http + */ +declare module "http" { + /** + * Create an HTTP Server + * When a request to the server is made, the callback is called. In the callback + * you can use the methods on the response (`httpSRs`) to send data. You can also + * add `request.on('data',function() { ... })` to listen for POSTed data + * + * @param {any} callback - A function(request,response) that will be called when a connection is made + * @returns {any} Returns a new httpSrv object + * @url http://www.espruino.com/Reference#l_http_createServer + */ + function createServer(callback: any): httpSrv; + + /** + * Create an HTTP Request - `end()` must be called on it to complete the operation. + * `options` is of the form: + * ``` + * var options = { + * host: 'example.com', // host name + * port: 80, // (optional) port, defaults to 80 + * path: '/', // path sent to server + * method: 'GET', // HTTP command sent to server (must be uppercase 'GET', 'POST', etc) + * protocol: 'http:', // optional protocol - https: or http: + * headers: { key : value, key : value } // (optional) HTTP headers + * }; + * var req = require("http").request(options, function(res) { + * res.on('data', function(data) { + * console.log("HTTP> "+data); + * }); + * res.on('close', function(data) { + * console.log("Connection closed"); + * }); + * }); + * // You can req.write(...) here if your request requires data to be sent. + * req.end(); // called to finish the HTTP request and get the response + * ``` + * You can easily pre-populate `options` from a URL using `var options = + * url.parse("http://www.example.com/foo.html")` + * There's an example of using [`http.request` for HTTP POST + * here](/Internet#http-post) + * **Note:** if TLS/HTTPS is enabled, options can have `ca`, `key` and `cert` + * fields. See `tls.connect` for more information about these and how to use them. + * + * @param {any} options - An object containing host,port,path,method,headers fields (and also ca,key,cert if HTTPS is enabled) + * @param {any} callback - A function(res) that will be called when a connection is made. You can then call `res.on('data', function(data) { ... })` and `res.on('close', function() { ... })` to deal with the response. + * @returns {any} Returns a new httpCRq object + * @url http://www.espruino.com/Reference#l_http_request + */ + function request(options: any, callback: any): httpCRq; + + /** + * Request a webpage over HTTP - a convenience function for `http.request()` that + * makes sure the HTTP command is 'GET', and that calls `end` automatically. + * ``` + * require("http").get("http://pur3.co.uk/hello.txt", function(res) { + * res.on('data', function(data) { + * console.log("HTTP> "+data); + * }); + * res.on('close', function(data) { + * console.log("Connection closed"); + * }); + * }); + * ``` + * See `http.request()` and [the Internet page](/Internet) for more usage examples. + * + * @param {any} options - A simple URL, or an object containing host,port,path,method fields + * @param {any} callback - A function(res) that will be called when a connection is made. You can then call `res.on('data', function(data) { ... })` and `res.on('close', function() { ... })` to deal with the response. + * @returns {any} Returns a new httpCRq object + * @url http://www.espruino.com/Reference#l_http_get + */ + function get(options: any, callback: any): httpCRq; +} + +/** + * Library for communication with the WIZnet Ethernet module + * @url http://www.espruino.com/Reference#WIZnet + */ +declare module "WIZnet" { + /** + * Initialise the WIZnet module and return an Ethernet object + * + * @param {any} spi - Device to use for SPI (or undefined to use the default) + * @param {Pin} cs - The pin to use for Chip Select + * @returns {any} An Ethernet Object + * @url http://www.espruino.com/Reference#l_WIZnet_connect + */ + function connect(spi: any, cs: Pin): Ethernet; +} + +/** +>>>>>>> bc375c512b0fc15ca033851245c9137656001c54 * @url http://www.espruino.com/Reference#CC3000 */ declare module "CC3000" { @@ -19296,6 +24796,20 @@ declare module "fs" { */ function statSync(path: any): any; + /** + * Get the number of free sectors on the volume. This returns an object with the following + * fields: + * freeSectors: the number of free sectors + * totalSectors: the total number of sectors on the volume + * sectorSize: the number of bytes per sector + * clusterSize: the number of sectors per cluster + * + * @param {any} path - The path specifying the logical drive + * @returns {any} An object describing the drive, or undefined on failure + * @url http://www.espruino.com/Reference#l_fs_getFree + */ + function getFree(path: any): any; + /** * Create the directory * NOTE: Espruino does not yet support Async file IO, so this function behaves like @@ -19316,6 +24830,13 @@ declare module "fs" { */ function mkdirSync(path: any): boolean; + /** + * Reformat the connected media to a FAT filesystem + * @returns {boolean} True on success, or false on failure + * @url http://www.espruino.com/Reference#l_fs_mkfs + */ + function mkfs(): boolean; + /** * Pipe this file to a destination stream (object which has a `.write(data)` method). * @@ -19465,14 +24986,14 @@ declare module "tensorflow" { */ declare module "heatshrink" { /** - * Compress the data supplied as input, and return heatshrink encoded data as an ArrayBuffer. + * Compress the data supplied as input, and return heatshrink encoded data as an `ArrayBuffer`. * No type information is stored, and the `data` argument is treated as an array of bytes * (whether it is a `String`/`Uint8Array` or even `Uint16Array`), so the result of - * decompressing any compressed data will always be an ArrayBuffer. + * decompressing any compressed data will always be an `ArrayBuffer`. * If you'd like a way to perform compression/decompression on desktop, check out https://github.com/espruino/EspruinoWebTools#heatshrinkjs * * @param {any} data - The data to compress - * @returns {any} Returns the result as an ArrayBuffer + * @returns {any} Returns the result as an `ArrayBuffer` * @url http://www.espruino.com/Reference#l_heatshrink_compress */ function compress(data: any): ArrayBuffer; @@ -19777,7 +25298,7 @@ declare module "Storage" { * @param {boolean} [showMessage] - [optional] If true, an overlay message will be displayed on the screen while compaction is happening. Default is false. * @url http://www.espruino.com/Reference#l_Storage_compact */ - function compact(showMessage?: boolean): void; + function compact(showMessage?: ShortBoolean): void; /** * This writes information about all blocks in flash memory to the console - and is @@ -19796,7 +25317,7 @@ declare module "Storage" { * @returns {number} The amount of free bytes * @url http://www.espruino.com/Reference#l_Storage_getFree */ - function getFree(checkInternalFlash: boolean): number; + function getFree(checkInternalFlash: ShortBoolean): number; /** * Returns: @@ -19816,7 +25337,7 @@ declare module "Storage" { * @returns {any} An object containing info about the current Storage system * @url http://www.espruino.com/Reference#l_Storage_getStats */ - function getStats(checkInternalFlash: boolean): any; + function getStats(checkInternalFlash: ShortBoolean): any; /** * Writes a lookup table for files into Bangle.js's storage. This allows any file diff --git a/typescript/types/modules.d.ts b/typescript/types/modules.d.ts index e8aa15ac1..628074d11 100644 --- a/typescript/types/modules.d.ts +++ b/typescript/types/modules.d.ts @@ -6,3 +6,6 @@ declare function require(moduleName: "ClockFace"): typeof ClockFace_.ClockFace; declare function require(moduleName: "clock_info"): typeof ClockInfo; declare function require(moduleName: "Layout"): typeof Layout.Layout; declare function require(moduleName: "power_usage"): PowerUsageModule; +declare function require(moduleName: "exstats"): typeof ExStats; +declare function require(moduleName: "time_utils"): typeof TimeUtils; +declare function require(moduleName: "textinput"): typeof TextInput; diff --git a/typescript/types/sched.d.ts b/typescript/types/sched.d.ts index c2cd23d35..1bcffb632 100644 --- a/typescript/types/sched.d.ts +++ b/typescript/types/sched.d.ts @@ -77,6 +77,8 @@ declare module Sched { } ); + type Timer = Sched & { timer: Milliseconds }; + type Repeat = { num: number, interval: "day" | "week" | "month" | "year", @@ -103,6 +105,8 @@ declare module Sched { function setAlarm(id: string, alarm?: NewSched): void; + function resetTimer(alarm: Timer, time?: Date): void; + function getTimeToAlarm(alarm: Sched | undefined | null, time?: Date): number | undefined; function getTimeToAlarm(alarm?: undefined | null, time?: Date): undefined; diff --git a/typescript/types/textinput.d.ts b/typescript/types/textinput.d.ts new file mode 100644 index 000000000..1177d8c9f --- /dev/null +++ b/typescript/types/textinput.d.ts @@ -0,0 +1,3 @@ +declare module TextInput { + function input(options: { text: string }): Promise; +} diff --git a/typescript/types/time_utils.d.ts b/typescript/types/time_utils.d.ts new file mode 100644 index 000000000..c176ffac6 --- /dev/null +++ b/typescript/types/time_utils.d.ts @@ -0,0 +1,18 @@ +declare module TimeUtils { + type TimeObj = { + d: number, + h: number, + m: number, + s: number, + }; + + function encodeTime(time: TimeObj): number; + + function decodeTime(millis: number): TimeObj; + + function formatTime(value: number | TimeObj): string + + function formatDuration(value: number | TimeObj, compact?: boolean): string; + + function getCurrentTimeMillis(): number; +} diff --git a/typescript/types/utility.d.ts b/typescript/types/utility.d.ts new file mode 100644 index 000000000..9deabd118 --- /dev/null +++ b/typescript/types/utility.d.ts @@ -0,0 +1,5 @@ +type Omit = Pick>; + +type Pick = { + [P in K]: T[P]; +};