diff --git a/.gitignore b/.gitignore index 996ba6a..190f101 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .idea output dist +private packages/**/lib packages/**/dist node_modules @@ -14,4 +15,5 @@ packages/**/coverage .coverage client/config.json server/config.mjs -server/config.json \ No newline at end of file +server/config.json +server/cert diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d8edc..965d088 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +### 1.0.2 ++ [x] Added cpu threads load chart ++ [x] Re-disposition RAM and CPU panels content ++ [x] Added https server creation. Use server conf option `https` to set paths to cert and key ++ [x] Added dark/light modes ++ [x] Visual improvements + ### 1.0.1 + [x] Added php proxy server + [x] Added uptime values from sidecar (parsed from http://uptime.minaprotocol.com) diff --git a/HOWTO.EN.md b/HOWTO.EN.md index 121bfd3..d74a3f0 100644 --- a/HOWTO.EN.md +++ b/HOWTO.EN.md @@ -198,6 +198,7 @@ Copy the files from the `server` folder of the repository to a convenient place Next, we have two options: 1) We open a port on the Mina server to access GraphQL for the Monitor server side 2) We forward the GraphQL port using SSH from the Mina server to the Monitor server +3) We forward the Monitor Server port using SSH from the Mina server to your local computer **Option 1** Open the GraphQL port (flag `-insecure-rest-server` when starting Mina). @@ -252,4 +253,32 @@ In the client's configuration file, we write: } ``` -Compile and run with any of the options listed above. \ No newline at end of file +Compile and run with any of the options listed above. + +**Option 3** +Let you start the monitor server on a computer with an ip address of `1.1.1.1` and port` 8000`. +The server config states + +```json +{ +"host": "1.1.1.1:8000" +} +``` + +We forward the Monitor Server with the command +```shell +ssh -L 8000: 1.1.1.1: 8000 your_user_name@1.1.1.1 +``` + +After executing this command, the server side of the monitor will work locally on port 8000. +Now you can specify in the settings: + +For client: + +```json +{ + "hosts": { + "node1": "localhost: 8000" + } +} +``` \ No newline at end of file diff --git a/HOWTO.RU.md b/HOWTO.RU.md index 8606585..8244015 100644 --- a/HOWTO.RU.md +++ b/HOWTO.RU.md @@ -192,6 +192,7 @@ npm run serve_x Далее у нас два варианта: 1) Мы открываем порт на сервере Mina для доступа к GraphQL для серверной части Монитора 2) Мы пробрасываем порт GraphQL средствами SSH от сервера Mina на сервер Монитора +3) Мы пробрасываем порт Monitor Server средствами SSH от сервера Mina на ваш локальный компьютер **Вариант 1** Открываем порт GraphQL (флаг `-insecure-rest-server` при запуске Mina). @@ -238,4 +239,31 @@ node monitor.mjs } ``` -Компилируем и запускаем любым из вариантов. \ No newline at end of file +Компилируем и запускаем любым из вариантов. + +**Вариант 3** +Пусть вы запустили сервер монитора на компьютере с ip адресом `1.1.1.1` и портом `8000`. +В конфигурации сервера указано + +```json +{ + "host": "1.1.1.1:8000" +} +``` + +Пробрасываем Monitor Server командой +```shell +ssh -L 8000:1.1.1.1:8000 user_name@1.1.1.1 +``` +После выполнения этой команды у вас локально на порту 8000 будет работать серверная часть монитора. +Теперь вы можете указать в настройках: + +Для Клиента: + +```json +{ + "hosts": { + "node1": "localhost:8000" + } +} +``` diff --git a/README.RU.md b/README.RU.md index 61f8449..e10ffe9 100644 --- a/README.RU.md +++ b/README.RU.md @@ -18,7 +18,7 @@ - клиент - JavaScript, HTML, CSS ### Использованы компоненты -+ [x] [Mina Node Monitor]() by [Serhii Pimenov](https://github.com/olton) ++ [x] [Mina Node Monitor](https://github.com/olton/mina-node-monitor) by [Serhii Pimenov](https://github.com/olton) + [x] [Metro 4](https://github.com/olton/Metro-UI-CSS) by [Serhii Pimenov](https://github.com/olton) + [x] [ChartJS](https://github.com/olton/chartjs) by [Serhii Pimenov](https://github.com/olton) + [x] [SystemInformation](https://github.com/sebhildebrandt/systeminformation) by [Sebastian Hildebrandt](https://github.com/sebhildebrandt) @@ -53,7 +53,7 @@ npm i ```json { "hosts": { - "node1": "192.168.1.2:3085" + "node1": "xxx.xxx.xxx.xxx:xxxx" }, "useHost": "node1", "intervals": { @@ -66,13 +66,14 @@ npm i "cpu": 2000, "uptime": 600000 }, + "theme": "auto", "useProxy": false, "proxy": "https://server/proxy.php" } ``` Секция `hosts` содержит информацию о серверах, на которых установлена серверная часть Монитора. -Каждый адрес должен определять открытый внешний сетевой интерфейс и его порт. +Каждый адрес должен определять открытый внешний сетевой интерфейс/ip и его порт. Параметр `useHost` определяет какой сервер из списка в секции `hosts` будет использоваться. Параметр `showIp` определяет показывать или нет IP адрес в блоке **HOSTNAME** (иногда не стоит светить IP адрес). @@ -90,6 +91,7 @@ npm i - `mem` - интервал обновления информации о загрузке оперативной памяти сервера - `cpu` - интервал обновления информации о загрузке CPU(s) - `uptime` - interval for retrieve information about sidecar calculating server uptime +- `theme` - default `auto` (dark\light mode dependence from os), value can be `dark`, `light` Section for using proxy (читайте про прокси-сервер ниже) - `useProxy` - use or not proxy server @@ -110,7 +112,11 @@ Section for using proxy (читайте про прокси-сервер ниж "restartAfter": 30, "restartCmd": "systemctl --user restart mina", "host": "192.168.1.2:3085", - "graphql": "localhost:3085" + "graphql": "localhost:3085", + "https": { + "key": "", + "cert": "" + } } ``` @@ -128,6 +134,7 @@ where - `canRestartNode` - Если значение этого ключа **true**, сервер может перезапустить узел мины - `restartAfter` - значение в минутах, если узел синхронизирован, но при этом отстает по высоте блоков от Mina Explorer в течении указанного времени, узел будет перезапущен - `restartCmd` - Команда для перезапуска узла Mina +- `https` - contains paths to cert and key to create https server ### Сборка клиентского приложения diff --git a/README.UA.md b/README.UA.md index 73dd52d..cfaa21a 100644 --- a/README.UA.md +++ b/README.UA.md @@ -18,7 +18,7 @@ - кліент - JavaScript, HTML, CSS ### Використано компоненти -+ [x] [Mina Node Monitor]() by [Serhii Pimenov](https://github.com/olton) ++ [x] [Mina Node Monitor](https://github.com/olton/mina-node-monitor) by [Serhii Pimenov](https://github.com/olton) + [x] [Metro 4](https://github.com/olton/Metro-UI-CSS) by [Serhii Pimenov](https://github.com/olton) + [x] [ChartJS](https://github.com/olton/chartjs) by [Serhii Pimenov](https://github.com/olton) + [x] [SystemInformation](https://github.com/sebhildebrandt/systeminformation) by [Sebastian Hildebrandt](https://github.com/sebhildebrandt) @@ -54,7 +54,7 @@ npm i ```json { "hosts": { - "node1": "192.168.1.2:3085" + "node1": "xxx.xxx.xxx.xxx:xxxxx" }, "useHost": "node1", "intervals": { @@ -67,13 +67,14 @@ npm i "cpu": 2000, "uptime": 600000 }, + "theme": "auto", "useProxy": false, "proxy": "https://server/proxy.php" } ``` Секція `hosts` містить інформацію про сервери, на яких встановлена серверна частина Монітору. -Кожна адреса повинна визначати мережевий інтерфейс та його порт. +Кожна адреса повинна визначати мережевий інтерфейс/ip та його порт. Параметр `useHost` визначає який сервер зі списку в секції` hosts` буде використовуватись. Параметр `showIp` визначає показувати чи ні IP адресу в блоці ** Addresses ** (іноді не варто світити IP адресу). @@ -91,6 +92,7 @@ npm i - `mem` - інтервал оновлення інформації про завантаження оперативної пам'яті сервера - `cpu` - інтервал оновлення інформації про завантаження CPU (s) - `uptime` - interval for retrieve information about sidecar calculating server uptime +- `theme` - default `auto` (dark\light mode dependence from os), value can be `dark`, `light` Section for using proxy (інформацію про проксі-сервер викладено нижче) - `useProxy` - use or not proxy server @@ -113,7 +115,11 @@ Section for using proxy (інформацію про проксі-сервер "restartAfter": 30, "restartCmd": "systemctl --user restart mina", "host": "192.168.1.2:3085", - "graphql": "localhost:3085" + "graphql": "localhost:3085", + "https": { + "key": "", + "cert": "" + } } ``` @@ -131,6 +137,7 @@ Section for using proxy (інформацію про проксі-сервер - `canRestartNode` - Якщо значення цього ключа **true**, сервер може перезапустити вузол міни - `restartAfter` - значення в хвилинах, якщо вузол синхронізований, але при цьому відстає по висоті блоків від Mina Explorer протягом зазначеного часу, вузол буде перезапущений - `restartCmd` - Команда для перезапуска вузла Mina +- `https` - contains paths to cert and key to create https server ### Збірка клієнтського додатка diff --git a/README.md b/README.md index d017ca6..4c4fe5a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

# Mina Node Monitor -**Mina Node Monitor** is an extended graphical version of the` mina client status` command with additional indicators. +**Mina Monitor** is an extended graphical version of the` mina client status` command with additional indicators. This is a `client-server` application for visual monitoring of the validator node and alerts when the node has a problem. ## Key Features @@ -18,7 +18,7 @@ This is a `client-server` application for visual monitoring of the validator nod - client - JavaScript, HTML, CSS ### Credits -+ [x] [Mina Node Monitor]() by [Serhii Pimenov](https://github.com/olton) ++ [x] [Mina Monitor](https://github.com/olton/mina-node-monitor) by [Serhii Pimenov](https://github.com/olton) + [x] [Metro 4](https://github.com/olton/Metro-UI-CSS) by [Serhii Pimenov](https://github.com/olton) + [x] [ChartJS](https://github.com/olton/chartjs) by [Serhii Pimenov](https://github.com/olton) + [x] [SystemInformation](https://github.com/sebhildebrandt/systeminformation) by [Sebastian Hildebrandt](https://github.com/sebhildebrandt) @@ -52,7 +52,7 @@ Create file `config.json` in a `client` folder. Example below demonstrate witch ```json { "hosts": { - "node1": "192.168.1.2:3085" + "node1": "xxx.xxx.xxx.xxx:xxxx" }, "useHost": "node1", "intervals": { @@ -65,13 +65,14 @@ Create file `config.json` in a `client` folder. Example below demonstrate witch "cpu": 2000, "uptime": 600000 }, + "theme": "auto", "useProxy": false, - "proxy": "https://server/proxy.php" + "proxy": "https://server/proxy.php", } ``` Section `hosts` contain information about your servers addresses. -Each address must be an opened network interface on the mina node server. +Each address must be an opened network interface/ip and port on the mina node server. Parameter `useHost` defines host where client retrieves data. Section `intervals` contain information about intervals (in milliseconds), with which data will be retrieve. @@ -84,11 +85,14 @@ Section `intervals` contain information about intervals (in milliseconds), with - `mem` - interval for retrieve information about server memory - `cpu` - interval for retrieve information about server CPU(s) - `uptime` - interval for retrieve information about sidecar calculating server uptime +- `theme` - default `auto` (dark\light mode dependence from os), value can be `dark`, `light` Section for using proxy (read about proxy below) - `useProxy` - use or not proxy server - `proxy` - proxy server address + + #### Config file for server Create file `config.json` in a `server` folder. Example below demonstrate witch data you must create. ```json @@ -103,8 +107,12 @@ Create file `config.json` in a `server` folder. Example below demonstrate witch "canRestartNode": true, "restartAfter": 30, "restartCmd": "systemctl --user restart mina", - "host": "192.168.1.2:3085", - "graphql": "localhost:3085" + "host": "xxx.xxx.xxx.xxx:xxxx", + "graphql": "xxx.xxx.xxx.xxx:xxxx", + "https": { + "key": "", + "cert": "" + } } ``` @@ -118,10 +126,11 @@ where - `alertInterval` - the interval with which the server will check node state and send alerts in telegrams - `blockDiff` - difference in blocks with MinaExplorer at which an alert will be sent - `host` - IP and PORT on which the server will run -- `graphql` - Mina node GraphQL address +- `graphql` - Mina node GraphQL address (by default `localhost:3085`) - `canRestartNode` - if true, server can restart mina node - `restartAfter` - value in minutes, if node synced and height is lower from Mina Explorer within the specified time, node will restart after this interval - `restartCmd` - command for restart mina node +- `https` - contains paths to cert and key to create https server ### Build web client To build client use command: diff --git a/client/css/index.css b/client/css/index.css index 0a7362d..c47eff1 100644 --- a/client/css/index.css +++ b/client/css/index.css @@ -3,22 +3,46 @@ --text-color: #adbaa9; --border-color: #444c56; --panel-background: #22272e; + --accent-color: #fff; --alert-color: #ea0b0b; --warning-color: #ff8330; - --chart-stroke-color: #7dc37b; - --chart-fill-color: rgba(125, 195, 123, 0.3); + --info-color1: #7dc37b; + --info-color2: #1ba1e2; + --info-color3: #ffdb10; + --fill-color: rgba(125, 195, 123, 0.3); } .fg-normal { - color: var(--text-color) !important; + color: var(--text-color); +} +.fg-accent { + color: var(--accent-color); +} +.fg-warning { + color: var(--warning-color); +} +.fg-alert { + color: var(--alert-color); } .fg-stroke { - color: var(--chart-stroke-color); + color: var(--info-color1); +} +.fg-fill { + color: var(--fill-color); +} +.fg-info1 { + color: var(--info-color1); +} +.fg-info2 { + color: var(--info-color2); +} +.fg-info3 { + color: var(--info-color3); } .bd-system { - border-color: var(--border-color) !important; + border-color: var(--border-color); } .bg-system { - background: var(--body-background) !important; + background: var(--body-background); } body { background: var(--body-background); @@ -31,28 +55,30 @@ body { height: 36px; } hr { - background: var(--border-color) !important; + background: var(--border-color); } #max-block { - color: #fff000; + color: var(--info-color3); } #max-unvalidated { - color: #ff0000; + color: var(--alert-color); } #explorer-height { - color: #0b98da; + color: var(--info-color2); } .panel { height: 100%; background: var(--panel-background); color: var(--text-color); - border: 1px solid var(--border-color); + border-color: var(--border-color) !important; + border: 1px solid; padding: 0 10px; } .panel .panel-title { - border-bottom: 1px solid var(--border-color); + border-bottom: 1px solid; + border-color: var(--border-color); text-align: center; - color: darkorange; + color: var(--warning-color); font-size: 12px; font-weight: bold; } @@ -68,16 +94,16 @@ hr { .panel.alert, .panel.warning { background: var(--alert-color); - color: #fff !important; + color: var(--accent-color); } .panel.alert .panel-title, .panel.warning .panel-title { border: none; - color: #fff !important; + color: var(--accent-color); } .panel.alert #node-status, .panel.warning #node-status { - color: #fff !important; + color: var(--accent-color); } .panel.alert #max-block, .panel.warning #max-block, @@ -85,7 +111,7 @@ hr { .panel.warning #max-unvalidated, .panel.alert #explorer-height, .panel.warning #explorer-height { - color: #fff; + color: var(--accent-color); } .panel.warning { background: var(--warning-color); @@ -116,16 +142,18 @@ hr { margin-top: 8px; } .info-table tr:not(:last-child) { - border-bottom: 1px solid var(--border-color); + border-bottom: 1px solid; + border-color: var(--border-color); } .info-table tbody td { padding: 4px 0; } .info-table tbody td:nth-child(2) { - color: #fff; + color: var(--accent-color); } .progress { - border: 1px solid var(--border-color); + border: 1px solid; + border-color: var(--border-color); overflow: visible; } .progress .value { @@ -133,26 +161,153 @@ hr { transform: none; } .progress-back { - background: var(--body-background); + background: var(--alert-color); } .progress-bar { - background: var(--chart-stroke-color) !important; + background: var(--info-color1) !important; } #ip-address, #bind-ip, #p2p-port, #client-port { font-size: 18px; - color: #fff; + color: var(--accent-color); font-weight: 500; line-height: 1.2; } #sidecar-position, #sidecar-uptime, #sidecar-score { - color: #fff000; + color: var(--info-color3); } canvas { max-width: 100%; } +:root { + --body-background-light: #f6f8fa; + --text-color-light: #24292e; + --border-color-light: #e1e4e8; + --panel-background-light: #ffffff; + --accent-color-light: #444c56; + --alert-color-light: #ea0b0b; + --warning-color-light: #ff8330; + --info-color1-light: #7dc37b; + --info-color2-light: #1ba1e2; + --info-color3-light: #ffe725; + --fill-color-light: rgba(125, 195, 123, 0.3); +} +body.light-mode { + background: var(--body-background-light); + color: var(--text-color-light); +} +body.light-mode .fg-normal { + color: var(--text-color-light); +} +body.light-mode .fg-accent { + color: var(--accent-color-light); +} +body.light-mode .fg-warning { + color: var(--warning-color-light); +} +body.light-mode .fg-alert { + color: var(--alert-color-light); +} +body.light-mode .fg-stroke { + color: var(--info-color1-light); +} +body.light-mode .fg-fill { + color: var(--fill-color-light); +} +body.light-mode .fg-info1 { + color: var(--info-color1-light); +} +body.light-mode .fg-info2 { + color: var(--info-color2-light); +} +body.light-mode .fg-info3 { + color: var(--accent-color-light); +} +body.light-mode .bd-system { + border-color: var(--border-color-light); +} +body.light-mode .bg-system { + background: var(--body-background-light); +} +body.light-mode hr { + background: var(--border-color-light); +} +body.light-mode #max-block { + color: var(--accent-color-light); +} +body.light-mode #max-unvalidated { + color: var(--alert-color-light); +} +body.light-mode #explorer-height { + color: var(--info-color2-light); +} +body.light-mode .panel { + background: var(--panel-background-light); + color: var(--text-color-light); + border-color: var(--border-color-light) !important; +} +body.light-mode .panel .panel-title { + border-color: var(--border-color-light); + color: var(--accent-color-light); +} +body.light-mode .panel.alert, +body.light-mode .panel.warning { + background: var(--alert-color-light); + color: #fff; +} +body.light-mode .panel.alert .panel-title, +body.light-mode .panel.warning .panel-title { + color: #fff; +} +body.light-mode .panel.alert #node-status, +body.light-mode .panel.warning #node-status { + color: #fff; +} +body.light-mode .panel.alert #max-block, +body.light-mode .panel.warning #max-block, +body.light-mode .panel.alert #max-unvalidated, +body.light-mode .panel.warning #max-unvalidated, +body.light-mode .panel.alert #explorer-height, +body.light-mode .panel.warning #explorer-height, +body.light-mode .panel.alert .fg-stroke, +body.light-mode .panel.warning .fg-stroke, +body.light-mode .panel.alert .fg-normal, +body.light-mode .panel.warning .fg-normal, +body.light-mode .panel.alert .fg-accent, +body.light-mode .panel.warning .fg-accent { + color: #fff; +} +body.light-mode .panel.warning { + background: var(--warning-color-light); +} +body.light-mode .info-table tr:not(:last-child) { + border-color: var(--border-color-light); +} +body.light-mode .info-table tbody td:nth-child(2) { + color: var(--accent-color-light); +} +body.light-mode .progress { + border-color: var(--panel-background-light); +} +body.light-mode .progress-back { + background: var(--alert-color-light); +} +body.light-mode .progress-bar { + background: var(--info-color1-light); +} +body.light-mode #ip-address, +body.light-mode #bind-ip, +body.light-mode #p2p-port, +body.light-mode #client-port { + color: var(--accent-color-light); +} +body.light-mode #sidecar-position, +body.light-mode #sidecar-uptime, +body.light-mode #sidecar-score { + color: var(--accent-color-light); +} /*# sourceMappingURL=index.css.map */ \ No newline at end of file diff --git a/client/css/index.css.map b/client/css/index.css.map index 8f45373..e7fff36 100644 --- a/client/css/index.css.map +++ b/client/css/index.css.map @@ -1 +1 @@ -{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACE,0BAAA;EACA,qBAAA;EACA,uBAAA;EACA,2BAAA;EACA,sBAAA;EACA,wBAAA;EACA,6BAAA;EACA,4CAAA;;AAGF;EACE,OAAO,iBAAP;;AAGF;EACE,OAAO,yBAAP;;AAGF;EACE,cAAc,mBAAd;;AAGF;EACE,YAAY,sBAAZ;;AAGF;EACE,YAAY,sBAAZ;EACA,OAAO,iBAAP;;AAGF;EACE,sBAAA;;AAGF;EACE,YAAA;;AAGF;EACE,YAAY,mBAAZ;;AAGF;EAAY,cAAA;;AACZ;EAAkB,cAAA;;AAClB;EAAkB,cAAA;;AAElB;EACE,YAAA;EACA,YAAY,uBAAZ;EACA,OAAO,iBAAP;EACA,kBAAkB,mBAAlB;EACA,eAAA;;AALF,MAOE;EACE,yBAAyB,mBAAzB;EACA,kBAAA;EACA,iBAAA;EACA,eAAA;EACA,iBAAA;;AAZJ,MAeE;EACE,YAAA;EACA,aAAA;EACA,uBAAA;EACA,mBAAA;;AAEA,MANF,eAMI;EACA,WAAA;;AAIJ,MAAC;AAAQ,MAAC;EACR,YAAY,kBAAZ;EACA,WAAA;;AAFF,MAAC,MAIC;AAJO,MAAC,QAIR;EACE,YAAA;EACA,WAAA;;AANJ,MAAC,MAQC;AARO,MAAC,QAQR;EACE,WAAA;;AATJ,MAAC,MAWC;AAXO,MAAC,QAWR;AAXF,MAAC,MAWa;AAXL,MAAC,QAWI;AAXd,MAAC,MAW+B;AAXvB,MAAC,QAWsB;EAC5B,WAAA;;AAGJ,MAAC;EACC,YAAY,oBAAZ;;AAIJ;AAAW;AAAc;AAAe;AAAc;AAAe;AAAc;AAAgB;EACjG,eAAA;EACA,iBAAA;EACA,cAAA;;AAGF;EACE,mBAAA;;AAGF;EACE,eAAA;;AAGF;AAAsB;EACpB,gBAAA;;AAGF;EACE,eAAA;;AADF,WAEE,GAAE,IAAI;EACJ,yBAAyB,mBAAzB;;AAHJ,WAME,MAAM;EACJ,cAAA;;AACA,WAFF,MAAM,GAEH,UAAU;EACT,WAAA;;AAKN;EACE,kBAAkB,mBAAlB;EACA,iBAAA;;AAFF,SAIE;EACE,UAAA;EACA,eAAA;;AAGJ;EACE,YAAY,sBAAZ;;AAEF;EACE,YAAY,yBAAZ;;AAGF;AAAa;AAAU;AAAW;EAChC,eAAA;EACA,WAAA;EACA,gBAAA;EACA,gBAAA;;AAGF;AAAmB;AAAiB;EAClC,cAAA;;AAGF;EACE,eAAA","file":"index.css"} \ No newline at end of file +{"version":3,"sources":["index.less","light.less"],"names":[],"mappings":"AAAA;EACE,0BAAA;EACA,qBAAA;EACA,uBAAA;EACA,2BAAA;EACA,oBAAA;EACA,sBAAA;EACA,wBAAA;EACA,sBAAA;EACA,sBAAA;EACA,sBAAA;EACA,sCAAA;;AAGF;EACE,OAAO,iBAAP;;AAGF;EACE,OAAO,mBAAP;;AAGF;EACE,OAAO,oBAAP;;AAGF;EACE,OAAO,kBAAP;;AAGF;EACE,OAAO,kBAAP;;AAGF;EACE,OAAO,iBAAP;;AAGF;EACE,OAAO,kBAAP;;AAGF;EACE,OAAO,kBAAP;;AAGF;EACE,OAAO,kBAAP;;AAIF;EACE,cAAc,mBAAd;;AAGF;EACE,YAAY,sBAAZ;;AAGF;EACE,YAAY,sBAAZ;EACA,OAAO,iBAAP;;AAGF;EACE,sBAAA;;AAGF;EACE,YAAA;;AAGF;EACE,YAAY,mBAAZ;;AAGF;EAAY,OAAO,kBAAP;;AACZ;EAAkB,OAAO,kBAAP;;AAClB;EAAkB,OAAO,kBAAP;;AAElB;EACE,YAAA;EACA,YAAY,uBAAZ;EACA,OAAO,iBAAP;EACA,cAAc,mBAAd;EACA,iBAAA;EACA,eAAA;;AANF,MAQE;EACE,wBAAA;EACA,cAAc,mBAAd;EACA,kBAAA;EACA,OAAO,oBAAP;EACA,eAAA;EACA,iBAAA;;AAdJ,MAiBE;EACE,YAAA;EACA,aAAA;EACA,uBAAA;EACA,mBAAA;;AAEA,MANF,eAMI;EACA,WAAA;;AAIJ,MAAC;AAAQ,MAAC;EACR,YAAY,kBAAZ;EACA,OAAO,mBAAP;;AAFF,MAAC,MAIC;AAJO,MAAC,QAIR;EACE,YAAA;EACA,OAAO,mBAAP;;AANJ,MAAC,MAQC;AARO,MAAC,QAQR;EACE,OAAO,mBAAP;;AATJ,MAAC,MAWC;AAXO,MAAC,QAWR;AAXF,MAAC,MAWa;AAXL,MAAC,QAWI;AAXd,MAAC,MAW+B;AAXvB,MAAC,QAWsB;EAC5B,OAAO,mBAAP;;AAGJ,MAAC;EACC,YAAY,oBAAZ;;AAIJ;AAAW;AAAc;AAAe;AAAc;AAAe;AAAc;AAAgB;EACjG,eAAA;EACA,iBAAA;EACA,cAAA;;AAGF;EACE,mBAAA;;AAGF;EACE,eAAA;;AAGF;AAAsB;EACpB,gBAAA;;AAGF;EACE,eAAA;;AADF,WAEE,GAAE,IAAI;EACJ,wBAAA;EACA,cAAc,mBAAd;;AAJJ,WAOE,MAAM;EACJ,cAAA;;AACA,WAFF,MAAM,GAEH,UAAU;EACT,OAAO,mBAAP;;AAKN;EACE,iBAAA;EACA,cAAc,mBAAd;EACA,iBAAA;;AAHF,SAKE;EACE,UAAA;EACA,eAAA;;AAGJ;EACE,YAAY,kBAAZ;;AAEF;EACE,YAAY,kBAAZ;;AAGF;AAAa;AAAU;AAAW;EAChC,eAAA;EACA,OAAO,mBAAP;EACA,gBAAA;EACA,gBAAA;;AAGF;AAAmB;AAAiB;EAClC,OAAO,kBAAP;;AAGF;EACE,eAAA;;AC9LF;EACE,gCAAA;EACA,2BAAA;EACA,6BAAA;EACA,iCAAA;EACA,6BAAA;EACA,4BAAA;EACA,8BAAA;EACA,4BAAA;EACA,4BAAA;EACA,4BAAA;EACA,4CAAA;;AAGF,IAAI;EACF,YAAY,4BAAZ;EACA,OAAO,uBAAP;;AAFF,IAAI,WAIF;EACE,OAAO,uBAAP;;AALJ,IAAI,WAQF;EACE,OAAO,yBAAP;;AATJ,IAAI,WAYF;EACE,OAAO,0BAAP;;AAbJ,IAAI,WAgBF;EACE,OAAO,wBAAP;;AAjBJ,IAAI,WAoBF;EACE,OAAO,wBAAP;;AArBJ,IAAI,WAwBF;EACE,OAAO,uBAAP;;AAzBJ,IAAI,WA4BF;EACE,OAAO,wBAAP;;AA7BJ,IAAI,WAgCF;EACE,OAAO,wBAAP;;AAjCJ,IAAI,WAoCF;EACE,OAAO,yBAAP;;AArCJ,IAAI,WAyCF;EACE,cAAc,yBAAd;;AA1CJ,IAAI,WA6CF;EACE,YAAY,4BAAZ;;AA9CJ,IAAI,WAiDF;EACE,YAAY,yBAAZ;;AAlDJ,IAAI,WAqDF;EAAY,OAAO,yBAAP;;AArDd,IAAI,WAsDF;EAAkB,OAAO,wBAAP;;AAtDpB,IAAI,WAuDF;EAAkB,OAAO,wBAAP;;AAvDpB,IAAI,WAyDF;EACE,YAAY,6BAAZ;EACA,OAAO,uBAAP;EACA,cAAc,yBAAd;;AA5DJ,IAAI,WAyDF,OAKE;EACE,cAAc,yBAAd;EACA,OAAO,yBAAP;;AAGF,IAnEA,WAyDF,OAUG;AAAQ,IAnET,WAyDF,OAUY;EACR,YAAY,wBAAZ;EACA,WAAA;;AAFF,IAnEA,WAyDF,OAUG,MAIC;AAJO,IAnET,WAyDF,OAUY,QAIR;EACE,WAAA;;AALJ,IAnEA,WAyDF,OAUG,MAOC;AAPO,IAnET,WAyDF,OAUY,QAOR;EACE,WAAA;;AARJ,IAnEA,WAyDF,OAUG,MAUC;AAVO,IAnET,WAyDF,OAUY,QAUR;AAVF,IAnEA,WAyDF,OAUG,MAUa;AAVL,IAnET,WAyDF,OAUY,QAUI;AAVd,IAnEA,WAyDF,OAUG,MAU+B;AAVvB,IAnET,WAyDF,OAUY,QAUsB;AAVhC,IAnEA,WAyDF,OAUG,MAUiD;AAVzC,IAnET,WAyDF,OAUY,QAUwC;AAVlD,IAnEA,WAyDF,OAUG,MAU6D;AAVrD,IAnET,WAyDF,OAUY,QAUoD;AAV9D,IAnEA,WAyDF,OAUG,MAUyE;AAVjE,IAnET,WAyDF,OAUY,QAUgE;EACtE,WAAA;;AAGJ,IAjFA,WAyDF,OAwBG;EACC,YAAY,0BAAZ;;AAlFN,IAAI,WAsFF,YACE,GAAE,IAAI;EACJ,cAAc,yBAAd;;AAIA,IA5FF,WAsFF,YAKE,MAAM,GACH,UAAU;EACT,OAAO,yBAAP;;AA7FR,IAAI,WAkGF;EACE,cAAc,6BAAd;;AAnGJ,IAAI,WAqGF;EACE,YAAY,wBAAZ;;AAtGJ,IAAI,WAwGF;EACE,YAAY,wBAAZ;;AAzGJ,IAAI,WA4GF;AA5GF,IAAI,WA4GW;AA5Gf,IAAI,WA4GqB;AA5GzB,IAAI,WA4GgC;EAChC,OAAO,yBAAP;;AA7GJ,IAAI,WAgHF;AAhHF,IAAI,WAgHiB;AAhHrB,IAAI,WAgHkC;EAClC,OAAO,yBAAP","file":"index.css"} \ No newline at end of file diff --git a/client/css/index.less b/client/css/index.less index 3bee008..e213cb8 100644 --- a/client/css/index.less +++ b/client/css/index.less @@ -3,26 +3,58 @@ --text-color: #adbaa9; --border-color: #444c56; --panel-background: #22272e; + --accent-color: #fff; --alert-color: #ea0b0b; --warning-color: #ff8330; - --chart-stroke-color: #7dc37b; - --chart-fill-color: rgba(125, 195, 123, .3); + --info-color1: #7dc37b; + --info-color2: #1ba1e2; + --info-color3: #ffdb10; + --fill-color: rgba(125, 195, 123, .3); } .fg-normal { - color: var(--text-color)!important; + color: var(--text-color); +} + +.fg-accent { + color: var(--accent-color); +} + +.fg-warning { + color: var(--warning-color); +} + +.fg-alert { + color: var(--alert-color); } .fg-stroke { - color: var(--chart-stroke-color); + color: var(--info-color1); +} + +.fg-fill { + color: var(--fill-color); +} + +.fg-info1 { + color: var(--info-color1); } +.fg-info2 { + color: var(--info-color2); +} + +.fg-info3 { + color: var(--info-color3); +} + + .bd-system { - border-color: var(--border-color)!important; + border-color: var(--border-color); } .bg-system { - background: var(--body-background)!important; + background: var(--body-background); } body { @@ -39,24 +71,26 @@ body { } hr { - background: var(--border-color)!important; + background: var(--border-color); } -#max-block {color: #fff000;} -#max-unvalidated {color: #ff0000;} -#explorer-height {color: #0b98da;} +#max-block {color: var(--info-color3);} +#max-unvalidated {color: var(--alert-color);} +#explorer-height {color: var(--info-color2);} .panel { height: 100%; background: var(--panel-background); color: var(--text-color); - border: 1px solid var(--border-color); + border-color: var(--border-color)!important; + border: 1px solid; padding: 0 10px; .panel-title { - border-bottom: 1px solid var(--border-color); + border-bottom: 1px solid; + border-color: var(--border-color); text-align: center; - color: darkorange; + color: var(--warning-color); font-size: 12px; font-weight: bold; } @@ -74,17 +108,17 @@ hr { &.alert, &.warning{ background: var(--alert-color); - color: #fff!important; + color: var(--accent-color); .panel-title { border: none; - color: #fff!important; + color: var(--accent-color); } #node-status { - color: #fff!important; + color: var(--accent-color); } #max-block, #max-unvalidated, #explorer-height { - color: #fff; + color: var(--accent-color); } } &.warning{ @@ -113,19 +147,21 @@ hr { .info-table { margin-top: 8px; tr:not(:last-child) { - border-bottom: 1px solid var(--border-color) + border-bottom: 1px solid; + border-color: var(--border-color); } tbody td { padding: 4px 0; &:nth-child(2) { - color: #fff; + color: var(--accent-color); } } } .progress { - border: 1px solid var(--border-color); + border: 1px solid; + border-color: var(--border-color); overflow: visible; .value { @@ -134,23 +170,25 @@ hr { } } .progress-back { - background: var(--body-background); + background: var(--alert-color); } .progress-bar { - background: var(--chart-stroke-color)!important; + background: var(--info-color1)!important; } #ip-address, #bind-ip, #p2p-port, #client-port { font-size: 18px; - color: #fff; + color: var(--accent-color); font-weight: 500; line-height: 1.2; } #sidecar-position, #sidecar-uptime, #sidecar-score { - color: #fff000; + color: var(--info-color3); } canvas { max-width: 100%; -} \ No newline at end of file +} + +@import "light"; \ No newline at end of file diff --git a/client/css/light.css b/client/css/light.css new file mode 100644 index 0000000..70ab911 --- /dev/null +++ b/client/css/light.css @@ -0,0 +1,128 @@ +:root { + --body-background-light: #f6f8fa; + --text-color-light: #24292e; + --border-color-light: #e1e4e8; + --panel-background-light: #ffffff; + --accent-color-light: #444c56; + --alert-color-light: #ea0b0b; + --warning-color-light: #ff8330; + --info-color1-light: #7dc37b; + --info-color2-light: #1ba1e2; + --info-color3-light: #ffe725; + --fill-color-light: rgba(125, 195, 123, 0.3); +} +body.light-mode { + background: var(--body-background-light); + color: var(--text-color-light); +} +body.light-mode .fg-normal { + color: var(--text-color-light); +} +body.light-mode .fg-accent { + color: var(--accent-color-light); +} +body.light-mode .fg-warning { + color: var(--warning-color-light); +} +body.light-mode .fg-alert { + color: var(--alert-color-light); +} +body.light-mode .fg-stroke { + color: var(--info-color1-light); +} +body.light-mode .fg-fill { + color: var(--fill-color-light); +} +body.light-mode .fg-info1 { + color: var(--info-color1-light); +} +body.light-mode .fg-info2 { + color: var(--info-color2-light); +} +body.light-mode .fg-info3 { + color: var(--accent-color-light); +} +body.light-mode .bd-system { + border-color: var(--border-color-light); +} +body.light-mode .bg-system { + background: var(--body-background-light); +} +body.light-mode hr { + background: var(--border-color-light); +} +body.light-mode #max-block { + color: var(--accent-color-light); +} +body.light-mode #max-unvalidated { + color: var(--alert-color-light); +} +body.light-mode #explorer-height { + color: var(--info-color2-light); +} +body.light-mode .panel { + background: var(--panel-background-light); + color: var(--text-color-light); + border-color: var(--border-color-light) !important; +} +body.light-mode .panel .panel-title { + border-color: var(--border-color-light); + color: var(--accent-color-light); +} +body.light-mode .panel.alert, +body.light-mode .panel.warning { + background: var(--alert-color-light); + color: #fff; +} +body.light-mode .panel.alert .panel-title, +body.light-mode .panel.warning .panel-title { + color: #fff; +} +body.light-mode .panel.alert #node-status, +body.light-mode .panel.warning #node-status { + color: #fff; +} +body.light-mode .panel.alert #max-block, +body.light-mode .panel.warning #max-block, +body.light-mode .panel.alert #max-unvalidated, +body.light-mode .panel.warning #max-unvalidated, +body.light-mode .panel.alert #explorer-height, +body.light-mode .panel.warning #explorer-height, +body.light-mode .panel.alert .fg-stroke, +body.light-mode .panel.warning .fg-stroke, +body.light-mode .panel.alert .fg-normal, +body.light-mode .panel.warning .fg-normal, +body.light-mode .panel.alert .fg-accent, +body.light-mode .panel.warning .fg-accent { + color: #fff; +} +body.light-mode .panel.warning { + background: var(--warning-color-light); +} +body.light-mode .info-table tr:not(:last-child) { + border-color: var(--border-color-light); +} +body.light-mode .info-table tbody td:nth-child(2) { + color: var(--accent-color-light); +} +body.light-mode .progress { + border-color: var(--panel-background-light); +} +body.light-mode .progress-back { + background: var(--alert-color-light); +} +body.light-mode .progress-bar { + background: var(--info-color1-light); +} +body.light-mode #ip-address, +body.light-mode #bind-ip, +body.light-mode #p2p-port, +body.light-mode #client-port { + color: var(--accent-color-light); +} +body.light-mode #sidecar-position, +body.light-mode #sidecar-uptime, +body.light-mode #sidecar-score { + color: var(--accent-color-light); +} +/*# sourceMappingURL=light.css.map */ \ No newline at end of file diff --git a/client/css/light.css.map b/client/css/light.css.map new file mode 100644 index 0000000..12b0784 --- /dev/null +++ b/client/css/light.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["light.less"],"names":[],"mappings":"AAAA;EACE,gCAAA;EACA,2BAAA;EACA,6BAAA;EACA,iCAAA;EACA,6BAAA;EACA,4BAAA;EACA,8BAAA;EACA,4BAAA;EACA,4BAAA;EACA,4BAAA;EACA,4CAAA;;AAGF,IAAI;EACF,YAAY,4BAAZ;EACA,OAAO,uBAAP;;AAFF,IAAI,WAIF;EACE,OAAO,uBAAP;;AALJ,IAAI,WAQF;EACE,OAAO,yBAAP;;AATJ,IAAI,WAYF;EACE,OAAO,0BAAP;;AAbJ,IAAI,WAgBF;EACE,OAAO,wBAAP;;AAjBJ,IAAI,WAoBF;EACE,OAAO,wBAAP;;AArBJ,IAAI,WAwBF;EACE,OAAO,uBAAP;;AAzBJ,IAAI,WA4BF;EACE,OAAO,wBAAP;;AA7BJ,IAAI,WAgCF;EACE,OAAO,wBAAP;;AAjCJ,IAAI,WAoCF;EACE,OAAO,yBAAP;;AArCJ,IAAI,WAyCF;EACE,cAAc,yBAAd;;AA1CJ,IAAI,WA6CF;EACE,YAAY,4BAAZ;;AA9CJ,IAAI,WAiDF;EACE,YAAY,yBAAZ;;AAlDJ,IAAI,WAqDF;EAAY,OAAO,yBAAP;;AArDd,IAAI,WAsDF;EAAkB,OAAO,wBAAP;;AAtDpB,IAAI,WAuDF;EAAkB,OAAO,wBAAP;;AAvDpB,IAAI,WAyDF;EACE,YAAY,6BAAZ;EACA,OAAO,uBAAP;EACA,cAAc,yBAAd;;AA5DJ,IAAI,WAyDF,OAKE;EACE,cAAc,yBAAd;EACA,OAAO,yBAAP;;AAGF,IAnEA,WAyDF,OAUG;AAAQ,IAnET,WAyDF,OAUY;EACR,YAAY,wBAAZ;EACA,WAAA;;AAFF,IAnEA,WAyDF,OAUG,MAIC;AAJO,IAnET,WAyDF,OAUY,QAIR;EACE,WAAA;;AALJ,IAnEA,WAyDF,OAUG,MAOC;AAPO,IAnET,WAyDF,OAUY,QAOR;EACE,WAAA;;AARJ,IAnEA,WAyDF,OAUG,MAUC;AAVO,IAnET,WAyDF,OAUY,QAUR;AAVF,IAnEA,WAyDF,OAUG,MAUa;AAVL,IAnET,WAyDF,OAUY,QAUI;AAVd,IAnEA,WAyDF,OAUG,MAU+B;AAVvB,IAnET,WAyDF,OAUY,QAUsB;AAVhC,IAnEA,WAyDF,OAUG,MAUiD;AAVzC,IAnET,WAyDF,OAUY,QAUwC;AAVlD,IAnEA,WAyDF,OAUG,MAU6D;AAVrD,IAnET,WAyDF,OAUY,QAUoD;AAV9D,IAnEA,WAyDF,OAUG,MAUyE;AAVjE,IAnET,WAyDF,OAUY,QAUgE;EACtE,WAAA;;AAGJ,IAjFA,WAyDF,OAwBG;EACC,YAAY,0BAAZ;;AAlFN,IAAI,WAsFF,YACE,GAAE,IAAI;EACJ,cAAc,yBAAd;;AAIA,IA5FF,WAsFF,YAKE,MAAM,GACH,UAAU;EACT,OAAO,yBAAP;;AA7FR,IAAI,WAkGF;EACE,cAAc,6BAAd;;AAnGJ,IAAI,WAqGF;EACE,YAAY,wBAAZ;;AAtGJ,IAAI,WAwGF;EACE,YAAY,wBAAZ;;AAzGJ,IAAI,WA4GF;AA5GF,IAAI,WA4GW;AA5Gf,IAAI,WA4GqB;AA5GzB,IAAI,WA4GgC;EAChC,OAAO,yBAAP;;AA7GJ,IAAI,WAgHF;AAhHF,IAAI,WAgHiB;AAhHrB,IAAI,WAgHkC;EAClC,OAAO,yBAAP","file":"light.css"} \ No newline at end of file diff --git a/client/css/light.less b/client/css/light.less new file mode 100644 index 0000000..4796bb8 --- /dev/null +++ b/client/css/light.less @@ -0,0 +1,131 @@ +:root { + --body-background-light: #f6f8fa; + --text-color-light: #24292e; + --border-color-light: #e1e4e8; + --panel-background-light: #ffffff; + --accent-color-light: #444c56; + --alert-color-light: #ea0b0b; + --warning-color-light: #ff8330; + --info-color1-light: #7dc37b; + --info-color2-light: #1ba1e2; + --info-color3-light: #ffe725; + --fill-color-light: rgba(125, 195, 123, .3); +} + +body.light-mode { + background: var(--body-background-light); + color: var(--text-color-light); + + .fg-normal { + color: var(--text-color-light); + } + + .fg-accent { + color: var(--accent-color-light); + } + + .fg-warning { + color: var(--warning-color-light); + } + + .fg-alert { + color: var(--alert-color-light); + } + + .fg-stroke { + color: var(--info-color1-light); + } + + .fg-fill { + color: var(--fill-color-light); + } + + .fg-info1 { + color: var(--info-color1-light); + } + + .fg-info2 { + color: var(--info-color2-light); + } + + .fg-info3 { + color: var(--accent-color-light); + } + + + .bd-system { + border-color: var(--border-color-light); + } + + .bg-system { + background: var(--body-background-light); + } + + hr { + background: var(--border-color-light); + } + + #max-block {color: var(--accent-color-light);} + #max-unvalidated {color: var(--alert-color-light);} + #explorer-height {color: var(--info-color2-light);} + + .panel { + background: var(--panel-background-light); + color: var(--text-color-light); + border-color: var(--border-color-light)!important; + + .panel-title { + border-color: var(--border-color-light); + color: var(--accent-color-light); + } + + &.alert, &.warning{ + background: var(--alert-color-light); + color: #fff; + + .panel-title { + color: #fff; + } + #node-status { + color: #fff; + } + #max-block, #max-unvalidated, #explorer-height, .fg-stroke, .fg-normal, .fg-accent { + color: #fff; + } + } + &.warning{ + background: var(--warning-color-light); + } + } + + .info-table { + tr:not(:last-child) { + border-color: var(--border-color-light); + } + + tbody td { + &:nth-child(2) { + color: var(--accent-color-light); + } + } + } + + .progress { + border-color: var(--panel-background-light); + } + .progress-back { + background: var(--alert-color-light); + } + .progress-bar { + background: var(--info-color1-light); + } + + #ip-address, #bind-ip, #p2p-port, #client-port { + color: var(--accent-color-light); + } + + #sidecar-position, #sidecar-uptime, #sidecar-score { + color: var(--accent-color-light); + } + +} \ No newline at end of file diff --git a/client/index.html b/client/index.html index 0b91699..227b2e6 100644 --- a/client/index.html +++ b/client/index.html @@ -8,38 +8,37 @@ - +
-
- MINAMONITOR v1.0.1 +
+ MINAMONITOR v1.0.2
-
Next block will be produce at
- Calculating... -
-
calculating...
+
Next block will be produce at
+ Calculating... +
+
calculating...
- - +
- Server time: + Server time:
- Server uptime: + Server uptime:
- +
@@ -50,40 +49,43 @@
-
-
UNKNOWN
-
---.---.---.---
+
+
UNKNOWN
+
---.---.---.---
-
-
+
+
UNKNOWN
-
UNKNOWN
+
+ network: + UNKNOWN +
-
+
0
-
- max: 0 - unv: 0 - exp: 0 +
+ max: 0 + unv: 0 + exp: 0
-
+
0
-
- pos: 0 - score: 0 - rate: 0 +
+ pos: 0 + score: 0 + rate: 0
@@ -93,26 +95,27 @@
-
-
0
+
+
0
- liquid: 0 + liquid: + 0
-
-
0
+
+
0
-
-
0
-
time calculating... left
+
+
0
+
time calculating... left
@@ -121,39 +124,51 @@
-
-
0
-
0
+
+
0
+
0
-
+
-
-
-
-
-
-
-
-
Free: GiB
+
+
+
+
+
+
+
+ free: GiB + used: GiB +
+
-
-
-
-
-
Load average:
+ +
+
+
+
+
+
+
+
+
Load average:
+
-
-
-
+ +
+
+
+
+
@@ -164,10 +179,10 @@
-
Network Traffic
+
Network Traffic
- 0 - MB/S + 0 + MB/S
@@ -178,8 +193,8 @@
-
Peers Connected
-
0
+
Peers Connected
+
0
@@ -207,8 +222,8 @@
-
Network Connections
-
0
+
Network Connections
+
0
@@ -219,35 +234,35 @@ - + - + - + - + - + - + - + - +
System info
System time
CPU info
RAM info
NET info
Mina GraphQL
Mina Explorer
Uptime
@@ -263,7 +278,7 @@
-
+
No data
No data
@@ -273,7 +288,7 @@
-
unknown
+
unknown
diff --git a/client/js/app.js b/client/js/app.js index 3037dc7..9c56ce6 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -1,3 +1,4 @@ +import "./init"; import {processSystemInfo} from "./server-info"; import {processServerTime} from "./server-time"; import {processCPUData} from "./cpu"; @@ -9,15 +10,34 @@ import {processConsensus} from "./consensus" import {processUptime} from "./uptime" fetch("./config.json").then( (r) => r.ok ? r.json() : null ).then(config => { + const body = $("body") + globalThis.config = config + if (config.theme === "auto") { + if ($.dark) { + body.removeClass("light-mode") + } else { + body.addClass("light-mode") + } + } else { + globalThis.darkMode = config.theme !== "light" + + if (config.theme === "light") { + body.addClass("light-mode") + } + } + + globalThis.chartLineColor = globalThis.darkMode ? '#3c424b' : "#e5e5e5" + globalThis.chartLabelColor = globalThis.darkMode ? "#fff" : "#000" + setTimeout(() => processSystemInfo(), 0) setTimeout(() => processServerTime(), 0) setTimeout(() => processCPUData(), 0) setTimeout(() => processMemInfo(), 0) setTimeout(() => processNetInfo(), 0) setTimeout(() => processNetConnections(), 0) - setTimeout( () => processBlockchainInfo(), 0 ) + setTimeout(() => processBlockchainInfo(), 0 ) setTimeout(() => processNodeStatus(), 0) setTimeout(() => processConsensus(), 0) setTimeout(() => processUptime(), 0) diff --git a/client/js/cpu.js b/client/js/cpu.js index 68a3fe6..f75bcde 100644 --- a/client/js/cpu.js +++ b/client/js/cpu.js @@ -4,73 +4,120 @@ import {getFakeData} from "./helpers/get-fake-data"; import {defaultChartConfig, defaultGaugeConfig} from "./helpers/chart-config"; import {imgOk, imgStop} from "./helpers/const"; -const cpuChart = chart.areaChart("#cpu-load", [ - { - name: "CPU usage", - data: getFakeData(40) - } -], { - ...defaultChartConfig, - colors: [Metro.colors.toRGBA('#00AFF0', .5), Metro.colors.toRGBA('#aa00ff', .5)], - legend: { - position: 'top-left', - vertical: true, - background: "#22272e", - font: { - color: "#fff" - }, - margin: 0, - border: { - color: "#22272e" - }, - padding: 5 - }, - padding: { - left: 35, - top: 5, - right: 0, - bottom: 10 - }, - boundaries: { - maxY: 100, - minY: 0 - }, - onDrawLabelX: (v) => { - return `${datetime(+v).format("HH:mm:ss")}` - }, - onDrawLabelY: (v) => { - return `${+v}%` - } -}); - -let cpuGauge +let cpuChart, cpuGauge, cpuSegment export const processCPUData = async () => { const elLog = $("#log-cpu") elLog.html(imgStop) - let cpu = await getInfo('cpu-load') - - if (cpu) { + let container = $("#cpu-load-all") + let height = 208 - let {load = 0, user = 0, sys = 0, loadavg = [0, 0, 0]} = cpu + if (!cpuGauge) { + cpuGauge = chart.gauge('#cpu-use', [0], { + ...defaultGaugeConfig, + backStyle: globalThis.darkMode ? '#1e2228' : '#f0f6fc', + padding: 0, + onDrawValue: (v, p) => { + return +p.toFixed(0) + "%" + } + }) + } - if (!cpuGauge) { - cpuGauge = chart.gauge('#cpu-use', [0], { - ...defaultGaugeConfig, - padding: 0, - onDrawValue: (v, p) => { - return +p.toFixed(0) + "%" + if (!cpuChart) { + cpuChart = chart.areaChart("#cpu-load", [ + { + name: "CPU usage", + data: getFakeData(40) + } + ], { + ...defaultChartConfig, + colors: [Metro.colors.toRGBA('#00AFF0', .5), Metro.colors.toRGBA('#aa00ff', .5)], + legend: false, + axis: { + x: { + line: { + color: globalThis.chartLineColor, + shortLineSize: 0 + }, + label: { + count: 10, + color: globalThis.chartLabelColor, + }, + arrow: false + }, + y: { + line: { + color: globalThis.chartLineColor + }, + label: { + count: 10, + color: globalThis.chartLabelColor, + font: { + size: 10 + }, + skip: 2 + }, + arrow: false } - }) - } + }, + padding: { + left: 35, + top: 5, + right: 1, + bottom: 5 + }, + boundaries: { + maxY: 100, + minY: 0 + }, + onDrawLabelX: (v) => { + return `${datetime(+v).format("HH:mm:ss")}` + }, + onDrawLabelY: (v) => { + return `${+v}%` + } + }) + } + + let cpuLoad = await getInfo('cpu-load') + + if (cpuLoad) { + + let {load = 0, user = 0, sys = 0, loadavg = [0, 0, 0], threads = []} = cpuLoad cpuChart.addPoint(0, [datetime().time(), load]) cpuGauge.setData([load]) - $("#loadavg").html(`${loadavg[0]} ${loadavg[1]} ${loadavg[2]}`) + $("#loadavg").html(`${loadavg[0]} ${loadavg[1]} ${loadavg[2]}`) + + if (!container.children().length) { + cpuSegment = chart.segment("#cpu-load-all", cpuLoad.threads, { + padding: { + top: 0, + bottom: 0, + left: 0, + right: 0 + }, + segment: { + rowDistance: 6, + count: 40, + height: height / (cpuLoad.threads.length) - 6 + }, + colors: [ [70, '#60a917'], [90, '#f0a30a'], [100, '#a20025'] ], + border: { + color: "transparent" + }, + ghost: { + color: globalThis.darkMode ? "rgba(125, 195, 123, .1)" : "#f0f6fc" + } + }) + } else { + cpuLoad.threads.forEach( (v, i) => { + cpuSegment.setData(v, i) + }) + } - // console.log("CPU (re)loaded!") elLog.html(imgOk) } diff --git a/client/js/helpers/chart-config.js b/client/js/helpers/chart-config.js index 6e1129e..50f430a 100644 --- a/client/js/helpers/chart-config.js +++ b/client/js/helpers/chart-config.js @@ -1,68 +1,17 @@ export const defaultChartConfig = { border: false, - legend: { - margin: { - top: 25 - }, - font: { - color: '#fff' - } - }, margin: 0, - padding: { - left: 40, - right: 10, - top: 10, - bottom: 50 - }, colors: ['#00AFF0', '#7dc37b', '#aa00ff'], showDots: false, boundaries: { minY: 0, }, graphSize: 40, - axis: { - x: { - line: { - count: 10, - color: '#444c56' - }, - label: { - count: 3, - color: '#fff', - font: { - size: 10 - }, - fixed: 0, - first: true, - }, - arrow: { - color: '#22272e' - } - }, - y: { - line: { - count: 10, - color: '#444c56' - }, - label: { - fixed: 0, - color: '#fff', - font: { - size: 10 - } - }, - arrow: { - color: '#22272e' - } - } - }, tooltip: false, } export const defaultGaugeConfig = { border: false, - backStyle: '#1e2228', fillStyle: [ [30, '#00fa9a'], [60, '#60a917'], diff --git a/client/js/helpers/const.js b/client/js/helpers/const.js index bdce8a1..4234121 100644 --- a/client/js/helpers/const.js +++ b/client/js/helpers/const.js @@ -1,2 +1,2 @@ -export const imgOk = "" -export const imgStop = "" \ No newline at end of file +export const imgOk = "" +export const imgStop = "" \ No newline at end of file diff --git a/client/js/init.js b/client/js/init.js new file mode 100644 index 0000000..9286805 --- /dev/null +++ b/client/js/init.js @@ -0,0 +1 @@ +globalThis.darkMode = $.dark diff --git a/client/js/mem.js b/client/js/mem.js index 0f472dc..700efa0 100644 --- a/client/js/mem.js +++ b/client/js/mem.js @@ -10,6 +10,86 @@ export const processMemInfo = async () => { const elLog = $("#log-mem") elLog.html(imgStop) + if (!memoryChart) { + const _data = getFakeData(40) + + memoryChart = chart.lineChart("#memory-load", [ + { + name: "Used", + data: _data + }, + { + name: "Free", + data: _data + } + ], { + ...defaultChartConfig, + colors: ['#aa00ff', '#7dc37b'], + legend: { + position: 'top-left', + vertical: true, + background: globalThis.darkMode ? "#22272e" : "#fff", + margin: { + left: 40, + top: 0 + }, + border: { + color: globalThis.darkMode ? "#22272e" : "#fafbfc" + }, + padding: 5, + font: { + color: globalThis.chartLabelColor + }, + }, + axis: { + x: { + line: { + color: globalThis.chartLineColor, + shortLineSize: 0 + }, + label: { + count: 10, + fixed: 0, + color: globalThis.chartLabelColor, + font: { + size: 10 + } + }, + skip: 2, + arrow: false + }, + y: { + arrow: false, + line: { + color: globalThis.chartLineColor + }, + label: { + count: 10, + fixed: 0, + color: globalThis.chartLabelColor, + font: { + size: 10 + }, + skip: 2 + } + } + }, + padding: { + left: 25, + top: 5, + right: 1, + bottom: 5 + }, + boundaries: { + maxY: 0, + minY: 0 + }, + onDrawLabelX: (v) => { + return `` + } + }); + } + let mem = await getInfo('mem') if (mem) { @@ -17,54 +97,16 @@ export const processMemInfo = async () => { const memFree = mem.free / (1024 ** 3) const memTotal = mem.total / (1024 ** 3) - if (!memoryChart) { - const _data = getFakeData(40) - - memoryChart = chart.lineChart("#memory-load", [ - { - name: "Used", - data: _data - }, - { - name: "Free", - data: _data - } - ], { - ...defaultChartConfig, - legend: { - position: 'top-left', - vertical: true, - background: "#22272e", - font: { - color: "#fff" - }, - margin: 0, - border: { - color: "#22272e" - }, - padding: 5 - }, - padding: { - left: 30, - top: 5, - right: 0, - bottom: 10 - }, - boundaries: { - maxY: memTotal, - minY: 0 - }, - onDrawLabelX: (v) => { - return `${datetime(+v).format("HH:mm:ss")}` - } - }); - } + memoryChart.setBoundaries({ + maxY: memTotal + }) memoryChart.addPoint(0, [datetime().time(), memUsage]) memoryChart.addPoint(1, [datetime().time(), memFree]) if (!memoryGauge) { memoryGauge = chart.gauge('#memory-use', [0], { ...defaultGaugeConfig, + backStyle: globalThis.darkMode ? '#1e2228' : '#f0f6fc', padding: 0, boundaries: { max: Math.round(memTotal), @@ -77,6 +119,7 @@ export const processMemInfo = async () => { memoryGauge.setData([memUsage]) $("#free-ram").text(memFree.toFixed(0)) + $("#used-ram").text(memUsage.toFixed(0)) elLog.html(imgOk) // console.log("Mem (re)loaded!") diff --git a/client/js/net.js b/client/js/net.js index ff05bd6..f5b05c4 100644 --- a/client/js/net.js +++ b/client/js/net.js @@ -4,51 +4,88 @@ import {getFakeData} from "./helpers/get-fake-data"; import {defaultChartConfig} from "./helpers/chart-config"; import {imgOk, imgStop} from "./helpers/const"; -let networkChart = chart.areaChart("#net-load", [ - { - name: "Transfer", - data: getFakeData(40) - }, - { - name: "Receive", - data: getFakeData(40) - }, -], { - ...defaultChartConfig, - colors: [Metro.colors.toRGBA('#00AFF0', .5), Metro.colors.toRGBA('#7dc37b', .5)], - legend: { - position: 'top-left', - vertical: true, - background: "#22272e", - font: { - color: "#fff" - }, - margin: 0, - border: { - color: "#22272e" - }, - padding: 5 - }, - padding: { - left: 30, - top: 5, - right: 0, - bottom: 10 - }, - height: 160, - onDrawLabelX: (v) => { - return `` - // return `${datetime(+v).format("HH:mm:ss")}` - }, - onDrawLabelY: (v) => { - return `${(+v / 1024 ** 2).toFixed(2)}` - } -}); +let networkChart export const processNetInfo = async () => { const elLog = $("#log-explorer") elLog.html(imgStop) + if (!networkChart) { + const chartLineColor = globalThis.darkMode ? '#3c424b' : "#e5e5e5" + const chartLabelColor = globalThis.darkMode ? "#fff" : "#000" + networkChart = chart.areaChart("#net-load", [ + { + name: "Transfer", + data: getFakeData(40) + }, + { + name: "Receive", + data: getFakeData(40) + }, + ], { + ...defaultChartConfig, + colors: [Metro.colors.toRGBA('#00AFF0', .5), Metro.colors.toRGBA('#aa00ff', .5)], + legend: { + position: 'top-left', + vertical: true, + background: globalThis.darkMode ? "#22272e" : "#fff", + margin: { + left: 32, + top: 0 + }, + border: { + color: globalThis.darkMode ? "#22272e" : "#fafbfc" + }, + padding: 5, + font: { + color: globalThis.chartLabelColor + }, + }, + axis: { + x: { + line: { + color: globalThis.chartLineColor, + shortLineSize: 0 + }, + label: { + count: 10, + color: globalThis.chartLabelColor, + }, + arrow: false + }, + y: { + line: { + color: globalThis.chartLineColor + }, + label: { + count: 10, + fixed: 0, + color: globalThis.chartLabelColor, + font: { + size: 10 + }, + skip: 2 + }, + arrow: false + } + }, + padding: { + left: 35, + top: 5, + right: 1, + bottom: 10 + }, + height: 160, + onDrawLabelX: (v) => { + return `` + // return `${datetime(+v).format("HH:mm:ss")}` + }, + onDrawLabelY: (v) => { + return `${(+v / 1024 ** 2).toFixed(2)}` + } + }) + } + let net = await getInfo('net-stat') if (net) { diff --git a/client/js/node.js b/client/js/node.js index 1966153..36a9629 100644 --- a/client/js/node.js +++ b/client/js/node.js @@ -7,36 +7,7 @@ import {imgOk, imgStop} from "./helpers/const"; const graphSize = 20 let START_NODE_MON = datetime() let START_NODE_POINTS = 200 -let peersChart = chart.histogramChart('#peers-load', [ - { - name: "Peers", - data: getFakeTriplets(20, 40, 60, 0) - }, -], { - ...defaultChartConfig, - bars: { - stroke: '#22272e' - }, - boundaries: { - maxY: 200, - minY: 0 - }, - graphSize, - legend: false, - padding: { - left: 30, - top: 5, - right: 0, - bottom: 10 - }, - height: 160, - onDrawLabelX: (v) => { - return "" - }, - onDrawLabelY: (v) => { - return `${v}` - } -}) +let peersChart const getNodeStatus = async () => await getInfo('node-status') const getExplorerSummary = async () => await getInfo('explorer') @@ -73,13 +44,72 @@ const processExplorerSummary = async () => { elBlockHeightPanel.addClass('alert') } elLog.html(imgOk) - // console.log("Block height from explorer (re)loaded!") } export const processNodeStatus = async () => { const elLog = $("#log-mina") elLog.html(imgStop) + if (!peersChart) { + peersChart = chart.histogramChart('#peers-load', [ + { + name: "Peers", + data: getFakeTriplets(20, 40, 60, 0) + }, + ], { + ...defaultChartConfig, + bars: { + stroke: globalThis.darkMode ? '#22272e' : '#fff' + }, + boundaries: { + maxY: 100, + minY: 0 + }, + graphSize, + legend: false, + axis: { + x: { + line: { + color: globalThis.chartLineColor, + shortLineSize: 0 + }, + label: { + count: 10, + color: globalThis.chartLabelColor, + }, + arrow: false + }, + y: { + line: { + color: globalThis.chartLineColor + }, + label: { + count: 10, + font: { + size: 10 + }, + color: globalThis.chartLabelColor, + skip: 2 + }, + arrow: false, + } + }, + padding: { + left: 30, + top: 5, + right: 1, + bottom: 10 + }, + height: 160, + onDrawLabelX: (v) => { + return "" + }, + onDrawLabelY: (v) => { + return `${v}` + } + }) + } + let status = await getNodeStatus() let reload = globalThis.config.intervals.node const UNKNOWN = "UNKNOWN" diff --git a/client/js/server-info.js b/client/js/server-info.js index 62e27f3..0435848 100644 --- a/client/js/server-info.js +++ b/client/js/server-info.js @@ -15,9 +15,9 @@ export const processSystemInfo = async () => { $("#cpu-info").text(cpuInfo.model) $("#ram-total").text(Math.round(memInfo.total / (1024 ** 3))) $("#os-distro").text(platformInfo.osVersion) - $("#hostname").text(platformInfo.hostname) + $("#hostname").text(platformInfo.hostname.split(".")[0]) $("#vcpu").text(cpuInfo.cores) - $("title").text(platformInfo.hostname + " :: Mona Node Monitor") + $("title").text(platformInfo.hostname + " :: Mina Monitor") elLog.html(imgOk) diff --git a/client/js/uptime.js b/client/js/uptime.js index 56d964b..3691fe4 100644 --- a/client/js/uptime.js +++ b/client/js/uptime.js @@ -11,7 +11,7 @@ export const processUptime = async () => { if (time && Array.isArray(time) && time.length) { const [position, publicKey, score, rate] = time $("#sidecar-position").text(position) - $("#sidecar-uptime").text(Math.floor(parseFloat(rate)) + "%") + $("#sidecar-uptime").text((parseFloat(rate)) + "%") $("#sidecar-score").text(score) elLog.html(imgOk) diff --git a/client/vendor/chart/chart.js b/client/vendor/chart/chart.js index ba4bd5d..9d8ed53 100644 --- a/client/vendor/chart/chart.js +++ b/client/vendor/chart/chart.js @@ -106,7 +106,7 @@ right: 0 }; - var StandardColorPalette = { + var defaultColors = { aliceBlue: "#f0f8ff", antiqueWhite: "#faebd7", aqua: "#00ffff", @@ -264,8 +264,7 @@ legend: defaultLegend, tooltip: defaultTooltip, boundaries: false, - accuracy: 2, - colors: Object.values(StandardColorPalette), + colors: Object.values(defaultColors), animate: false, onDrawLabelY: null, onDrawLabelX: null, @@ -349,7 +348,7 @@ ctx.strokeStyle = stroke; ctx.font = "".concat(style, " ").concat(weight, " ").concat(size, "px/").concat(lineHeight, " ").concat(family); ctx.translate(tX, tY); - ctx.rotate(angle); + ctx.rotate(angle * Math.PI / 180); ctx.textBaseline = baseLine; var lines = text.toString().split('\n'); lines.map((str, i) => { @@ -464,27 +463,27 @@ legendHorizontal() { var o = this.options, padding = expandPadding(o.padding), - legend = o.legend, - legendPadding = expandPadding(legend.padding), - legendMargin = expandMargin(legend.margin); + legend = o.legend; + var ctx = this.ctx; + var items = this.legendItems; + if (!legend || !isObject(legend)) return; + if (!items || !Array.isArray(items) || !items.length) return; + var legendPadding = expandPadding(legend.padding); + var legendMargin = expandMargin(legend.margin); var lh, x, y, magic = 5, box; - var ctx = this.ctx; - var items = this.legendItems; var offset = 0; - if (!legend || !isObject(legend)) return; - if (!items || !Array.isArray(items) || !items.length) return; box = legend.font.size / 2; lh = legend.font.size * legend.font.lineHeight; - y = padding.top + this.viewHeight + legend.font.size + legendPadding.top + legendMargin.top; + y = padding.top + padding.bottom + this.viewHeight - (legend.font.size + legendPadding.top + legendMargin.top); x = padding.left + legendPadding.left + legendMargin.left; for (var i = 0; i < items.length; i++) { - var [name] = items[i]; - offset += getTextBoxWidth(ctx, [[name]], { + var [name, _, value] = items[i]; + offset += getTextBoxWidth(ctx, [[legend.showValue ? "".concat(name, " - ").concat(value) : name]], { font: legend.font }) + box * 2 + magic; } @@ -492,8 +491,8 @@ offset = (this.viewWidth - offset) / 2; for (var _i = 0; _i < items.length; _i++) { - var [_name, color] = items[_i]; - var nameWidth = getTextBoxWidth(ctx, [[_name]], { + var [_name, color, _value] = items[_i]; + var nameWidth = getTextBoxWidth(ctx, [[legend.showValue ? "".concat(_name, " - ").concat(_value) : _name]], { font: legend.font }); @@ -506,7 +505,7 @@ color, fill: color }); - drawText(ctx, _name, [offset + x + box + magic, y + box / 2], { + drawText(ctx, legend.showValue ? "".concat(_name, " - ").concat(_value) : _name, [offset + x + box + magic, y + box / 2], { color: legend.font.color, stroke: legend.font.color, font: o.font @@ -541,17 +540,17 @@ textBoxHeight = items.length * lh + legendPadding.top + legendPadding.bottom + magic; if (legend.position === 'top-left') { - x = padding.left + legendMargin.left; - y = padding.top + legendMargin.top; + x = legendPadding.left + legendMargin.left; + y = legendPadding.top + legendMargin.top; } else if (legend.position === 'top-right') { x = this.dpiWidth - textBoxWidth - legendMargin.right - padding.right; - y = padding.top + legendMargin.top; + y = legendPadding.top + legendMargin.top; } else if (legend.position === 'bottom-left') { - x = padding.left + legendMargin.left; - y = this.dpiHeight - textBoxHeight - padding.bottom + legendMargin.bottom; + x = legendPadding.left + legendMargin.left; + y = this.dpiHeight - textBoxHeight - legendPadding.bottom + legendMargin.bottom; } else { - x = this.dpiWidth - textBoxWidth - legendMargin.right - padding.right; - y = this.dpiHeight - textBoxHeight - padding.bottom + legendMargin.bottom; + x = this.dpiWidth - textBoxWidth - legendMargin.right - legendPadding.right; + y = this.dpiHeight - textBoxHeight - legendPadding.bottom + legendMargin.bottom; } drawBox(ctx, [x, y, textBoxWidth, textBoxHeight], { @@ -564,12 +563,12 @@ y += box + magic + legendPadding.top; for (var i = 0; i < items.length; i++) { - var [name, color] = items[i]; + var [name, color, value] = items[i]; drawSquare(ctx, [x, y, box], { color, fill: color }); - drawText(ctx, name, [x + box + magic, y + 1], { + drawText(ctx, legend.showValue ? "".concat(name, " - ").concat(value) : name, [x + box + magic, y + 1], { color: legend.font.color, stroke: legend.font.color, font: legend.font @@ -688,8 +687,9 @@ height = o.height.toString().includes('%') ? elHeight / 100 * parseInt(o.height) : +o.height; this.width = width; this.height = height; - this.dpiHeight = o.dpi * height; - this.dpiWidth = o.dpi * width; + this.dpi = o.dpi; + this.dpiHeight = this.dpi * height; + this.dpiWidth = this.dpi * width; this.viewHeight = this.dpiHeight - (padding.top + padding.bottom); this.viewWidth = this.dpiWidth - (padding.left + padding.right); this.center = [this.dpiWidth / 2, this.dpiHeight / 2]; @@ -744,13 +744,31 @@ } setData(data, index) { + var redraw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + if (typeof index !== "undefined") { this.data[index].data = data; } else { this.data = data; } - this.draw(); + if (redraw) this.resize(); + } + + setBoundaries(obj) { + var redraw = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var grantedKeys = ["minX", "minY", "minZ", "maxX", "maxY", "maxZ", "min", "max"]; + + for (var k in obj) { + if (grantedKeys.includes(k)) { + this[k] = obj[k]; + this.options.boundaries[k] = obj[k]; + } + } + + if (redraw) { + this.draw(); + } } mouseMove(e) { @@ -803,29 +821,85 @@ Object.assign(Chart.prototype, MixinLegend); Object.assign(Chart.prototype, MixinTooltip); + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; + } + + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + + return keys; + } + + function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; + } + var arrow = { - color: '#000', + color: '#7d7d7d', size: 1, dash: [], factorX: 5, - factorY: 5 + factorY: 5, + outside: 0 }; var line = { color: '#e3e3e3', size: 1, dash: [], - count: 5, - show: true + shortLineSize: 5 }; var label = { color: '#000', font: labelFont, count: 5, - // odd, even, num - show: true, - first: true, - last: true, - fixed: false + fixed: false, + opposite: false, + angle: 0, + align: 'center', + shift: { + x: 0, + y: 0 + }, + skip: 0, + showLine: true, + showLabel: true, + showMin: true }; var axis = { arrow, @@ -834,7 +908,11 @@ }; var defaultAxis = { x: axis, - y: axis + y: _objectSpread2(_objectSpread2({}, axis), {}, { + label: _objectSpread2(_objectSpread2({}, label), {}, { + align: 'right' + }) + }) }; var defaultCross = { @@ -846,7 +924,8 @@ var defaultAreaChartOptions = { axis: defaultAxis, cross: defaultCross, - showDots: true + showDots: true, + accuracy: 2 }; var minMax = function minMax() { @@ -1078,12 +1157,12 @@ var o = this.options, ctx = this.ctx; var padding = expandPadding(o.padding); + if (!o.axis.x.arrow) return; + var arrow = o.axis.x.arrow; var x1 = padding.left, y1 = this.viewHeight + padding.top; - var x2 = x1 + this.viewWidth, + var x2 = padding.left + this.viewWidth + arrow.outside, y2 = y1; - if (!o.axis.x.arrow) return; - var arrow = o.axis.x.arrow; drawArrowX(ctx, [x1, y1, x2, y2, arrow.factorX, arrow.factorY], { color: arrow.color, size: arrow.size, @@ -1092,54 +1171,71 @@ }, axisX() { - var _ref; + var _ref, _line$shortLineSize; var ctx = this.ctx, o = this.options; var padding = expandPadding(o.padding); if (!o.axis.x) return; - var axis = o.axis.x; - var font = (_ref = axis && axis.label && axis.label.font) !== null && _ref !== void 0 ? _ref : o.font; - var step = this.viewWidth / axis.line.count; - var textStep = (this.maxX - this.minX) / axis.line.count; - var skipLabels = Math.round(axis.line.count / axis.label.count); - - for (var i = 0; i <= axis.line.count; i++) { - var _ref2, _ref3; + var axis = o.axis.x, + label = axis.label, + line = axis.line, + arrow = axis.arrow; + var font = (_ref = label && label.font) !== null && _ref !== void 0 ? _ref : o.font; + var labelStep = label.count ? (this.maxX - this.minX) / label.count : 0; + var labelValue, + value, + k, + x, + y, + labelY, + shortLineSize = (_line$shortLineSize = line.shortLineSize) !== null && _line$shortLineSize !== void 0 ? _line$shortLineSize : 0; + x = padding.left; + y = padding.top; + labelY = padding.top + this.viewHeight + font.size + 5; + value = this.minX; + k = 0; - var x = step * i + padding.left; - var labelXValue = this.minX + textStep * i; + for (var i = 0; i <= label.count; i++) { + labelValue = typeof label.fixed === "number" ? value.toFixed(label.fixed) : value; - if (typeof axis.label.fixed === "number") { - labelXValue = labelXValue.toFixed(axis.label.fixed); + if (typeof o.onDrawLabelX === "function") { + labelValue = o.onDrawLabelX.apply(null, [value]); } - if (axis.line.show) { - drawVector(ctx, [x, padding.top, x, this.viewHeight + padding.top], { - color: axis.line.color, - size: axis.line.size, - dash: axis.line.dash + if (label.showLine) { + drawVector(ctx, [x, y, x, y + this.viewHeight], { + color: line.color, + size: line.size, + dash: line.dash }); } - if (!axis.label.show) continue; - if (skipLabels && i && i % skipLabels !== 0) continue; - if (!axis.label.first && i === 0) continue; - if (!axis.label.last && i === axis.line.count) continue; - - if (typeof o.onDrawLabelX === "function") { - labelXValue = o.onDrawLabelX.apply(null, [labelXValue]); - } // if (x + ctx.measureText(labelXValue.toString()).width > this.viewWidth) continue - + if (label.skip && k !== label.skip) { + k++; + } else { + k = 1; + + if (label.showLabel && !(!i && !label.showMin)) { + var _label$color, _label$shift$x, _label$shift$y; + + // short line + drawVector(ctx, [x, this.viewHeight + padding.top - shortLineSize, x, this.viewHeight + padding.top + shortLineSize], { + color: arrow && arrow.color ? arrow.color : line.color + }); // label + + drawText(ctx, labelValue.toString(), [0, 0], { + color: (_label$color = label.color) !== null && _label$color !== void 0 ? _label$color : o.color, + align: label.align, + font, + translate: [x + ((_label$shift$x = label.shift.x) !== null && _label$shift$x !== void 0 ? _label$shift$x : 0), labelY + ((_label$shift$y = label.shift.y) !== null && _label$shift$y !== void 0 ? _label$shift$y : 0)], + angle: label.angle + }); + } + } - drawVector(ctx, [x, this.viewHeight + padding.top, x, this.viewHeight + padding.top + 5], { - color: (_ref2 = axis.arrow && axis.arrow.color) !== null && _ref2 !== void 0 ? _ref2 : axis.line.color - }); - drawText(ctx, labelXValue.toString(), [x, this.viewHeight + padding.top + font.size + 5], { - color: (_ref3 = axis.label && axis.label.color) !== null && _ref3 !== void 0 ? _ref3 : o.color, - align: 'center', - font - }); + value += labelStep; + x = padding.left + (value - this.minX) * this.ratioX; } }, @@ -1147,12 +1243,12 @@ var o = this.options, ctx = this.ctx; var padding = expandPadding(o.padding); + if (!o.axis.y.arrow) return; + var arrow = o.axis.y.arrow; var x1 = padding.left, y1 = this.viewHeight + padding.top; var x2 = x1, - y2 = padding.top; - if (!o.axis.y.arrow) return; - var arrow = o.axis.y.arrow; + y2 = padding.top - arrow.outside; drawArrowY(ctx, [x1, y1, x2, y2, arrow.factorX, arrow.factorY], { color: arrow.color, size: arrow.size, @@ -1161,60 +1257,79 @@ }, axisY() { - var _ref4; + var _ref2, _line$shortLineSize2; var ctx = this.ctx, o = this.options; var padding = expandPadding(o.padding); if (!o.axis.y) return; - var axis = o.axis.y; - var font = (_ref4 = axis && axis.label && axis.label.font) !== null && _ref4 !== void 0 ? _ref4 : o.font; - var step = this.viewHeight / axis.line.count; - var textStep = (this.maxY - this.minY) / axis.line.count; - var skipLabels = Math.floor(axis.line.count / axis.label.count); - - for (var i = 0; i < axis.line.count + 1; i++) { - var _ref5, _ref6; + var axis = o.axis.y, + label = axis.label, + line = axis.line, + arrow = axis.arrow; + var font = (_ref2 = label && label.font) !== null && _ref2 !== void 0 ? _ref2 : o.font; + var labelStep = label.count ? (this.maxY - this.minY) / label.count : 0; + var labelValue, value, k, x, y, labelX, shortLineX; + var shortLineSize = (_line$shortLineSize2 = line.shortLineSize) !== null && _line$shortLineSize2 !== void 0 ? _line$shortLineSize2 : 0; + x = padding.left; + labelX = padding.left; + y = this.viewHeight + padding.top; + value = this.minY; + k = 0; + + if (label.opposite) { + labelX += this.viewWidth + 10 + shortLineSize; + shortLineX = padding.left + this.viewWidth; + label.align = 'left'; + } else { + labelX -= 10; + shortLineX = x - shortLineSize; + } - var y = this.viewHeight + padding.top - step * i; - var x = padding.left; - var labelYValue = this.minY + textStep * i; + for (var i = 0; i <= label.count + 1; i++) { + labelValue = typeof label.fixed === "number" ? value.toFixed(label.fixed) : value; - if (typeof axis.label.fixed === "number") { - labelYValue = labelYValue.toFixed(axis.label.fixed); + if (typeof o.onDrawLabelY === "function") { + labelValue = o.onDrawLabelY.apply(null, [value]); } - if (axis.line.show) { + if (label.showLine) { drawVector(ctx, [x, y, this.viewWidth + padding.left, y], { - color: axis.line.color, - size: axis.line.size, - dash: axis.line.dash + color: line.color, + size: line.size, + dash: line.dash }); } - if (!axis.label.show) continue; - if (skipLabels && i && i % skipLabels !== 0) continue; - if (!axis.label.first && i === 0) continue; - if (!axis.label.last && i === axis.line.count) continue; + if (i !== 0 && label.skip && k !== label.skip) { + k++; + } else { + k = 1; - if (typeof o.onDrawLabelY === "function") { - labelYValue = o.onDrawLabelY.apply(null, [labelYValue]); + if (label.showLabel && !(!i && !label.showMin)) { + var _ref3, _label$shift$x2, _label$shift$y2; + + // short line + drawVector(ctx, [shortLineX, y, shortLineX + shortLineSize * 2, y], { + color: arrow && arrow.color ? arrow.color : line.color + }); + drawText(ctx, labelValue.toString(), [0, 0], { + color: (_ref3 = label && label.color) !== null && _ref3 !== void 0 ? _ref3 : o.color, + align: label.align, + font, + translate: [labelX + ((_label$shift$x2 = label.shift.x) !== null && _label$shift$x2 !== void 0 ? _label$shift$x2 : 0), y + 1 + ((_label$shift$y2 = label.shift.y) !== null && _label$shift$y2 !== void 0 ? _label$shift$y2 : 0)], + angle: label.angle + }); + } } - drawVector(ctx, [x - 5, y, x, y], { - color: (_ref5 = axis.arrow && axis.arrow.color) !== null && _ref5 !== void 0 ? _ref5 : axis.line.color - }); - drawText(ctx, labelYValue.toString(), [padding.left - 10, y + 1], { - color: (_ref6 = axis.label && axis.label.color) !== null && _ref6 !== void 0 ? _ref6 : o.color, - align: 'right', - font - }); + value += labelStep; + y = padding.top + this.viewHeight - (value - this.minY) * this.ratioY; } }, axisXY() { - var o = this.options; - if (!o.axis) return; + if (!this.options.axis) return; this.axisX(); this.arrowX(); this.axisY(); @@ -1237,7 +1352,7 @@ if (!o.graphSize) { data = data.slice(1); } else { - if (data.length === o.graphSize) { + if (data.length >= o.graphSize) { data = data.slice(1); } } @@ -1245,8 +1360,10 @@ this.data[index].data = data; this.data[index].data.push([x, y]); - this.calcMinMax(); - this.calcRatio(); + this.minX = data[0][0]; + this.maxX = x; + if (y < this.minY) this.minY = y; + if (y > this.maxY) this.maxY = y; this.resize(); } @@ -1487,55 +1604,6 @@ Object.assign(AreaChart.prototype, MixinAddPoint); var areaChart = (el, data, options) => new AreaChart(el, data, options); - function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; - } - - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - - return keys; - } - - function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; - } - var defaultBarChartOptions = { groupDistance: 0, barDistance: 0, @@ -1992,8 +2060,9 @@ axis: defaultAxis, cross: defaultCross, showDots: true, - type: 'line' // line, curve - + type: 'line', + // line, curve + accuracy: 2 }; var drawCurve = function drawCurve(ctx) { @@ -2265,10 +2334,7 @@ color: '#fff' }, showValue: false, - holeSize: 0, - legend: { - vertical: true - }, + padding: 0, onDrawValue: null }; @@ -2296,12 +2362,13 @@ class PieChart extends Chart { constructor(el, data, options) { super(el, data, merge({}, defaultPieChartOptions, options), 'pie'); - this.total = this.data.reduce((acc, curr) => acc + curr.data, 0); + this.total = this.data.reduce((acc, curr) => acc + curr, 0); this.legendItems = []; + var legend = this.options.legend; - if (this.options.legend && this.data.length) { - for (var i = 0; i < this.data.length; i++) { - this.legendItems.push([this.data[i].name, this.options.colors[i]]); + if (legend && legend.titles && legend.titles.length) { + for (var i = 0; i < legend.titles.length; i++) { + this.legendItems.push([legend.titles[i], this.options.colors[i], this.data[i]]); } } @@ -2311,21 +2378,19 @@ sectors() { var ctx = this.ctx, o = this.options; - expandPadding(o.padding); var [x, y] = this.center; var radius = this.radius; var startAngle = 0, endAngle = 360, offset = 0, - val = '', textVal = ''; var textX, textY; if (!this.data || !this.data.length) return; for (var i = 0; i < this.data.length; i++) { - var sector = this.data[i]; + var _val = this.data[i]; var color = o.colors[i]; - endAngle = 2 * Math.PI * sector.data / this.total; + endAngle = 2 * Math.PI * _val / this.total; drawSector(ctx, [x, y, radius, startAngle, startAngle + endAngle], { fill: color, color: color @@ -2333,29 +2398,26 @@ startAngle += endAngle; } - if (o.holeSize) { - drawCircle(ctx, [x, y, o.holeSize], { - color: '#fff' - }); - } - startAngle = 0; for (var _i = 0; _i < this.data.length; _i++) { - var _sector = this.data[_i], + var _ref; + + var _val2 = this.data[_i], percent = void 0; - endAngle = 2 * Math.PI * _sector.data / this.total; - offset = o.holeSize / 2; - percent = Math.round(_sector.data * 100 / this.total); - textVal = o.showValue ? _sector.data : percent + "%"; + var name = (_ref = this.legendItems[_i] && this.legendItems[_i][0]) !== null && _ref !== void 0 ? _ref : ""; + endAngle = 2 * Math.PI * _val2 / this.total; + offset = 0; + percent = Math.round(_val2 * 100 / this.total); + textVal = o.showValue ? _val2 : percent + "%"; if (typeof o.onDrawValue === 'function') { - textVal = o.onDrawValue.apply(null, [_sector.name, _sector.data, percent]); + textVal = o.onDrawValue.apply(null, [name, _val2, percent]); } textX = x + (radius / 2 + offset) * Math.cos(startAngle + endAngle / 2); textY = y + (radius / 2 + offset) * Math.sin(startAngle + endAngle / 2); - var textW = getTextBoxWidth(ctx, [val + "%"], { + var textW = getTextBoxWidth(ctx, [_val2 + "%"], { font: o.labels.font }); drawText(ctx, textVal, [textX - textW / 2, textY + o.labels.font.size / 2], { @@ -2656,26 +2718,28 @@ ctx.closePath(); }; - class Gauge extends Chart { - constructor(el, data, options) { - super(el, data, merge({}, defaultGaugeOptions, options), 'gauge'); - this.resize(); - } - - _getFillColor(p, colors) { - var res = '#fff', - min = 0; + var getFillColor = (p, colors) => { + var res = '#fff', + min = 0; - for (var i = 0; i < colors.length; i++) { - var c = colors[i][0]; + for (var i = 0; i < colors.length; i++) { + var c = colors[i][0]; - if (p > min && p <= c) { - res = colors[i][1]; - min = colors[i][0]; - } + if (p >= min && p <= c) { + res = colors[i][1]; + min = colors[i][0]; } + } - return res; + return res; + }; + + class Gauge extends Chart { + constructor(el, data, options) { + super(el, data, merge({}, defaultGaugeOptions, options), 'gauge'); + this.min = this.options.boundaries.min; + this.max = this.options.boundaries.max; + this.resize(); } gauge() { @@ -2690,7 +2754,7 @@ max = PI * (2 + o.endFactor); var r = o.radius * this.radius / 100 - o.backWidth; var v = this.data[0], - p = Math.round(Math.abs(100 * (v - o.boundaries.min) / (o.boundaries.max - o.boundaries.min))); + p = Math.round(Math.abs(100 * (v - this.min) / (this.max - this.min))); var val = min + (max - min) * p / 100; var textVal = p; var colors = []; @@ -2714,7 +2778,7 @@ drawArc(ctx, [x, y, r, min, val], { size: o.valueWidth, - stroke: this._getFillColor(p, colors) + stroke: getFillColor(p, colors) }); drawText(ctx, textVal, [0, 0], { align: "center", @@ -2759,49 +2823,93 @@ } var gauge = (el, data, options) => new Gauge(el, data, options); + var donutLabel = { + font: defaultFont, + fixed: false, + color: "#000", + angle: 0, + shift: { + x: 0, + y: 0 + } + }; + var defaultDonutOptions = { + backStyle: "#a7a7a7", + fillStyle: "#8f8", + backWidth: 100, + valueWidth: 100, + radius: 100, + boundaries: { + min: 0, + max: 100 + }, + label: donutLabel, + padding: 0 + }; + class Donut extends Chart { constructor(el, data, options) { - super(el, data, merge({}, defaultGaugeOptions, options), 'gauge'); + super(el, data, merge({}, defaultDonutOptions, options), 'donut'); + this.total = this.data.reduce((acc, curr) => acc + curr, 0); + this.min = this.options.boundaries.min; + this.max = this.options.boundaries.max; + this.legendItems = []; + var legend = this.options.legend; + + if (legend && legend.titles && legend.titles.length) { + for (var i = 0; i < legend.titles.length; i++) { + this.legendItems.push([legend.titles[i], this.options.colors[i], this.data[i]]); + } + } + this.resize(); } gauge() { var ctx = this.ctx, - o = this.options, - padding = expandPadding(o.padding); + o = this.options; var [x, y] = this.center; - x += padding.left; - y += padding.top; - var PI = Math.PI, - min = PI * o.startFactor, - max = PI * (2 + o.endFactor); - var r = o.radius * this.radius / 100 - o.backWidth; - var v = this.data[0], - p = Math.abs(100 * (v - o.boundaries.min) / (o.boundaries.max - o.boundaries.min)); - var val = min + (max - min) * p / 100; - var textVal = p.toFixed(0); - - if (typeof o.onDrawValue === 'function') { - textVal = o.onDrawValue.apply(null, [v, p]); - } - - drawArc(ctx, [x, y, r, 0, 2 * PI], { + var PI = Math.PI; + var radius = this.radius - o.backWidth / 2; + drawArc(ctx, [x, y, radius, 0, 2 * PI], { size: o.backWidth, stroke: o.backStyle }); - drawArc(ctx, [x, y, r, min, val], { - size: o.valueWidth, - stroke: o.fillStyle - }); - drawText(ctx, textVal, [0, 0], { - align: "center", - baseLine: "middle", - color: o.value.color, - stroke: o.value.color, - font: o.value.font || o.font, - translate: [x + o.value.shift.x, y + o.value.shift.y], - angle: o.value.angle - }); + var startAngle = 0, + endAngle = 0; + + for (var i = 0; i < this.data.length; i++) { + var color = o.colors[i]; + var val = this.data[i]; + endAngle = 2 * Math.PI * val / this.total; + drawArc(ctx, [x, y, radius, startAngle, startAngle + endAngle], { + size: o.valueWidth, + stroke: color + }); + + if (o.label) { + var _ref; + + var name = (_ref = this.legendItems[i] && this.legendItems[i][0]) !== null && _ref !== void 0 ? _ref : ""; + var percent = Math.round(val * 100 / this.total); + var textVal = o.showValue ? val : percent + "%"; + var textX = void 0, + textY = void 0; + + if (typeof o.onDrawValue === 'function') { + textVal = o.onDrawValue.apply(null, [name, val, percent]); + } + + textX = x + radius * Math.cos(startAngle + endAngle / 2); + textY = y + radius * Math.sin(startAngle + endAngle / 2); + drawText(ctx, textVal, [textX, textY], { + color: o.label.color, + font: o.label.font + }); + } + + startAngle += endAngle; + } } draw() { @@ -2810,9 +2918,165 @@ this.legend(); } + resize() { + super.resize(); + this.center = [this.dpiWidth / 2, this.dpiHeight / 2]; + } + } var donut = (el, data, options) => new Donut(el, data, options); + var defaultSegmentOptions = { + segment: { + count: 100, + distance: 4, + rowDistance: 4, + height: 10, + radius: 0 + }, + ghost: { + color: "#f1f1f1" + }, + colors: [[70, '#60a917'], [90, '#f0a30a'], [100, '#a20025']], + padding: 0, + margin: 0 + }; + + var drawRoundedRect = function drawRoundedRect(ctx, _ref) { + var [x, y, width, height] = _ref; + var { + color = '#000', + fill = '#fff', + size = 1, + dash = [], + radius = 4 + } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + if (typeof radius === 'number') { + radius = { + tl: radius, + tr: radius, + br: radius, + bl: radius + }; + } else { + var defaultRadius = { + tl: 0, + tr: 0, + br: 0, + bl: 0 + }; + + for (var side in defaultRadius) { + radius[side] = radius[side] || defaultRadius[side]; + } + } + + ctx.beginPath(); + ctx.fillStyle = fill; + ctx.strokeStyle = color; + ctx.moveTo(x + radius.tl, y); + ctx.lineTo(x + width - radius.tr, y); + ctx.quadraticCurveTo(x + width, y, x + width, y + radius.tr); + ctx.lineTo(x + width, y + height - radius.br); + ctx.quadraticCurveTo(x + width, y + height, x + width - radius.br, y + height); + ctx.lineTo(x + radius.bl, y + height); + ctx.quadraticCurveTo(x, y + height, x, y + height - radius.bl); + ctx.lineTo(x, y + radius.tl); + ctx.quadraticCurveTo(x, y, x + radius.tl, y); + ctx.fill(); + ctx.stroke(); + ctx.closePath(); + }; + + class Segment extends Chart { + constructor(el, data, options) { + var values = Array.isArray(data) ? data : [data]; + var opt = merge({}, defaultOptions, defaultSegmentOptions, options); + var padding = expandPadding(opt.padding); + var { + height, + distance, + rowDistance + } = opt.segment; + var canvasHeight = ((height + rowDistance) * values.length - rowDistance + (padding.top + padding.bottom)) * opt.dpi + rowDistance; + super(el, data, _objectSpread2(_objectSpread2({}, opt), {}, { + height: canvasHeight + }), 'segment'); + this.min = 0; + this.max = 100; + this.values = values; + this.resize(); + } + + segments() { + var ctx = this.ctx, + o = this.options, + s = o.segment; + var count = s.count ? s.count : 20; + var distance = s.distance * o.dpi; + var rowDistance = s.rowDistance * o.dpi; + var width = this.viewWidth / count - distance; + var height = s.height; + var colors = []; + var padding = expandPadding(o.padding); + var x, + y = padding.top + distance; + + if (typeof o.colors === "string") { + colors.push([100, o.colors]); + } else if (Array.isArray(o.colors)) { + for (var c of o.colors) { + colors.push(c); + } + } + + for (var k = 0; k < this.values.length; k++) { + var value = this.values[k]; + var limit = count * value / 100; + x = padding.left + 1; + + for (var i = 0; i < count; i++) { + var color = getFillColor(i * 100 / count, colors); + + if (i <= limit) { + drawRoundedRect(ctx, [x, y, width, height], { + color, + fill: color, + radius: s.radius + }); + } else { + if (o.ghost) { + drawRoundedRect(ctx, [x, y, width, height], { + color: o.ghost.color, + fill: o.ghost.color, + radius: s.radius + }); + } + } + + x += width + distance; + } + + y += height + rowDistance; + } + } + + setData(data) { + var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var redraw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + this.values[index] = data; + if (redraw) this.resize(); + } + + draw() { + super.draw(); + this.segments(); + } + + } + var segment = (el, data, options) => new Segment(el, data, options); + globalThis.chart = { areaChart, barChart, @@ -2822,7 +3086,8 @@ pieChart, stackedBarChart, gauge, - donut + donut, + segment }; }()); diff --git a/client/vendor/chart/chart.min.js b/client/vendor/chart/chart.min.js index 2bbb65c..94f3ca5 100644 --- a/client/vendor/chart/chart.min.js +++ b/client/vendor/chart/chart.min.js @@ -7,7 +7,7 @@ */ !function(){"use strict";var t={width:1,lineType:"solid",color:"#e3e3e3",radius:0},i={style:"normal",family:"Helvetica, sans-serif",size:12,weight:"normal",lineHeight:1.2,color:"#000"},e=Object.assign({},i,{weight:"bold"}),a={dpi:1,height:200,width:"100%",padding:{top:40,bottom:40,left:40,right:40},margin:{top:0,bottom:0,left:0,right:0},background:"#fff",color:"#000",font:i,border:t,title:{display:!0,align:"center", // start, center, end -rtl:!1,color:"#000",text:"",font:Object.assign({},i,{weight:"bold",size:24}),padding:{top:10,bottom:10,left:10,right:10}},legend:{rtl:!1,margin:{top:20,left:0,right:0,bottom:0},padding:{top:0,left:0,right:0,bottom:0},font:e,border:t,dash:[],background:"#fff",vertical:!1,position:"top-left"},tooltip:{width:"auto",background:"#fff",color:"#000",font:i,border:t,padding:{top:10,bottom:10,left:10,right:10},shadow:{shiftX:2,shiftY:2,blur:4,stretch:0,color:"rgba(0,0,0,.5)"}},boundaries:!1,accuracy:2,colors:Object.values({aliceBlue:"#f0f8ff",antiqueWhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedAlmond:"#ffebcd",blue:"#0000ff",blueViolet:"#8a2be2",brown:"#a52a2a",burlyWood:"#deb887",cadetBlue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerBlue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkBlue:"#00008b",darkCyan:"#008b8b",darkGoldenRod:"#b8860b",darkGray:"#a9a9a9",darkGreen:"#006400",darkKhaki:"#bdb76b",darkMagenta:"#8b008b",darkOliveGreen:"#556b2f",darkOrange:"#ff8c00",darkOrchid:"#9932cc",darkRed:"#8b0000",darkSalmon:"#e9967a",darkSeaGreen:"#8fbc8f",darkSlateBlue:"#483d8b",darkSlateGray:"#2f4f4f",darkTurquoise:"#00ced1",darkViolet:"#9400d3",deepPink:"#ff1493",deepSkyBlue:"#00bfff",dimGray:"#696969",dodgerBlue:"#1e90ff",fireBrick:"#b22222",floralWhite:"#fffaf0",forestGreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#DCDCDC",ghostWhite:"#F8F8FF",gold:"#ffd700",goldenRod:"#daa520",gray:"#808080",green:"#008000",greenYellow:"#adff2f",honeyDew:"#f0fff0",hotPink:"#ff69b4",indianRed:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderBlush:"#fff0f5",lawnGreen:"#7cfc00",lemonChiffon:"#fffacd",lightBlue:"#add8e6",lightCoral:"#f08080",lightCyan:"#e0ffff",lightGoldenRodYellow:"#fafad2",lightGray:"#d3d3d3",lightGreen:"#90ee90",lightPink:"#ffb6c1",lightSalmon:"#ffa07a",lightSeaGreen:"#20b2aa",lightSkyBlue:"#87cefa",lightSlateGray:"#778899",lightSteelBlue:"#b0c4de",lightYellow:"#ffffe0",lime:"#00ff00",limeGreen:"#32dc32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumAquaMarine:"#66cdaa",mediumBlue:"#0000cd",mediumOrchid:"#ba55d3",mediumPurple:"#9370db",mediumSeaGreen:"#3cb371",mediumSlateBlue:"#7b68ee",mediumSpringGreen:"#00fa9a",mediumTurquoise:"#48d1cc",mediumVioletRed:"#c71585",midnightBlue:"#191970",mintCream:"#f5fffa",mistyRose:"#ffe4e1",moccasin:"#ffe4b5",navajoWhite:"#ffdead",navy:"#000080",oldLace:"#fdd5e6",olive:"#808000",oliveDrab:"#6b8e23",orange:"#ffa500",orangeRed:"#ff4500",orchid:"#da70d6",paleGoldenRod:"#eee8aa",paleGreen:"#98fb98",paleTurquoise:"#afeeee",paleVioletRed:"#db7093",papayaWhip:"#ffefd5",peachPuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderBlue:"#b0e0e6",purple:"#800080",rebeccaPurple:"#663399",red:"#ff0000",rosyBrown:"#bc8f8f",royalBlue:"#4169e1",saddleBrown:"#8b4513",salmon:"#fa8072",sandyBrown:"#f4a460",seaGreen:"#2e8b57",seaShell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",slyBlue:"#87ceeb",slateBlue:"#6a5acd",slateGray:"#708090",snow:"#fffafa",springGreen:"#00ff7f",steelBlue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whiteSmoke:"#f5f5f5",yellow:"#ffff00",yellowGreen:"#9acd32"}),animate:!1,onDrawLabelY:null,onDrawLabelX:null,onTooltipShow:null,onHover:null,onLeave:null}; +rtl:!1,color:"#000",text:"",font:Object.assign({},i,{weight:"bold",size:24}),padding:{top:10,bottom:10,left:10,right:10}},legend:{rtl:!1,margin:{top:20,left:0,right:0,bottom:0},padding:{top:0,left:0,right:0,bottom:0},font:e,border:t,dash:[],background:"#fff",vertical:!1,position:"top-left"},tooltip:{width:"auto",background:"#fff",color:"#000",font:i,border:t,padding:{top:10,bottom:10,left:10,right:10},shadow:{shiftX:2,shiftY:2,blur:4,stretch:0,color:"rgba(0,0,0,.5)"}},boundaries:!1,colors:Object.values({aliceBlue:"#f0f8ff",antiqueWhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedAlmond:"#ffebcd",blue:"#0000ff",blueViolet:"#8a2be2",brown:"#a52a2a",burlyWood:"#deb887",cadetBlue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerBlue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkBlue:"#00008b",darkCyan:"#008b8b",darkGoldenRod:"#b8860b",darkGray:"#a9a9a9",darkGreen:"#006400",darkKhaki:"#bdb76b",darkMagenta:"#8b008b",darkOliveGreen:"#556b2f",darkOrange:"#ff8c00",darkOrchid:"#9932cc",darkRed:"#8b0000",darkSalmon:"#e9967a",darkSeaGreen:"#8fbc8f",darkSlateBlue:"#483d8b",darkSlateGray:"#2f4f4f",darkTurquoise:"#00ced1",darkViolet:"#9400d3",deepPink:"#ff1493",deepSkyBlue:"#00bfff",dimGray:"#696969",dodgerBlue:"#1e90ff",fireBrick:"#b22222",floralWhite:"#fffaf0",forestGreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#DCDCDC",ghostWhite:"#F8F8FF",gold:"#ffd700",goldenRod:"#daa520",gray:"#808080",green:"#008000",greenYellow:"#adff2f",honeyDew:"#f0fff0",hotPink:"#ff69b4",indianRed:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderBlush:"#fff0f5",lawnGreen:"#7cfc00",lemonChiffon:"#fffacd",lightBlue:"#add8e6",lightCoral:"#f08080",lightCyan:"#e0ffff",lightGoldenRodYellow:"#fafad2",lightGray:"#d3d3d3",lightGreen:"#90ee90",lightPink:"#ffb6c1",lightSalmon:"#ffa07a",lightSeaGreen:"#20b2aa",lightSkyBlue:"#87cefa",lightSlateGray:"#778899",lightSteelBlue:"#b0c4de",lightYellow:"#ffffe0",lime:"#00ff00",limeGreen:"#32dc32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumAquaMarine:"#66cdaa",mediumBlue:"#0000cd",mediumOrchid:"#ba55d3",mediumPurple:"#9370db",mediumSeaGreen:"#3cb371",mediumSlateBlue:"#7b68ee",mediumSpringGreen:"#00fa9a",mediumTurquoise:"#48d1cc",mediumVioletRed:"#c71585",midnightBlue:"#191970",mintCream:"#f5fffa",mistyRose:"#ffe4e1",moccasin:"#ffe4b5",navajoWhite:"#ffdead",navy:"#000080",oldLace:"#fdd5e6",olive:"#808000",oliveDrab:"#6b8e23",orange:"#ffa500",orangeRed:"#ff4500",orchid:"#da70d6",paleGoldenRod:"#eee8aa",paleGreen:"#98fb98",paleTurquoise:"#afeeee",paleVioletRed:"#db7093",papayaWhip:"#ffefd5",peachPuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderBlue:"#b0e0e6",purple:"#800080",rebeccaPurple:"#663399",red:"#ff0000",rosyBrown:"#bc8f8f",royalBlue:"#4169e1",saddleBrown:"#8b4513",salmon:"#fa8072",sandyBrown:"#f4a460",seaGreen:"#2e8b57",seaShell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",slyBlue:"#87ceeb",slateBlue:"#6a5acd",slateGray:"#708090",snow:"#fffafa",springGreen:"#00ff7f",steelBlue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whiteSmoke:"#f5f5f5",yellow:"#ffff00",yellowGreen:"#9acd32"}),animate:!1,onDrawLabelY:null,onDrawLabelX:null,onTooltipShow:null,onHover:null,onLeave:null}; /** * Simple object check. * @param item @@ -18,15 +18,19 @@ function s(t){return t&&"object"==typeof t&&!Array.isArray(t)} * Deep merge two objects. * @param target * @param ...sources - */function o(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),a=1;a3&&void 0!==arguments[3]?arguments[3]:{},{style:f="normal",weight:u="normal",size:p=12,lineHeight:g=1,family:m="sans-serif"}=h,v=0,b=0;"number"==typeof c?v=b=c:Array.isArray(c)&&([v,b]=c),t.save(),t.beginPath(),t.textAlign=o,t.fillStyle=n,t.strokeStyle=l,t.font="".concat(f," ").concat(u," ").concat(p,"px/").concat(g," ").concat(m),t.translate(v,b),t.rotate(d),t.textBaseline=r;var x=i.toString().split("\n");x.map(((i,e)=>{t.fillText(i,a,s+s*e*g)})),t.closePath(),t.restore()},n=(t,i,e)=>{var a,{font:s=null}=e,o=0;if(t.save(),s){var{style:r="normal",weight:n="normal",size:l=12,lineHeight:h=1.2,family:d="sans-serif"}=s;t.font="".concat(r," ").concat(n," ").concat(l,"px/").concat(h," ").concat(d)}for(var c=0;co&&(o=a);return t.restore(),o},l=function(t,i){var[e,a,s]=i,{color:o="#000",fill:r="#fff",size:n=1,dash:l=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(l),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.rect(e-s,a-s,2*s,2*s),t.fill(),t.stroke(),t.restore(),t.closePath()},h=t=>"number"==typeof t?{top:t,left:t,right:t,bottom:t}:t,d=t=>"number"==typeof t?{top:t,left:t,right:t,bottom:t}:t,c={legend(){return!0===this.options.legend.vertical?this.legendVertical():this.legendHorizontal()},legendHorizontal(){var t,i,e,a,o=this.options,c=h(o.padding),f=o.legend,u=h(f.padding),p=d(f.margin),g=this.ctx,m=this.legendItems,v=0;if(f&&s(f)&&m&&Array.isArray(m)&&m.length){a=f.font.size/2,t=f.font.size*f.font.lineHeight,e=c.top+this.viewHeight+f.font.size+u.top+p.top,i=c.left+u.left+p.left;for(var b=0;bthis.viewWidth&&(i=c.left+u.left+p.left,e+=t),l(g,[v+i,e,a],{color:X,fill:X}),r(g,w,[v+i+a+5,e+a/2],{color:f.font.color,stroke:f.font.color,font:o.font}),i+=a+Y+20}}},legendVertical(){var t,i,e,a,o,c,f=this.options,u=f.legend,p=null!==(t=u.font)&&void 0!==t?t:f.font,g=p.size/2,m=this.ctx,v=this.legendItems,b=h(u.padding),x=d(u.margin),y=h(f.padding);if(u&&s(u)&&v&&Array.isArray(v)&&v.length){i=p.size*p.lineHeight,o=n(m,v,{font:p})+b.left+b.right+3*g+5,c=v.length*i+b.top+b.bottom+5,"top-left"===u.position?(e=y.left+x.left,a=y.top+x.top):"top-right"===u.position?(e=this.dpiWidth-o-x.right-y.right,a=y.top+x.top):"bottom-left"===u.position?(e=y.left+x.left,a=this.dpiHeight-c-y.bottom+x.bottom):(e=this.dpiWidth-o-x.right-y.right,a=this.dpiHeight-c-y.bottom+x.bottom),function(t,i){var[e,a,s,o]=i,{color:r="#fff",borderColor:n="#000",dash:l=[],size:h=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.save(),t.beginPath(),t.strokeStyle=n,t.fillStyle=r,t.setLineDash(l),t.lineWidth=h,t.clearRect(e,a,s,o),t.fillRect(e,a,s,o),h&&t.strokeRect(e,a,s,o),t.closePath(),t.restore()}(m,[e,a,o,c],{color:u.background,dash:u.dash,size:u.border.width,borderColor:u.border.color}),e+=g+5+b.left,a+=g+5+b.top;for(var w=0;w1&&void 0!==arguments[1]?arguments[1]:[],e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unknown";if(this.el=document.querySelector(t),!this.el)throw new Error("You must define a selector for chart wrapper element!");this.options=o({},a,e),this.data=i,this.canvas=null,this.ctx=null,this.raf=null,this.tooltip=null,this.legendItems=[],this.chartType=s,this.rect=this.el.getBoundingClientRect(),this.canvasRect=null,this.static=!1;var r=this;this.proxy=new Proxy({},{set(){var t=Reflect.set(...arguments);return r.raf=requestAnimationFrame(r.draw.bind(r)),t}}),this.options.border&&(this.el.style.border="".concat(this.options.border.width,"px ").concat(this.options.border.lineType," ").concat(this.options.border.color)),this.calcInternalValues(),this.createCanvas(),this.addEvents()}createCanvas(){this.canvas=document.createElement("canvas"),this.el.innerHTML="",this.el.style.overflow="hidden",this.el.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d"),this.setCanvasSize(),this.canvasRect=this.canvas.getBoundingClientRect()}setCanvasSize(){var t=this.options;this.canvas.style.height=this.height+"px",this.canvas.style.width=this.width+"px",this.canvas.width=t.dpi*this.width,this.canvas.height=t.dpi*this.height}calcInternalValues(){var t,i,e=this.options,a=h(e.padding),s=this.el.getBoundingClientRect(),{width:o,height:r}=s;t=e.width.toString().includes("%")?o/100*parseInt(e.width):+e.width,i=e.height.toString().includes("%")?r/100*parseInt(e.height):+e.height,this.width=t,this.height=i,this.dpiHeight=e.dpi*i,this.dpiWidth=e.dpi*t,this.viewHeight=this.dpiHeight-(a.top+a.bottom),this.viewWidth=this.dpiWidth-(a.left+a.right),this.center=[this.dpiWidth/2,this.dpiHeight/2],this.radius=Math.min(this.viewHeight,this.viewWidth)/2}title(){var t,i=this.options.title,e=this.ctx;if(i&&i.text){var{text:a,align:s,color:o,font:n}=i;switch(s){case"center":t=this.dpiWidth/2;break;case"right":t=this.dpiWidth-5;break;default:t=5}r(e,a,[t,n.size+5],{align:i.align,color:i.color,stroke:i.color,font:i.font})}}draw(){this.clear(),this.title()}clear(){this.ctx.clearRect(0,0,this.dpiWidth,this.dpiHeight)}setData(t,i){void 0!==i?this.data[i].data=t:this.data=t,this.draw()}mouseMove(t){var i=this.options.onHover,{clientX:e,clientY:a}=t.changedTouches?t.touches[0]:t;"function"==typeof i&&i.apply(null,[e,a]),this.proxy.mouse={x:e,y:a},t.cancelable&&t.preventDefault()}mouseLeave(){var t=this.options.onLeave;"function"==typeof t&&t.apply(null,[]),this.proxy.mouse=null}resize(){this.calcInternalValues(),this.setCanvasSize(),this.rect=this.el.getBoundingClientRect(),this.canvasRect=this.canvas.getBoundingClientRect(),this.draw()}addEvents(){var t=this.canvas;t.addEventListener("mousemove",this.mouseMove.bind(this)),t.addEventListener("touchmove",this.mouseMove.bind(this),{passive:!1}),t.addEventListener("mouseleave",this.mouseLeave.bind(this)),window.addEventListener("resize",this.resize.bind(this))}destroy(){var t=this.canvas;cancelAnimationFrame(this.raf),t.removeEventListener("mousemove",this.mouseMove.bind(this)),t.removeEventListener("mouseleave",this.mouseLeave.bind(this)),window.removeEventListener("resize",this.resize.bind(this))}}Object.assign(u.prototype,c),Object.assign(u.prototype,f);var p={arrow:{color:"#000",size:1,dash:[],factorX:5,factorY:5},line:{color:"#e3e3e3",size:1,dash:[],count:5,show:!0},label:{color:"#000",font:e,count:5, -// odd, even, num -show:!0,first:!0,last:!0,fixed:!1}},g={x:p,y:p},m={size:1,color:"#bbb",dash:[5,3]},v={axis:g,cross:m,showDots:!0},b=function(){var t,i,e,a,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"x";if("number"==typeof o)a=o;else switch(o.toString().toLowerCase()){case"y":a=1;break;case"z":a=2;break;default:a=0}for(var r of s)e=r[a],(isNaN(t)||t>e)&&(t=e),(isNaN(i)||i0&&void 0!==arguments[0]?arguments[0]:[];return[Math.min.apply(null,t),Math.max.apply(null,t)]},y=function(t,i){var[e,a,s]=i,{color:o="#000",fill:r="#fff",size:n=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.arc(e,a,s,0,2*Math.PI),t.fill(),t.stroke(),t.restore(),t.closePath()},w=function(t,i){var[e,a,s]=i,{color:o="#000",fill:r="#fff",size:n=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.moveTo(e,a-s),t.lineTo(e+s,a+s),t.lineTo(e-s,a+s),t.lineTo(e,a-s),t.fill(),t.stroke(),t.restore(),t.closePath()},X=function(t,i){var[e,a,s]=i,{color:o="#000",fill:r="#fff",size:n=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.moveTo(e,a-s),t.lineTo(e+s,a),t.lineTo(e,a+s),t.lineTo(e-s,a),t.lineTo(e,a-s),t.fill(),t.stroke(),t.restore(),t.closePath()},Y={cross(){var t=this.options,i=t.cross,e=h(t.padding),a=this.ctx,s=this.canvas.getBoundingClientRect();if(t.cross&&(!t.cross||this.proxy.mouse)){var{x:o,y:r}=this.proxy.mouse;o-=s.left,r-=s.top,o-e.left+1<0||o>this.viewWidth+e.left+1||r-e.top+1<0||r>this.viewHeight+e.top+1||(a.beginPath(),a.setLineDash(t.cross.dash),a.lineWidth=i.size,a.strokeStyle=i.color,// vertical line + */function o(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),a=1;a3&&void 0!==arguments[3]?arguments[3]:{},{style:f="normal",weight:u="normal",size:p=12,lineHeight:g=1,family:m="sans-serif"}=l,v=0,b=0;"number"==typeof c?v=b=c:Array.isArray(c)&&([v,b]=c),t.save(),t.beginPath(),t.textAlign=o,t.fillStyle=n,t.strokeStyle=h,t.font="".concat(f," ").concat(u," ").concat(p,"px/").concat(g," ").concat(m),t.translate(v,b),t.rotate(d*Math.PI/180),t.textBaseline=r;var x=i.toString().split("\n");x.map(((i,e)=>{t.fillText(i,a,s+s*e*g)})),t.closePath(),t.restore()},n=(t,i,e)=>{var a,{font:s=null}=e,o=0;if(t.save(),s){var{style:r="normal",weight:n="normal",size:h=12,lineHeight:l=1.2,family:d="sans-serif"}=s;t.font="".concat(r," ").concat(n," ").concat(h,"px/").concat(l," ").concat(d)}for(var c=0;co&&(o=a);return t.restore(),o},h=function(t,i){var[e,a,s]=i,{color:o="#000",fill:r="#fff",size:n=1,dash:h=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(h),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.rect(e-s,a-s,2*s,2*s),t.fill(),t.stroke(),t.restore(),t.closePath()},l=t=>"number"==typeof t?{top:t,left:t,right:t,bottom:t}:t,d=t=>"number"==typeof t?{top:t,left:t,right:t,bottom:t}:t,c={legend(){return!0===this.options.legend.vertical?this.legendVertical():this.legendHorizontal()},legendHorizontal(){var t=this.options,i=l(t.padding),e=t.legend,a=this.ctx,o=this.legendItems;if(e&&s(e)&&o&&Array.isArray(o)&&o.length){var c,f,u,p,g=l(e.padding),m=d(e.margin),v=0;p=e.font.size/2,c=e.font.size*e.font.lineHeight,u=i.top+i.bottom+this.viewHeight-(e.font.size+g.top+m.top),f=i.left+g.left+m.left;for(var b=0;bthis.viewWidth&&(f=i.left+g.left+m.left,u+=c),h(a,[v+f,u,p],{color:k,fill:k}),r(a,e.showValue?"".concat(Y," - ").concat(z):Y,[v+f+p+5,u+p/2],{color:e.font.color,stroke:e.font.color,font:t.font}),f+=p+W+20}}},legendVertical(){var t,i,e,a,o,c,f=this.options,u=f.legend,p=null!==(t=u.font)&&void 0!==t?t:f.font,g=p.size/2,m=this.ctx,v=this.legendItems,b=l(u.padding),x=d(u.margin),y=l(f.padding);if(u&&s(u)&&v&&Array.isArray(v)&&v.length){i=p.size*p.lineHeight,o=n(m,v,{font:p})+b.left+b.right+3*g+5,c=v.length*i+b.top+b.bottom+5,"top-left"===u.position?(e=b.left+x.left,a=b.top+x.top):"top-right"===u.position?(e=this.dpiWidth-o-x.right-y.right,a=b.top+x.top):"bottom-left"===u.position?(e=b.left+x.left,a=this.dpiHeight-c-b.bottom+x.bottom):(e=this.dpiWidth-o-x.right-b.right,a=this.dpiHeight-c-b.bottom+x.bottom),function(t,i){var[e,a,s,o]=i,{color:r="#fff",borderColor:n="#000",dash:h=[],size:l=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.save(),t.beginPath(),t.strokeStyle=n,t.fillStyle=r,t.setLineDash(h),t.lineWidth=l,t.clearRect(e,a,s,o),t.fillRect(e,a,s,o),l&&t.strokeRect(e,a,s,o),t.closePath(),t.restore()}(m,[e,a,o,c],{color:u.background,dash:u.dash,size:u.border.width,borderColor:u.border.color}),e+=g+5+b.left,a+=g+5+b.top;for(var w=0;w1&&void 0!==arguments[1]?arguments[1]:[],e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unknown";if(this.el=document.querySelector(t),!this.el)throw new Error("You must define a selector for chart wrapper element!");this.options=o({},a,e),this.data=i,this.canvas=null,this.ctx=null,this.raf=null,this.tooltip=null,this.legendItems=[],this.chartType=s,this.rect=this.el.getBoundingClientRect(),this.canvasRect=null,this.static=!1;var r=this;this.proxy=new Proxy({},{set(){var t=Reflect.set(...arguments);return r.raf=requestAnimationFrame(r.draw.bind(r)),t}}),this.options.border&&(this.el.style.border="".concat(this.options.border.width,"px ").concat(this.options.border.lineType," ").concat(this.options.border.color)),this.calcInternalValues(),this.createCanvas(),this.addEvents()}createCanvas(){this.canvas=document.createElement("canvas"),this.el.innerHTML="",this.el.style.overflow="hidden",this.el.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d"),this.setCanvasSize(),this.canvasRect=this.canvas.getBoundingClientRect()}setCanvasSize(){var t=this.options;this.canvas.style.height=this.height+"px",this.canvas.style.width=this.width+"px",this.canvas.width=t.dpi*this.width,this.canvas.height=t.dpi*this.height}calcInternalValues(){var t,i,e=this.options,a=l(e.padding),s=this.el.getBoundingClientRect(),{width:o,height:r}=s;t=e.width.toString().includes("%")?o/100*parseInt(e.width):+e.width,i=e.height.toString().includes("%")?r/100*parseInt(e.height):+e.height,this.width=t,this.height=i,this.dpi=e.dpi,this.dpiHeight=this.dpi*i,this.dpiWidth=this.dpi*t,this.viewHeight=this.dpiHeight-(a.top+a.bottom),this.viewWidth=this.dpiWidth-(a.left+a.right),this.center=[this.dpiWidth/2,this.dpiHeight/2],this.radius=Math.min(this.viewHeight,this.viewWidth)/2}title(){var t,i=this.options.title,e=this.ctx;if(i&&i.text){var{text:a,align:s,color:o,font:n}=i;switch(s){case"center":t=this.dpiWidth/2;break;case"right":t=this.dpiWidth-5;break;default:t=5}r(e,a,[t,n.size+5],{align:i.align,color:i.color,stroke:i.color,font:i.font})}}draw(){this.clear(),this.title()}clear(){this.ctx.clearRect(0,0,this.dpiWidth,this.dpiHeight)}setData(t,i){var e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];void 0!==i?this.data[i].data=t:this.data=t,e&&this.resize()}setBoundaries(t){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=["minX","minY","minZ","maxX","maxY","maxZ","min","max"];for(var a in t)e.includes(a)&&(this[a]=t[a],this.options.boundaries[a]=t[a]);i&&this.draw()}mouseMove(t){var i=this.options.onHover,{clientX:e,clientY:a}=t.changedTouches?t.touches[0]:t;"function"==typeof i&&i.apply(null,[e,a]),this.proxy.mouse={x:e,y:a},t.cancelable&&t.preventDefault()}mouseLeave(){var t=this.options.onLeave;"function"==typeof t&&t.apply(null,[]),this.proxy.mouse=null}resize(){this.calcInternalValues(),this.setCanvasSize(),this.rect=this.el.getBoundingClientRect(),this.canvasRect=this.canvas.getBoundingClientRect(),this.draw()}addEvents(){var t=this.canvas;t.addEventListener("mousemove",this.mouseMove.bind(this)),t.addEventListener("touchmove",this.mouseMove.bind(this),{passive:!1}),t.addEventListener("mouseleave",this.mouseLeave.bind(this)),window.addEventListener("resize",this.resize.bind(this))}destroy(){var t=this.canvas;cancelAnimationFrame(this.raf),t.removeEventListener("mousemove",this.mouseMove.bind(this)),t.removeEventListener("mouseleave",this.mouseLeave.bind(this)),window.removeEventListener("resize",this.resize.bind(this))}}function p(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function g(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);i&&(a=a.filter((function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable}))),e.push.apply(e,a)}return e}function m(t){for(var i=1;i0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"x";if("number"==typeof o)a=o;else switch(o.toString().toLowerCase()){case"y":a=1;break;case"z":a=2;break;default:a=0}for(var r of s)e=r[a],(isNaN(t)||t>e)&&(t=e),(isNaN(i)||i0&&void 0!==arguments[0]?arguments[0]:[];return[Math.min.apply(null,t),Math.max.apply(null,t)]},k=function(t,i){var[e,a,s]=i,{color:o="#000",fill:r="#fff",size:n=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.arc(e,a,s,0,2*Math.PI),t.fill(),t.stroke(),t.restore(),t.closePath()},z=function(t,i){var[e,a,s]=i,{color:o="#000",fill:r="#fff",size:n=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.moveTo(e,a-s),t.lineTo(e+s,a+s),t.lineTo(e-s,a+s),t.lineTo(e,a-s),t.fill(),t.stroke(),t.restore(),t.closePath()},W=function(t,i){var[e,a,s]=i,{color:o="#000",fill:r="#fff",size:n=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.moveTo(e,a-s),t.lineTo(e+s,a),t.lineTo(e,a+s),t.lineTo(e-s,a),t.lineTo(e,a-s),t.fill(),t.stroke(),t.restore(),t.closePath()},N={cross(){var t=this.options,i=t.cross,e=l(t.padding),a=this.ctx,s=this.canvas.getBoundingClientRect();if(t.cross&&(!t.cross||this.proxy.mouse)){var{x:o,y:r}=this.proxy.mouse;o-=s.left,r-=s.top,o-e.left+1<0||o>this.viewWidth+e.left+1||r-e.top+1<0||r>this.viewHeight+e.top+1||(a.beginPath(),a.setLineDash(t.cross.dash),a.lineWidth=i.size,a.strokeStyle=i.color,// vertical line a.moveTo(o,e.top),a.lineTo(o,this.viewHeight+e.top),// Horizontal line -a.moveTo(e.left,r),a.lineTo(this.viewWidth+e.left,r),a.arc(o,r,10,0,2*Math.PI),a.stroke(),a.closePath())}}},k=function(t,i){var[e,a,s,o]=i,{color:r="#000",size:n=1,dash:l=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(l),t.lineWidth=n,t.strokeStyle=r,t.moveTo(e,a),t.lineTo(s,o),t.stroke(),t.restore(),t.closePath()},z={arrowX(){var t=this.options,i=this.ctx,e=h(t.padding),a=e.left,s=this.viewHeight+e.top,o=a+this.viewWidth,r=s;if(t.axis.x.arrow){var n=t.axis.x.arrow;!function(t,i){var[e,a,s,o,r,n]=i,{color:l="#000",dash:h=[],size:d=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.strokeStyle=l,t.lineWidth=d,t.setLineDash(h),t.moveTo(e,a),t.lineTo(s,o),t.moveTo(s,o),t.lineTo(s-r,o-n),t.moveTo(s,o),t.lineTo(s-r,o+n),t.stroke(),t.closePath()}(i,[a,s,o,r,n.factorX,n.factorY],{color:n.color,size:n.size,dash:n.dash})}},axisX(){var t,i=this.ctx,e=this.options,a=h(e.padding);if(e.axis.x)for(var s=e.axis.x,o=null!==(t=s&&s.label&&s.label.font)&&void 0!==t?t:e.font,n=this.viewWidth/s.line.count,l=(this.maxX-this.minX)/s.line.count,d=Math.round(s.line.count/s.label.count),c=0;c<=s.line.count;c++){var f,u,p=n*c+a.left,g=this.minX+l*c;"number"==typeof s.label.fixed&&(g=g.toFixed(s.label.fixed)),s.line.show&&k(i,[p,a.top,p,this.viewHeight+a.top],{color:s.line.color,size:s.line.size,dash:s.line.dash}),s.label.show&&(d&&c&&c%d!=0||(s.label.first||0!==c)&&(s.label.last||c!==s.line.count)&&("function"==typeof e.onDrawLabelX&&(g=e.onDrawLabelX.apply(null,[g])),// if (x + ctx.measureText(labelXValue.toString()).width > this.viewWidth) continue -k(i,[p,this.viewHeight+a.top,p,this.viewHeight+a.top+5],{color:null!==(f=s.arrow&&s.arrow.color)&&void 0!==f?f:s.line.color}),r(i,g.toString(),[p,this.viewHeight+a.top+o.size+5],{color:null!==(u=s.label&&s.label.color)&&void 0!==u?u:e.color,align:"center",font:o})))}},arrowY(){var t=this.options,i=this.ctx,e=h(t.padding),a=e.left,s=this.viewHeight+e.top,o=a,r=e.top;if(t.axis.y.arrow){var n=t.axis.y.arrow;!function(t,i){var[e,a,s,o,r,n]=i,{color:l="#000",dash:h=[],size:d=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.strokeStyle=l,t.lineWidth=d,t.setLineDash(h),t.moveTo(e,a),t.lineTo(s,o),t.moveTo(s,o),t.lineTo(s-r,o+n),t.moveTo(s,o),t.lineTo(s+r,o+n),t.stroke(),t.closePath()}(i,[a,s,o,r,n.factorX,n.factorY],{color:n.color,size:n.size,dash:n.dash})}},axisY(){var t,i=this.ctx,e=this.options,a=h(e.padding);if(e.axis.y)for(var s=e.axis.y,o=null!==(t=s&&s.label&&s.label.font)&&void 0!==t?t:e.font,n=this.viewHeight/s.line.count,l=(this.maxY-this.minY)/s.line.count,d=Math.floor(s.line.count/s.label.count),c=0;c2&&void 0!==arguments[2])||arguments[2],r=this.options;this.data&&this.data.length&&(e=this.data[t].data,o&&(r.graphSize?e.length===r.graphSize&&(e=e.slice(1)):e=e.slice(1)),this.data[t].data=e,this.data[t].data.push([a,s]),this.calcMinMax(),this.calcRatio(),this.resize())}},W=function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{color:e="#000",size:a=1,dash:s=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(s),t.lineWidth=a,t.strokeStyle=e,i.map((i=>{var[e,a]=i;t.lineTo(e,a)})),t.stroke(),t.restore(),t.closePath()};class M extends u{constructor(t){if(super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o({},v,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),"area"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.legendItems=[],this.options.legend)for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:[],{color:e="#000",fill:a="#000",size:s=1,dash:o=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(o),t.lineWidth=s,t.strokeStyle=e,t.fillStyle=a,i.map((i=>{var[e,a]=i;t.lineTo(e,a)})),t.lineTo(i[0][0],i[0][1]),t.fill(),t.restore(),t.closePath()}(s,t,{color:u,fill:p,size:f.size});var x=f.dots?f.dots:{type:"dot"},Y={color:null!==(h=x.color)&&void 0!==h?h:u,fill:null!==(d=x.fill)&&void 0!==d?d:u,radius:null!==(c=x.size)&&void 0!==c?c:4},k=void 0;switch(x.type){case"square":k=l;break;case"triangle":k=w;break;case"diamond":k=X;break;default:k=y}f.dots&&!1!==e.showDots&&t.map((t=>{var[i,e]=t;k(s,[i,e,Y.radius],Y)})),i.coords[f.name]={graph:f,coords:t,drawPointFn:k,opt:Y},t.shift(),t.pop(),!1!==f.showLines&&W(s,t,{color:u,fill:p,size:f.size})},r=0;rv&&rv&&rx&&n2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(h),t.lineWidth=l,t.strokeStyle=r,t.fillStyle=n,t.rect(e,a,s,o),t.fill(),t.stroke(),t.restore(),t.closePath()};class L extends u{constructor(t,i,e){super(t,i,o({},T,e),"bar"),this.groups=0,this.barWidth=0,this.maxY=0,this.maxX=0,this.minY=0,this.minX=0,this.viewAxis=this.options.dataAxisX?this.viewHeight:this.viewWidth,this.legendItems=[];var a=this.options.legend;if(a&&a.titles&&a.titles.length)for(var s=0;s0&&void 0!==arguments[0]&&arguments[0],o=this.options,n=h(o.padding),l=this.ctx,d=this.canvas.getBoundingClientRect(),c=!1;if(this.data&&this.data.length){this.proxy.mouse&&(e=this.proxy.mouse.x-d.left,a=this.proxy.mouse.y-d.top),t=s?n.left:n.left+o.groupDistance,i=s?n.top+o.groupDistance:this.viewHeight+n.top;for(var f=0;fY[0]&&ek[0]&&a2&&void 0!==arguments[2])||arguments[2],n=this.options;this.data&&this.data.length&&(e=this.data[t].data,r&&(e=(n.graphSize&&(e.length,n.graphSize),e.slice(1))),this.data[t].data=e,this.data[t].data.push([a,s,o]),this.calcMinMax(),this.calcRatio(),this.resize())}};class B extends u{constructor(t){if(super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o({},A,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),"histogram"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.legendItems=[],this.options.legend)for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(h),t.lineWidth=n,t.strokeStyle=r,t.moveTo(e,a),t.lineTo(s,o),t.stroke(),t.restore(),t.closePath()},S={arrowX(){var t=this.options,i=this.ctx,e=l(t.padding);if(t.axis.x.arrow){var a=t.axis.x.arrow,s=e.left,o=this.viewHeight+e.top;!function(t,i){var[e,a,s,o,r,n]=i,{color:h="#000",dash:l=[],size:d=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.strokeStyle=h,t.lineWidth=d,t.setLineDash(l),t.moveTo(e,a),t.lineTo(s,o),t.moveTo(s,o),t.lineTo(s-r,o-n),t.moveTo(s,o),t.lineTo(s-r,o+n),t.stroke(),t.closePath()}(i,[s,o,e.left+this.viewWidth+a.outside,o,a.factorX,a.factorY],{color:a.color,size:a.size,dash:a.dash})}},axisX(){var t,i,e=this.ctx,a=this.options,s=l(a.padding);if(a.axis.x){var o,n,h,d,c,f,u=a.axis.x,p=u.label,g=u.line,m=u.arrow,v=null!==(t=p&&p.font)&&void 0!==t?t:a.font,b=p.count?(this.maxX-this.minX)/p.count:0,x=null!==(i=g.shortLineSize)&&void 0!==i?i:0;d=s.left,c=s.top,f=s.top+this.viewHeight+v.size+5,n=this.minX,h=0;for(var y=0;y<=p.count;y++){var w,X,Y; +// short line +if(o="number"==typeof p.fixed?n.toFixed(p.fixed):n,"function"==typeof a.onDrawLabelX&&(o=a.onDrawLabelX.apply(null,[n])),p.showLine&&M(e,[d,c,d,c+this.viewHeight],{color:g.color,size:g.size,dash:g.dash}),p.skip&&h!==p.skip)h++;else if(h=1,p.showLabel&&(y||p.showMin))M(e,[d,this.viewHeight+s.top-x,d,this.viewHeight+s.top+x],{color:m&&m.color?m.color:g.color}),// label +r(e,o.toString(),[0,0],{color:null!==(w=p.color)&&void 0!==w?w:a.color,align:p.align,font:v,translate:[d+(null!==(X=p.shift.x)&&void 0!==X?X:0),f+(null!==(Y=p.shift.y)&&void 0!==Y?Y:0)],angle:p.angle});n+=b,d=s.left+(n-this.minX)*this.ratioX}}},arrowY(){var t=this.options,i=this.ctx,e=l(t.padding);if(t.axis.y.arrow){var a=t.axis.y.arrow,s=e.left;!function(t,i){var[e,a,s,o,r,n]=i,{color:h="#000",dash:l=[],size:d=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.strokeStyle=h,t.lineWidth=d,t.setLineDash(l),t.moveTo(e,a),t.lineTo(s,o),t.moveTo(s,o),t.lineTo(s-r,o+n),t.moveTo(s,o),t.lineTo(s+r,o+n),t.stroke(),t.closePath()}(i,[s,this.viewHeight+e.top,s,e.top-a.outside,a.factorX,a.factorY],{color:a.color,size:a.size,dash:a.dash})}},axisY(){var t,i,e=this.ctx,a=this.options,s=l(a.padding);if(a.axis.y){var o,n,h,d,c,f,u,p=a.axis.y,g=p.label,m=p.line,v=p.arrow,b=null!==(t=g&&g.font)&&void 0!==t?t:a.font,x=g.count?(this.maxY-this.minY)/g.count:0,y=null!==(i=m.shortLineSize)&&void 0!==i?i:0;d=s.left,f=s.left,c=this.viewHeight+s.top,n=this.minY,h=0,g.opposite?(f+=this.viewWidth+10+y,u=s.left+this.viewWidth,g.align="left"):(f-=10,u=d-y);for(var w=0;w<=g.count+1;w++){var X,Y,k; +// short line +if(o="number"==typeof g.fixed?n.toFixed(g.fixed):n,"function"==typeof a.onDrawLabelY&&(o=a.onDrawLabelY.apply(null,[n])),g.showLine&&M(e,[d,c,this.viewWidth+s.left,c],{color:m.color,size:m.size,dash:m.dash}),0!==w&&g.skip&&h!==g.skip)h++;else if(h=1,g.showLabel&&(w||g.showMin))M(e,[u,c,u+2*y,c],{color:v&&v.color?v.color:m.color}),r(e,o.toString(),[0,0],{color:null!==(X=g&&g.color)&&void 0!==X?X:a.color,align:g.align,font:b,translate:[f+(null!==(Y=g.shift.x)&&void 0!==Y?Y:0),c+1+(null!==(k=g.shift.y)&&void 0!==k?k:0)],angle:g.angle});n+=x,c=s.top+this.viewHeight-(n-this.minY)*this.ratioY}}},axisXY(){if(this.options.axis)return this.axisX(),this.arrowX(),this.axisY(),this.arrowY(),this}},D={addPoint(t,i){var e,[a,s]=i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=this.options;this.data&&this.data.length&&(e=this.data[t].data,o&&(r.graphSize?e.length>=r.graphSize&&(e=e.slice(1)):e=e.slice(1)),this.data[t].data=e,this.data[t].data.push([a,s]),this.minX=e[0][0],this.maxX=a,sthis.maxY&&(this.maxY=s),this.resize())}},P=function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{color:e="#000",size:a=1,dash:s=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(s),t.lineWidth=a,t.strokeStyle=e,i.map((i=>{var[e,a]=i;t.lineTo(e,a)})),t.stroke(),t.restore(),t.closePath()};class T extends u{constructor(t){if(super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o({},w,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),"area"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.legendItems=[],this.options.legend)for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:[],{color:e="#000",fill:a="#000",size:s=1,dash:o=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(o),t.lineWidth=s,t.strokeStyle=e,t.fillStyle=a,i.map((i=>{var[e,a]=i;t.lineTo(e,a)})),t.lineTo(i[0][0],i[0][1]),t.fill(),t.restore(),t.closePath()}(s,t,{color:u,fill:p,size:f.size});var x=f.dots?f.dots:{type:"dot"},y={color:null!==(l=x.color)&&void 0!==l?l:u,fill:null!==(d=x.fill)&&void 0!==d?d:u,radius:null!==(c=x.size)&&void 0!==c?c:4},w=void 0;switch(x.type){case"square":w=h;break;case"triangle":w=z;break;case"diamond":w=W;break;default:w=k}f.dots&&!1!==e.showDots&&t.map((t=>{var[i,e]=t;w(s,[i,e,y.radius],y)})),i.coords[f.name]={graph:f,coords:t,drawPointFn:w,opt:y},t.shift(),t.pop(),!1!==f.showLines&&P(s,t,{color:u,fill:p,size:f.size})},r=0;rv&&rv&&rx&&n2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(l),t.lineWidth=h,t.strokeStyle=r,t.fillStyle=n,t.rect(e,a,s,o),t.fill(),t.stroke(),t.restore(),t.closePath()};class A extends u{constructor(t,i,e){super(t,i,o({},L,e),"bar"),this.groups=0,this.barWidth=0,this.maxY=0,this.maxX=0,this.minY=0,this.minX=0,this.viewAxis=this.options.dataAxisX?this.viewHeight:this.viewWidth,this.legendItems=[];var a=this.options.legend;if(a&&a.titles&&a.titles.length)for(var s=0;s0&&void 0!==arguments[0]&&arguments[0],o=this.options,n=l(o.padding),h=this.ctx,d=this.canvas.getBoundingClientRect(),c=!1;if(this.data&&this.data.length){this.proxy.mouse&&(e=this.proxy.mouse.x-d.left,a=this.proxy.mouse.y-d.top),t=s?n.left:n.left+o.groupDistance,i=s?n.top+o.groupDistance:this.viewHeight+n.top;for(var f=0;fk[0]&&ez[0]&&a2&&void 0!==arguments[2])||arguments[2],n=this.options;this.data&&this.data.length&&(e=this.data[t].data,r&&(e=(n.graphSize&&(e.length,n.graphSize),e.slice(1))),this.data[t].data=e,this.data[t].data.push([a,s,o]),this.calcMinMax(),this.calcRatio(),this.resize())}};class I extends u{constructor(t){if(super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o({},R,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),"histogram"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.legendItems=[],this.options.legend)for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:[],o({},j,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),"line"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.legendItems=[],this.options.legend)for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:[],{color:e="#000",size:a=1,dash:s=[],tension:o=.25}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(s),t.lineWidth=a,t.strokeStyle=e,t.moveTo(i[0][0],i[0][1]);for(var r=0;r{i&&s(i)&&Object.assign(t,i)})),t}({type:"circle"},e.dots,c.dots),x={color:null!==(n=b.color)&&void 0!==n?n:f,fill:null!==(h=b.fill)&&void 0!==h?h:f,radius:null!==(d=b.size)&&void 0!==d?d:2},Y=void 0;switch(b.type){case"square":Y=l;break;case"triangle":Y=w;break;case"diamond":Y=X;break;default:Y=y}c.dots&&!1!==e.showDots&&t.map((t=>{var[i,e]=t;Y(o,[i,e,x.radius],x)})),i.coords[c.name]={graph:c,coords:t,drawPointFn:Y,opt:x}},n=0;nv&&rv&&rx&&n2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=h,t.strokeStyle=n,t.fillStyle=l,t.arc(e,a,s,o,r),t.lineTo(e,a),t.fill(),t.stroke(),t.restore(),t.closePath()};class q extends u{constructor(t,i,e){if(super(t,i,o({},V,e),"pie"),this.total=this.data.reduce(((t,i)=>t+i.data),0),this.legendItems=[],this.options.legend&&this.data.length)for(var a=0;at+i),0))}var[,s]=x(i);this.maxX=this.maxY=t.boundaries&&!isNaN(t.boundaries.max)?t.boundaries.maxY:s,isNaN(this.maxX)&&(this.maxX=100),isNaN(this.maxY)&&(this.maxX=100)}calcRatio(){this.ratio=(this.options.dataAxisX?this.viewWidth:this.viewHeight)/(this.maxY===this.minY?this.maxY:this.maxY-this.minY)}calcBarWidth(){var t=this.options,i=this.data.length,e=(t.dataAxisX?this.viewHeight:this.viewWidth)-(this.data.length+1)*t.groupDistance;// space between groups -this.barWidth=e/i}barsX(){var t,i,e,a,s=this.options,o=h(s.padding),n=this.ctx,l=this.canvas.getBoundingClientRect(),d=!1;if(this.data&&this.data.length){this.proxy.mouse&&(e=this.proxy.mouse.x-l.left,a=this.proxy.mouse.y-l.top),t=o.left,i=o.top+s.groupDistance;var c=Array.isArray(s.colors)?s.colors:s.colors.split(",").map((t=>t.trim()));for(var f of this.data){for(var u=f.data,p=f.name,g=c.length>1?s.color:c[0],m=0,v=0;vt+m&&ei&&at.trim()));for(var f of this.data){for(var u=f.data,p=f.name,g=c.length>1?s.color:c[0],m=0,v=0;vt&&ei-b-m&&a2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(d),t.lineWidth=h,t.strokeStyle=n,t.fillStyle=l,t.arc(e,a,s,o,r),t.stroke(),t.restore(),t.closePath()};class U extends u{constructor(t,i,e){super(t,i,o({},J,e),"gauge"),this.resize()}_getFillColor(t,i){for(var e="#fff",a=0,s=0;sa&&t<=o&&(e=i[s][1],a=i[s][0])}return e}gauge(){var t=this.ctx,i=this.options,e=h(i.padding),[a,s]=this.center;a+=e.left,s+=e.top;var o=Math.PI,n=o*i.startFactor,l=o*(2+i.endFactor),d=i.radius*this.radius/100-i.backWidth,c=this.data[0],f=Math.round(Math.abs(100*(c-i.boundaries.min)/(i.boundaries.max-i.boundaries.min))),u=n+(l-n)*f/100,p=f,g=[];if("function"==typeof i.onDrawValue&&(p=i.onDrawValue.apply(null,[c,f])),Q(t,[a,s,d,n,l],{size:i.backWidth,stroke:i.backStyle}),"string"==typeof i.fillStyle)g.push([100,i.fillStyle]);else if(Array.isArray(i.fillStyle))for(var m of i.fillStyle)g.push(m);Q(t,[a,s,d,n,u],{size:i.valueWidth,stroke:this._getFillColor(f,g)}),r(t,p,[0,0],{align:"center",baseLine:"middle",color:i.value.color,stroke:i.value.color,font:i.value.font||i.font,translate:[a+i.value.shift.x,s+i.value.shift.y],angle:i.value.angle}),i.label.min&&r(t,i.boundaries.min,[0,0],{align:"left",baseLine:"middle",color:i.label.min.color,stroke:i.label.min.color,font:i.label.min.font||i.font,translate:[a+d*Math.cos(n)+i.backWidth+i.label.min.shift.x,s+d*Math.sin(n)+i.label.min.shift.y],angle:0}),i.label.max&&r(t,i.boundaries.max,[0,0],{align:"right",baseLine:"middle",color:i.label.max.color,stroke:i.label.max.color,font:i.label.max.font||i.font,translate:[a+d*Math.cos(l)-i.backWidth+i.label.max.shift.x,s+d*Math.sin(l)+i.label.max.shift.y],angle:0})}draw(){super.draw(),this.gauge()}}class $ extends u{constructor(t,i,e){super(t,i,o({},J,e),"gauge"),this.resize()}gauge(){var t=this.ctx,i=this.options,e=h(i.padding),[a,s]=this.center;a+=e.left,s+=e.top;var o=Math.PI,n=o*i.startFactor,l=o*(2+i.endFactor),d=i.radius*this.radius/100-i.backWidth,c=this.data[0],f=Math.abs(100*(c-i.boundaries.min)/(i.boundaries.max-i.boundaries.min)),u=n+(l-n)*f/100,p=f.toFixed(0);"function"==typeof i.onDrawValue&&(p=i.onDrawValue.apply(null,[c,f])),Q(t,[a,s,d,0,2*o],{size:i.backWidth,stroke:i.backStyle}),Q(t,[a,s,d,n,u],{size:i.valueWidth,stroke:i.fillStyle}),r(t,p,[0,0],{align:"center",baseLine:"middle",color:i.value.color,stroke:i.value.color,font:i.value.font||i.font,translate:[a+i.value.shift.x,s+i.value.shift.y],angle:i.value.angle})}draw(){super.draw(),this.gauge(),this.legend()}}globalThis.chart={areaChart:(t,i,e)=>new M(t,i,e),barChart:(t,i,e)=>new L(t,i,e),bubbleChart:(t,i,e)=>new O(t,i,e),histogramChart:(t,i,e)=>new B(t,i,e),lineChart:(t,i,e)=>new F(t,i,e),pieChart:(t,i,e)=>new q(t,i,e),stackedBarChart:(t,i,e)=>new _(t,i,e),gauge:(t,i,e)=>new U(t,i,e),donut:(t,i,e)=>new $(t,i,e)}}(); +axis:x,cross:y,showDots:!0,type:"line", +// line, curve +accuracy:2},G="line",V="default";class q extends u{constructor(t){if(super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o({},j,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),"line"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.legendItems=[],this.options.legend)for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:[],{color:e="#000",size:a=1,dash:s=[],tension:o=.25}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(s),t.lineWidth=a,t.strokeStyle=e,t.moveTo(i[0][0],i[0][1]);for(var r=0;r{i&&s(i)&&Object.assign(t,i)})),t}({type:"circle"},e.dots,c.dots),x={color:null!==(n=b.color)&&void 0!==n?n:f,fill:null!==(l=b.fill)&&void 0!==l?l:f,radius:null!==(d=b.size)&&void 0!==d?d:2},y=void 0;switch(b.type){case"square":y=h;break;case"triangle":y=z;break;case"diamond":y=W;break;default:y=k}c.dots&&!1!==e.showDots&&t.map((t=>{var[i,e]=t;y(o,[i,e,x.radius],x)})),i.coords[c.name]={graph:c,coords:t,drawPointFn:y,opt:x}},n=0;nv&&rv&&rx&&n2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=l,t.strokeStyle=n,t.fillStyle=h,t.arc(e,a,s,o,r),t.lineTo(e,a),t.fill(),t.stroke(),t.restore(),t.closePath()};class E extends u{constructor(t,i,e){super(t,i,o({},Z,e),"pie"),this.total=this.data.reduce(((t,i)=>t+i),0),this.legendItems=[];var a=this.options.legend;if(a&&a.titles&&a.titles.length)for(var s=0;st+i),0))}var[,s]=Y(i);this.maxX=this.maxY=t.boundaries&&!isNaN(t.boundaries.max)?t.boundaries.maxY:s,isNaN(this.maxX)&&(this.maxX=100),isNaN(this.maxY)&&(this.maxX=100)}calcRatio(){this.ratio=(this.options.dataAxisX?this.viewWidth:this.viewHeight)/(this.maxY===this.minY?this.maxY:this.maxY-this.minY)}calcBarWidth(){var t=this.options,i=this.data.length,e=(t.dataAxisX?this.viewHeight:this.viewWidth)-(this.data.length+1)*t.groupDistance;// space between groups +this.barWidth=e/i}barsX(){var t,i,e,a,s=this.options,o=l(s.padding),n=this.ctx,h=this.canvas.getBoundingClientRect(),d=!1;if(this.data&&this.data.length){this.proxy.mouse&&(e=this.proxy.mouse.x-h.left,a=this.proxy.mouse.y-h.top),t=o.left,i=o.top+s.groupDistance;var c=Array.isArray(s.colors)?s.colors:s.colors.split(",").map((t=>t.trim()));for(var f of this.data){for(var u=f.data,p=f.name,g=c.length>1?s.color:c[0],m=0,v=0;vt+m&&ei&&at.trim()));for(var f of this.data){for(var u=f.data,p=f.name,g=c.length>1?s.color:c[0],m=0,v=0;vt&&ei-b-m&&a2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(d),t.lineWidth=l,t.strokeStyle=n,t.fillStyle=h,t.arc(e,a,s,o,r),t.stroke(),t.restore(),t.closePath()},_=(t,i)=>{for(var e="#fff",a=0,s=0;s=a&&t<=o&&(e=i[s][1],a=i[s][0])}return e};class tt extends u{constructor(t,i,e){super(t,i,o({},U,e),"gauge"),this.min=this.options.boundaries.min,this.max=this.options.boundaries.max,this.resize()}gauge(){var t=this.ctx,i=this.options,e=l(i.padding),[a,s]=this.center;a+=e.left,s+=e.top;var o=Math.PI,n=o*i.startFactor,h=o*(2+i.endFactor),d=i.radius*this.radius/100-i.backWidth,c=this.data[0],f=Math.round(Math.abs(100*(c-this.min)/(this.max-this.min))),u=n+(h-n)*f/100,p=f,g=[];if("function"==typeof i.onDrawValue&&(p=i.onDrawValue.apply(null,[c,f])),$(t,[a,s,d,n,h],{size:i.backWidth,stroke:i.backStyle}),"string"==typeof i.fillStyle)g.push([100,i.fillStyle]);else if(Array.isArray(i.fillStyle))for(var m of i.fillStyle)g.push(m);$(t,[a,s,d,n,u],{size:i.valueWidth,stroke:_(f,g)}),r(t,p,[0,0],{align:"center",baseLine:"middle",color:i.value.color,stroke:i.value.color,font:i.value.font||i.font,translate:[a+i.value.shift.x,s+i.value.shift.y],angle:i.value.angle}),i.label.min&&r(t,i.boundaries.min,[0,0],{align:"left",baseLine:"middle",color:i.label.min.color,stroke:i.label.min.color,font:i.label.min.font||i.font,translate:[a+d*Math.cos(n)+i.backWidth+i.label.min.shift.x,s+d*Math.sin(n)+i.label.min.shift.y],angle:0}),i.label.max&&r(t,i.boundaries.max,[0,0],{align:"right",baseLine:"middle",color:i.label.max.color,stroke:i.label.max.color,font:i.label.max.font||i.font,translate:[a+d*Math.cos(h)-i.backWidth+i.label.max.shift.x,s+d*Math.sin(h)+i.label.max.shift.y],angle:0})}draw(){super.draw(),this.gauge()}}var it={backStyle:"#a7a7a7",fillStyle:"#8f8",backWidth:100,valueWidth:100,radius:100,boundaries:{min:0,max:100},label:{font:i,fixed:!1,color:"#000",angle:0,shift:{x:0,y:0}},padding:0};class et extends u{constructor(t,i,e){super(t,i,o({},it,e),"donut"),this.total=this.data.reduce(((t,i)=>t+i),0),this.min=this.options.boundaries.min,this.max=this.options.boundaries.max,this.legendItems=[];var a=this.options.legend;if(a&&a.titles&&a.titles.length)for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:{};if("number"==typeof d)d={tl:d,tr:d,br:d,bl:d};else{var c={tl:0,tr:0,br:0,bl:0};for(var f in c)d[f]=d[f]||c[f]}t.beginPath(),t.fillStyle=n,t.strokeStyle=r,t.moveTo(e+d.tl,a),t.lineTo(e+s-d.tr,a),t.quadraticCurveTo(e+s,a,e+s,a+d.tr),t.lineTo(e+s,a+o-d.br),t.quadraticCurveTo(e+s,a+o,e+s-d.br,a+o),t.lineTo(e+d.bl,a+o),t.quadraticCurveTo(e,a+o,e,a+o-d.bl),t.lineTo(e,a+d.tl),t.quadraticCurveTo(e,a,e+d.tl,a),t.fill(),t.stroke(),t.closePath()};class ot extends u{constructor(t,i,e){var s=Array.isArray(i)?i:[i],r=o({},a,at,e),n=l(r.padding),{height:h,distance:d,rowDistance:c}=r.segment,f=((h+c)*s.length-c+(n.top+n.bottom))*r.dpi+c;super(t,i,m(m({},r),{},{height:f}),"segment"),this.min=0,this.max=100,this.values=s,this.resize()}segments(){var t,i=this.ctx,e=this.options,a=e.segment,s=a.count?a.count:20,o=a.distance*e.dpi,r=a.rowDistance*e.dpi,n=this.viewWidth/s-o,h=a.height,d=[],c=l(e.padding),f=c.top+o;if("string"==typeof e.colors)d.push([100,e.colors]);else if(Array.isArray(e.colors))for(var u of e.colors)d.push(u);for(var p=0;p1&&void 0!==arguments[1]?arguments[1]:0,e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.values[i]=t,e&&this.resize()}draw(){super.draw(),this.segments()}}globalThis.chart={areaChart:(t,i,e)=>new T(t,i,e),barChart:(t,i,e)=>new A(t,i,e),bubbleChart:(t,i,e)=>new O(t,i,e),histogramChart:(t,i,e)=>new I(t,i,e),lineChart:(t,i,e)=>new q(t,i,e),pieChart:(t,i,e)=>new E(t,i,e),stackedBarChart:(t,i,e)=>new J(t,i,e),gauge:(t,i,e)=>new tt(t,i,e),donut:(t,i,e)=>new et(t,i,e),segment:(t,i,e)=>new ot(t,i,e)}}(); diff --git a/client/vendor/metro4/css/metro-all.css b/client/vendor/metro4/css/metro-all.css index 2e07ee6..674aaa4 100644 --- a/client/vendor/metro4/css/metro-all.css +++ b/client/vendor/metro4/css/metro-all.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ *, diff --git a/client/vendor/metro4/css/metro-colors.css b/client/vendor/metro4/css/metro-colors.css index 4f6fa88..5003fe2 100644 --- a/client/vendor/metro4/css/metro-colors.css +++ b/client/vendor/metro4/css/metro-colors.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ .bg-transparent { diff --git a/client/vendor/metro4/css/metro-common.css b/client/vendor/metro4/css/metro-common.css index cdf254e..85c73cf 100644 --- a/client/vendor/metro4/css/metro-common.css +++ b/client/vendor/metro4/css/metro-common.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ .button.primary, diff --git a/client/vendor/metro4/css/metro-components.css b/client/vendor/metro4/css/metro-components.css index 61c30b2..08d3400 100644 --- a/client/vendor/metro4/css/metro-components.css +++ b/client/vendor/metro4/css/metro-components.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ .accordion { diff --git a/client/vendor/metro4/css/metro-icons.css b/client/vendor/metro4/css/metro-icons.css index b1a8f05..9324bc4 100644 --- a/client/vendor/metro4/css/metro-icons.css +++ b/client/vendor/metro4/css/metro-icons.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ @font-face { diff --git a/client/vendor/metro4/css/metro-reset.css b/client/vendor/metro4/css/metro-reset.css index 2a1a391..7a353ba 100644 --- a/client/vendor/metro4/css/metro-reset.css +++ b/client/vendor/metro4/css/metro-reset.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ *, diff --git a/client/vendor/metro4/css/metro.css b/client/vendor/metro4/css/metro.css index af900f3..5459a2d 100644 --- a/client/vendor/metro4/css/metro.css +++ b/client/vendor/metro4/css/metro.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ *, diff --git a/client/vendor/metro4/css/schemes/darcula.css b/client/vendor/metro4/css/schemes/darcula.css index 62e8747..8433640 100644 --- a/client/vendor/metro4/css/schemes/darcula.css +++ b/client/vendor/metro4/css/schemes/darcula.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ .bg-scheme { diff --git a/client/vendor/metro4/css/schemes/red-alert.css b/client/vendor/metro4/css/schemes/red-alert.css index d86f128..1eb4f93 100644 --- a/client/vendor/metro4/css/schemes/red-alert.css +++ b/client/vendor/metro4/css/schemes/red-alert.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ .bg-scheme { diff --git a/client/vendor/metro4/css/schemes/red-dark.css b/client/vendor/metro4/css/schemes/red-dark.css index 293c4b5..cd40a9c 100644 --- a/client/vendor/metro4/css/schemes/red-dark.css +++ b/client/vendor/metro4/css/schemes/red-dark.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ .bg-scheme { diff --git a/client/vendor/metro4/css/schemes/red-mirohost.css b/client/vendor/metro4/css/schemes/red-mirohost.css index c5eaa59..e7352d1 100644 --- a/client/vendor/metro4/css/schemes/red-mirohost.css +++ b/client/vendor/metro4/css/schemes/red-mirohost.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ .bg-scheme { diff --git a/client/vendor/metro4/css/schemes/sky-net.css b/client/vendor/metro4/css/schemes/sky-net.css index 4953034..821b1ce 100644 --- a/client/vendor/metro4/css/schemes/sky-net.css +++ b/client/vendor/metro4/css/schemes/sky-net.css @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ .bg-scheme { diff --git a/client/vendor/metro4/js/metro.js b/client/vendor/metro4/js/metro.js index f7dcc7b..3290a3b 100644 --- a/client/vendor/metro4/js/metro.js +++ b/client/vendor/metro4/js/metro.js @@ -1,7 +1,7 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ /*! @@ -2818,7 +2818,7 @@ // Source: src/func.js /* global dataSet */ -/* exported isTouch, isSimple, isHidden, isPlainObject, isEmptyObject, isArrayLike, str2arr, parseUnit, getUnit, setStyleProp, acceptData, dataAttr, normName, strip, dashedName, isLocalhost */ +/* exported isDark, isTouch, isSimple, isHidden, isPlainObject, isEmptyObject, isArrayLike, str2arr, parseUnit, getUnit, setStyleProp, acceptData, dataAttr, normName, strip, dashedName, isLocalhost */ var numProps = ['opacity', 'zIndex', "order", "zoom"]; @@ -2960,6 +2960,11 @@ function isTouch() { return (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); +} + +function isDark(){ + var prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)") + return prefersDarkScheme.matches } // Source: src/setimmediate.js @@ -3104,7 +3109,7 @@ function isTouch() { /* global hasProp */ -var m4qVersion = "v1.1.0. Built at 27/03/2021 21:47:36"; +var m4qVersion = "v1.1.0. Built at 05/05/2021 22:47:56"; /* eslint-disable-next-line */ var matches = Element.prototype.matches @@ -4042,7 +4047,7 @@ $.fn.extend({ // Source: src/utils.js -/* global $, not, camelCase, dashedName, isPlainObject, isEmptyObject, isArrayLike, acceptData, parseUnit, getUnit, isVisible, isHidden, matches, strip, normName, hasProp, isLocalhost, isTouch */ +/* global $, not, isDark, camelCase, dashedName, isPlainObject, isEmptyObject, isArrayLike, acceptData, parseUnit, getUnit, isVisible, isHidden, matches, strip, normName, hasProp, isLocalhost, isTouch */ $.extend({ @@ -4050,6 +4055,7 @@ $.extend({ localhost: isLocalhost(), isLocalhost: isLocalhost, touchable: isTouch(), + dark: isDark(), uniqueId: function (prefix) { var d = new Date().getTime(); @@ -7191,7 +7197,7 @@ $.noConflict = function() { var Metro = { version: "4.5.0", - compileTime: "08/04/2021 16:25:25", + compileTime: "17/05/2021 12:24:52", buildNumber: "@@build", isTouchable: isTouch, fullScreenEnabled: document.fullscreenEnabled, @@ -7955,6 +7961,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8009,6 +8019,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8066,6 +8080,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8123,6 +8141,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8180,6 +8202,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8237,6 +8263,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "Dodaj uzorcima", userColorsTitle: "Korisničke boje" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8292,6 +8322,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8349,6 +8383,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8406,6 +8444,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8463,6 +8505,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ДОБАВИТЬ В ОБРАЗЦЫ", userColorsTitle: "ЦВЕТА ПОЛЬЗОВАТЕЛЯ" + }, + "switch": { + on: "вкл", + off: "выкл" } } }); @@ -8520,6 +8566,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8577,6 +8627,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ДОДАТИ В ЗРАЗКИ", userColorsTitle: "КОЛІРИ КОРИСТУВАЧА" + }, + "switch": { + on: "увм", + off: "вім" } } }); @@ -8634,6 +8688,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -8691,6 +8749,10 @@ $.noConflict = function() { "colorSelector": { addUserColorButton: "ADD TO SWATCHES", userColorsTitle: "USER COLORS" + }, + "switch": { + on: "on", + off: "off" } } }); @@ -9102,7 +9164,8 @@ $.noConflict = function() { }, arrayDelete: function(arr, val){ - if (arr.indexOf(val) > -1) arr.splice(arr.indexOf(val), 1); + var i = arr.indexOf(val); + if (i > -1) arr.splice(i, 1); }, arrayDeleteByKey: function(arr, key){ @@ -9509,6 +9572,13 @@ $.noConflict = function() { activeFrameClass: "", activeHeadingClass: "", activeContentClass: "", + clsFrame: "", + clsHeading: "", + clsContent: "", + clsAccordion: "", + clsActiveFrame: "", + clsActiveFrameHeading: "", + clsActiveFrameContent: "", onFrameOpen: Metro.noop, onFrameBeforeOpen: Metro.noop_true, onFrameClose: Metro.noop, @@ -9547,7 +9617,19 @@ $.noConflict = function() { var active = element.children(".frame.active"); var frame_to_open; - element.addClass("accordion"); + element + .addClass("accordion") + .addClass(o.clsAccordion) + ; + + frames + .addClass(o.clsFrame) + .each(function(){ + var $el = $(this); + $el.children(".heading").addClass(o.clsHeading); + $el.children(".content").addClass(o.clsContent); + }) + ; if (o.showMarker === true) { element.addClass("marker-on"); @@ -9613,9 +9695,9 @@ $.noConflict = function() { this._closeAll(frame[0]); } - frame.addClass("active " + o.activeFrameClass); - frame.children(".heading").addClass(o.activeHeadingClass); - frame.children(".content").addClass(o.activeContentClass).slideDown(o.duration); + frame.addClass("active " + o.activeFrameClass).addClass(o.clsActiveFrame); + frame.children(".heading").addClass(o.activeHeadingClass).addClass(o.clsActiveFrameHeading); + frame.children(".content").addClass(o.activeContentClass).addClass(o.clsActiveFrameContent).slideDown(o.duration); this._fireEvent("frameOpen", { frame: frame[0] @@ -9634,9 +9716,9 @@ $.noConflict = function() { return ; } - frame.removeClass("active " + o.activeFrameClass); - frame.children(".heading").removeClass(o.activeHeadingClass); - frame.children(".content").removeClass(o.activeContentClass).slideUp(o.duration); + frame.removeClass("active " + o.activeFrameClass).removeClass(o.clsActiveFrame); + frame.children(".heading").removeClass(o.activeHeadingClass).removeClass(o.clsActiveFrameHeading); + frame.children(".content").removeClass(o.activeContentClass).removeClass(o.clsActiveFrameContent).slideUp(o.duration); this._fireEvent("frameClose", { frame: frame[0] @@ -9671,8 +9753,13 @@ $.noConflict = function() { }); }, + open: function(i){ + var frame = this.element.children(".frame").eq(i); + this._openFrame(frame); + }, + /* eslint-disable-next-line */ - changeAttribute: function(attributeName){ + changeAttribute: function(attr, newVal){ }, destroy: function(){ @@ -32224,6 +32311,10 @@ $.noConflict = function() { clsSwitch: "", clsCheck: "", clsCaption: "", + textOn: "", + textOff: "", + locale: METRO_LOCALE, + showOnOff: false, onSwitchCreate: Metro.noop }; @@ -32237,7 +32328,9 @@ $.noConflict = function() { Metro.Component('switch', { init: function( options, elem ) { - this._super(elem, options, SwitchDefaultConfig); + this._super(elem, options, SwitchDefaultConfig, { + locale: null + }); return this; }, @@ -32263,9 +32356,6 @@ $.noConflict = function() { check.appendTo(container); caption.appendTo(container); - if (element.attr("data-on")) check.attr("data-on", element.attr("data-on")); - if (element.attr("data-off")) check.attr("data-off", element.attr("data-off")); - if (o.transition === true) { container.addClass("transition-on"); } @@ -32286,6 +32376,7 @@ $.noConflict = function() { this.enable(); } + this.i18n(o.locale); this._fireEvent("switch-create"); }, @@ -32319,9 +32410,42 @@ $.noConflict = function() { return this; }, - changeAttribute: function(attributeName){ - switch (attributeName) { + changeLocale: function(where, val){ + var element = this.element, o = this.options; + var check = element.siblings(".check"); + + o["text"+Cake.capitalize(where)] = val + + check.attr("data-"+where, val); + }, + + i18n: function(locale){ + var element = this.element, o = this.options; + var check = element.siblings(".check"); + var on, off; + + o.locale = locale; + this.locale = Metro.locales[o.locale] !== undefined ? Metro.locales[o.locale] : Metro.locales["en-US"]; + + if (o.showOnOff) { + on = element.attr("data-on") || o.textOn || this.locale.switch.on; + off = element.attr("data-off") || o.textOff || this.locale.switch.off; + + check.attr("data-on", on); + check.attr("data-off", off); + } else { + check.removeAttr("data-on"); + check.removeAttr("data-off"); + } + }, + + changeAttribute: function(attr, newVal){ + switch (attr) { case 'disabled': this.toggleState(); break; + case 'data-on': + case 'data-text-on': this.changeLocale('on', newVal); break; + case 'data-off': + case 'data-text-off': this.changeLocale('off', newVal); break; } }, @@ -32336,6 +32460,7 @@ $.noConflict = function() { var Utils = Metro.utils; var TableDefaultConfig = { + useCurrentSlice: false, showInspectorButton: false, inspectorButtonIcon: "", tableDeferred: 0, @@ -32515,6 +32640,7 @@ $.noConflict = function() { items: [], foots: [], filteredItems: [], + currentSlice: [], index: {} }); @@ -33377,18 +33503,38 @@ $.noConflict = function() { }); element.on(Metro.events.click, ".table-service-check-all input", function(){ - var status = $(this).is(":checked"); + var checked = $(this).is(":checked"); var store_key = o.checkStoreKey.replace("$1", id); - var data = []; var storage = Metro.storage; + var data, stored_keys; - if (status) { - $.each(that.filteredItems, function(){ - if (data.indexOf(this[o.checkColIndex]) !== -1) return ; - data.push(""+this[o.checkColIndex]); - }); + if (o.useCurrentSlice === true) { + stored_keys = storage.getItem(store_key, []); + + if (checked) { + $.each(that.currentSlice, function(){ + if (stored_keys.indexOf(""+this[o.checkColIndex]) === -1) { + stored_keys.push(""+this[o.checkColIndex]) + } + }); + } else { + $.each(that.currentSlice, function(){ + var key = ""+this[o.checkColIndex]; + if (stored_keys.indexOf(key) !== -1) { + Metro.utils.arrayDelete(stored_keys, key) + } + }); + } + data = stored_keys } else { - data = []; + if (checked) { + $.each(that.filteredItems, function () { + if (data.indexOf(this[o.checkColIndex]) !== -1) return; + data.push("" + this[o.checkColIndex]); + }); + } else { + data = []; + } } storage.setItem(store_key, data); @@ -33397,7 +33543,7 @@ $.noConflict = function() { that._fireEvent("check-click-all", { check: this, - status: status, + status: checked, data: data }); }); @@ -33645,27 +33791,6 @@ $.noConflict = function() { post_data: post_data }); }); - // - // $.post(viewPath, post_data) - // .then(function(data){ - // - // that._fireEvent("view-save", { - // target: "server", - // path: o.viewSavePath, - // view: view, - // post_data: post_data, - // response: data - // }); - // - // }, function(xhr){ - // - // that._fireEvent("data-save-error", { - // source: o.viewSavePath, - // xhr: xhr, - // post_data: post_data - // }); - // - // }); } }, @@ -33783,7 +33908,7 @@ $.noConflict = function() { var i, j, tr, td, check, cells, tds, is_even_row; var start = parseInt(o.rows) === -1 ? 0 : o.rows * (this.currentPage - 1), stop = parseInt(o.rows) === -1 ? this.items.length - 1 : start + o.rows - 1; - var items; + var items, checkedItems = []; var stored_keys = Metro.storage.getItem(o.checkStoreKey.replace("$1", element.attr('id'))); var view = o.staticView ? this.viewDefault : this.view; @@ -33797,6 +33922,9 @@ $.noConflict = function() { items = this._filter(); + this.currentSlice = items.slice(start, stop + 1); + checkedItems = []; + if (items.length > 0) { for (i = start; i <= stop; i++) { cells = items[i]; @@ -33825,6 +33953,7 @@ $.noConflict = function() { if (Utils.isValue(stored_keys) && Array.isArray(stored_keys) && stored_keys.indexOf(""+items[i][o.checkColIndex]) > -1) { check.prop("checked", true); + checkedItems.push(cells) } check.addClass("table-service-check"); @@ -33838,6 +33967,7 @@ $.noConflict = function() { td.addClass(that.service[1].clsColumn); } td.appendTo(tr); + // End of check for (j = 0; j < cells.length; j++){ tds[j] = null; @@ -33908,6 +34038,7 @@ $.noConflict = function() { }); } + $(this.component).find(".table-service-check-all input").prop("checked", checkedItems.length); } else { j = 0; $.each(view, function(){ @@ -33954,7 +34085,7 @@ $.noConflict = function() { switch (format) { case "date": result = formatMask ? Datetime.from(result, formatMask, o.locale) : datetime(result); break; - case "number": result = Number(result); break; + case "number": result = +result; break; case "int": result = parseInt(result); break; case "float": result = parseFloat(result); break; case "money": result = Utils.parseMoney(result); break; @@ -34250,34 +34381,6 @@ $.noConflict = function() { error: error }); }) - // $.json(o.source).then(function(data){ - // that.activity.hide(); - // that.items = []; - // that.heads = []; - // that.foots = []; - // - // that._fireEvent("data-loaded", { - // source: o.source, - // data: data - // }); - // - // if (Array.isArray(o.head)) { - // that.heads = o.head; - // } - // - // if (Array.isArray(o.body)) { - // that.items = o.body; - // } - // - // that._createItemsFromJSON(data); - // that._rebuild(review); - // }, function(xhr){ - // that.activity.hide(); - // that._fireEvent("data-load-error", { - // source: o.source, - // xhr: xhr - // }); - // }); }); } diff --git a/client/vendor/metro4/js/metro.min.js b/client/vendor/metro4/js/metro.min.js index 8a556f8..0e369b6 100644 --- a/client/vendor/metro4/js/metro.min.js +++ b/client/vendor/metro4/js/metro.min.js @@ -1,9 +1,9 @@ /* * Metro 4 Components Library v4.5.0 (https://metroui.org.ua) * Copyright 2012-2021 Sergey Pimenov - * Built at 08/04/2021 16:25:25 + * Built at 17/05/2021 12:24:52 * Licensed under MIT */ -!function(n){"use strict";var h="YYYY-MM-DDTHH:mm:ss.sss",t="Invalid date",p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|m{1,2}|s{1,3}/g;n.DATETIME_LOCALES={en:{months:"January February March April May June July August September October November December".split(" "),monthsShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),weekdays:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),weekdaysShort:"Sun Mon Tue Wed Thu Fri Sat".split(" "),weekdaysMin:"Su Mo Tu We Th Fr Sa".split(" "),weekStart:0}};function f(e,t,n){return e=""+e,n&&n<=e.length?e:Array(n+1-e.length).join(t)+e}function i(e){return null==e}var s={ms:"Milliseconds",s:"Seconds",m:"Minutes",h:"Hours",D:"Date",d:"Day",M:"Month",Y:"FullYear",y:"Year",t:"Time"},a="ms",o="second",r="minute",l="hour",c="day",d="week",u="month",m="year",v=function(){var e;return arguments[0]instanceof g?v(arguments[0].value):(e=[].slice.call(Array.isArray(arguments[0])?arguments[0]:arguments),new(Function.prototype.bind.apply(g,[this].concat(e))))},g=function(){var e=[].slice.call(arguments);if(this.value=new(Function.prototype.bind.apply(Date,[this].concat(e))),this.locale="en",this.weekStart=n.DATETIME_LOCALES.en.weekStart,this.utcMode=!1,this.mutable=!0,isNaN(this.value.getTime()))throw new Error(t)};g.DEFAULT_FORMAT=h,g.REGEX_FORMAT=p,g.INVALID_DATE=t,g.lpad=f,g.not=i,g.isDatetime=function(e){return e instanceof g},g.now=function(e){return v()[e?"val":"time"]()},g.locale=function(e,t){n.DATETIME_LOCALES[e]=t},g.getLocale=function(e){return n.DATETIME_LOCALES[e||"en"]||n.DATETIME_LOCALES.en},g.parse=function(e){return v(Date.parse(e))},g.align=function(e,t){var n,i,s=e instanceof g?e:v(e);switch(t){case o:n=s.ms(0);break;case r:n=g.align(s,o)[o](0);break;case l:n=g.align(s,r)[r](0);break;case c:n=g.align(s,l)[l](0);break;case u:n=g.align(s,c)[c](1);break;case m:n=g.align(s,u)[u](0);break;case d:i=s.weekDay(),n=g.align(s,c).addDay(-i);break;default:n=s}return n},g.alignEnd=function(e,t){var n,i,s=e instanceof g?e:v(e);switch(t){case a:n=s.ms(999);break;case o:n=g.alignEnd(s,a);break;case r:n=g.alignEnd(s,o)[o](59);break;case l:n=g.alignEnd(s,r)[r](59);break;case c:n=g.alignEnd(s,l)[l](23);break;case u:n=g.alignEnd(s,c)[c](1).add(1,u).add(-1,c);break;case m:n=g.alignEnd(s,c)[u](11)[c](31);break;case d:i=s.weekDay(),n=g.alignEnd(s,"day").addDay(6-i);break;default:n=s}return n},g.extend=function(e){for(var t,n,i=arguments.length,s=1;s",">=","<=","=","!="].indexOf(n=n||"=")&&(n="="),t=(t||"ms").toLowerCase(),i=e.align(t).time(),s=a.align(t).time(),n){case"<":return i":return s=":return s<=i;case"=":return i===s;case"!=":return i!==s}},between:function(e,t){return this.younger(e)&&this.older(t)},older:function(e,t){return this.compare(e,t,"<")},olderOrEqual:function(e,t){return this.compare(e,t,"<=")},younger:function(e,t){return this.compare(e,t,">")},youngerOrEqual:function(e,t){return this.compare(e,t,">=")},equal:function(e,t){return this.compare(e,t,"=")},notEqual:function(e,t){return this.compare(e,t,"!=")},diff:function(e){var t=datetime(e),e=Math.abs(this.time()-t.time()),t=Math.abs(this.month()-t.month()+12*(this.year()-t.year()));return{ms:e,second:Math.ceil(e/1e3),minute:Math.ceil(e/6e4),hour:Math.ceil(e/36e5),day:Math.ceil(e/864e5),month:t,year:Math.floor(t/12)}},distance:function(e,t){return this.diff(e)[t]}})}(),function(){"use strict";Datetime.use({dayOfYear:function(){var e=this.month(),t=this.day();return[0,31,59,90,120,151,181,212,243,273,304,334][e]+t+(1&"'`]/g,c=/(<([^>]+)>)/gi,d=new RegExp("(?:["+i+"]["+t+"]*)?(?:["+n+"]["+t+"]*)+|(?:["+i+"]["+t+"]*)+(?!["+n+"])|[\\d]+|[\\u2700-\\u27BF]|[^\\x00-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7b-\\xBF\\xD7\\xF7\\u2000-\\u206F"+e+"]+","g"),u=/[A-Z\xC0-\xD6\xD8-\xDE]?[a-z\xDF-\xF6\xF8-\xFF]+|[A-Z\xC0-\xD6\xD8-\xDE]+(?![a-z\xDF-\xF6\xF8-\xFF])|\d+/g,h=new RegExp("^(?:["+n+i+"]["+t+"]*)+$"),p=new RegExp("^((?:["+n+i+"]["+t+"]*)|[\\d])+$"),f=/^[\x01-\xFF]*$/;function m(e,t){return o(e)?t:e}function v(e,t){t=1e.length)&&(t=e.length);for(var n=0,i=new Array(t);n":">","&":"&",'"':""","'":"'","`":"`"};function I(e){return E[e]}var A={"<":/(<)|(�*3c;)|(�*60;)/gi,">":/(>)|(�*3e;)|(�*62;)/gi,"&":/(&)|(�*26;)|(�*38;)/gi,'"':/(")|(�*22;)|(�*34;)/gi,"'":/(�*27;)|(�*39;)/gi,"`":/(�*60;)|(�*96;)/gi},M=Object.keys(A);function D(e,t){return e.replace(A[t],t)}function O(e,t,n){return v(e).substr(t,n)}var P=9007199254740991;function L(e,t,n){n=2>>0).toString(8);break;case"s":n=String(n),n=i.precision?n.substring(0,i.precision):n;break;case"t":n=String(!!n),n=i.precision?n.substring(0,i.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=i.precision?n.substring(0,i.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=i.precision?n.substring(0,i.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}q.json.test(i.type)?d+=n:(!q.number.test(i.type)||o&&!i.sign?r="":(r=o?"+":"-",n=n.toString().replace(q.sign,"")),s=i.pad_char?"0"===i.pad_char?"0":i.pad_char.charAt(1):" ",a=i.width-(r+n).length,a=i.width&&0").concat(v(e),"")},escapeHtml:function(e){return v(e).replace(l,I)},unescapeHtml:function(e){return M.reduce(D,v(e))},unique:function(e,t){return x(w(e,t)).join("")},uniqueWords:function(e,t,n){return x(g(e,t,n)).join("")},substr:O,first:function(e,t){return(e=v(e))?O(e,0,t):""},last:function(e,t){return(e=v(e))?O(e,e.length-t):""},truncate:function(e,t){var n=2]*>/gi,function(e,t){return n.includes(t)?e:""})},stripTagsAll:function(e){return v(e).replace(c,"")},sprintf:Y,vsprintf:function(e,t){return Y.apply(null,[e].concat(t||[]))},includes:function(e,t,n){return v(e).includes(t,n)}},$=null;G=Symbol.toPrimitive,K=Symbol.toStringTag;var X=function(){function s(){var e,t,n,i=0=e.interval)&&(e.fn(),e.lastTime=M())})},this.intervalTicking=!0,n()),this.intervalId},clearInterval:function(e){for(var t=0;t:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i.exec(e))s.push(document.createElement(n[1]));else{i.innerHTML=e;for(var a=0;aA.animation.elements[y].loop?setTimeout(function(){S()},p):_()):"alternate"!==f||w?_():(b="normal"===b?"reverse":"normal",w=!0,S()))}};0
M4Q - "+m4q.version+"
";h.infobox.create(e)},info:function(){console.info("Metro 4 - v"+h.version+". "+h.showCompileTime()),console.info("m4q - "+m4q.version)},showCompileTime:function(){return"Built at: "+h.compileTime},aboutDlg:function(){alert("Metro 4 - v"+h.version+". "+h.showCompileTime())},ver:function(){return h.version},build:function(){return h.build},compile:function(){return h.compileTime},observe:function(){new MutationObserver(function(e){e.map(function(e){var t,n,i,s,a;if("attributes"===e.type&&"data-role"!==e.attributeName)"data-hotkey"===e.attributeName?h.initHotkeys([e.target],!0):(n=(t=u(e.target)).data("metroComponent"),i=e.attributeName,s=t.attr(i),a=e.oldValue,void 0!==n&&(t.fire("attr-change",{attr:i,newValue:s,oldValue:a,__this:t[0]}),u.each(n,function(){var e=h.getPlugin(t,this);e&&"function"==typeof e.changeAttribute&&e.changeAttribute(i,s,a)})));else if("childList"===e.type&&0/gi.test(e)},isEmbedObject:function(e){var t=!1;return o.each(["iframe","object","embed","video"],function(){("string"==typeof e&&e.toLowerCase()===this||void 0!==e.nodeType&&e.tagName.toLowerCase()===this)&&(t=!0)}),t},isVideoUrl:function(e){return/youtu\.be|youtube|twitch|vimeo/gi.test(e)},isDate:function(e,t,n){var i;if(this.isDateObject(e))return!0;try{return i=t?Datetime.from(e,t,n||"en-US"):datetime(e),Datetime.isDatetime(i)}catch(e){return!1}},isDateObject:function(e){return"object"==typeof e&&void 0!==e.getMonth},isInt:function(e){return!isNaN(e)&&+e%1==0},isFloat:function(e){return!isNaN(e)&&+e%1!=0||/^\d*\.\d+$/.test(e)},isFunc:function(e){return this.isType(e,"function")},isObject:function(e){return this.isType(e,"object")},isObject2:function(e){return"object"==typeof e&&!Array.isArray(e)},isType:function(e,t){if(!this.isValue(e))return!1;if(typeof e===t)return e;if("tag"===(""+t).toLowerCase()&&this.isTag(e))return e;if("url"===(""+t).toLowerCase()&&this.isUrl(e))return e;if("array"===(""+t).toLowerCase()&&Array.isArray(e))return e;if(this.isTag(e)||this.isUrl(e))return!1;if(typeof window[e]===t)return window[e];if("string"==typeof e&&-1===e.indexOf("."))return!1;if("string"==typeof e&&/[/\s([]+/gm.test(e))return!1;if("number"==typeof e&&"number"!==t.toLowerCase())return!1;for(var n=e.split("."),i=window,s=0;s
"},elementId:function(e){return e+"-"+(new Date).getTime()+o.random(1,1e3)},secondsToTime:function(e){return{d:Math.floor(e%31536e3/86400),h:Math.floor(e%31536e3%86400/3600),m:Math.floor(e%31536e3%86400%3600/60),s:Math.round(e%31536e3%86400%3600%60)}},secondsToFormattedString:function(e){var t=parseInt(e,10),n=Math.floor(t/3600),e=Math.floor((t-3600*n)/60),t=t-3600*n-60*e;return[Cake.lpad(n,2,"0"),Cake.lpad(e,2,"0"),Cake.lpad(t,2,"0")].join(":")},func:function(e){return new Function("a",e)},exec:function(e,t,n){var i;if(null==e)return!1;var s=this.isFunc(e);!1===s&&(s=this.func(e));try{i=s.apply(n,t)}catch(e){if(!(i=null)===window.METRO_THROWS)throw e}return i},isOutsider:function(e){var t=o(e),e=t.clone();return e.removeAttr("data-role").css({visibility:"hidden",position:"absolute",display:"block"}),t.parent().append(e),t=this.inViewport(e[0]),e.remove(),!t},inViewport:function(e){e=this.rect(e);return 0<=e.top&&0<=e.left&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)},rect:function(e){return e.getBoundingClientRect()},getCursorPosition:function(e,t){e=this.rect(e);return{x:this.pageXY(t).x-e.left-window.pageXOffset,y:this.pageXY(t).y-e.top-window.pageYOffset}},getCursorPositionX:function(e,t){return this.getCursorPosition(e,t).x},getCursorPositionY:function(e,t){return this.getCursorPosition(e,t).y},objectLength:function(e){return Object.keys(e).length},percent:function(e,t,n){if(0===e)return 0;e=100*t/e;return!0===n?Math.round(e):Math.round(100*e)/100},objectShift:function(e){var t=0;return o.each(e,function(e){(0===t||e").addClass("circle").appendTo(n)}();break;case"square":!function(){for(e=0;e<4;e++)s("
").addClass("square").appendTo(n)}();break;case"cycle":s("
").addClass("cycle").appendTo(n);break;case"simple":s('').appendTo(n);break;case"atom":!function(){for(e=0;e<3;e++)s("").addClass("electron").appendTo(n)}();break;case"bars":!function(){for(e=0;e<6;e++)s("").addClass("bar").appendTo(n)}();break;default:!function(){for(e=0;e<5;e++)t=s("
").addClass("wrap").appendTo(n),s("
").addClass("circle").appendTo(t)}()}this._fireEvent("activity-create",{element:n})},changeAttribute:function(e){},destroy:function(){return this.element}}),i.activity={open:function(e){var t=e||{},n='
',e=t.text?'
'+t.text+"
":"";return i.dialog.create({content:n+e,defaultAction:!1,clsContent:"d-flex flex-column flex-justify-center flex-align-center bg-transparent no-shadow w-auto",clsDialog:"no-border no-shadow bg-transparent global-dialog",autoHide:t.autoHide||0,overlayClickClose:!0===t.overlayClickClose,overlayColor:t.overlayColor||"#000000",overlayAlpha:t.overlayAlpha||.5,clsOverlay:"global-overlay"})},close:function(e){i.dialog.close(e)}}}(Metro,m4q),function(e,r){"use strict";var l=e.utils,t={adblockDeferred:0,checkInterval:1e3,fireOnce:!0,checkStop:10,localhost:!1,onAlert:e.noop,onFishingStart:e.noop,onFishingDone:e.noop};e.adblockSetup=function(e){t=r.extend({},t,e)},window.metroAdblockSetup,e.adblockSetup(window.metroAdblockSetup);var c={bite:function(){r("
").addClass("adblock-bite adsense google-adsense dblclick advert topad top_ads topAds textads sponsoredtextlink_container show_ads right-banner rekl mpu module-ad mid_ad mediaget horizontal_ad headerAd contentAd brand-link bottombanner bottom_ad_block block_ad bannertop banner-right banner-body b-banner b-article-aside__banner b-advert adwrapper adverts advertisment advertisement:not(body) advertise advert_list adtable adsense adpic adlist adleft adinfo adi adholder adframe addiv ad_text ad_space ad_right ad_links ad_body ad_block ad_Right adTitle adText".split(" ").shuffle().join(" ")).css({position:"fixed",height:1,width:1,overflow:"hidden",visibility:"visible",top:0,left:0}).append(r("").html("dblclick.net")).appendTo("body"),c.options.adblockDeferred?setTimeout(function(){c.fishing()},c.options.adblockDeferred):this.fishing()},fishing:function(){function e(){function e(){clearInterval(o),l.exec(i.onFishingDone),r(window).fire("fishing-done"),t.remove()}var t=r(".adsense.google-adsense.dblclick.advert.adblock-bite"),n=t.find("a");i.localhost||!r.localhost?!t.length||!n.length||-1").attr("type","button").addClass("hamburger menu-down");for(var s=0;s<3;s++)o("").addClass("line").appendTo(e);"rgba(0, 0, 0, 0)"!==i&&!0!==a.colors.isLight(i)||e.addClass("dark")}t.prepend(e),0===(i=t.find(".app-bar-menu")).length?e.css("display","none"):r.addCssRule(a.sheet,".app-bar-menu li","list-style: none!important;"),"block"===e.css("display")?(i.hide().addClass("collapsed"),e.removeClass("hidden")):e.addClass("hidden"),(!0===n.expand||r.isValue(n.expandPoint)&&r.mediaExist(n.expandPoint))&&(t.addClass("app-bar-expand"),e.addClass("hidden"))},_createEvents:function(){var e=this,t=this.element,n=this.options,i=t.find(".app-bar-menu"),s=t.find(".hamburger");t.on(a.events.click,".hamburger",function(){0!==i.length&&(i.hasClass("collapsed")?e.open():e.close())}),o(window).on(a.events.resize,function(){!0!==n.expand&&(r.isValue(n.expandPoint)&&r.mediaExist(n.expandPoint)?(t.addClass("app-bar-expand"),e._fireEvent("menu-expand")):(t.removeClass("app-bar-expand"),e._fireEvent("menu-collapse"))),0!==i.length&&("block"!==s.css("display")?(i.show(function(){o(this).removeStyleProperty("display")}),s.addClass("hidden")):(s.removeClass("hidden"),s.hasClass("active")?i.show().removeClass("collapsed"):i.hide().addClass("collapsed")))},{ns:this.id})},close:function(){var e=this,t=this.element,n=this.options,i=t.find(".app-bar-menu"),s=t.find(".hamburger");e._fireEvent("before-menu-close",{menu:i[0]}),i.slideUp(n.duration,function(){i.addClass("collapsed").removeClass("opened"),s.removeClass("active"),e._fireEvent("menu-close",{menu:i[0]})})},open:function(){var e=this,t=this.element,n=this.options,i=t.find(".app-bar-menu"),s=t.find(".hamburger");e._fireEvent("before-menu-open",{menu:i[0]}),i.slideDown(n.duration,function(){i.removeClass("collapsed").addClass("opened"),s.addClass("active"),e._fireEvent("menu-open",{menu:i[0]})})},changeAttribute:function(e){},destroy:function(){var e=this.element;return e.off(a.events.click,".hamburger"),o(window).off(a.events.resize,{ns:this.id}),e}})}(Metro,m4q),function(s,t){"use strict";var a=s.utils,n={audioVolume:.5,audioSrc:"",onAudioStart:s.noop,onAudioEnd:s.noop,onAudioButtonCreate:s.noop};s.audioButtonSetup=function(e){n=t.extend({},n,e)},window.metroAudioButtonSetup,s.audioButtonSetup(window.metroAudioButtonSetup),s.Component("audio-button",{init:function(e,t){return this._super(t,e,n,{audio:null,canPlay:null,id:a.elementId("audioButton")}),this},_create:function(){var e=this.element;this._createStructure(),this._createEvents(),this._fireEvent("audioButtonCreate",{element:e})},_createStructure:function(){var e=this.options;this.audio=new Audio(e.audioSrc),this.audio.volume=e.audioVolume},_createEvents:function(){var e=this,t=this.element,n=this.options,i=this.audio;i.addEventListener("loadeddata",function(){e.canPlay=!0}),i.addEventListener("ended",function(){e._fireEvent("audioEnd",{src:n.audioSrc,audio:i})}),t.on(s.events.click,function(){e.play()},{ns:this.id})},play:function(e){var t=this.element,n=this.options,i=this.audio;""!==n.audioSrc&&this.audio.duration&&this.canPlay&&(this._fireEvent("audioStart",{src:n.audioSrc,audio:i}),i.pause(),i.currentTime=0,i.play(),a.exec(e,[i],t[0]))},stop:function(e){var t=this.element,n=this.options,i=this.audio;i.pause(),i.currentTime=0,this._fireEvent("audioEnd",{src:n.audioSrc,audio:i}),a.exec(e,[i],t[0])},changeAttribute:function(e){var t,n,i=this.element,s=this.options,a=this.audio;"data-audio-src"===e&&(t=i.attr("data-audio-src"))&&""!==t.trim()&&(s.audioSrc=t,a.src=t),"data-audio-volume"===e&&(n=parseFloat(i.attr("data-audio-volume")),isNaN(n)||(s.audioVolume=n,a.volume=n))},destroy:function(){this.element.off(s.events.click,{ns:this.id})}}),s.playSound=function(e){var t,n="string"==typeof e?e:e.audioSrc,i=e&&e.audioVolume?e.audioVolume:.5;n&&((t=new Audio(n)).volume=parseFloat(i),t.addEventListener("loadeddata",function(){e&&e.onAudioStart&&a.exec(e.onAudioStart,[n],this),this.play()}),t.addEventListener("ended",function(){e&&e.onAudioEnd&&a.exec(e.onAudioEnd,[null],this)}))}}(Metro,m4q),function(h,p){"use strict";var o=h.utils,n={audioDeferred:0,playlist:null,src:null,volume:.5,loop:!1,autoplay:!1,showLoop:!0,showPlay:!0,showStop:!0,showMute:!0,showFull:!0,showStream:!0,showVolume:!0,showInfo:!0,showPlaylist:!0,showNext:!0,showPrev:!0,showFirst:!0,showLast:!0,showForward:!0,showBackward:!0,showShuffle:!0,showRandom:!0,loopIcon:"",stopIcon:"",playIcon:"",pauseIcon:"",muteIcon:"",volumeLowIcon:"",volumeMediumIcon:"",volumeHighIcon:"",playlistIcon:"",nextIcon:"",prevIcon:"",firstIcon:"",lastIcon:"",forwardIcon:"",backwardIcon:"",shuffleIcon:"",randomIcon:"",onPlay:h.noop,onPause:h.noop,onStop:h.noop,onEnd:h.noop,onMetadata:h.noop,onTime:h.noop,onAudioPlayerCreate:h.noop};h.audioPlayerSetup=function(e){n=p.extend({},n,e)},window.metroAudioPlayerSetup,h.audioPlayerSetup(window.metroAudioPlayerSetup),h.Component("audio-player",{init:function(e,t){return this._super(t,e,n,{preloader:null,player:null,audio:t,stream:null,volume:null,volumeBackup:0,muted:!1}),this},_create:function(){var e=this.element,t=this.options;this._createPlayer(),this._createControls(),this._createEvents(),!0===t.autoplay&&this.play(),this._fireEvent("audio-player-create",{element:e,player:this.player})},_createPlayer:function(){var e=this.element,t=this.options,n=this.audio,i=e.prev(),s=e.parent(),a=p("
").addClass("media-player audio-player "+e[0].className);0===i.length?s.prepend(a):a.insertAfter(i),e.appendTo(a),p.each(["muted","autoplay","controls","height","width","loop","poster","preload"],function(){e.removeAttr(this)}),e.attr("preload","auto"),n.volume=t.volume,null!==t.src&&this._setSource(t.src),e[0].className="",this.player=a},_setSource:function(e){var t=this.element;t.find("source").remove(),t.removeAttr("src"),Array.isArray(e)?p.each(e,function(){void 0!==this.src&&p("").attr("src",this.src).attr("type",void 0!==this.type?this.type:"").appendTo(t)}):t.attr("src",e)},_createControls:function(){var e,t=this,n=this.element,i=this.options,s=this.elem,a=p("
").addClass("controls").addClass(i.clsControls).insertAfter(n),o=p("
").addClass("stream").appendTo(a),r=p("").addClass("stream-slider ultra-thin cycle-marker").appendTo(o),l=p("
").addClass("load-audio").appendTo(o),c=p("
").addClass("volume").appendTo(a),d=p("").addClass("volume-slider ultra-thin cycle-marker").appendTo(c),u=p("
").addClass("info-box").appendTo(a);!0!==i.showInfo&&u.hide(),l.activity({type:"metro",style:"color"}),l.hide(0),this.preloader=l,h.makePlugin(r,"slider",{clsMarker:"bg-red",clsHint:"bg-cyan fg-white",clsComplete:"bg-cyan",hint:!0,onStart:function(){s.paused||s.pause()},onStop:function(e){0").attr("type","button").addClass("button square loop").html(i.loopIcon).appendTo(a)),!0===i.showPlay&&p("").appendTo(n),a[i.view[e]["index-view"]]=n}),t=0;t").addClass("table-inspector");i.attr("for",this.element.attr("id")),w("
"+(n.inspectorTitle||this.locale.table.inspector)+"
").appendTo(i),e=w("
").addClass("table-wrap").appendTo(i),t=w("").addClass("table subcompact"),n=w("").appendTo(t),t.appendTo(e),this._createInspectorItems(n),n=w("
").appendTo(i),w("
").addClass(a.clsHeadRow).appendTo(o),w.each(this.service,function(){var e=[];i=w("").appendTo(n)),s.clear().addClass(i.clsFooter),0!==this.foots.length&&(e=w("").addClass(i.clsHeadRow).appendTo(s),w.each(this.foots,function(){t=w("").addClass(h.clsBodyRow)).data("original",o),l=t%2==0,s=w("").appendTo(m),C=[];if("function"==typeof h.tableToCSV){for(t=y.isValue(t)?t.toLowerCase():"all-filtered",n=y.isValue(n)?n:y.elementId("table")+"-export.csv",l=w(""),o=this.heads,a=0;a"),y.isValue(this.title)&&c.html(this.title),C[p.view[e]["index-view"]]=c)}),a=0;a"),o=r[s],a=0;a").html(this),C[p.view[e]["index-view"]]=c)}),a=0;a").addClass("tabs-material-wrapper").addClass(t.clsComponent).insertBefore(e);!0===t.appBar&&s.addClass("app-bar-present"),"more"===t.appBar&&s.addClass("app-bar-present-more"),e.appendTo(s),e.addClass("tabs-material").addClass(t.clsTabs),n.addClass(t.clsTab),!0===t.deep&&e.addClass("deep"),!0===t.fixedTabs&&e.addClass("fixed-tabs"),this.marker=e.find(".tab-marker"),0===this.marker.length&&(this.marker=d("").addClass("tab-marker").addClass(t.clsMarker).appendTo(e)),this.openTab((0===i.length?n:i)[0])},_createEvents:function(){var s=this,a=this.element,o=this.options;a.on(t.events.click,"li",function(e){var t=d(this),n=a.find("li.active"),i=t.index()>n.index(),n=t.children("a").attr("href");u.isValue(n)&&"#"===n[0]&&(t.hasClass("active")||t.hasClass("disabled")||!1!==u.exec(o.onBeforeTabOpen,[t,n,i],this)&&(s.openTab(t,i),e.preventDefault()))}),a.on(t.events.scroll,function(){var e=s.scroll;s.scrollDir=s.scrolln.index(t);this.openTab(e,t)},changeAttribute:function(){},destroy:function(){var e=this.element;return e.off(t.events.click,"li"),e.off(t.events.scroll),e}})}(Metro,m4q),function(r,l){"use strict";var c=r.utils,n={tabsDeferred:0,expand:!1,expandPoint:null,tabsPosition:"top",tabsType:"default",clsTabs:"",clsTabsList:"",clsTabsListItem:"",clsTabsListItemActive:"",onTab:r.noop,onBeforeTab:r.noop_true,onTabsCreate:r.noop};r.tabsSetup=function(e){n=l.extend({},n,e)},window.metroTabsSetup,r.tabsSetup(window.metroTabsSetup),r.Component("tabs",{init:function(e,t){return this._super(t,e,n,{_targets:[],id:c.elementId("tabs")}),this},_create:function(){var e=this.element,t=0").addClass("tabs tabs-wrapper");if(i.addClass(n.tabsPosition.replace(["-","_","+"]," ")),t.addClass("tabs-list"),"default"!==n.tabsType&&t.addClass("tabs-"+n.tabsType),s||(i.insertBefore(t),t.appendTo(i)),t.data("expanded",!1),s=l("
").addClass("expand-title"),i.prepend(s),0===(e=i.find(".hamburger")).length){e=l("
").appendTo(t),y.isValue(this.title)&&i.html(this.title),y.isValue(this.size)&&i.css({width:this.size}),y.isValue(this.cls)&&e.push(this.cls),e.push(a.clsHeadCell),i.addClass(e.join(" "))}),n=this.heads,e=0;e")).data("index",e),y.isValue(t.title)&&i.html(t.title),y.isValue(t.format)&&i.attr("data-format",t.format),y.isValue(t.name)&&i.attr("data-name",t.name),y.isValue(t.colspan)&&i.attr("colspan",t.colspan),y.isValue(l[e].size)&&i.css({width:l[e].size}),!0===t.sortable&&(n.push("sortable-column"),y.isValue(t.sortDir)&&n.push("sort-"+t.sortDir)),y.isValue(t.cls)&&w.each(t.cls.toArray(),function(){n.push(this)}),!1===y.bool(l[e].show)&&-1===n.indexOf("hidden")&&n.push("hidden"),n.push(a.clsHeadCell),y.bool(l[e].show)&&y.arrayDelete(n,"hidden"),i.addClass(n.join(" ")),r[l[e]["index-view"]]=i}),e=0;e").addClass(this.options.clsBody),0!==t.length?n.insertAfter(t):e.append(n)),n.clear()},_createTableFooter:function(){var e,t,n=this.element,i=this.options,s=n.find("tfoot");0===s.length&&(s=w("
").appendTo(e),void 0!==this.title&&t.html(this.title),void 0!==this.name&&t.addClass("foot-column-name-"+this.name),void 0!==this.cls&&t.addClass(this.cls),y.isValue(this.colspan)&&t.attr("colspan",this.colspan),t.appendTo(e)}))},_createTopBlock:function(){var n,i=this,e=this.element,s=this.options,t=w("
").addClass("table-top").addClass(s.clsTableTop).insertBefore(e.parent()),a=y.isValue(this.wrapperSearch)?this.wrapperSearch:w("
").addClass("table-search-block").addClass(s.clsSearch).appendTo(t);return a.addClass(s.clsSearch),e=w("").attr("type","text").appendTo(a),b.makePlugin(e,"input",{prepend:s.tableSearchTitle||i.locale.table.search}),!0!==s.showSearch&&a.hide(),(a=y.isValue(this.wrapperRows)?this.wrapperRows:w("
").addClass("table-rows-block").appendTo(t)).addClass(s.clsRowsCount),n=w("").addClass("input table-skip-input").addClass(t.clsTableSkipInput).appendTo(e),w("
").html(t+1),void 0!==d.service[0].clsColumn&&s.addClass(d.service[0].clsColumn),s.appendTo(i),s=w(""),a="checkbox"===h.checkType?w(""):w(""),y.isValue(v)&&Array.isArray(v)&&-1");y.isValue(d.heads[e].template)&&(t=d.heads[e].template.replace(/%VAL%/g,t)),n.html(t),n.addClass(h.clsBodyCell),y.isValue(d.heads[e].clsColumn)&&n.addClass(d.heads[e].clsColumn),!1===y.bool(g[e].show)&&n.addClass("hidden"),y.bool(g[e].show)&&n.removeClass("hidden"),n.data("original",this),r[g[e]["index-view"]]=n,d._fireEvent("draw-cell",{td:n,val:t,cellIndex:e,head:d.heads[e],items:o}),!0===h.cellWrapper&&(t=w("
").addClass("data-wrapper").addClass(h.clsCellWrapper).html(n.html()),n.html("").append(t))}),n=0;n").addClass(h.clsBodyRow).appendTo(p),(s=w("
").attr("colspan",n).addClass("text-center").html(w("").addClass(h.clsEmptyTableTitle).html(h.emptyTableTitle||d.locale.table.empty))).appendTo(i);this._info(1+f,1+m,c.length),this._paging(c.length),this.activity&&this.activity.hide(),this._fireEvent("draw"),void 0!==e&&y.exec(e,null,u[0])}else console.warn("Heads is not defined for table ID "+u.attr("id"))},_getItemContent:function(e){var t=this.options,n=e[this.sort.colIndex],i=this.heads[this.sort.colIndex].format,s=y.isNull(this.heads)||y.isNull(this.heads[this.sort.colIndex])||!y.isValue(this.heads[this.sort.colIndex].formatMask)?"%Y-%m-%d":this.heads[this.sort.colIndex].formatMask,a=(this.heads&&this.heads[this.sort.colIndex]&&this.heads[this.sort.colIndex].thousandSeparator?this.heads[this.sort.colIndex]:t).thousandSeparator,e=(this.heads&&this.heads[this.sort.colIndex]&&this.heads[this.sort.colIndex].decimalSeparator?this.heads[this.sort.colIndex]:t).decimalSeparator,o=(""+n).toLowerCase().replace(/[\n\r]+|[\s]{2,}/g," ").trim();if(y.isValue(o)&&y.isValue(i))switch(-1!==["number","int","float","money"].indexOf(i)&&(o=y.parseNumber(o,a,e)),i){case"date":o=s?Datetime.from(o,s,t.locale):datetime(o);break;case"number":o=Number(o);break;case"int":o=parseInt(o);break;case"float":o=parseFloat(o);break;case"money":o=y.parseMoney(o);break;case"card":o=y.parseCard(o);break;case"phone":o=y.parsePhone(o)}return o},addItem:function(e,t){if(!Array.isArray(e))return console.warn("Item is not an array and can't be added"),this;this.items.push(e),!1!==t&&this.draw()},addItems:function(e,t){if(!Array.isArray(e))return console.warn("Items is not an array and can't be added"),this;e.forEach(function(e){Array.isArray(e)&&this.items.push(e,!1)}),this.draw(),!1!==t&&this.draw()},updateItem:function(e,n,t){var i=this.items[this.index[e]],s=null;return y.isNull(i)?(console.warn("Item is undefined for update"),this):(isNaN(n)&&this.heads.forEach(function(e,t){e.name===n&&(s=t)}),y.isNull(s)?console.warn("Item is undefined for update. Field "+n+" not found in data structure"):(i[s]=t,this.items[this.index[e]]=i),this)},getItem:function(e){return this.items[this.index[e]]},deleteItem:function(e,t){for(var n=[],i=y.isFunc(t),s=0;sthis.pagesCount))return this._draw(),this;this.currentPage=this.pagesCount}},prev:function(){if(0!==this.items.length){if(this.currentPage--,0!==this.currentPage)return this._draw(),this;this.currentPage=1}},first:function(){if(0!==this.items.length)return this.currentPage=1,this._draw(),this},last:function(){if(0!==this.items.length)return this.currentPage=this.pagesCount,this._draw(),this},page:function(e){return e<=0&&(e=1),e>this.pagesCount&&(e=this.pagesCount),this.currentPage=e,this._draw(),this},addFilter:function(e,t){var n,i=null,s=y.isFunc(e);if(!1!==s){for(n=0;n").appendTo(m),g=w("