diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a9343cde..f90d242a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: branches: - master paths-ignore: - - '**.md' + - "**.md" pull_request: branches: - master @@ -15,155 +15,155 @@ jobs: job_build_modulecode: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Cache pip - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: ${{ runner.os }}-pip- - - - name: Cache PlatformIO - uses: actions/cache@v2 - with: - path: ~/.platformio - key: ${{ runner.os }}-platformio-2022-${{ hashFiles('**/lockfiles') }} - - - name: Set up Python - uses: actions/setup-python@v2 - - - uses: actions/cache@v2 - with: - path: ~/.local/share/virtualenvs - key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }} - restore-keys: ${{ runner.os }}-pipenv- - - - name: Install PlatformIO - run: | - python -m pip install --upgrade pip - pip install --upgrade platformio - - - name: Create folders - run: | - mkdir -p ./ESPController/data/avr - mkdir -p ~/OUTPUT - mkdir -p ~/OUTPUT/Controller - mkdir -p ~/OUTPUT/ControllerBoardTest - mkdir -p ~/OUTPUT/Modules/HEX - mkdir -p ~/OUTPUT/Modules/BIN - - - name: Build code for modules - run: pio run --project-dir=./ATTINYCellModule --project-conf=./ATTINYCellModule/platformio.ini - - - name: Copy output - run: | - cp ./ATTINYCellModule/.pio/build/V*/*.hex ~/OUTPUT/Modules/HEX/ - cp ./ATTINYCellModule/.pio/build/V*/*.bin ~/OUTPUT/Modules/BIN/ - - - name: Get latest esptool - run: | - git clone https://github.com/espressif/esptool.git - cd esptool - pip install --user -e . - cd ~ - python -m esptool version - - - name: Build code for ESP32 controller - run: pio run --project-dir=./ESPController --environment esp32-devkitc --project-conf=./ESPController/platformio.ini - - - name: Copy output - run: | - cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/ - cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.elf ~/OUTPUT/Controller/ - cp ./ESPController/.pio/build/esp32-devkitc/partitions.bin ~/OUTPUT/Controller/ - cp ./ESPController/.pio/build/esp32-devkitc/bootloader_dout_40m.bin ~/OUTPUT/Controller/ - cp ./ESPController/.pio/build/esp32-devkitc/boot_app0.bin ~/OUTPUT/Controller/ - cp ./ESPController/data/avr/manifest.json ~/OUTPUT/Modules/ - - - name: Build File System Image for ESP32 - run: pio run --project-dir=./ESPController --target buildfs --environment esp32-devkitc - - - name: Copy output - run: | - cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/ - - - name: Build single ESP32 image - run: | - python -m esptool --chip esp32 merge_bin -o ~/OUTPUT/Controller/esp32-controller-firmware-complete.bin --flash_mode=keep --flash_size 4MB 0x1000 ~/OUTPUT/Controller/bootloader_dout_40m.bin 0x8000 ~/OUTPUT/Controller/partitions.bin 0xe000 ~/OUTPUT/Controller/boot_app0.bin 0x10000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x1C0000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x370000 ~/OUTPUT/Controller/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin - - - name: Board test code for ESP32 controller - run: pio run --project-dir=./ESP32BoardTest --environment esp32-devkitc --project-conf=./ESP32BoardTest/platformio.ini - - - name: Copy board test output - run: | - cp ./ESP32BoardTest/.pio/build/esp32-devkitc/diybms_boardtest_espressif32_esp32-devkitc.bin ~/OUTPUT/ControllerBoardTest/ - - - name: Publish Artifacts 1 - uses: actions/upload-artifact@v2 - with: - name: DIYBMS-Compiled - path: ~/OUTPUT - if-no-files-found: error + - uses: actions/checkout@v3 + + - name: Cache pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: ${{ runner.os }}-pip- + + - name: Cache PlatformIO + uses: actions/cache@v3 + with: + path: ~/.platformio + key: ${{ runner.os }}-platformio-2022-${{ hashFiles('**/lockfiles') }} + + - name: Set up Python + uses: actions/setup-python@v4 + + - uses: actions/cache@v3 + with: + path: ~/.local/share/virtualenvs + key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }} + restore-keys: ${{ runner.os }}-pipenv- + + - name: Install PlatformIO + run: | + python -m pip install --upgrade pip + pip install --upgrade platformio + + - name: Create folders + run: | + mkdir -p ./ESPController/data/avr + mkdir -p ~/OUTPUT + mkdir -p ~/OUTPUT/Controller + mkdir -p ~/OUTPUT/ControllerBoardTest + mkdir -p ~/OUTPUT/Modules/HEX + mkdir -p ~/OUTPUT/Modules/BIN + + - name: Build code for modules + run: pio run --project-dir=./ATTINYCellModule --project-conf=./ATTINYCellModule/platformio.ini + + - name: Copy output + run: | + cp ./ATTINYCellModule/.pio/build/V*/*.hex ~/OUTPUT/Modules/HEX/ + cp ./ATTINYCellModule/.pio/build/V*/*.bin ~/OUTPUT/Modules/BIN/ + + - name: Get latest esptool + run: | + git clone https://github.com/espressif/esptool.git + cd esptool + pip install --user -e . + cd ~ + python -m esptool version + + - name: Build code for ESP32 controller + run: pio run --project-dir=./ESPController --environment esp32-devkitc --project-conf=./ESPController/platformio.ini + + - name: Copy output + run: | + cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/ + cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.elf ~/OUTPUT/Controller/ + cp ./ESPController/.pio/build/esp32-devkitc/partitions.bin ~/OUTPUT/Controller/ + cp ./ESPController/.pio/build/esp32-devkitc/bootloader.bin ~/OUTPUT/Controller/ + cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin ~/OUTPUT/Controller/ + cp ./ESPController/data/avr/manifest.json ~/OUTPUT/Modules/ + + - name: Build File System Image for ESP32 + run: pio run --project-dir=./ESPController --target buildfs --environment esp32-devkitc + + - name: Copy output + run: | + cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/ + + - name: Build single ESP32 image + run: | + python -m esptool --chip esp32 merge_bin -o ~/OUTPUT/Controller/esp32-controller-firmware-complete.bin --flash_mode=keep --flash_size 4MB 0x1000 ~/OUTPUT/Controller/bootloader.bin 0x8000 ~/OUTPUT/Controller/partitions.bin 0xe000 ~/OUTPUT/Controller/boot_app0.bin 0x10000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x1C0000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x370000 ~/OUTPUT/Controller/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin + + - name: Board test code for ESP32 controller + run: pio run --project-dir=./ESP32BoardTest --environment esp32-devkitc --project-conf=./ESP32BoardTest/platformio.ini + + - name: Copy board test output + run: | + cp ./ESP32BoardTest/.pio/build/esp32-devkitc/diybms_boardtest_espressif32_esp32-devkitc.bin ~/OUTPUT/ControllerBoardTest/ + + - name: Publish Artifacts 1 + uses: actions/upload-artifact@v2 + with: + name: DIYBMS-Compiled + path: ~/OUTPUT + if-no-files-found: error job_zip_code: runs-on: ubuntu-latest needs: [job_build_modulecode] steps: - - name: Download artifact DIYBMS-Compiled - uses: actions/download-artifact@v2 - with: - name: DIYBMS-Compiled - - - name: Display structure of downloaded files - run: ls -R - - - name: ZIP output for release - run: | - zip release.zip ./Controller/esp32-controller-firmware-complete.bin - zip release.zip ./ControllerBoardTest/diybms_boardtest_espressif32_esp32-devkitc.bin - zip release.zip ./Modules/manifest.json - zip release.zip ./Modules/HEX/*.* - - - name: Get current date - id: date - run: echo "dt=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_ENV - - - name: Display structure of downloaded files - run: mv release.zip release_${{ env.dt }}.zip - - - name: Publish Artifact - uses: actions/upload-artifact@v2 - with: - name: DIYBMS-Release-Artifact-${{ env.dt }} - path: | + - name: Download artifact DIYBMS-Compiled + uses: actions/download-artifact@v2 + with: + name: DIYBMS-Compiled + + - name: Display structure of downloaded files + run: ls -R + + - name: ZIP output for release + run: | + zip release.zip ./Controller/esp32-controller-firmware-complete.bin + zip release.zip ./ControllerBoardTest/diybms_boardtest_espressif32_esp32-devkitc.bin + zip release.zip ./Modules/manifest.json + zip release.zip ./Modules/HEX/*.* + + - name: Get current date + id: date + run: echo "dt=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_ENV + + - name: Display structure of downloaded files + run: mv release.zip release_${{ env.dt }}.zip + + - name: Publish Artifact + uses: actions/upload-artifact@v2 + with: + name: DIYBMS-Release-Artifact-${{ env.dt }} + path: | ./Controller/*.* ./Modules/manifest.json ./Modules/HEX/*.* - if-no-files-found: error - - - name: Create Release Files on MASTER branch only - id: create_release - uses: actions/create-release@v1 - if: github.ref == 'refs/heads/master' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: Tag-${{ env.dt }} - release_name: Release-${{ env.dt }} - body: | - Automatically generated release - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - if: github.ref == 'refs/heads/master' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./release_${{ env.dt }}.zip - asset_name: Compiled_Firmware_${{ env.dt }}.zip - asset_content_type: application/zip + if-no-files-found: error + + - name: Create Release Files on MASTER branch only + id: create_release + uses: actions/create-release@v1 + if: github.ref == 'refs/heads/master' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: Tag-${{ env.dt }} + release_name: Release-${{ env.dt }} + body: | + Automatically generated release + draft: false + prerelease: false + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + if: github.ref == 'refs/heads/master' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./release_${{ env.dt }}.zip + asset_name: Compiled_Firmware_${{ env.dt }}.zip + asset_content_type: application/zip diff --git a/ESP32BoardTest/platformio.ini b/ESP32BoardTest/platformio.ini index 4aefc68f..d2959cc0 100644 --- a/ESP32BoardTest/platformio.ini +++ b/ESP32BoardTest/platformio.ini @@ -54,9 +54,7 @@ upload_speed=921600 upload_port=COM4 platform_packages = - toolchain-xtensa32 @ ~2.80400.0 - platformio/tool-esptoolpy @ ~1.30100 - framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.3 + framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.6 board_build.partitions = diybms_partitions.csv diff --git a/ESP32BoardTest/src/main.cpp b/ESP32BoardTest/src/main.cpp index b62c5d43..5391b167 100644 --- a/ESP32BoardTest/src/main.cpp +++ b/ESP32BoardTest/src/main.cpp @@ -32,14 +32,12 @@ static constexpr const char *const TAG = "diybms"; #include "FS.h" #include "SD.h" -//#include #include #include #include "driver/gpio.h" #include "driver/twai.h" #include "driver/adc.h" #include -//#include #include "TFT_eSPI.h" #include "driver/i2c.h" #include "esp32-hal-i2c.h" @@ -89,7 +87,6 @@ static constexpr const char *const TAG = "diybms"; #define RS485_TX GPIO_NUM_22 #define RS485_ENABLE GPIO_NUM_25 - enum RGBLED : uint8_t { OFF = 0, @@ -111,7 +108,7 @@ void Led(uint8_t bits); uint8_t readByte(i2c_port_t i2c_num, uint8_t dev, uint8_t reg); uint16_t read16bitWord(i2c_port_t i2c_num, uint8_t dev, uint8_t reg); -SPIClass vspi; +SPIClass vspi(VSPI); // Copy of pin state for TCA9534 uint8_t TCA9534APWR_Value; // Copy of pin state for TCA6408 @@ -119,7 +116,6 @@ uint8_t TCA6408_Value; TFT_eSPI tft = TFT_eSPI(); - uint8_t readByte(i2c_port_t i2c_num, uint8_t dev, uint8_t reg) { // We use the native i2c commands for ESP32 as the Arduino library @@ -231,7 +227,7 @@ void ConfigurePins() // GPIO34 is interrupt pin from TCA9534A (doesnt have pull up/down resistors) pinMode(TCA9534A_INTERRUPT_PIN, INPUT); - // BOOT Button on ESP32 module is used for resetting wifi details + // BOOT Button on ESP32 module pinMode(GPIO_NUM_0, INPUT_PULLUP); // attachInterrupt(GPIO_NUM_0, WiFiPasswordResetInterrupt, CHANGE); @@ -248,6 +244,11 @@ void ConfigurePins() pinMode(RS485_ENABLE, OUTPUT); // Enable receive digitalWrite(RS485_ENABLE, LOW); + + + pinMode(GPIO_NUM_35, INPUT); + pinMode(GPIO_NUM_33, OUTPUT); + digitalWrite(GPIO_NUM_33, HIGH); } // Attempts connection to i2c device @@ -301,7 +302,7 @@ void WriteTCA6416OutputState() // Emulate the 9534 + 6408 and set the state on the 16 bit output TCA6416_Output_Pins = ((uint16_t)TCA9534APWR_Output_Pins << 8) | TCA6408_Output_Pins; - //ESP_LOGD(TAG, "TCA6416_Output_Pins=%x", TCA6416_Output_Pins); + // ESP_LOGD(TAG, "TCA6416_Output_Pins=%x", TCA6416_Output_Pins); ESP_ERROR_CHECK_WITHOUT_ABORT(write16bitWord(I2C_NUM_0, TCA6416_ADDRESS, TCA6416_OUTPUT, TCA6416_Output_Pins)); @@ -574,7 +575,7 @@ SD CARD TEST */ ESP_LOGI(TAG, "Mounting SD card"); - if (SD.begin(SDCARD_CHIPSELECT, vspi)) + if (SD.begin(SDCARD_CHIPSELECT, vspi, 4000000,"/sd", 5U,true)) { uint8_t cardType = SD.cardType(); if (cardType == CARD_NONE) @@ -595,17 +596,17 @@ SD CARD TEST } void testSerial() { - ESP_LOGI(TAG, "Test serial TX1/RX1"); - for (size_t i = 0; i < 5; i++) + // Clear send and reply buffers + SERIAL_DATA.flush(); + while (SERIAL_DATA.available()) { - delay(100); - // Clear send and reply buffers - SERIAL_DATA.flush(); - while (SERIAL_DATA.available()) - { - SERIAL_DATA.read(); - } + SERIAL_DATA.read(); + } + delay(10); + ESP_LOGI(TAG, "Test serial TX1/RX1"); + for (size_t i = 0; i < 50; i++) + { SERIAL_DATA.println("test!"); Led(RGBLED::Blue); @@ -633,46 +634,41 @@ void setup() SERIAL_DEBUG.begin(115200, SERIAL_8N1); SERIAL_DEBUG.setDebugOutput(true); - vspi = SPIClass(VSPI); - ConfigurePins(); ConfigureI2C(); ConfigureVSPI(); - /* - mountSDCard(); + mountSDCard(); - // Create a test file - File file; - const char *filename = "/burnin.txt"; + // Create a test file + File file; + const char *filename = "/burnin.txt"; - if (SD.exists(filename)) + if (SD.exists(filename)) + { + file = SD.open(filename, FILE_APPEND); + ESP_LOGD(TAG, "Open %s", filename); + } + else + { + File file = SD.open(filename, FILE_WRITE); + if (file) { - file = SD.open(filename, FILE_APPEND); - ESP_LOGD(TAG, "Open %s", filename); + ESP_LOGI(TAG, "Created %s", filename); } else { - File file = SD.open(filename, FILE_WRITE); - if (file) - { - ESP_LOGI(TAG, "Created %s", filename); - } - else - { - Halt(RGBLED::Blue); - } + Halt(RGBLED::Blue); } + } - file.println("Mary had a little lamb..."); - file.close(); - - ESP_LOGI(TAG, "All good for SD card file %s", filename); - SD.end(); + file.println("Mary had a little lamb..."); + file.close(); - */ + ESP_LOGI(TAG, "All good for SD card file %s", filename); + SD.end(); - //RGB led test + // RGB led test ESP_LOGD(TAG, "RED"); Led(RGBLED::Red); delay(1000); @@ -684,13 +680,11 @@ void setup() delay(1000); Led(RGBLED::OFF); - // Test SERIAL SERIAL_DATA.begin(2400, SERIAL_8N1, 2, 32); // Serial for comms to modules testSerial(); init_tft_display(); - } void SetOutputState(uint8_t outputId, bool state) @@ -827,22 +821,23 @@ void loop() state = !state; } - if (TCA6416_Fitted) { + if (TCA6416_Fitted) + { ReadTCA6416InputRegisters(); - } else { + } + else + { ReadTCA6408InputRegisters(); ReadTCA9534InputRegisters(); } - - //Hex dump the input status + // Hex dump the input status tft.setTextColor(TFT_GREEN, TFT_BLACK); tft.setCursor(0, 150, 4); tft.print("INPUTS= "); - tft.print(TCA6408_Input,16); + tft.print(TCA6408_Input, 16); tft.print(" / "); - tft.print(TCA9534APWR_Input,16); - + tft.print(TCA9534APWR_Input, 16); TouchScreenValues touchscreen = TouchScreenUpdate(); diff --git a/ESPController/.prettierrc b/ESPController/.prettierrc new file mode 100644 index 00000000..baa9dabc --- /dev/null +++ b/ESPController/.prettierrc @@ -0,0 +1,11 @@ +{ + "printWidth":120, + "trailingComma": "none", + "tabWidth": 2, + "semi": false, + "singleQuote": true, + "bracketSpacing": false, + "bracketSameLine":true, + "htmlWhitespaceSensitivity":"ignore", + "singleAttributePerLine":false + } \ No newline at end of file diff --git a/ESPController/data/cfg_lifepo4_16cells.json b/ESPController/data/cfg_lifepo4_16cells.json new file mode 100644 index 00000000..a0e3c1cf --- /dev/null +++ b/ESPController/data/cfg_lifepo4_16cells.json @@ -0,0 +1 @@ +{"diybms_settings":{"totalNumberOfBanks":1,"totalNumberOfSeriesModules":16,"baudRate":10000,"interpacketgap":3000,"graph_voltagehigh":3650,"graph_voltagelow":3000,"BypassOverTempShutdown":65,"BypassThresholdmV":3450,"timeZone":0,"minutesTimeZone":0,"daylight":false,"ntpServer":"time.google.com","loggingEnabled":false,"loggingFrequencySeconds":15,"currentMonitoringEnabled":true,"currentMonitoringModBusAddress":90,"rs485baudrate":19200,"rs485databits":3,"rs485parity":0,"rs485stopbits":1,"language":"en","mqtt":{"enabled":true,"uri":"mqtt://192.168.0.26:1883","topic":"emon/diybms","username":"emonpi","password":"emonpimqtt2016"},"influxdb":{"enabled":false,"apitoken":"","bucket":"bucketname","org":"organisation","url":"http://192.168.0.49:8086/api/v2/write","logfreq":15},"outputs":{"default":[153,153,153,153],"type":[0,0,0,0]},"rules":{"EmergencyStop":{"value":0,"hysteresis":0,"state":[0,0,0,0]},"BMSError":{"value":0,"hysteresis":0,"state":[0,0,0,0]},"CurrentMonitorOverCurrentAmps":{"value":100,"hysteresis":100,"state":[0,0,0,0]},"ModuleOverVoltage":{"value":3650,"hysteresis":3500,"state":[255,0,0,0]},"ModuleUnderVoltage":{"value":2900,"hysteresis":3050,"state":[255,0,0,0]},"ModuleOverTemperatureInternal":{"value":75,"hysteresis":75,"state":[0,0,0,0]},"ModuleUnderTemperatureInternal":{"value":5,"hysteresis":5,"state":[0,0,0,0]},"ModuleOverTemperatureExternal":{"value":50,"hysteresis":50,"state":[0,0,0,0]},"ModuleUnderTemperatureExternal":{"value":2,"hysteresis":2,"state":[0,0,0,0]},"CurrentMonitorOverVoltage":{"value":57600,"hysteresis":57000,"state":[0,0,0,0]},"CurrentMonitorUnderVoltage":{"value":48000,"hysteresis":49000,"state":[0,0,0,0]},"BankOverVoltage":{"value":57600,"hysteresis":57000,"state":[0,0,0,0]},"BankUnderVoltage":{"value":48000,"hysteresis":49000,"state":[0,0,0,0]},"Timer2":{"value":1020,"hysteresis":1020,"state":[0,0,0,0]},"Timer1":{"value":480,"hysteresis":480,"state":[0,0,0,0]}},"canbusprotocol":2,"nominalbatcap":280,"chargevolt":568,"chargecurrent":650,"dischargecurrent":650,"dischargevolt":488,"chargetemplow":0,"chargetemphigh":50,"dischargetemplow":-30,"dischargetemphigh":55,"stopchargebalance":false,"socoverride":false,"socforcelow":false,"dynamiccharge":true,"preventdischarge":false,"preventcharging":false,"cellminmv":3050,"cellmaxmv":3460,"kneemv":3320,"cellmaxspikemv":3550,"sensitivity":27,"cur_val1":36,"cur_val2":7,"tilevisibility":[49152,0,62209,0,0]}} \ No newline at end of file diff --git a/ESPController/diybms_partitions.csv b/ESPController/diybms_partitions.csv index 26d1eac4..ed155e1c 100644 --- a/ESPController/diybms_partitions.csv +++ b/ESPController/diybms_partitions.csv @@ -3,4 +3,5 @@ nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x1B0000, app1, app, ota_1, 0x1C0000, 0x1B0000, -spiffs, data, spiffs, 0x370000, 0x90000, \ No newline at end of file +spiffs, data, spiffs, 0x370000, 0x80000, +coredump, data, coredump,0x3F0000, 0x10000 diff --git a/ESPController/extract_bootloader.py b/ESPController/extract_bootloader.py index 0eea48b9..52807ea2 100644 --- a/ESPController/extract_bootloader.py +++ b/ESPController/extract_bootloader.py @@ -11,26 +11,58 @@ import os from os import path import shutil +import subprocess Import("env") + def after_build(source, target, env): #print("extract_bootloader from framework-arduinoespressif32") - #print(env.Dump('FLASH_EXTRA_IMAGES')) - builddir=env.subst(env.get('BUILD_DIR','')) + # print(env.Dump('FLASH_EXTRA_IMAGES')) + builddir = env.subst(env.get('BUILD_DIR', '')) # Get the 2nd tuple from the list, expanding env variables as we go - files_to_copy = [env.subst(x[-1]) for x in env.get('FLASH_EXTRA_IMAGES',[])] + files_to_copy = [env.subst(x[-1]) + for x in env.get('FLASH_EXTRA_IMAGES', [])] # Strip out partitions.bin file its already in the correct location - files_to_copy = [x for x in files_to_copy if x.endswith('partitions.bin')==False] + files_to_copy = [x for x in files_to_copy if x.endswith( + 'partitions.bin') == False] - #print(files_to_copy) - #print(len(files_to_copy)) + # print(files_to_copy) + # print(len(files_to_copy)) for file in files_to_copy: - #file=env.subst(file) - print("Copying",file) + # file=env.subst(file) + print("Copying", file) shutil.copy2(file, builddir) + +def after_buildfs(source, target, env): + print("Build complete 4MB ESP32 image") + #print(env.Dump()) + cmd = [sys.executable, env.get('OBJCOPY', ''), "--chip", "esp32", "merge_bin", "-o", + "esp32-controller-firmware-complete.bin","--flash_size", "4MB"] + + for x in env.get('FLASH_EXTRA_IMAGES', []): + cmd.append(x[0]) + cmd.append(x[1]) + + cmd.append(env.get('ESP32_APP_OFFSET')) + cmd.append(env.get('PROGNAME')+".bin") + # This value should be read from 'PARTITIONS_TABLE_CSV' + cmd.append("0x1c0000") + cmd.append(env.get('PROGNAME')+".bin") + # This value should be read from 'PARTITIONS_TABLE_CSV' + cmd.append("0x370000") + cmd.append(env.get('ESP32_FS_IMAGE_NAME')+".bin") + + builddir = env.subst(env.get('BUILD_DIR', '')) + + result = subprocess.run(args=cmd, cwd=builddir, + shell=True, check=True, capture_output=True) + print(result.stdout) + + env.AddPostAction("buildprog", after_build) +env.AddPostAction("buildfs", after_buildfs) diff --git a/ESPController/include/HAL_ESP32.h b/ESPController/include/HAL_ESP32.h index aeb8bf9f..975e37f3 100644 --- a/ESPController/include/HAL_ESP32.h +++ b/ESPController/include/HAL_ESP32.h @@ -4,19 +4,22 @@ FOR DIYBMS ESP32 CONTROLLER PCB - THIS IS THE LARGER PCB WITH RS485/CANBUS/TFT DISPLAY */ +#define CONFIG_DISABLE_HAL_LOCKS 1 + #include #include "driver/i2c.h" #include #include "esp32-hal-i2c.h" #include - -//#define GREEN_LED 2 +#include "SD.h" #define PFC_INTERRUPT_PIN 33 #ifndef HAL_ESP32_H_ #define HAL_ESP32_H_ +#pragma once + // GPIO34 (input only pin) #define TCA9534A_INTERRUPT_PIN GPIO_NUM_34 #define TCA9534APWR_ADDRESS 0x38 @@ -68,16 +71,19 @@ struct TouchScreenValues uint16_t Y; }; +//extern SPIClass vspi; + + + // Derived classes class HAL_ESP32 { public: bool TCA6416_Fitted; - SPIClass vspi; + HAL_ESP32() { TCA6416_Fitted = false; - vspi = SPIClass(VSPI); xVSPIMutex = xSemaphoreCreateMutex(); xDisplayMutex = xSemaphoreCreateMutex(); xi2cMutex = xSemaphoreCreateMutex(); @@ -90,6 +96,9 @@ class HAL_ESP32 uint8_t ReadTCA9534InputRegisters(); uint16_t ReadTCA6416InputRegisters(); + // Returns pointer to VSPI object class + SPIClass *VSPI_Ptr(); + void Led(uint8_t bits); void ConfigurePins(); void TFTScreenBacklight(bool Status); @@ -144,7 +153,12 @@ class HAL_ESP32 if (xVSPIMutex == NULL) return false; - return (xSemaphoreGive(xVSPIMutex) == pdTRUE); + bool reply = (xSemaphoreGive(xVSPIMutex) == pdTRUE); + if (!reply) + { + ESP_LOGE(TAG, "Unable to release VSPI mutex"); + } + return reply; } bool Geti2cMutex() @@ -165,7 +179,12 @@ class HAL_ESP32 if (xi2cMutex == NULL) return false; - return (xSemaphoreGive(xi2cMutex) == pdTRUE); + bool reply = (xSemaphoreGive(xi2cMutex) == pdTRUE); + if (!reply) + { + ESP_LOGE(TAG, "Unable to release I2C mutex"); + } + return reply; } bool GetRS485Mutex() @@ -203,132 +222,6 @@ class HAL_ESP32 } } - TouchScreenValues TouchScreenUpdate() - { - /* - Features and Specification of XPT2046 - * 12 bit SAR type A/D converter with S/H circuit - * Low voltage operations (VCC = 2.2V - 3.6V) - * Low power consumption (260uA) - * 125 kHz sampling frequency - * On-chip reference voltage - 2.5V - * Pen pressure measurement - * On-chip thermo sensor - * Direct battery measurement - * 4-wire I/F - - DataSheet - https://components101.com/admin/sites/default/files/component_datasheet/XPT2046-Datasheet.pdf - - // BIT7(MSB) BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0(LSB) - // S A2 A1 A0 MODE SER/——DFR PD1 PD0 - - // S = START BIT - // A2/A1/A0 = Channel address bits 011 = Z1, 100=Z2, 001=X, 101=Y - // MODE = 12bit/8bit (12bit=low) - // SER/DFR = SingleEnded/Differential ADC mode (differential mode) - // PD0 and PD1 control power delivery, 0/0 = all enabled, 1=1=disabled. - */ - // Z is touch (depth) - // const uint8_t ADD_TEMPERATURE = 0B00000000; - // const uint8_t ADD_VBATTERY = 0B00100000; - const uint8_t ADD_Z1 = 0B00110000; - const uint8_t ADD_Z2 = 0B01000000; - const uint8_t ADD_X = 0B00010000; - const uint8_t ADD_Y = 0B01010000; - const uint8_t STARTBIT = 0B10000000; - // internal reference voltage is only used in the single-ended mode for battery monitoring, temperature measurement - const uint8_t PWR_ALLOFF = 0B00000000; - const uint8_t PWR_REFOFF_ADCON = 0B00000001; - // const uint8_t PWR_REFON_ADCOFF = 0B00000010; - // const uint8_t PWR_REFON_ADCON = 0B00000011; - - // Differential Reference Mode (SER/DFR low) should be used for reading X/Y/Z - // Single ended mode (SER/DFR high) should be used for temperature and battery - const uint8_t ADC_DIFFERENTIAL = 0B00000000; - // const uint8_t ADC_SINGLEENDED = 0B00000100; - - const uint8_t ADC_8BIT = 0B00001000; - const uint8_t ADC_12BIT = 0B00000000; - - TouchScreenValues reply; - reply.touched = false; - reply.pressure = 0; - reply.X = 0; - reply.Y = 0; - - // Landscape orientation screen - // X is zero when not touched, left of screen is about 290, right of screen is about 3900 - // Y is 3130 when not touched, top of screen is 250, bottom is 3150 - - if (GetVSPIMutex()) - { - // Slow down to 2Mhz SPI bus - vspi.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0)); - - digitalWrite(TOUCH_CHIPSELECT, LOW); - - // We don't need accurate touch pressure for this application, so - // only read Z2 register, we just want a boolean value at the end of the day - - // The transfers are always a step behind, so the transfer reads the previous value/command - vspi.write(STARTBIT | PWR_REFOFF_ADCON | ADC_8BIT | ADC_DIFFERENTIAL | ADD_Z1); - - // Read Z2 (1 byte) and request X - reply.pressure = vspi.transfer(STARTBIT | PWR_REFOFF_ADCON | ADC_12BIT | ADC_DIFFERENTIAL | ADD_X); - - // Read X (2 bytes) and request Y - reply.X = vspi.transfer16(STARTBIT | PWR_REFOFF_ADCON | ADC_12BIT | ADC_DIFFERENTIAL | ADD_Y) >> 3; - // Take Y reading, then power down after this sample - reply.Y = vspi.transfer16(STARTBIT | PWR_ALLOFF | ADC_8BIT | ADC_DIFFERENTIAL | ADD_Z2) >> 3; - - // Final transfer to ensure device goes into sleep - // In order to turn the reference off, an additional write to the XPT2046 is required after the channel has been converted. Page 24 datasheet - // uint16_t Z2 = - vspi.transfer(0); - - digitalWrite(TOUCH_CHIPSELECT, HIGH); - vspi.endTransaction(); - - ReleaseVSPIMutex(); - - // Screen connected and not touched - // Touch = 128, x=0 , y around 3130-3140 - - // 135 controls the minimum amount of pressure needed to "touch" - // X also needs to be greater than zero - reply.touched = reply.pressure > 135 && reply.X > 0; - - //ESP_LOGI(TAG, "Touch = touch=%i pressure=%u x=%u y=%u", reply.touched, reply.pressure, reply.X, reply.Y); - } - - return reply; - } - - bool IsScreenAttached() - { - TouchScreenValues v = TouchScreenUpdate(); - //ESP_LOGD(TAG,"Touch pressure=%u, X=%u, Y=%u",v.pressure, v.X, v.Y); - return !(v.pressure == 0 && v.X == 0 && v.Y == 0); - } - - void ConfigureVSPI() - { - ESP_LOGD(TAG,"Configure VSPI"); - vspi.endTransaction(); - vspi.end(); - // VSPI - // GPIO23 (MOSI), GPIO19(MISO), GPIO18(CLK) and GPIO5 (CS) - vspi.begin(GPIO_NUM_18, GPIO_NUM_19, GPIO_NUM_23, -1); - - // Don't use hardware chip selects on VSPI - vspi.setHwCs(false); - vspi.setBitOrder(MSBFIRST); - vspi.setDataMode(SPI_MODE0); - // 10mhz - vspi.setFrequency(10000000); - } - uint8_t LastTCA6408Value() { return TCA6408_Input; @@ -337,6 +230,11 @@ class HAL_ESP32 { return TCA9534APWR_Input; } + bool MountSDCard(); + void UnmountSDCard(); + TouchScreenValues TouchScreenUpdate(); + bool IsScreenAttached(); + void ConfigureVSPI(); private: SemaphoreHandle_t xVSPIMutex = NULL; diff --git a/ESPController/include/Rules.h b/ESPController/include/Rules.h index bcfd268f..892ad24a 100644 --- a/ESPController/include/Rules.h +++ b/ESPController/include/Rules.h @@ -6,9 +6,9 @@ #include "defines.h" // Needs to match the ordering on the HTML screen -// You also need to update "RuleTextDescription" +// You also need to update "RuleTextDescription" (Rules.cpp) // Define a max constant for the highest value (change if you add more rules) -#define MAXIMUM_RuleNumber 14 +#define MAXIMUM_RuleNumber 15 enum Rule : uint8_t { EmergencyStop = 0, @@ -24,12 +24,13 @@ enum Rule : uint8_t CurrentMonitorUnderVoltage = 10, BankOverVoltage = 11, BankUnderVoltage = 12, - Timer2 = 13, - Timer1 = 14 + BankRange = 13, + Timer2 = 14, + Timer1 = 15 }; // Define a max constant for the highest value (change if you add more warnings) -#define MAXIMUM_InternalWarningCode 6 +#define MAXIMUM_InternalWarningCode 9 enum InternalWarningCode : uint8_t { NoWarning = 0, @@ -38,7 +39,10 @@ enum InternalWarningCode : uint8_t ModuleInconsistantCodeVersion = 3, ModuleInconsistantBoardRevision = 4, LoggingEnabledNoSDCard = 5, - AVRProgrammingMode = 6 + AVRProgrammingMode = 6, + ChargePrevented = 7, + DischargePrevented = 8, + NoExternalTempSensor = 9 }; // Define a max constant for the highest value (change if you add more errors) @@ -57,26 +61,45 @@ enum InternalErrorCode : uint8_t class Rules { +private: + uint16_t dynamicChargeVoltage; + uint16_t dynamicChargeCurrent; + + bool SharedChargingDischargingRules(diybms_eeprom_settings *mysettings); public: bool rule_outcome[RELAY_RULES]; // Number of TRUE values in array rule_outcome uint8_t active_rule_count; - uint32_t packvoltage[maximum_number_of_banks]; + // Actual bank voltage reported by the modules (sum of voltage reported by modules) + uint32_t bankvoltage[maximum_number_of_banks]; + // As above, but each voltage reading limited to "cellmaxmv" setting (used for charge voltage calc) + uint32_t limitedbankvoltage[maximum_number_of_banks]; - uint16_t lowestvoltageinpack[maximum_number_of_banks]; - uint16_t highestvoltageinpack[maximum_number_of_banks]; + uint16_t LowestCellVoltageInBank[maximum_number_of_banks]; + uint16_t HighestCellVoltageInBank[maximum_number_of_banks]; + // Number of modules who have reported zero volts (bad!) uint8_t zeroVoltageModuleCount; - uint32_t highestPackVoltage; - uint32_t lowestPackVoltage; + // Highest pack voltage + uint32_t highestBankVoltage; + // Lowest pack voltage + uint32_t lowestBankVoltage; + + // Highest cell voltage in the whole system uint16_t highestCellVoltage; + // Lowest cell voltage in the whole system uint16_t lowestCellVoltage; + // Highest cell voltage range (mV) across all banks + uint16_t highestBankRange; + // Identify address (id) of which module reports the highest/lowest values uint8_t address_HighestCellVoltage; + // Bank with the highest cell voltage in it + uint8_t index_bank_HighestCellVoltage; uint8_t address_LowestCellVoltage; uint8_t address_highestExternalTemp; uint8_t address_lowestExternalTemp; @@ -100,7 +123,7 @@ class Rules int8_t numberOfBalancingModules; void ClearValues(); - void ProcessCell(uint8_t bank, uint8_t cellNumber, CellModuleInfo *c); + void ProcessCell(uint8_t bank, uint8_t cellNumber, CellModuleInfo *c, uint16_t cellmaxmv); void ProcessBank(uint8_t bank); void SetWarning(InternalWarningCode warncode); @@ -119,10 +142,18 @@ class Rules void SetError(InternalErrorCode err); uint16_t VoltageRangeInBank(uint8_t bank); void RunRules( - uint32_t *value, - uint32_t *hysteresisvalue, + int32_t *value, + int32_t *hysteresisvalue, bool emergencyStop, uint16_t mins, currentmonitoring_struct *currentMonitor); + + bool IsChargeAllowed(diybms_eeprom_settings *mysettings); + bool IsDischargeAllowed(diybms_eeprom_settings *mysettings); + void CalculateDynamicChargeVoltage(diybms_eeprom_settings *mysettings, CellModuleInfo *cellarray); + void CalculateDynamicChargeCurrent(diybms_eeprom_settings *mysettings, CellModuleInfo *cellarray); + uint16_t DynamicChargeVoltage(); + int16_t DynamicChargeCurrent(); + uint16_t StateOfChargeWithRulesApplied(diybms_eeprom_settings *mysettings, float realSOC); }; #endif \ No newline at end of file diff --git a/ESPController/include/avrisp_programmer.h b/ESPController/include/avrisp_programmer.h index 0dde568f..abfe4be7 100644 --- a/ESPController/include/avrisp_programmer.h +++ b/ESPController/include/avrisp_programmer.h @@ -15,6 +15,7 @@ Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales (CC BY-NC-SA 2.0 UK #ifndef avrisp_program_H_ #define avrisp_program_H_ +#define CONFIG_DISABLE_HAL_LOCKS 1 #include #include #include "FS.h" diff --git a/ESPController/include/defines.h b/ESPController/include/defines.h index becd5a64..1fd28c20 100644 --- a/ESPController/include/defines.h +++ b/ESPController/include/defines.h @@ -11,10 +11,10 @@ #ifndef DIYBMS_DEFINES_H_ #define DIYBMS_DEFINES_H_ -// Needs to be at least 1550 bytes... +// Needs to be at least 1800 bytes... #define BUFSIZE 1800 -// Data uses Rx2/TX2 and debug logs go to serial0 - USB +// Data uses RX2/TX2 and debug logs go to serial0 - USB #define SERIAL_DATA Serial2 #define SERIAL_DEBUG Serial #define SERIAL_RS485 Serial1 @@ -63,9 +63,6 @@ enum VictronDVCC : uint8_t // This also needs changing in default.htm (MAXIMUM_NUMBER_OF_BANKS) #define maximum_number_of_banks 16 -// Version 4.XX of DIYBMS modules operate at 5000 baud (since 26 Jan 2021) -//#define COMMS_BAUD_RATE 5000 - enum enumInputState : uint8_t { INPUT_HIGH = 0xFF, @@ -92,6 +89,13 @@ enum RelayType : uint8_t RELAY_PULSE = 0x01 }; +enum CanBusProtocolEmulation : uint8_t +{ + CANBUS_DISABLED = 0x00, + CANBUS_VICTRON = 0x01, + CANBUS_PYLONTECH = 0x02 +}; + enum CurrentMonitorDevice : uint8_t { DIYBMS_CURRENT_MON = 0x00, @@ -99,7 +103,8 @@ enum CurrentMonitorDevice : uint8_t }; // Number of rules as defined in Rules.h (enum Rule) -#define RELAY_RULES 15 +// This value is 1 + MAXIMUM_RuleNumber +#define RELAY_RULES 16 // Number of relays on board (4) #define RELAY_TOTAL 4 @@ -117,8 +122,8 @@ struct diybms_eeprom_settings uint16_t baudRate; uint16_t interpacketgap; - uint32_t rulevalue[RELAY_RULES]; - uint32_t rulehysteresis[RELAY_RULES]; + int32_t rulevalue[RELAY_RULES]; + int32_t rulehysteresis[RELAY_RULES]; // Use a bit pattern to indicate the relay states RelayState rulerelaystate[RELAY_RULES][RELAY_TOTAL]; @@ -127,8 +132,8 @@ struct diybms_eeprom_settings // Default starting state for relay types RelayType relaytype[RELAY_TOTAL]; - float graph_voltagehigh; - float graph_voltagelow; + uint16_t graph_voltagehigh; + uint16_t graph_voltagelow; uint8_t BypassOverTempShutdown; uint16_t BypassThresholdmV; @@ -145,18 +150,47 @@ struct diybms_eeprom_settings uint8_t currentMonitoringModBusAddress; CurrentMonitorDevice currentMonitoringDevice; - int rs485baudrate; + int32_t rs485baudrate; uart_word_length_t rs485databits; uart_parity_t rs485parity; uart_stop_bits_t rs485stopbits; char language[2 + 1]; - uint16_t cvl[3]; - int16_t ccl[3]; - int16_t dcl[3]; - - bool VictronEnabled; + CanBusProtocolEmulation canbusprotocol; + uint16_t nominalbatcap; + // Maximum charge voltage - scale 0.1 + uint16_t chargevolt; + // Maximum charge current - scale 0.1 + uint16_t chargecurrent; + uint16_t dischargecurrent; + uint16_t dischargevolt; + int16_t cellminmv; + int16_t cellmaxmv; + int16_t kneemv; + // Part of the dynamic charge calculation scale 0.1 + int16_t sensitivity; + + int16_t cellmaxspikemv; + + // charge current formula values - scale 0.1 + uint16_t current_value1; + uint16_t current_value2; + + int8_t chargetemplow; + int8_t chargetemphigh; + int8_t dischargetemplow; + int8_t dischargetemphigh; + //Stop charging is a module is balancing + bool stopchargebalance; + //Override SoC values reported over CANBUS - limited between 20% and 99% + bool socoverride; + //Force a 2% SoC over CANBUS to trick charger/inverter into trickle charging + bool socforcelow; + //Dynamic charge control - voltage & current + bool dynamiccharge; + bool preventcharging; + bool preventdischarge; // NOTE this array is subject to buffer overflow vulnerabilities! bool mqtt_enabled; @@ -172,6 +206,9 @@ struct diybms_eeprom_settings char influxdb_apitoken[128 + 1]; char influxdb_orgid[128 + 1]; uint8_t influxdb_loggingFreqSeconds; + + // Holds a bit pattern indicating which "tiles" are visible on the web gui + uint16_t tileconfig[5]; }; typedef union @@ -298,15 +335,15 @@ struct currentmonitor_raw_modbus // Voltage float voltage; - // Current in AMPS + // Current in AMPS. Negative value is DISCHARGING float current; uint32_t milliamphour_out; uint32_t milliamphour_in; int16_t temperature; uint16_t flags; float power; - float shuntmV; - float currentlsb; + uint32_t daily_milliamphour_out; + uint32_t daily_milliamphour_in; float shuntresistance; uint16_t shuntmaxcurrent; uint16_t shuntmillivolt; @@ -333,7 +370,6 @@ struct currentmonitoring_struct { currentmonitor_raw_modbus modbus; - // Uses float as these are 4 bytes on ESP32 int64_t timestamp; bool validReadings; diff --git a/ESPController/include/mqtt.h b/ESPController/include/mqtt.h index 2afea161..0231335b 100644 --- a/ESPController/include/mqtt.h +++ b/ESPController/include/mqtt.h @@ -14,6 +14,8 @@ void stopMqtt(); void connectToMqtt(); void mqtt2(PacketReceiveProcessor *receiveProc,PacketRequestGenerator *prg, uint16_t requestq_count,Rules *rules, RelayState *previousRelayState); void mqtt1(currentmonitoring_struct *currentMonitor,Rules *rules); +void GeneralStatusPayload(PacketRequestGenerator *prg, PacketReceiveProcessor *receiveProc, uint16_t requestq_count,Rules *rules); +void BankLevelInformation(Rules *rules); extern uint16_t TotalNumberOfCells(); extern diybms_eeprom_settings mysettings; diff --git a/ESPController/include/pylon_canbus.h b/ESPController/include/pylon_canbus.h new file mode 100644 index 00000000..a61898a7 --- /dev/null +++ b/ESPController/include/pylon_canbus.h @@ -0,0 +1,28 @@ +#ifndef DIYBMS_PYLON_CANBUS_H_ +#define DIYBMS_PYLON_CANBUS_H_ + +#include "defines.h" +#include "Rules.h" +#include + +void pylon_message_356(); +void pylon_message_35e(); +void pylon_message_351(); +void pylon_message_355(); +void pylon_message_359(); +void pylon_message_35c(); + + +extern uint16_t TotalNumberOfCells(); +extern Rules rules; +extern currentmonitoring_struct currentMonitor; +extern diybms_eeprom_settings mysettings; +extern char hostname[16]; +extern ControllerState _controller_state; +extern uint32_t canbus_messages_failed_sent; +extern uint32_t canbus_messages_sent; +extern uint32_t canbus_messages_received; + +extern void send_canbus_message(uint32_t identifier, uint8_t *buffer, uint8_t length); + +#endif \ No newline at end of file diff --git a/ESPController/include/settings.h b/ESPController/include/settings.h new file mode 100644 index 00000000..8fe5eb7e --- /dev/null +++ b/ESPController/include/settings.h @@ -0,0 +1,45 @@ +#ifndef DIYBMS_SETTINGS_H_ +#define DIYBMS_SETTINGS_H_ + +#include "defines.h" +#include "nvs_flash.h" +#include "nvs.h" +#include "Rules.h" + +#include "ArduinoJson.h" +bool ValidateGetSetting(esp_err_t err, const char *key); + +bool getString(nvs_handle_t handle, const char *key, char *out_value, size_t size); +bool getSetting(nvs_handle_t handle, const char *key, float *out_value); +bool getSetting(nvs_handle_t handle, const char *key, uint8_t *out_value); +bool getSetting(nvs_handle_t handle, const char *key, int8_t *out_value); +bool getSetting(nvs_handle_t handle, const char *key, uint16_t *out_value); +// bool getSetting(nvs_handle_t handle, const char *key, uint32_t *out_value); +bool getSetting(nvs_handle_t handle, const char *key, int32_t *out_value); +bool getSetting(nvs_handle_t handle, const char *key, int16_t *out_value); +bool getSetting(nvs_handle_t handle, const char *key, bool *out_value); + +bool getSettingBlob(nvs_handle_t handle, const char *key, void *out_value, size_t size); + +void InitializeNVS(); +void SaveConfiguration(diybms_eeprom_settings *settings); +void LoadConfiguration(diybms_eeprom_settings *settings); +void ValidateConfiguration(diybms_eeprom_settings *settings); +void DefaultConfiguration(diybms_eeprom_settings *settings); + +void SaveWIFI(wifi_eeprom_settings *wifi); +bool LoadWIFI(wifi_eeprom_settings *wifi); + +void GenerateSettingsJSONDocument(DynamicJsonDocument *doc, diybms_eeprom_settings *settings); +void JSONToSettings(DynamicJsonDocument &doc, diybms_eeprom_settings *settings); + +void writeSetting(nvs_handle_t handle, const char *key, bool value); +void writeSetting(nvs_handle_t handle, const char *key, uint8_t value); +void writeSetting(nvs_handle_t handle, const char *key, uint16_t value); +void writeSetting(nvs_handle_t handle, const char *key, int16_t value); +void writeSetting(nvs_handle_t handle, const char *key, int8_t value); +void writeSetting(nvs_handle_t handle, const char *key, const char *value); +void writeSettingBlob(nvs_handle_t handle, const char *key, const void *value, size_t length); + +extern const char *RuleTextDescription[]; +#endif \ No newline at end of file diff --git a/ESPController/include/victron_canbus.h b/ESPController/include/victron_canbus.h index 871d62ba..99d38eda 100644 --- a/ESPController/include/victron_canbus.h +++ b/ESPController/include/victron_canbus.h @@ -15,7 +15,8 @@ void victron_message_372(); void victron_message_373(); void victron_message_35f(); void victron_message_374_375_376_377(); -void send_canbus_message(uint32_t identifier, uint8_t *buffer, uint8_t length); + +extern void send_canbus_message(uint32_t identifier, uint8_t *buffer, uint8_t length); extern uint16_t TotalNumberOfCells(); extern Rules rules; diff --git a/ESPController/include/webserver.h b/ESPController/include/webserver.h index f1209fa1..2c6dea22 100644 --- a/ESPController/include/webserver.h +++ b/ESPController/include/webserver.h @@ -19,15 +19,15 @@ #include "PacketReceiveProcessor.h" #include "EmbeddedFiles_AutoGenerated.h" -//#include "EmbeddedFiles_Integrity.h" #include "HAL_ESP32.h" -int printBoolean(char *buffer, size_t bufferLen,const char *fieldName, boolean value, boolean addComma); +int printBoolean(char *buffer, size_t bufferLen, const char *fieldName, boolean value, boolean addComma); int printBoolean(char *buffer, size_t bufferLen, const char *fieldName, boolean value); void generateUUID(); void StartServer(); +void resetModuleMinMaxVoltage(uint8_t module); void clearModuleValues(uint8_t module); httpd_handle_t start_webserver(void); void stop_webserver(httpd_handle_t server); @@ -37,7 +37,7 @@ void setNoStoreCacheControl(httpd_req_t *req); esp_err_t SendSuccess(httpd_req_t *req); esp_err_t SendFailure(httpd_req_t *req); - +static esp_err_t ota_post_handler(httpd_req_t *req); extern diybms_eeprom_settings mysettings; extern bool _sd_card_installed; @@ -45,7 +45,8 @@ extern TaskHandle_t avrprog_task_handle; extern avrprogramsettings _avrsettings; extern RelayState previousRelayState[RELAY_TOTAL]; extern currentmonitoring_struct currentMonitor; - - +extern void suspendTasksDuringFirmwareUpdate(); +extern void resumeTasksAfterFirmwareUpdateFailure(); +extern void SaveConfiguration(diybms_eeprom_settings *settings); #endif \ No newline at end of file diff --git a/ESPController/include/webserver_json_post.h b/ESPController/include/webserver_json_post.h index 98601162..f3c53d5c 100644 --- a/ESPController/include/webserver_json_post.h +++ b/ESPController/include/webserver_json_post.h @@ -26,6 +26,8 @@ extern avrprogramsettings _avrsettings; extern void stopMqtt(); extern void ConfigureRS485(); +extern bool CurrentMonitorSetSOC(float value); +extern bool CurrentMonitorResetDailyAmpHourCounters(); extern void CurrentMonitorSetBasicSettings(uint16_t shuntmv, uint16_t shuntmaxcur, uint16_t batterycapacity, float fullchargevolt, float tailcurrent, float chargeefficiency); extern void CurrentMonitorSetAdvancedSettings(currentmonitoring_struct newvalues); extern void CurrentMonitorSetRelaySettings(currentmonitoring_struct newvalues); diff --git a/ESPController/include/webserver_json_requests.h b/ESPController/include/webserver_json_requests.h index c3f260df..d3b63c8d 100644 --- a/ESPController/include/webserver_json_requests.h +++ b/ESPController/include/webserver_json_requests.h @@ -35,12 +35,15 @@ extern TaskHandle_t avrprog_task_handle; extern uint32_t canbus_messages_received; extern uint32_t canbus_messages_sent; extern uint32_t canbus_messages_failed_sent; -extern void sdcardaction_callback(uint8_t action); + extern Rules rules; extern ControllerState _controller_state; extern void formatCurrentDateTime(char* buf, size_t buf_size); - extern void setNoStoreCacheControl(httpd_req_t *req); extern char CookieValue[20 + 1]; extern char hostname[16]; + +extern uint32_t time100; +extern uint32_t time20; +extern uint32_t time10; #endif diff --git a/ESPController/lib/settings/settings.cpp b/ESPController/lib/settings/settings.cpp deleted file mode 100644 index 677c5a03..00000000 --- a/ESPController/lib/settings/settings.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "settings.h" - -#define USE_ESP_IDF_LOG 1 -static constexpr const char *const TAG = "diybms-set"; - -void Settings::WriteConfig(const char *tag, char *settings, int size) -{ - ESP_LOGD(TAG, "WriteConfig %s", tag); - - Preferences prefs; - prefs.begin(tag); - - prefs.putBytes("bytes", settings, size); - - //Generate and save the checksum for the setting data block - prefs.putUShort("checksum", CRC16::CalculateArray((uint8_t *)settings, size)); - - prefs.end(); -} - -bool Settings::ReadConfig(const char *tag, char *settings, int size) -{ - ESP_LOGD(TAG, "ReadConfig %s", tag); - - Preferences prefs; - - prefs.begin(tag); - - - size_t schLen = prefs.getBytesLength("bytes"); - - if (schLen == size) - { - - prefs.getBytes("bytes", settings, schLen); - - // Calculate the checksum - uint16_t checksum = CRC16::CalculateArray((uint8_t *)settings, size); - uint16_t existingChecksum = prefs.getUShort("checksum"); - prefs.end(); - - if (checksum == existingChecksum) - { - //Return TRUE - ESP_LOGD(TAG, "checksum verified"); - return true; - } - } - - prefs.end(); - //Wrong size/checksum - return false; -} - -void Settings::FactoryDefault(const char *tag) -{ - ESP_LOGI(TAG, "FactoryDefault %s", tag); - Preferences prefs; - prefs.begin(tag); - prefs.clear(); - //prefs.remove("bytes"); - //prefs.remove("checksum"); - prefs.end(); -} diff --git a/ESPController/lib/settings/settings.h b/ESPController/lib/settings/settings.h deleted file mode 100644 index c9238813..00000000 --- a/ESPController/lib/settings/settings.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef Settings_H // include guard -#define Settings_H - -/* -Settings storage with checksum (works with ESP32 devices) -(c)2021 Stuart Pittaway - -LICENSE -Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales (CC BY-NC-SA 2.0 UK) -https://creativecommons.org/licenses/by-nc-sa/2.0/uk/ - -* Non-Commercial — You may not use the material for commercial purposes. -* Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. - You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. -* ShareAlike — If you remix, transform, or build upon the material, you must distribute your - contributions under the same license as the original. -* No additional restrictions — You may not apply legal terms or technological measures - that legally restrict others from doing anything the license permits. - -*/ - -#include -#include "crc16.h" - -class Settings -{ -public: - static void WriteConfig(const char *tag, char *settings, int size); - static bool ReadConfig(const char *tag, char *settings, int size); - static void FactoryDefault(const char *tag); -}; -#endif diff --git a/ESPController/platformio.ini b/ESPController/platformio.ini index 57303785..d1f01ff5 100644 --- a/ESPController/platformio.ini +++ b/ESPController/platformio.ini @@ -37,12 +37,11 @@ build_flags = framework = arduino ; 4MB FLASH DEVKITC platform = espressif32 -;platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream board = esp32dev monitor_speed = 115200 monitor_port=COM4 -monitor_filters = log2file, esp32_exception_decoder +monitor_filters = esp32_exception_decoder board_build.flash_mode = dout board_build.filesystem = littlefs extra_scripts = @@ -57,10 +56,8 @@ upload_speed=921600 upload_port=COM4 platform_packages = - toolchain-xtensa32 @ ~2.80400.0 - platformio/tool-esptoolpy @ ~1.30100 - framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.3 - + framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.6 + board_build.partitions = diybms_partitions.csv lib_deps = diff --git a/ESPController/src/HAL_ESP32.cpp b/ESPController/src/HAL_ESP32.cpp index 8bc257cc..a87f0d2f 100644 --- a/ESPController/src/HAL_ESP32.cpp +++ b/ESPController/src/HAL_ESP32.cpp @@ -1,10 +1,56 @@ #define USE_ESP_IDF_LOG 1 static constexpr const char *const TAG = "diybms-hal"; +#define CONFIG_DISABLE_HAL_LOCKS 1 + #include #include "defines.h" #include "HAL_ESP32.h" +// Move outside class so Arduino Framework 2.0.4+ work as expected +SPIClass vspi(VSPI); + +SPIClass *HAL_ESP32::VSPI_Ptr() { return &vspi; } + +bool HAL_ESP32::MountSDCard() +{ + bool result = false; + ESP_LOGI(TAG, "Mounting SD card"); + if (GetVSPIMutex()) + { + // Initialize SD card + if (SD.begin(SDCARD_CHIPSELECT, vspi)) + { + uint8_t cardType = SD.cardType(); + if (cardType == CARD_NONE) + { + ESP_LOGW(TAG, "No SD card attached"); + } + else + { + ESP_LOGI(TAG, "SD card available"); + result = true; + } + } + else + { + ESP_LOGE(TAG, "Card mount failed"); + } + ReleaseVSPIMutex(); + } + return result; +} + +void HAL_ESP32::UnmountSDCard() +{ + ESP_LOGI(TAG, "Unmounting SD card"); + if (GetVSPIMutex()) + { + SD.end(); + ReleaseVSPIMutex(); + } +} + uint8_t HAL_ESP32::readByte(i2c_port_t i2c_num, uint8_t dev, uint8_t reg) { // We use the native i2c commands for ESP32 as the Arduino library @@ -334,6 +380,10 @@ void HAL_ESP32::ConfigurePins() pinMode(GPIO_NUM_0, OUTPUT); digitalWrite(GPIO_NUM_0, HIGH); + + pinMode(GPIO_NUM_35, INPUT); + pinMode(GPIO_NUM_33, OUTPUT); + digitalWrite(GPIO_NUM_33, HIGH); } struct isr_param @@ -348,7 +398,7 @@ static void ipc_interrupt_attach(void *param) attachInterrupt(params->pin, params->handler, FALLING); } -//Attempts connection to i2c device +// Attempts connection to i2c device esp_err_t HAL_ESP32::Testi2cAddress(i2c_port_t port, uint8_t address) { int ret; @@ -391,13 +441,13 @@ void HAL_ESP32::ConfigureI2C(void (*TCA6408Interrupt)(void), void (*TCA9534AInte ESP_LOGI(TAG, "Scanning i2c bus"); for (uint8_t i = 1; i < 127; i++) { - if (Testi2cAddress(I2C_NUM_0,i) == ESP_OK) + if (Testi2cAddress(I2C_NUM_0, i) == ESP_OK) { ESP_LOGI(TAG, "Found i2c device at address 0x%2x", i); } } - if (Testi2cAddress(I2C_NUM_0,TCA6416_ADDRESS) == ESP_OK) + if (Testi2cAddress(I2C_NUM_0, TCA6416_ADDRESS) == ESP_OK) { ESP_LOGI(TAG, "Found TCA6416A"); @@ -441,7 +491,7 @@ void HAL_ESP32::ConfigureI2C(void (*TCA6408Interrupt)(void), void (*TCA9534AInte // INTERRUPT PIN = ESP32 IO39 isr_param tca6416_param = {.pin = TCA6416_INTERRUPT_PIN, .handler = TCA6416Interrupt}; - //ESP_ERROR_CHECK(esp_ipc_call_blocking(PRO_CPU_NUM, ipc_interrupt_attach, &tca6416_param)); + // ESP_ERROR_CHECK(esp_ipc_call_blocking(PRO_CPU_NUM, ipc_interrupt_attach, &tca6416_param)); ipc_interrupt_attach(&tca6416_param); return; @@ -470,7 +520,7 @@ void HAL_ESP32::ConfigureI2C(void (*TCA6408Interrupt)(void), void (*TCA9534AInte // PORT 76543210 // MASK=10000000 - if (Testi2cAddress(I2C_NUM_0,TCA9534APWR_ADDRESS) != ESP_OK) + if (Testi2cAddress(I2C_NUM_0, TCA9534APWR_ADDRESS) != ESP_OK) { ESP_LOGE(TAG, "TCA9534APWR Error"); Halt(RGBLED::Purple); @@ -484,9 +534,9 @@ void HAL_ESP32::ConfigureI2C(void (*TCA6408Interrupt)(void), void (*TCA9534AInte ReadTCA9534InputRegisters(); TCA9534APWR_Output_Pins = readByte(I2C_NUM_0, TCA9534APWR_ADDRESS, TCA9534APWR_OUTPUT); - //ESP_LOGD(TAG, "About to configure interrupt..."); + // ESP_LOGD(TAG, "About to configure interrupt..."); isr_param tca9534_param = {.pin = TCA9534A_INTERRUPT_PIN, .handler = TCA9534AInterrupt}; - //ESP_ERROR_CHECK(esp_ipc_call_blocking(PRO_CPU_NUM, ipc_interrupt_attach, &tca9534_param)); + // ESP_ERROR_CHECK(esp_ipc_call_blocking(PRO_CPU_NUM, ipc_interrupt_attach, &tca9534_param)); ipc_interrupt_attach(&tca9534_param); ESP_LOGI(TAG, "Found TCA9534A"); @@ -504,7 +554,7 @@ void HAL_ESP32::ConfigureI2C(void (*TCA6408Interrupt)(void), void (*TCA9534AInte // P6=RELAY 3 (SSR) // P7=RELAY 4 (SSR) - if (Testi2cAddress(I2C_NUM_0,TCA6408_ADDRESS) != ESP_OK) + if (Testi2cAddress(I2C_NUM_0, TCA6408_ADDRESS) != ESP_OK) { ESP_LOGE(TAG, "TCA6408 Error"); Halt(RGBLED::Green); @@ -520,7 +570,7 @@ void HAL_ESP32::ConfigureI2C(void (*TCA6408Interrupt)(void), void (*TCA9534AInte ESP_LOGI(TAG, "Found TCA6408"); isr_param tca6408_param = {.pin = TCA6408_INTERRUPT_PIN, .handler = TCA6408Interrupt}; - //ESP_ERROR_CHECK(esp_ipc_call_blocking(PRO_CPU_NUM, ipc_interrupt_attach, &tca6408_param)); + // ESP_ERROR_CHECK(esp_ipc_call_blocking(PRO_CPU_NUM, ipc_interrupt_attach, &tca6408_param)); ipc_interrupt_attach(&tca6408_param); TCA6416_Fitted = false; @@ -531,3 +581,130 @@ void HAL_ESP32::ConfigureI2C(void (*TCA6408Interrupt)(void), void (*TCA9534AInte ESP_LOGE(TAG, "No TCA chip found on i2c bus"); Halt(RGBLED::Cyan); } + +TouchScreenValues HAL_ESP32::TouchScreenUpdate() +{ + /* + Features and Specification of XPT2046 + * 12 bit SAR type A/D converter with S/H circuit + * Low voltage operations (VCC = 2.2V - 3.6V) + * Low power consumption (260uA) + * 125 kHz sampling frequency + * On-chip reference voltage - 2.5V + * Pen pressure measurement + * On-chip thermo sensor + * Direct battery measurement + * 4-wire I/F + + DataSheet + https://components101.com/admin/sites/default/files/component_datasheet/XPT2046-Datasheet.pdf + + // BIT7(MSB) BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0(LSB) + // S A2 A1 A0 MODE SER/——DFR PD1 PD0 + + // S = START BIT + // A2/A1/A0 = Channel address bits 011 = Z1, 100=Z2, 001=X, 101=Y + // MODE = 12bit/8bit (12bit=low) + // SER/DFR = SingleEnded/Differential ADC mode (differential mode) + // PD0 and PD1 control power delivery, 0/0 = all enabled, 1=1=disabled. + */ + // Z is touch (depth) + // const uint8_t ADD_TEMPERATURE = 0B00000000; + // const uint8_t ADD_VBATTERY = 0B00100000; + const uint8_t ADD_Z1 = 0B00110000; + const uint8_t ADD_Z2 = 0B01000000; + const uint8_t ADD_X = 0B00010000; + const uint8_t ADD_Y = 0B01010000; + const uint8_t STARTBIT = 0B10000000; + // internal reference voltage is only used in the single-ended mode for battery monitoring, temperature measurement + const uint8_t PWR_ALLOFF = 0B00000000; + const uint8_t PWR_REFOFF_ADCON = 0B00000001; + // const uint8_t PWR_REFON_ADCOFF = 0B00000010; + // const uint8_t PWR_REFON_ADCON = 0B00000011; + + // Differential Reference Mode (SER/DFR low) should be used for reading X/Y/Z + // Single ended mode (SER/DFR high) should be used for temperature and battery + const uint8_t ADC_DIFFERENTIAL = 0B00000000; + // const uint8_t ADC_SINGLEENDED = 0B00000100; + + const uint8_t ADC_8BIT = 0B00001000; + const uint8_t ADC_12BIT = 0B00000000; + + TouchScreenValues reply; + reply.touched = false; + reply.pressure = 0; + reply.X = 0; + reply.Y = 0; + + // Landscape orientation screen + // X is zero when not touched, left of screen is about 290, right of screen is about 3900 + // Y is 3130 when not touched, top of screen is 250, bottom is 3150 + + if (GetVSPIMutex()) + { + // Slow down to 2Mhz SPI bus + vspi.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0)); + + digitalWrite(TOUCH_CHIPSELECT, LOW); + + // We don't need accurate touch pressure for this application, so + // only read Z2 register, we just want a boolean value at the end of the day + + // The transfers are always a step behind, so the transfer reads the previous value/command + vspi.write(STARTBIT | PWR_REFOFF_ADCON | ADC_8BIT | ADC_DIFFERENTIAL | ADD_Z1); + + // Read Z2 (1 byte) and request X + reply.pressure = vspi.transfer(STARTBIT | PWR_REFOFF_ADCON | ADC_12BIT | ADC_DIFFERENTIAL | ADD_X); + + // Read X (2 bytes) and request Y + reply.X = vspi.transfer16(STARTBIT | PWR_REFOFF_ADCON | ADC_12BIT | ADC_DIFFERENTIAL | ADD_Y) >> 3; + // Take Y reading, then power down after this sample + reply.Y = vspi.transfer16(STARTBIT | PWR_ALLOFF | ADC_8BIT | ADC_DIFFERENTIAL | ADD_Z2) >> 3; + + // Final transfer to ensure device goes into sleep + // In order to turn the reference off, an additional write to the XPT2046 is required after the channel has been converted. Page 24 datasheet + // uint16_t Z2 = + vspi.transfer(0); + + digitalWrite(TOUCH_CHIPSELECT, HIGH); + vspi.endTransaction(); + + ReleaseVSPIMutex(); + + // Screen connected and not touched + // Touch = 128, x=0 , y around 3130-3140 + + // 135 controls the minimum amount of pressure needed to "touch" + // X also needs to be greater than zero + reply.touched = reply.pressure > 135 && reply.X > 0; + + // ESP_LOGI(TAG, "Touch = touch=%i pressure=%u x=%u y=%u", reply.touched, reply.pressure, reply.X, reply.Y); + } + + return reply; +} + +bool HAL_ESP32::IsScreenAttached() +{ + TouchScreenValues v = TouchScreenUpdate(); + // ESP_LOGD(TAG,"Touch pressure=%u, X=%u, Y=%u",v.pressure, v.X, v.Y); + return !(v.pressure == 0 && v.X == 0 && v.Y == 0); +} + +void HAL_ESP32::ConfigureVSPI() +{ + ESP_LOGD(TAG, "Configure VSPI"); + vspi.endTransaction(); + vspi.end(); + // VSPI + + // Don't use hardware chip selects on VSPI + vspi.setHwCs(false); + vspi.setBitOrder(MSBFIRST); + vspi.setDataMode(SPI_MODE0); + // 10mhz + vspi.setFrequency(10000000); + + // GPIO23 (MOSI), GPIO19(MISO), GPIO18(CLK) and GPIO5 (CS) + vspi.begin(GPIO_NUM_18, GPIO_NUM_19, GPIO_NUM_23, -1); +} diff --git a/ESPController/src/Rules.cpp b/ESPController/src/Rules.cpp index bce9ff6c..43a39079 100644 --- a/ESPController/src/Rules.cpp +++ b/ESPController/src/Rules.cpp @@ -1,9 +1,8 @@ #define USE_ESP_IDF_LOG 1 -static constexpr const char * const TAG = "diybms-rules"; +static constexpr const char *const TAG = "diybms-rules"; #include "Rules.h" - // Its critical these are in the same order as "enum Rule", and occupy the same index position const char *RuleTextDescription[] = { "EmergencyStop", @@ -19,22 +18,23 @@ const char *RuleTextDescription[] = { "CurrentMonitorUnderVoltage", "BankOverVoltage", "BankUnderVoltage", + "BankRange", "Timer2", "Timer1"}; - void Rules::ClearValues() { - //Array to hold the total voltage of each bank/pack (in millivolts) + // Array to hold the total voltage of each bank (in millivolts) for (uint8_t r = 0; r < maximum_number_of_banks; r++) { - packvoltage[r] = 0; - lowestvoltageinpack[r] = 0xFFFF; - highestvoltageinpack[r] = 0; + limitedbankvoltage[r] = 0; + bankvoltage[r] = 0; + LowestCellVoltageInBank[r] = 0xFFFF; + HighestCellVoltageInBank[r] = 0; } - highestPackVoltage = 0; - lowestPackVoltage = 0xFFFFFFFF; + highestBankVoltage = 0; + lowestBankVoltage = 0xFFFFFFFF; highestCellVoltage = 0; lowestCellVoltage = 0xFFFF; highestExternalTemp = -127; @@ -49,10 +49,14 @@ void Rules::ClearValues() address_lowestExternalTemp = maximum_controller_cell_modules + 1; address_highestExternalTemp = maximum_controller_cell_modules + 1; address_HighestCellVoltage = maximum_controller_cell_modules + 1; + index_bank_HighestCellVoltage = 0; + + dynamicChargeVoltage = 0; + dynamicChargeCurrent = 0; } -//Looking at individual voltages and temperatures and sum up pack voltages. -void Rules::ProcessCell(uint8_t bank, uint8_t cellNumber, CellModuleInfo *c) +// Looking at individual voltages and temperatures and sum up Bank voltages. +void Rules::ProcessCell(uint8_t bank, uint8_t cellNumber, CellModuleInfo *c, uint16_t cellmaxmv) { if (c->valid == false) { @@ -60,28 +64,30 @@ void Rules::ProcessCell(uint8_t bank, uint8_t cellNumber, CellModuleInfo *c) return; } - packvoltage[bank] += c->voltagemV; + bankvoltage[bank] += c->voltagemV; + limitedbankvoltage[bank] += min(c->voltagemV, cellmaxmv); - //If the voltage of the module is zero, we probably haven't requested it yet (which happens during power up) - //so keep count so we don't accidentally trigger rules. + // If the voltage of the module is zero, we probably haven't requested it yet (which happens during power up) + // so keep count so we don't accidentally trigger rules. if (c->voltagemV == 0) { zeroVoltageModuleCount++; } - if (c->voltagemV > highestvoltageinpack[bank]) + if (c->voltagemV > HighestCellVoltageInBank[bank]) { - highestvoltageinpack[bank] = c->voltagemV; + HighestCellVoltageInBank[bank] = c->voltagemV; } - if (c->voltagemV < lowestvoltageinpack[bank]) + if (c->voltagemV < LowestCellVoltageInBank[bank]) { - lowestvoltageinpack[bank] = c->voltagemV; + LowestCellVoltageInBank[bank] = c->voltagemV; } if (c->voltagemV > highestCellVoltage) { highestCellVoltage = c->voltagemV; address_HighestCellVoltage = cellNumber; + index_bank_HighestCellVoltage = bank; } if (c->voltagemV < lowestCellVoltage) @@ -92,7 +98,7 @@ void Rules::ProcessCell(uint8_t bank, uint8_t cellNumber, CellModuleInfo *c) if (c->externalTemp != -40) { - //Record that we do have at least one external temperature sensor on a module + // Record that we do have at least one external temperature sensor on a module moduleHasExternalTempSensor = true; if (c->externalTemp > highestExternalTemp) @@ -121,21 +127,27 @@ void Rules::ProcessCell(uint8_t bank, uint8_t cellNumber, CellModuleInfo *c) uint16_t Rules::VoltageRangeInBank(uint8_t bank) { - if (invalidModuleCount>0) return 0; - - return highestvoltageinpack[bank] - lowestvoltageinpack[bank]; + if (invalidModuleCount > 0) + return 0; + + return HighestCellVoltageInBank[bank] - LowestCellVoltageInBank[bank]; } void Rules::ProcessBank(uint8_t bank) { - //Combine the voltages - work out the highest and lowest pack voltages - if (packvoltage[bank] > highestPackVoltage) + // Combine the voltages - work out the highest and lowest Bank voltages + if (bankvoltage[bank] > highestBankVoltage) { - highestPackVoltage = packvoltage[bank]; + highestBankVoltage = bankvoltage[bank]; } - if (packvoltage[bank] < lowestPackVoltage) + if (bankvoltage[bank] < lowestBankVoltage) + { + lowestBankVoltage = bankvoltage[bank]; + } + + if (VoltageRangeInBank(bank) > highestBankRange) { - lowestPackVoltage = packvoltage[bank]; + highestBankRange = VoltageRangeInBank(bank); } } @@ -144,7 +156,7 @@ void Rules::SetWarning(InternalWarningCode warncode) if (warncode > MAXIMUM_InternalWarningCode) return; - //Only set the warning once + // Only set the warning once if (WarningCodes[warncode] != InternalWarningCode::NoWarning) return; @@ -158,7 +170,7 @@ void Rules::SetError(InternalErrorCode err) if (err > MAXIMUM_InternalErrorCode) return; - //Only set error once + // Only set error once if (ErrorCodes[err] != InternalErrorCode::NoError) return; @@ -168,32 +180,32 @@ void Rules::SetError(InternalErrorCode err) } void Rules::RunRules( - uint32_t *value, - uint32_t *hysteresisvalue, + int32_t *value, + int32_t *hysteresisvalue, bool emergencyStop, uint16_t mins, currentmonitoring_struct *currentMonitor) { - //Emergency stop signal... + // Emergency stop signal... rule_outcome[Rule::EmergencyStop] = emergencyStop; - //Timer 1 and Timer 2 + // Timer 1 and Timer 2 rule_outcome[Rule::Timer1] = (mins >= value[Rule::Timer1] && mins <= hysteresisvalue[Rule::Timer1]); rule_outcome[Rule::Timer2] = (mins >= value[Rule::Timer2] && mins <= hysteresisvalue[Rule::Timer2]); if (currentMonitor->validReadings) { - //Currents can be both positive and negative (depending on current flow, we ABS that to get an always POSITIVE number) + // Currents can be both positive and negative (depending on current flow, we ABS that to get an always POSITIVE number) uint32_t integercurrent = (uint32_t)(abs(currentMonitor->modbus.current) + (float)0.5); if (integercurrent > value[Rule::CurrentMonitorOverCurrentAmps] && rule_outcome[Rule::CurrentMonitorOverCurrentAmps] == false) { - //CurrentMonitorOverCurrentAmps - TRIGGERED + // CurrentMonitorOverCurrentAmps - TRIGGERED rule_outcome[Rule::CurrentMonitorOverCurrentAmps] = true; } else if (integercurrent < hysteresisvalue[Rule::CurrentMonitorOverCurrentAmps] && rule_outcome[Rule::CurrentMonitorOverCurrentAmps] == true) { - //CurrentMonitorOverCurrentAmps - HYSTERESIS RESET + // CurrentMonitorOverCurrentAmps - HYSTERESIS RESET rule_outcome[Rule::CurrentMonitorOverCurrentAmps] = false; } @@ -201,36 +213,36 @@ void Rules::RunRules( if (integervoltagemV > value[Rule::CurrentMonitorOverVoltage] && rule_outcome[Rule::CurrentMonitorOverVoltage] == false) { - //Rule - CURRENT MONITOR Pack over voltage (mV) + // Rule - CURRENT MONITOR Bank over voltage (mV) rule_outcome[Rule::CurrentMonitorOverVoltage] = true; } else if (integervoltagemV < hysteresisvalue[Rule::CurrentMonitorOverVoltage] && rule_outcome[Rule::CurrentMonitorOverVoltage] == true) { - //Rule - CURRENT MONITOR Pack over voltage (mV) - HYSTERESIS RESET + // Rule - CURRENT MONITOR Bank over voltage (mV) - HYSTERESIS RESET rule_outcome[Rule::CurrentMonitorOverVoltage] = false; } if (integervoltagemV < value[Rule::CurrentMonitorUnderVoltage] && rule_outcome[Rule::CurrentMonitorUnderVoltage] == false) { - //Rule - CURRENT MONITOR Pack under voltage (mV) + // Rule - CURRENT MONITOR Bank under voltage (mV) rule_outcome[Rule::CurrentMonitorUnderVoltage] = true; } else if (integervoltagemV > hysteresisvalue[Rule::CurrentMonitorUnderVoltage] && rule_outcome[Rule::CurrentMonitorUnderVoltage] == true) { - //Rule - CURRENT MONITOR Pack under voltage (mV) - HYSTERESIS RESET + // Rule - CURRENT MONITOR Bank under voltage (mV) - HYSTERESIS RESET rule_outcome[Rule::CurrentMonitorUnderVoltage] = false; } } else { - //We don't have valid current monitor readings, so the rule is ALWAYS false + // We don't have valid current monitor readings, so the rule is ALWAYS false rule_outcome[Rule::CurrentMonitorOverCurrentAmps] = false; rule_outcome[Rule::CurrentMonitorOverVoltage] = false; rule_outcome[Rule::CurrentMonitorUnderVoltage] = false; } - //At least 1 module is zero volt - not a problem whilst we are in stabilizing start up mode - if (zeroVoltageModuleCount > 0) + // At least 1 module is zero volt - not a problem whilst we are in stabilizing start up mode + if (zeroVoltageModuleCount > 0 || invalidModuleCount > 0) { rule_outcome[Rule::ModuleOverVoltage] = false; rule_outcome[Rule::ModuleUnderVoltage] = false; @@ -239,17 +251,17 @@ void Rules::RunRules( rule_outcome[Rule::ModuleOverTemperatureExternal] = false; rule_outcome[Rule::ModuleUnderTemperatureExternal] = false; - //Abort processing any more rules until controller is stable/running state + // Abort processing any more rules until controller is stable/running state return; } - //Only rules which are based on temperature or voltage should go below this point.... + // Only rules which are based on temperature or voltage should go below this point.... /* SERIAL_DEBUG.print("Rule Values: lowP="); - SERIAL_DEBUG.print(lowestPackVoltage); + SERIAL_DEBUG.print(lowestbankvoltage); SERIAL_DEBUG.print(" highP="); - SERIAL_DEBUG.print(highestPackVoltage); + SERIAL_DEBUG.print(highestBankVoltage); SERIAL_DEBUG.print(" / lowC="); SERIAL_DEBUG.print(lowestCellVoltage); @@ -265,50 +277,49 @@ void Rules::RunRules( if (highestCellVoltage > value[Rule::ModuleOverVoltage] && rule_outcome[Rule::ModuleOverVoltage] == false) { - //Rule Individual cell over voltage - TRIGGERED + // Rule Individual cell over voltage - TRIGGERED rule_outcome[Rule::ModuleOverVoltage] = true; } else if (highestCellVoltage < hysteresisvalue[Rule::ModuleOverVoltage] && rule_outcome[Rule::ModuleOverVoltage] == true) { - //Rule Individual cell over voltage - HYSTERESIS RESET + // Rule Individual cell over voltage - HYSTERESIS RESET rule_outcome[Rule::ModuleOverVoltage] = false; } if (lowestCellVoltage < value[Rule::ModuleUnderVoltage] && rule_outcome[Rule::ModuleUnderVoltage] == false) { - //Rule Individual cell under voltage (mV) - TRIGGERED + // Rule Individual cell under voltage (mV) - TRIGGERED rule_outcome[Rule::ModuleUnderVoltage] = true; } else if (lowestCellVoltage > hysteresisvalue[Rule::ModuleUnderVoltage] && rule_outcome[Rule::ModuleUnderVoltage] == true) { - //Rule Individual cell under voltage (mV) - HYSTERESIS RESET + // Rule Individual cell under voltage (mV) - HYSTERESIS RESET rule_outcome[Rule::ModuleUnderVoltage] = false; } - //These rules only fire if external temp sensor actually exists + // These rules only fire if external temp sensor actually exists if (moduleHasExternalTempSensor) { - //Doesn't cater for negative temperatures on rule (int8 vs uint32) - if (((uint8_t)highestExternalTemp > value[Rule::ModuleOverTemperatureExternal]) && rule_outcome[Rule::ModuleOverTemperatureExternal] == false) + // Doesn't cater for negative temperatures on rule (int8 vs uint32) + if ((highestExternalTemp > value[Rule::ModuleOverTemperatureExternal]) && rule_outcome[Rule::ModuleOverTemperatureExternal] == false) { - //Rule Individual cell over temperature (external probe) + // Rule Individual cell over temperature (external probe) rule_outcome[Rule::ModuleOverTemperatureExternal] = true; } - else if (((uint8_t)highestExternalTemp < hysteresisvalue[Rule::ModuleOverTemperatureExternal]) && rule_outcome[Rule::ModuleOverTemperatureExternal] == true) + else if ((highestExternalTemp < hysteresisvalue[Rule::ModuleOverTemperatureExternal]) && rule_outcome[Rule::ModuleOverTemperatureExternal] == true) { - //Rule Individual cell over temperature (external probe) - HYSTERESIS RESET + // Rule Individual cell over temperature (external probe) - HYSTERESIS RESET rule_outcome[Rule::ModuleOverTemperatureExternal] = false; } - - //Doesn't cater for negative temperatures on rule (int8 vs uint32) - if (((uint8_t)lowestExternalTemp < value[Rule::ModuleUnderTemperatureExternal]) && rule_outcome[Rule::ModuleUnderTemperatureExternal] == false) + // Doesn't cater for negative temperatures on rule (int8 vs uint32) + if ((lowestExternalTemp < value[Rule::ModuleUnderTemperatureExternal]) && rule_outcome[Rule::ModuleUnderTemperatureExternal] == false) { - //Rule Individual cell UNDER temperature (external probe) + // Rule Individual cell UNDER temperature (external probe) rule_outcome[Rule::ModuleUnderTemperatureExternal] = true; } - else if (((uint8_t)lowestExternalTemp > hysteresisvalue[Rule::ModuleUnderTemperatureExternal]) && rule_outcome[Rule::ModuleUnderTemperatureExternal] == true) + else if ((lowestExternalTemp > hysteresisvalue[Rule::ModuleUnderTemperatureExternal]) && rule_outcome[Rule::ModuleUnderTemperatureExternal] == true) { - //Rule Individual cell UNDER temperature (external probe) - HYSTERESIS RESET + // Rule Individual cell UNDER temperature (external probe) - HYSTERESIS RESET rule_outcome[Rule::ModuleUnderTemperatureExternal] = false; } } @@ -318,55 +329,67 @@ void Rules::RunRules( rule_outcome[Rule::ModuleUnderTemperatureExternal] = false; } - //Internal temperature monitoring and rules - //Does not cope with negative temperatures on rule (int8 vs uint32) - if (((uint8_t)highestInternalTemp > value[Rule::ModuleOverTemperatureInternal]) && rule_outcome[Rule::ModuleOverTemperatureInternal] == false) + // Internal temperature monitoring and rules + // Does not cope with negative temperatures on rule (int8 vs uint32) + if ((highestInternalTemp > value[Rule::ModuleOverTemperatureInternal]) && rule_outcome[Rule::ModuleOverTemperatureInternal] == false) { - //Rule Individual cell over temperature (Internal probe) + // Rule Individual cell over temperature (Internal probe) rule_outcome[Rule::ModuleOverTemperatureInternal] = true; } - else if (((uint8_t)highestInternalTemp < hysteresisvalue[Rule::ModuleOverTemperatureInternal]) && rule_outcome[Rule::ModuleOverTemperatureInternal] == true) + else if ((highestInternalTemp < hysteresisvalue[Rule::ModuleOverTemperatureInternal]) && rule_outcome[Rule::ModuleOverTemperatureInternal] == true) { - //Rule Individual cell over temperature (Internal probe) - HYSTERESIS RESET + // Rule Individual cell over temperature (Internal probe) - HYSTERESIS RESET rule_outcome[Rule::ModuleOverTemperatureInternal] = false; } - //Doesn't cater for negative temperatures on rule (int8 vs uint32) - if (((uint8_t)lowestInternalTemp < value[Rule::ModuleUnderTemperatureInternal]) && rule_outcome[Rule::ModuleUnderTemperatureInternal] == false) + // Doesn't cater for negative temperatures on rule (int8 vs uint32) + if ((lowestInternalTemp < value[Rule::ModuleUnderTemperatureInternal]) && rule_outcome[Rule::ModuleUnderTemperatureInternal] == false) { - //Rule Individual cell UNDER temperature (Internal probe) + // Rule Individual cell UNDER temperature (Internal probe) rule_outcome[Rule::ModuleUnderTemperatureInternal] = true; } - else if (((uint8_t)lowestInternalTemp > hysteresisvalue[Rule::ModuleUnderTemperatureInternal]) && rule_outcome[Rule::ModuleUnderTemperatureInternal] == true) + else if ((lowestInternalTemp > hysteresisvalue[Rule::ModuleUnderTemperatureInternal]) && rule_outcome[Rule::ModuleUnderTemperatureInternal] == true) { - //Rule Individual cell UNDER temperature (Internal probe) - HYSTERESIS RESET + // Rule Individual cell UNDER temperature (Internal probe) - HYSTERESIS RESET rule_outcome[Rule::ModuleUnderTemperatureInternal] = false; } - //While Pack voltages - if (highestPackVoltage > value[Rule::BankOverVoltage] && rule_outcome[Rule::BankOverVoltage] == false) + // Whole Bank voltages + if (highestBankVoltage > value[Rule::BankOverVoltage] && rule_outcome[Rule::BankOverVoltage] == false) { - //Rule - Pack over voltage (mV) + // Rule - Bank over voltage (mV) rule_outcome[Rule::BankOverVoltage] = true; } - else if (highestPackVoltage < hysteresisvalue[Rule::BankOverVoltage] && rule_outcome[Rule::BankOverVoltage] == true) + else if (highestBankVoltage < hysteresisvalue[Rule::BankOverVoltage] && rule_outcome[Rule::BankOverVoltage] == true) { - //Rule - Pack over voltage (mV) - HYSTERESIS RESET + // Rule - Bank over voltage (mV) - HYSTERESIS RESET rule_outcome[Rule::BankOverVoltage] = false; } - if (lowestPackVoltage < value[Rule::BankUnderVoltage] && rule_outcome[Rule::BankUnderVoltage] == false) + if (lowestBankVoltage < value[Rule::BankUnderVoltage] && rule_outcome[Rule::BankUnderVoltage] == false) { - //Rule - Pack under voltage (mV) + // Rule - Bank under voltage (mV) rule_outcome[Rule::BankUnderVoltage] = true; } - else if (lowestPackVoltage > hysteresisvalue[Rule::BankUnderVoltage] && rule_outcome[Rule::BankUnderVoltage] == true) + else if (lowestBankVoltage > hysteresisvalue[Rule::BankUnderVoltage] && rule_outcome[Rule::BankUnderVoltage] == true) { - //Rule - Pack under voltage (mV) - HYSTERESIS RESET + // Rule - Bank under voltage (mV) - HYSTERESIS RESET rule_outcome[Rule::BankUnderVoltage] = false; } - //Total up the active rules + // While Bank voltages + if (highestBankRange > value[Rule::BankRange] && rule_outcome[Rule::BankRange] == false) + { + // Rule - Bank Range + rule_outcome[Rule::BankRange] = true; + } + else if (highestBankRange < hysteresisvalue[Rule::BankRange] && rule_outcome[Rule::BankRange] == true) + { + // Rule - Bank Range - HYSTERESIS RESET + rule_outcome[Rule::BankRange] = false; + } + + // Total up the active rules active_rule_count = 0; for (size_t i = 0; i < RELAY_RULES; i++) @@ -374,4 +397,272 @@ void Rules::RunRules( if (rule_outcome[i] == true) active_rule_count++; } +} + +bool Rules::SharedChargingDischargingRules(diybms_eeprom_settings *mysettings) +{ + if (mysettings->canbusprotocol == CanBusProtocolEmulation::CANBUS_DISABLED) + return false; + + if (invalidModuleCount > 0) + return false; + if (moduleHasExternalTempSensor == false) + return false; + // Any errors, stop charge + if (numberOfActiveErrors > 0) + return false; + + // Battery high voltage alarm + if (rule_outcome[Rule::BankOverVoltage]) + return false; + // Low voltage alarm + if (rule_outcome[Rule::BankUnderVoltage]) + return false; + // Battery high temperature alarm + if (rule_outcome[Rule::ModuleOverTemperatureExternal]) + return false; + // Battery low temperature alarm + if (rule_outcome[Rule::ModuleUnderTemperatureExternal]) + return false; + + return true; +} +bool Rules::IsChargeAllowed(diybms_eeprom_settings *mysettings) +{ + if (SharedChargingDischargingRules(mysettings) == false) + return false; + + if (mysettings->preventcharging == true) + return false; + + if (lowestExternalTempchargetemplow | highestExternalTemp> mysettings->chargetemphigh) + { + // Stop charge - temperature out of range + // ESP_LOGW(TAG, "Stop charge - temperature out of range"); + return false; + } + + // chargevolt = 560 + if ((highestBankVoltage / 100) > mysettings->chargevolt) + return false; + + // Individual cell over voltage + if (highestCellVoltage > mysettings->cellmaxmv) + return false; + + return true; +} +bool Rules::IsDischargeAllowed(diybms_eeprom_settings *mysettings) +{ + if (SharedChargingDischargingRules(mysettings) == false) + return false; + + if (mysettings->preventdischarge == true) + return false; + + // Check battery temperature against charge/discharge parameters + if (lowestExternalTempdischargetemplow | highestExternalTemp> mysettings->dischargetemphigh) + { + // ESP_LOGW(TAG, "Stop discharge - temperature out of range"); + return false; + } + + if ((lowestBankVoltage / 100) < mysettings->dischargevolt) + return false; + + // Individual cell under voltage + if (lowestCellVoltage < mysettings->cellminmv) + return false; + + return true; +} + +// Charge voltage calculated by CalculateDynamicChargeVoltage +// Scale 0.1 = 567 = 56.7V +uint16_t Rules::DynamicChargeVoltage() +{ + return dynamicChargeVoltage; +} +// Charge current calculated by CalculateDynamicChargeCurrent +// Scale 0.1 = 123 = 12.3Amps +int16_t Rules::DynamicChargeCurrent() +{ + return dynamicChargeCurrent; +} + +// Apply "dynamic" charge current rules +void Rules::CalculateDynamicChargeCurrent(diybms_eeprom_settings *mysettings, CellModuleInfo *cellarray) +{ + // Remember dynamicChargeCurrent scale is 0.1 + dynamicChargeCurrent = mysettings->chargecurrent; + + if (!mysettings->dynamiccharge || mysettings->canbusprotocol == CanBusProtocolEmulation::CANBUS_DISABLED) + { + // Its switched off, use default + return; + } + + if (highestCellVoltage < mysettings->kneemv) + { + // Voltage of cell is below the knee voltage, so use full current + return; + } + + double value1 = mysettings->current_value1 / 10.0F; + double value2 = mysettings->current_value2 / 10.0F; + ESP_LOGD(TAG, "value1=%f", value1); + ESP_LOGD(TAG, "value2=%f", value2); + + // This is always 1 :-) + double knee_voltage = 0 / 100.0F; + double at_knee = pow(value1, knee_voltage * pow(knee_voltage, value2)); + ESP_LOGD(TAG, "at_knee=%f", at_knee); + + double target_cell_voltage = (mysettings->cellmaxmv - mysettings->kneemv) / 100.0F; + double at_target_cell_voltage = pow(value1, target_cell_voltage * pow(target_cell_voltage, value2)); + ESP_LOGD(TAG, "at_target_cell_voltage=%f", at_target_cell_voltage); + + double actual_cell_voltage = (highestCellVoltage - mysettings->kneemv) / 100.0F; + double at_actual_cell_voltage = pow(value1, actual_cell_voltage * pow(actual_cell_voltage, value2)); + ESP_LOGD(TAG, "at_actual_cell_voltage=%f", at_actual_cell_voltage); + + double percent = 1 - (at_actual_cell_voltage / at_knee) / at_target_cell_voltage; + ESP_LOGD(TAG, "percent=%f", percent); + + if (percent < 0.01) + { + // Catch small values and also negatives, 1% is the lowest we go... + percent = 0.01; + } + + // Use lowest of chargecurrent or calculation, just in case some math has gone wrong! + ESP_LOGD(TAG, "percent=%f", percent); + dynamicChargeCurrent = min(mysettings->chargecurrent, (uint16_t)round(mysettings->chargecurrent * percent)); + + ESP_LOGD(TAG, "dynamicChargeCurrent=%u", dynamicChargeCurrent); +} + +// Apply "dynamic" charge voltage rules +// This will always return a charge voltage - its the calling functions responsibility +// to check "IsChargeAllowed" function and take necessary action. +// Thanks to Matthias U (Smurfix) for the ideas and pseudo code https://community.openenergymonitor.org/u/smurfix/ +// Output is cached in variable dynamicChargeVoltage as its used in multiple places +void Rules::CalculateDynamicChargeVoltage(diybms_eeprom_settings *mysettings, CellModuleInfo *cellarray) +{ + if (!mysettings->dynamiccharge || mysettings->canbusprotocol == CanBusProtocolEmulation::CANBUS_DISABLED) + { + // Its switched off, use default voltage + dynamicChargeVoltage = mysettings->chargevolt; + return; + } + + // Some cells are above the knee voltage.... + + // Are any cells at or over the maximum allowed? (panic!) + if (highestCellVoltage >= mysettings->cellmaxmv) + { + ESP_LOGW(TAG, "Cell V>Max"); + // *** Stop charging, we are at or above maximum cell voltage *** + + // Find the lowest "limited" Bank voltage + uint32_t lowest = 0xFFFFFFFF; + for (uint8_t r = 0; r < mysettings->totalNumberOfBanks; r++) + { + if (limitedbankvoltage[r] < lowest) + { + lowest = limitedbankvoltage[r]; + } + } + + lowest = lowest / 100; + // ESP_LOGD(TAG, "lowest=%u", lowest); + + // Return MIN of either the "lowest Bank voltage" or the "user specified value" + dynamicChargeVoltage = min(lowest, (uint32_t)mysettings->chargevolt); + return; + } + + // At this point all cell voltages are UNDER the target cellmaxmv + + // This is unlikely to work if the value is changed from 1 (an integer) + const int16_t UniformDerating = 1; + + // Calculate voltage range + uint32_t R = min( + (int16_t)((mysettings->cellmaxmv - highestCellVoltage) * UniformDerating), + (int16_t)((mysettings->cellmaxspikemv - mysettings->kneemv) / ((float)mysettings->sensitivity / 10.0F))); + // Avoid future divide by zero errors + if (R == 0) + { + R = 1; + } + ESP_LOGD(TAG, "R=%u", R); + + // We use the Bank with the highest cell voltage for these calculations - although hopefully all banks are very similar :-) + uint32_t S = bankvoltage[index_bank_HighestCellVoltage]; + ESP_LOGD(TAG, "S=%u", S); + + uint32_t HminusR = (uint32_t)highestCellVoltage - R; + ESP_LOGD(TAG, "HminusR=%u", HminusR); + + uint32_t MminusH = mysettings->cellmaxmv - highestCellVoltage; + ESP_LOGD(TAG, "MminusH=%u", MminusH); + + // Jump to start of cells in the correct bank. + uint8_t cellid = index_bank_HighestCellVoltage * mysettings->totalNumberOfSeriesModules; + for (uint8_t i = 0; i < mysettings->totalNumberOfSeriesModules; i++) + { + if (cellarray[i].voltagemV >= HminusR) + { + S += ((MminusH) * (cellarray[i].voltagemV - (HminusR)) / R); + } + + ESP_LOGD(TAG, "id=%u, V=%u, S=%u", cellid, cellarray[i].voltagemV, S); + } + + // Scale down to 0.1V + S = S / 100; + ESP_LOGD(TAG, "S=%u", S); + + // Return MIN of either the above calculation or the "user specified value" + dynamicChargeVoltage = min(S, (uint32_t)mysettings->chargevolt); +} + +// Return SoC value after applying SOCFORCELOW and SOCOVERRIDE settings +// also limits output range between 0 and 100. +// SoC is rounded down to nearest integer +uint16_t Rules::StateOfChargeWithRulesApplied(diybms_eeprom_settings *mysettings, float realSOC) +{ + uint16_t value = floor(realSOC); + + // Deliberately force SoC to be reported as 2%, to trick external CANBUS devices into trickle charging (if they support it) + if (mysettings->socforcelow) + { + value = 2; + } + + if (mysettings->socoverride) + { + if (value > 90) + { + // Force inverter SoC reading to 90%, this should force it to continue charging the battery + // this is helpful when first commissioning as most inverters stop charging at 100% SOC + // even though the battery may not be full, and the DIYBMS current monitor has not learnt capacity yet. + // This function should not be left permanently switched on - you could damage the battery. + value = 90; + } + if (value < 25) + { + // Force minimum of 25% - some inverters (SoFAR) will force charge a battery lower than + // this level limiting the charge current to 500W + value = 25; + } + } + + // Limit to 100% maximum, DIYBMS current monitor can go above 100%, so don't confuse inverter/chargers + if (value > 100) + { + value = 100; + } + return value; } \ No newline at end of file diff --git a/ESPController/src/main.cpp b/ESPController/src/main.cpp index 48eb02e0..ccbd7afe 100644 --- a/ESPController/src/main.cpp +++ b/ESPController/src/main.cpp @@ -18,27 +18,35 @@ #error ESP8266 is not supported by this code #endif -#undef CONFIG_DISABLE_HAL_LOCKS - #define USE_ESP_IDF_LOG 1 static constexpr const char *const TAG = "diybms"; +#define CONFIG_DISABLE_HAL_LOCKS 1 + #include "esp_log.h" +#include "esp_netif.h" +#include "esp_eth.h" +#include "esp_ota_ops.h" +#include "esp_flash_partitions.h" +#include "esp_partition.h" +#include "nvs_flash.h" +#include "nvs.h" + #include -//#define PACKET_LOGGING_RECEIVE -//#define PACKET_LOGGING_SEND -//#define RULES_LOGGING +// #define PACKET_LOGGING_RECEIVE +// #define PACKET_LOGGING_SEND +// #define RULES_LOGGING #include "FS.h" #include "LittleFS.h" #include -#include + #include "time.h" #include #include #include -#include + #include // Libraries for SD card @@ -55,13 +63,17 @@ static constexpr const char *const TAG = "diybms"; #include "defines.h" #include "HAL_ESP32.h" #include "Rules.h" +#include "settings.h" #include "avrisp_programmer.h" #include "tft.h" #include "influxdb.h" #include "mqtt.h" #include "victron_canbus.h" +#include "pylon_canbus.h" #include "string_utils.h" +#include + const uart_port_t rs485_uart_num = UART_NUM_1; HAL_ESP32 hal; @@ -129,8 +141,8 @@ TaskHandle_t interrupt_task_handle = NULL; TaskHandle_t rs485_tx_task_handle = NULL; TaskHandle_t rs485_rx_task_handle = NULL; TaskHandle_t service_rs485_transmit_q_task_handle = NULL; -TaskHandle_t victron_canbus_tx_task_handle = NULL; -TaskHandle_t victron_canbus_rx_task_handle = NULL; +TaskHandle_t canbus_tx_task_handle = NULL; +TaskHandle_t canbus_rx_task_handle = NULL; // This large array holds all the information about the modules CellModuleInfo cmi[maximum_controller_cell_modules]; @@ -163,6 +175,10 @@ uint16_t sequence = 0; ControllerState _controller_state = ControllerState::Unknown; +uint32_t time100 = 0; +uint32_t time20 = 0; +uint32_t time10 = 0; + void LED(uint8_t bits) { hal.Led(bits); @@ -216,9 +232,6 @@ void SetupRS485() // Zero all data to start with memset(¤tMonitor, 0, sizeof(currentmonitoring_struct)); - // if (mysettings.currentMonitoringEnabled) { - // } - uart_config_t uart_config = { .baud_rate = mysettings.rs485baudrate, .data_bits = mysettings.rs485databits, @@ -254,28 +267,8 @@ void mountSDCard() } ESP_LOGI(TAG, "Mounting SD card"); - if (hal.GetVSPIMutex()) - { - // Initialize SD card - if (SD.begin(SDCARD_CHIPSELECT, hal.vspi)) - { - uint8_t cardType = SD.cardType(); - if (cardType == CARD_NONE) - { - ESP_LOGW(TAG, "No SD card attached"); - } - else - { - ESP_LOGI(TAG, "SD card available"); - _sd_card_installed = true; - } - } - else - { - ESP_LOGE(TAG, "Card mount failed"); - } - hal.ReleaseVSPIMutex(); - } + + _sd_card_installed = hal.MountSDCard(); } void unmountSDCard() @@ -292,12 +285,8 @@ void unmountSDCard() } ESP_LOGI(TAG, "Unmounting SD card"); - if (hal.GetVSPIMutex()) - { - SD.end(); - hal.ReleaseVSPIMutex(); - _sd_card_installed = false; - } + hal.UnmountSDCard(); + _sd_card_installed = false; } void wake_up_tft(bool force) @@ -343,7 +332,8 @@ void avrprog_task(void *param) // although AVRISP_PROGRAMMER will call the watchdog to prevent reboots uint32_t starttime = millis(); - AVRISP_PROGRAMMER isp = AVRISP_PROGRAMMER(&(hal.vspi), GPIO_NUM_0, false, VSPI_SCK); + + AVRISP_PROGRAMMER isp = AVRISP_PROGRAMMER(hal.VSPI_Ptr(), GPIO_NUM_0, false, VSPI_SCK); ESP_LOGI(TAG, "Programming AVR"); @@ -585,7 +575,7 @@ void sdcardlog_task(void *param) if (file) { ESP_LOGI(TAG, "Create log %s", cmon_filename.c_str()); - file.println("DateTime,valid,voltage,current,mAhIn,mAhOut,power,temperature,shuntmV,relayState"); + file.println("DateTime,valid,voltage,current,mAhIn,mAhOut,DailymAhIn,DailymAhOut,power,temperature,relayState"); } } else @@ -625,12 +615,14 @@ void sdcardlog_task(void *param) .append(",") .append(std::to_string(currentMonitor.modbus.milliamphour_out)) .append(",") + .append(std::to_string(currentMonitor.modbus.daily_milliamphour_in)) + .append(",") + .append(std::to_string(currentMonitor.modbus.daily_milliamphour_out)) + .append(",") .append(float_to_string(currentMonitor.modbus.power)) .append(",") .append(std::to_string(currentMonitor.modbus.temperature)) .append(",") - .append(float_to_string(currentMonitor.modbus.shuntmV)) - .append(",") .append(currentMonitor.RelayState ? "1" : "0") .append("\r\n"); @@ -1123,9 +1115,9 @@ void transmit_task(void *param) myPacketSerial.sendBuffer((byte *)&transmitBuffer); // Output the packet we just transmitted to debug console - //#if defined(PACKET_LOGGING_SEND) + // #if defined(PACKET_LOGGING_SEND) // dumpPacketToDebug('S', &transmitBuffer); - //#endif + // #endif } // Delay based on comms speed, ensure the first module has time to process and clear the request @@ -1184,13 +1176,25 @@ void ProcessRules() rules.SetError(InternalErrorCode::ErrorEmergencyStop); } + // Raise error is the current shunt stops responding for over 45 seconds + if (mysettings.currentMonitoringEnabled) + { + int64_t secondsSinceLastMessage = (esp_timer_get_time() - currentMonitor.timestamp) / 1E6; + if (secondsSinceLastMessage > 45) + { + rules.SetError(InternalErrorCode::CommunicationsError); + rules.rule_outcome[Rule::BMSError] = true; + } + } + + rules.highestBankRange = 0; rules.numberOfBalancingModules = 0; uint8_t cellid = 0; for (int8_t bank = 0; bank < mysettings.totalNumberOfBanks; bank++) { for (int8_t i = 0; i < mysettings.totalNumberOfSeriesModules; i++) { - rules.ProcessCell(bank, cellid, &cmi[cellid]); + rules.ProcessCell(bank, cellid, &cmi[cellid], mysettings.cellmaxmv); if (cmi[cellid].valid && cmi[cellid].settingsCached) { @@ -1228,6 +1232,10 @@ void ProcessRules() rules.ProcessBank(bank); } + // Need to call these even if Dynamic is switch off, as it seeds the internal variables with the correct values + rules.CalculateDynamicChargeVoltage(&mysettings, cmi); + rules.CalculateDynamicChargeCurrent(&mysettings, cmi); + if (mysettings.loggingEnabled && !_sd_card_installed && !_avrsettings.programmingModeEnabled) { rules.SetWarning(InternalWarningCode::LoggingEnabledNoSDCard); @@ -1257,6 +1265,26 @@ void ProcessRules() minutesSinceMidnight(), ¤tMonitor); + if (rules.moduleHasExternalTempSensor == false) + { + // NoExternalTempSensor + rules.SetWarning(InternalWarningCode::NoExternalTempSensor); + } + + if (mysettings.canbusprotocol != CanBusProtocolEmulation::CANBUS_DISABLED) + { + if (!rules.IsChargeAllowed(&mysettings)) + { + // Charge prevented + rules.SetWarning(InternalWarningCode::ChargePrevented); + } + if (!rules.IsDischargeAllowed(&mysettings)) + { + // Discharge prevented + rules.SetWarning(InternalWarningCode::DischargePrevented); + } + } + if (_controller_state == ControllerState::Stabilizing) { // Check for zero volt modules - not a problem whilst we are in stabilizing start up mode @@ -1480,14 +1508,6 @@ void enqueue_task(void *param) } } -/* FreeRTOS event group to signal when we are connected*/ -// static EventGroupHandle_t s_wifi_event_group; - -/* The event group allows multiple bits for each event, but we only care about two events: - * - we are connected to the AP with an IP - * - we failed to connect after the maximum amount of retries */ -//#define WIFI_CONNECTED_BIT BIT0 -//#define WIFI_FAIL_BIT BIT1 static int s_retry_num = 0; void formatCurrentDateTime(char *buf, size_t buf_size) @@ -1650,16 +1670,12 @@ static void event_handler(void *arg, esp_event_base_t event_base, snprintf(ip_string, sizeof(ip_string), IPSTR, IP2STR(&event->ip_info.ip)); ESP_LOGI(TAG, "You can access DIYBMS interface at http://%s.local or http://%s", hostname, ip_string); - - // Wake up the screen, this will show the IP address etc. - // Don't enable this, causes a cascade effect/race condition - // wake_up_tft(true); } } bool LoadWiFiConfig() { - return (Settings::ReadConfig("diybmswifi", (char *)&_wificonfig, sizeof(_wificonfig))); + return LoadWIFI(&_wificonfig); } void BuildHostname() @@ -1938,10 +1954,90 @@ void currentMon_ConfigureBasic(uint16_t shuntmv, uint16_t shuntmaxcur, uint16_t xQueueSend(rs485_transmit_q_handle, &cmd, portMAX_DELAY); // Zero all data - memset(¤tMonitor, 0, sizeof(currentmonitoring_struct)); + // memset(¤tMonitor, 0, sizeof(currentmonitoring_struct)); currentMonitor.validReadings = false; } +void currentMon_SetSOC(float newSOC) +{ + uint16_t value = newSOC * 100; + + // Write Multiple Holding Registers + uint8_t cmd2[] = { + // The Slave Address + mysettings.currentMonitoringModBusAddress, + // The Function Code 16 + 16, + // Data Address of the first register (zero based so 26 = register 40027) + 0, + 26, + // number of registers to write (1) + 0, + 1, + // number of data bytes to follow (1 register x 2 bytes each = 2 bytes) + 2, + // value to write to register |40027|State of charge % (unsigned int16) + // (scale x100 eg. 10000 = 100.00%, 8012 = 80.12%, 100 = 1.00%) + (uint8_t)(value >> 8), + (uint8_t)(value & 0xFF)}; + + xQueueSend(rs485_transmit_q_handle, &cmd2, portMAX_DELAY); +} + +void currentMon_ResetDailyAmpHourCounters() +{ + // Write Multiple Holding Registers + uint8_t cmd2[] = { + // The Slave Address + mysettings.currentMonitoringModBusAddress, + // The Function Code 16 + 16, + // Data Address of the first register (zero based so 11 = register 40012) + 0, + 11, + // number of registers to write + 0, + 4, + // number of data bytes to follow (2 registers x 2 bytes each = 4 bytes) + 8, + // value to write to register 40012/13 |40012| daily milliamphour_out (uint32_t) + 0, + 0, + 0, + 0, + // value to write to register 40014/15 |40014| daily milliamphour_in (uint32_t) + 0, + 0, + 0, + 0}; + + xQueueSend(rs485_transmit_q_handle, &cmd2, portMAX_DELAY); +} + +bool CurrentMonitorSetSOC(float newSOC) +{ + if (mysettings.currentMonitoringDevice == CurrentMonitorDevice::DIYBMS_CURRENT_MON && mysettings.currentMonitoringEnabled == true) + { + ESP_LOGI(TAG, "Set SOC"); + currentMon_SetSOC(newSOC); + return true; + } + + return false; +} + +bool CurrentMonitorResetDailyAmpHourCounters() +{ + if (mysettings.currentMonitoringDevice == CurrentMonitorDevice::DIYBMS_CURRENT_MON && mysettings.currentMonitoringEnabled == true) + { + ESP_LOGI(TAG, "Reset daily Ah counter"); + currentMon_ResetDailyAmpHourCounters(); + return true; + } + + return false; +} + void CurrentMonitorSetBasicSettings(uint16_t shuntmv, uint16_t shuntmaxcur, uint16_t batterycapacity, float fullchargevolt, float tailcurrent, float chargeefficiency) { if (mysettings.currentMonitoringDevice == CurrentMonitorDevice::DIYBMS_CURRENT_MON) @@ -2015,10 +2111,61 @@ Flag 2 ESP_LOGD(TAG, "Write register 10 = %u %u", flag1, flag2); // Zero all data - memset(¤tMonitor, 0, sizeof(currentmonitoring_struct)); + // memset(¤tMonitor, 0, sizeof(currentmonitoring_struct)); currentMonitor.validReadings = false; } +// Calculate estimated time to various % SoC +// This would be better to use an averaged current over a 3 or 5 minute period to avoid jumps in the readings +void TimeToSoCCalculation() +{ + // ESP_LOGD(TAG, "SoC time estimation"); + + // Avoid divide by zero errors + if (currentMonitor.modbus.current == 0) + return; + + // Calculate how "full" the battery is based on SoC % + float now_capacity_ah = currentMonitor.modbus.batterycapacityamphour / 100.0 * currentMonitor.stateofcharge; + + // Target 100% - only if we are charging + if (currentMonitor.stateofcharge < 100.0 && currentMonitor.modbus.current > 0) + { + // Gap between now and 100% + float empty_ah = currentMonitor.modbus.batterycapacityamphour - now_capacity_ah; + // Use instantaneous current value to predict amp-hour (in number of seconds) + time100 = (empty_ah / abs(currentMonitor.modbus.current)) * 60 * 60; + } + else + { + time100 = 0; + } + + // Target 20% - only if we are discharging + if (currentMonitor.stateofcharge > 20.0 && currentMonitor.modbus.current < 0) + { + // Gap between now and 20% + float empty_ah = now_capacity_ah - (currentMonitor.modbus.batterycapacityamphour * 0.20); + time20 = (empty_ah / abs(currentMonitor.modbus.current)) * 60 * 60; + } + else + { + time20 = 0; + } + + // Target 10% - only if we are discharging + if (currentMonitor.stateofcharge > 10.0 && currentMonitor.modbus.current < 0) + { + // Gap between now and 10% + float empty_ah = now_capacity_ah - (currentMonitor.modbus.batterycapacityamphour * 0.10); + time10 = (empty_ah / abs(currentMonitor.modbus.current)) * 60 * 60; + } + else + { + time10 = 0; + } +} + // Save the current monitor advanced settings back to the device over MODBUS/RS485 void CurrentMonitorSetAdvancedSettings(currentmonitoring_struct newvalues) { @@ -2087,17 +2234,6 @@ void CurrentMonitorSetAdvancedSettings(currentmonitoring_struct newvalues) ptr = SetMobusRegistersFromFloat(cmd2, ptr, newvalues.modbus.undercurrentlimit); ptr = SetMobusRegistersFromFloat(cmd2, ptr, newvalues.modbus.overpowerlimit); - /* - newvalues.shuntcal = p1->value().toInt(); - newvalues.temperaturelimit = p1->value().toInt(); - newvalues.overvoltagelimit = p1->value().toFloat(); - newvalues.undervoltagelimit = p1->value().toFloat(); - newvalues.overcurrentlimit = p1->value().toFloat(); - newvalues.undercurrentlimit = p1->value().toFloat(); - newvalues.overpowerlimit = p1->value().toFloat(); - newvalues.shunttempcoefficient = p1->value().toInt(); -*/ - uint8_t cmd[MAX_SEND_RS485_PACKET_LENGTH]; memset(&cmd, 0, sizeof(cmd)); memcpy(&cmd, &cmd2, sizeof(cmd2)); @@ -2143,6 +2279,8 @@ void ProcessDIYBMSCurrentMonitorRegisterReply(uint8_t length) // Finally, we have to fix the 32 bit fields currentMonitor.modbus.milliamphour_out = word16swap32(currentMonitor.modbus.milliamphour_out); currentMonitor.modbus.milliamphour_in = word16swap32(currentMonitor.modbus.milliamphour_in); + currentMonitor.modbus.daily_milliamphour_out = word16swap32(currentMonitor.modbus.daily_milliamphour_out); + currentMonitor.modbus.daily_milliamphour_in = word16swap32(currentMonitor.modbus.daily_milliamphour_in); currentMonitor.modbus.firmwareversion = word16swap32(currentMonitor.modbus.firmwareversion); currentMonitor.modbus.firmwaredatetime = word16swap32(currentMonitor.modbus.firmwaredatetime); @@ -2202,6 +2340,8 @@ void ProcessDIYBMSCurrentMonitorRegisterReply(uint8_t length) currentMonitor.validReadings = true; + TimeToSoCCalculation(); + /* ESP_LOGD(TAG, "WDog = %u", currentMonitor.modbus.watchdogcounter); ESP_LOGD(TAG, "SOC = %i", currentMonitor.stateofcharge); @@ -2218,14 +2358,79 @@ void ProcessDIYBMSCurrentMonitorRegisterReply(uint8_t length) */ } -void victron_canbus_tx(void *param) +void send_canbus_message(uint32_t identifier, uint8_t *buffer, uint8_t length) +{ + twai_message_t message; + message.identifier = identifier; + message.flags = TWAI_MSG_FLAG_NONE; + message.data_length_code = length; + + memcpy(&message.data, buffer, length); + + esp_err_t result = twai_transmit(&message, pdMS_TO_TICKS(250)); + + // Queue message for transmission + if (result != ESP_OK) + { + ESP_LOGE(TAG, "Fail to queue CANBUS message (0x%x)", result); + canbus_messages_failed_sent++; + } + else + { + ESP_LOGD(TAG, "Sent CAN message 0x%x", identifier); + // ESP_LOG_BUFFER_HEX_LEVEL(TAG, &message, sizeof(twai_message_t), esp_log_level_t::ESP_LOG_DEBUG); + canbus_messages_sent++; + } +} + +void canbus_tx(void *param) { for (;;) { - // Delay 1 seconds + // Delay 1 second vTaskDelay(pdMS_TO_TICKS(1000)); - if (mysettings.VictronEnabled) + if (mysettings.canbusprotocol == CanBusProtocolEmulation::CANBUS_PYLONTECH) + { + // Pylon Tech Battery Emulation + // https://github.com/PaulSturbo/DIY-BMS-CAN/blob/main/SEPLOS%20BMS%20CAN%20Protocoll%20V1.0.pdf + // https://www.setfirelabs.com/green-energy/pylontech-can-reading-can-replication + // https://github.com/juamiso/PYLON_EMU + // https://www.studocu.com/row/document/abasyn-university/electronics-engineering/can-bus-protocol-pylon-low-voltage-v1/17205338 + + /* + PYLON TECH battery transmits these values.... + + CAN ID – followed by 2 to 8 bytes of data: + 0x351 – 14 02 74 0E 74 0E CC 01 – Battery voltage + current limits + 0x355 – 1A 00 64 00 – State of Health (SOH) / State of Charge (SOC) + 0x356 – 4e 13 02 03 04 05 – Voltage / Current / Temp + 0x359 – 00 00 00 00 0A 50 4E – Protection & Alarm flags + 0x35C – C0 00 – Battery charge request flags + 0x35E – 50 59 4C 4F 4E 20 20 20 – Manufacturer name (“PYLON “) + + If you are watching the bus, you will also see a 0x305 ID message which is output by the inverter once per second. +*/ + pylon_message_351(); + vTaskDelay(pdMS_TO_TICKS(20)); + + if (_controller_state == ControllerState::Running) + { + pylon_message_355(); + vTaskDelay(pdMS_TO_TICKS(20)); + pylon_message_356(); + vTaskDelay(pdMS_TO_TICKS(20)); + } + pylon_message_359(); + vTaskDelay(pdMS_TO_TICKS(20)); + pylon_message_35c(); + vTaskDelay(pdMS_TO_TICKS(20)); + pylon_message_35e(); + // Delay a little whilst sending packets to give ESP32 some breathing room and not flood the CANBUS + // vTaskDelay(pdMS_TO_TICKS(100)); + } + + if (mysettings.canbusprotocol == CanBusProtocolEmulation::CANBUS_VICTRON) { // minimum CAN-IDs required for the core functionality are 0x351, 0x355, 0x356 and 0x35A. @@ -2259,12 +2464,12 @@ void victron_canbus_tx(void *param) } } -void victron_canbus_rx(void *param) +void canbus_rx(void *param) { for (;;) { - if (mysettings.VictronEnabled) + if (mysettings.canbusprotocol != CanBusProtocolEmulation::CANBUS_DISABLED) { // Wait for message to be received @@ -2277,8 +2482,7 @@ void victron_canbus_rx(void *param) message.identifier, message.data_length_code, message.flags); if (!(message.flags & TWAI_MSG_FLAG_RTR)) { - ESP_LOG_BUFFER_HEXDUMP(TAG, message.data, message.data_length_code, - ESP_LOG_DEBUG); + ESP_LOG_BUFFER_HEXDUMP(TAG, message.data, message.data_length_code, ESP_LOG_DEBUG); } } else if (res == ESP_ERR_TIMEOUT) @@ -2536,8 +2740,8 @@ void rs485_tx(void *param) for (;;) { - // Delay 5 seconds - vTaskDelay(pdMS_TO_TICKS(5000)); + // Delay 4 seconds between requests + vTaskDelay(pdMS_TO_TICKS(4000)); if (mysettings.currentMonitoringEnabled == true) { @@ -2579,138 +2783,6 @@ void rs485_tx(void *param) } } -void DefaultConfiguration(diybms_eeprom_settings *_myset) -{ - ESP_LOGI(TAG, "Apply default config"); - - // Zero all the bytes - memset(_myset, 0, sizeof(diybms_eeprom_settings)); - - // Default to a single module - _myset->totalNumberOfBanks = 1; - _myset->totalNumberOfSeriesModules = 1; - // Default serial port speed - _myset->baudRate = COMMS_BAUD_RATE; - _myset->BypassOverTempShutdown = 65; - _myset->interpacketgap = 6000; - // 4.10V bypass - _myset->BypassThresholdmV = 4100; - _myset->graph_voltagehigh = 4.5; - _myset->graph_voltagelow = 2.75; - - // EEPROM settings are invalid so default configuration - _myset->mqtt_enabled = false; - - _myset->VictronEnabled = false; - - // Charge current limit (CCL) - _myset->ccl[VictronDVCC::Default] = 10 * 10; - // Charge voltage limit (CVL) - _myset->cvl[VictronDVCC::Default] = 12 * 10; - // Discharge current limit (DCL) - _myset->dcl[VictronDVCC::Default] = 10 * 10; - - // Balance - _myset->ccl[VictronDVCC::Balance] = 10 * 10; - _myset->cvl[VictronDVCC::Balance] = 10 * 10; - _myset->dcl[VictronDVCC::Balance] = 10 * 10; - // Error - _myset->ccl[VictronDVCC::ControllerError] = 0 * 10; - _myset->cvl[VictronDVCC::ControllerError] = 0 * 10; - _myset->dcl[VictronDVCC::ControllerError] = 0 * 10; - - _myset->loggingEnabled = false; - _myset->loggingFrequencySeconds = 15; - - _myset->currentMonitoringEnabled = false; - _myset->currentMonitoringModBusAddress = 90; - _myset->currentMonitoringDevice = CurrentMonitorDevice::DIYBMS_CURRENT_MON; - - _myset->rs485baudrate = 19200; - _myset->rs485databits = uart_word_length_t::UART_DATA_8_BITS; - _myset->rs485parity = uart_parity_t::UART_PARITY_DISABLE; - _myset->rs485stopbits = uart_stop_bits_t::UART_STOP_BITS_1; - - _myset->currentMonitoringEnabled = false; - - strcpy(_myset->language, "en"); - - // Default to EMONPI default MQTT settings - strcpy(_myset->mqtt_topic, "emon/diybms"); - strcpy(_myset->mqtt_uri, "mqtt://192.168.0.26:1883"); - strcpy(_myset->mqtt_username, "emonpi"); - strcpy(_myset->mqtt_password, "emonpimqtt2016"); - - _myset->influxdb_enabled = false; - strcpy(_myset->influxdb_serverurl, "http://192.168.0.49:8086/api/v2/write"); - strcpy(_myset->influxdb_databasebucket, "bucketname"); - strcpy(_myset->influxdb_orgid, "organisation"); - _myset->influxdb_loggingFreqSeconds = 15; - - _myset->timeZone = 0; - _myset->minutesTimeZone = 0; - _myset->daylight = false; - strcpy(_myset->ntpServer, "time.google.com"); - - for (size_t x = 0; x < RELAY_TOTAL; x++) - { - _myset->rulerelaydefault[x] = RELAY_OFF; - } - - // Emergency stop - _myset->rulevalue[Rule::EmergencyStop] = 0; - // Internal BMS error (communication issues, fault readings from modules etc) - _myset->rulevalue[Rule::BMSError] = 0; - // Current monitoring maximum AMPS - _myset->rulevalue[Rule::CurrentMonitorOverCurrentAmps] = 100; - // Individual cell over voltage - _myset->rulevalue[Rule::ModuleOverVoltage] = 4150; - // Individual cell under voltage - _myset->rulevalue[Rule::ModuleUnderVoltage] = 3000; - // Individual cell over temperature (external probe) - _myset->rulevalue[Rule::ModuleOverTemperatureExternal] = 55; - // Pack over voltage (mV) - _myset->rulevalue[Rule::ModuleUnderTemperatureExternal] = 5; - // Pack under voltage (mV) - _myset->rulevalue[Rule::BankOverVoltage] = 4200 * 8; - // RULE_PackUnderVoltage - _myset->rulevalue[Rule::BankUnderVoltage] = 3000 * 8; - _myset->rulevalue[Rule::Timer1] = 60 * 8; // 8am - _myset->rulevalue[Rule::Timer2] = 60 * 17; // 5pm - - _myset->rulevalue[Rule::ModuleOverTemperatureInternal] = 60; - _myset->rulevalue[Rule::ModuleUnderTemperatureInternal] = 5; - - _myset->rulevalue[Rule::CurrentMonitorOverVoltage] = 4200 * 8; - _myset->rulevalue[Rule::CurrentMonitorUnderVoltage] = 3000 * 8; - - for (size_t i = 0; i < RELAY_RULES; i++) - { - _myset->rulehysteresis[i] = _myset->rulevalue[i]; - - // Set all relays to don't care - for (size_t x = 0; x < RELAY_TOTAL; x++) - { - _myset->rulerelaystate[i][x] = RELAY_X; - } - } - - for (size_t x = 0; x < RELAY_TOTAL; x++) - { - _myset->relaytype[x] = RELAY_STANDARD; - } -} - -void LoadConfiguration() -{ - ESP_LOGI(TAG, "Fetch config"); - - if (Settings::ReadConfig("diybms", (char *)&mysettings, sizeof(mysettings))) - return; - - DefaultConfiguration(&mysettings); -} - void periodic_task(void *param) { uint8_t countdown_influx = mysettings.influxdb_loggingFreqSeconds; @@ -2774,13 +2846,14 @@ void periodic_task(void *param) // Do activities which are not critical to the system like background loading of config, or updating timing results etc. void lazy_tasks(void *param) { + int year_day = 0; for (;;) { // TODO: Perhaps this should be based on some improved logic - based on number of modules in system? - // Delay 6.5 seconds + // Delay 5.5 seconds // ESP_LOGI(TAG, "Sleep"); - TickType_t delay_ticks = pdMS_TO_TICKS(6500); + TickType_t delay_ticks = pdMS_TO_TICKS(5500); vTaskDelay(delay_ticks); // Task 1 @@ -2788,19 +2861,41 @@ void lazy_tasks(void *param) // Send a "ping" message through the cells to get a round trip time prg.sendTimingRequest(); + // Check if clock has rolled over to next day, this won't fire exactly on midnight + // but should be within 0-20 seconds of it. + if (sntp_enabled()) + { + time_t now; + time(&now); + struct tm timeinfo; + localtime_r(&now, &timeinfo); + + if (year_day > 0 && year_day != timeinfo.tm_yday) + { + // Reset the current monitor at midnight (ish) + CurrentMonitorResetDailyAmpHourCounters(); + + for (size_t i = 0; i < maximum_controller_cell_modules; i++) + { + resetModuleMinMaxVoltage(i); + } + } + year_day = timeinfo.tm_yday; + } + // Sleep between sections to give the ESP a chance to do other stuff vTaskDelay(delay_ticks); // Task 2 ESP_LOGI(TAG, "Task 2"); - uint8_t counter = 0; - // Find modules that don't have settings cached and request them + // uint8_t counter = 0; + // Find modules that don't have settings cached and request them for (uint8_t module = 0; module < TotalNumberOfCells(); module++) { if (cmi[module].valid && !cmi[module].settingsCached) { prg.sendGetSettingsRequest(module); - counter++; + // counter++; } } @@ -2824,7 +2919,7 @@ void lazy_tasks(void *param) endmodule = max - 1; } - ESP_LOGI(TAG, "Task 3, s=%i e=%i", startmodule, endmodule); + ESP_LOGD(TAG, "Task 3, s=%i e=%i", startmodule, endmodule); prg.sendReadBalanceCurrentCountRequest(startmodule, endmodule); prg.sendReadPacketsReceivedRequest(startmodule, endmodule); prg.sendReadBadPacketCounter(startmodule, endmodule); @@ -3041,8 +3136,7 @@ void TerminalBasedWifiSetup() memset(&config, 0, sizeof(config)); strncpy(config.wifi_ssid, (char *)ap_info[index].ssid, sizeof(config.wifi_ssid)); strncpy(config.wifi_passphrase, buffer, sizeof(config.wifi_passphrase)); - Settings::WriteConfig("diybmswifi", (char *)&config, sizeof(config)); - + SaveWIFI(&config); // Now delete the WIFICONFIG backup from the SDCard to prevent boot loops/resetting defaults DeleteWiFiConfigFromSDCard(); } @@ -3050,7 +3144,7 @@ void TerminalBasedWifiSetup() fputc('\n', stdout); fputc('\n', stdout); - for (size_t i = 10; i > 0; i--) + for (size_t i = 5; i > 0; i--) { char number[5]; itoa(i, number, 10); @@ -3109,9 +3203,7 @@ bool LoadWiFiConfigFromSDCard(bool existingConfigValid) { memcpy(&_wificonfig, &_new_config, sizeof(_new_config)); ESP_LOGI(TAG, "Wifi config is different, saving"); - - Settings::WriteConfig("diybmswifi", (char *)&_new_config, sizeof(_new_config)); - + SaveWIFI(&_new_config); ret = true; } else @@ -3146,7 +3238,7 @@ log_level_t log_levels[] = {.tag = "dhcpc", .level = ESP_LOG_WARN}, {.tag = "diybms", .level = ESP_LOG_DEBUG}, {.tag = "diybms-avrisp", .level = ESP_LOG_INFO}, - {.tag = "diybms-hal", .level = ESP_LOG_INFO}, + {.tag = "diybms-hal", .level = ESP_LOG_DEBUG}, {.tag = "diybms-influxdb", .level = ESP_LOG_INFO}, {.tag = "diybms-rx", .level = ESP_LOG_INFO}, {.tag = "diybms-tx", .level = ESP_LOG_INFO}, @@ -3158,7 +3250,9 @@ log_level_t log_levels[] = {.tag = "diybms-webpost", .level = ESP_LOG_INFO}, {.tag = "diybms-webreq", .level = ESP_LOG_INFO}, {.tag = "diybms-web", .level = ESP_LOG_INFO}, - {.tag = "diybms-mqtt", .level = ESP_LOG_INFO}}; + {.tag = "diybms-set", .level = ESP_LOG_INFO}, + {.tag = "diybms-mqtt", .level = ESP_LOG_INFO}, + {.tag = "diybms-pylon", .level = ESP_LOG_INFO}}; void consoleConfigurationCheck() { @@ -3179,6 +3273,51 @@ void consoleConfigurationCheck() fputs("\n\nNo key press detected\n", stdout); } +// Mark running firmware as ok/valid. +// Believe this is also duplicated into ArduinoESP32 library/runtime +extern "C" void confirmFirmwareIsValid() +{ + const esp_partition_t *running = esp_ota_get_running_partition(); + esp_ota_img_states_t ota_state; + if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) + { + if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) + { + // Validate image some how, then call: + ESP_LOGI(TAG, "esp_ota_mark_app_valid_cancel_rollback"); + esp_ota_mark_app_valid_cancel_rollback(); + // If needed: esp_ota_mark_app_invalid_rollback_and_reboot(); + } + } +} + +void resumeTasksAfterFirmwareUpdateFailure() +{ + vTaskResume(updatetftdisplay_task_handle); + vTaskResume(avrprog_task_handle); + vTaskResume(sdcardlog_task_handle); + vTaskResume(sdcardlog_outputs_task_handle); + vTaskResume(rs485_tx_task_handle); + vTaskResume(service_rs485_transmit_q_task_handle); + vTaskResume(canbus_tx_task_handle); + vTaskResume(transmit_task_handle); + vTaskResume(lazy_task_handle); + vTaskResume(canbus_rx_task_handle); +} +void suspendTasksDuringFirmwareUpdate() +{ + vTaskSuspend(updatetftdisplay_task_handle); + vTaskSuspend(avrprog_task_handle); + vTaskSuspend(sdcardlog_task_handle); + vTaskSuspend(sdcardlog_outputs_task_handle); + vTaskSuspend(rs485_tx_task_handle); + vTaskSuspend(service_rs485_transmit_q_task_handle); + vTaskSuspend(canbus_tx_task_handle); + vTaskSuspend(transmit_task_handle); + vTaskSuspend(lazy_task_handle); + vTaskSuspend(canbus_rx_task_handle); +} + void setup() { esp_chip_info_t chip_info; @@ -3210,6 +3349,8 @@ ESP32 Chip model = %u, Rev %u, Cores=%u, Features=%u)RAW", hal.ConfigureI2C(TCA6408Interrupt, TCA9534AInterrupt, TCA6416AInterrupt); hal.ConfigureVSPI(); + confirmFirmwareIsValid(); + _avrsettings.inProgress = false; _avrsettings.programmingModeEnabled = false; @@ -3218,10 +3359,11 @@ ESP32 Chip model = %u, Rev %u, Cores=%u, Features=%u)RAW", // Touch is on VSPI bus _tft_screen_available = hal.IsScreenAttached(); SetControllerState(ControllerState::PowerUp); - // hal.ConfigureVSPI(); init_tft_display(); hal.Led(0); + InitializeNVS(); + // Switch CAN chip TJA1051T/3 ON hal.CANBUSEnable(true); hal.ConfigureCAN(); @@ -3257,13 +3399,8 @@ ESP32 Chip model = %u, Rev %u, Cores=%u, Features=%u)RAW", resetAllRules(); - LoadConfiguration(); - - // Check its not zero - if (mysettings.influxdb_loggingFreqSeconds < 5) - { - mysettings.influxdb_loggingFreqSeconds = 15; - } + LoadConfiguration(&mysettings); + ValidateConfiguration(&mysettings); if (!EepromConfigValid) { @@ -3299,21 +3436,21 @@ ESP32 Chip model = %u, Rev %u, Cores=%u, Features=%u)RAW", assert(tftwake_timer); xTaskCreate(voltageandstatussnapshot_task, "snap", 1950, nullptr, 1, &voltageandstatussnapshot_task_handle); - xTaskCreate(updatetftdisplay_task, "tftupd", 2000, nullptr, 1, &updatetftdisplay_task_handle); + xTaskCreate(updatetftdisplay_task, "tftupd", 2000, nullptr, 0, &updatetftdisplay_task_handle); xTaskCreate(avrprog_task, "avrprog", 2450, &_avrsettings, configMAX_PRIORITIES - 3, &avrprog_task_handle); // High priority task xTaskCreate(interrupt_task, "int", 2000, nullptr, configMAX_PRIORITIES - 1, &interrupt_task_handle); - xTaskCreate(sdcardlog_task, "sdlog", 3000, nullptr, 1, &sdcardlog_task_handle); - xTaskCreate(sdcardlog_outputs_task, "sdout", 3000, nullptr, 1, &sdcardlog_outputs_task_handle); + xTaskCreate(sdcardlog_task, "sdlog", 3000, nullptr, 0, &sdcardlog_task_handle); + xTaskCreate(sdcardlog_outputs_task, "sdout", 3000, nullptr, 0, &sdcardlog_outputs_task_handle); xTaskCreate(rs485_tx, "485_TX", 2950, nullptr, 1, &rs485_tx_task_handle); xTaskCreate(rs485_rx, "485_RX", 2950, nullptr, 1, &rs485_rx_task_handle); xTaskCreate(service_rs485_transmit_q, "485_Q", 2950, nullptr, 1, &service_rs485_transmit_q_task_handle); - xTaskCreate(victron_canbus_tx, "v_cantx", 2950, nullptr, 1, &victron_canbus_tx_task_handle); - xTaskCreate(victron_canbus_rx, "v_canrx", 2950, nullptr, 1, &victron_canbus_rx_task_handle); - xTaskCreate(transmit_task, "tx", 2000, nullptr, configMAX_PRIORITIES - 3, &transmit_task_handle); + xTaskCreate(canbus_tx, "CAN_Tx", 2950, nullptr, 1, &canbus_tx_task_handle); + xTaskCreate(canbus_rx, "CAN_Rx", 2950, nullptr, 1, &canbus_rx_task_handle); + xTaskCreate(transmit_task, "Tx", 2000, nullptr, configMAX_PRIORITIES - 3, &transmit_task_handle); xTaskCreate(replyqueue_task, "rxq", 2000, nullptr, configMAX_PRIORITIES - 2, &replyqueue_task_handle); - xTaskCreate(lazy_tasks, "lazyt", 2000, nullptr, 1, &lazy_task_handle); + xTaskCreate(lazy_tasks, "lazyt", 2500, nullptr, 0, &lazy_task_handle); // Set relay defaults for (int8_t y = 0; y < RELAY_TOTAL; y++) @@ -3331,7 +3468,7 @@ ESP32 Chip model = %u, Rev %u, Cores=%u, Features=%u)RAW", // Only run these after we have wifi... xTaskCreate(enqueue_task, "enqueue", 1900, nullptr, configMAX_PRIORITIES / 2, &enqueue_task_handle); xTaskCreate(rules_task, "rules", 3500, nullptr, configMAX_PRIORITIES - 5, &rule_task_handle); - xTaskCreate(periodic_task, "period", 3500, nullptr, 1, &periodic_task_handle); + xTaskCreate(periodic_task, "period", 3500, nullptr, 0, &periodic_task_handle); // Start the wifi and connect to access point wifi_init_sta(); diff --git a/ESPController/src/mqtt.cpp b/ESPController/src/mqtt.cpp index 57ab93ca..99979d7c 100644 --- a/ESPController/src/mqtt.cpp +++ b/ESPController/src/mqtt.cpp @@ -141,7 +141,7 @@ void connectToMqtt() } } -void GeneralStatusPayload(PacketRequestGenerator *prg, PacketReceiveProcessor *receiveProc, uint16_t requestq_count) +void GeneralStatusPayload(PacketRequestGenerator *prg, PacketReceiveProcessor *receiveProc, uint16_t requestq_count, Rules *rules) { ESP_LOGI(TAG, "General status payload"); std::string status; @@ -157,6 +157,11 @@ void GeneralStatusPayload(PacketRequestGenerator *prg, PacketReceiveProcessor *r status.append(",\"oos\":").append(std::to_string(receiveProc->totalOutofSequenceErrors)); status.append(",\"sendqlvl\":").append(std::to_string(requestq_count)); status.append(",\"roundtrip\":").append(std::to_string(receiveProc->packetTimerMillisecond)); + if (mysettings.dynamiccharge) + { + status.append(",\"dynchargev\":").append(float_to_string(((float)rules->DynamicChargeVoltage()) / 10.0)); + status.append(",\"dynchargec\":").append(float_to_string(((float)rules->DynamicChargeCurrent()) / 10.0)); + } status.append("}"); std::string topic = mysettings.mqtt_topic; @@ -173,8 +178,11 @@ void BankLevelInformation(Rules *rules) ESP_LOGI(TAG, "Bank(%d) status payload", bank); std::string bank_status; bank_status.reserve(128); - bank_status.append("{\"voltage\":").append(float_to_string(rules->packvoltage[bank] / 1000.0f)).append("}"); - + bank_status.append("{\"voltage\":") + .append(float_to_string(rules->bankvoltage[bank] / 1000.0f)) + .append(",\"range\":") + .append(std::to_string(rules->VoltageRangeInBank(bank))) + .append("}"); std::string topic = mysettings.mqtt_topic; topic.append("/bank/").append(std::to_string(bank)); publish_message(topic, bank_status); @@ -242,8 +250,9 @@ void MQTTCurrentMonitoring(currentmonitoring_struct *currentMonitor) { status.append(",\"mAhIn\":").append(std::to_string(currentMonitor->modbus.milliamphour_in)); status.append(",\"mAhOut\":").append(std::to_string(currentMonitor->modbus.milliamphour_out)); + status.append(",\"DailymAhIn\":").append(std::to_string(currentMonitor->modbus.daily_milliamphour_in)); + status.append(",\"DailymAhOut\":").append(std::to_string(currentMonitor->modbus.daily_milliamphour_out)); status.append(",\"temperature\":").append(std::to_string(currentMonitor->modbus.temperature)); - status.append(",\"shuntmV\":").append(std::to_string(currentMonitor->modbus.shuntmV)); status.append(",\"relayState\":").append(std::to_string(currentMonitor->RelayState ? 1 : 0)); status.append(",\"soc\":").append(float_to_string(currentMonitor->stateofcharge)); } @@ -365,7 +374,7 @@ void mqtt2(PacketReceiveProcessor *receiveProc, return; } - GeneralStatusPayload(prg, receiveProc, requestq_count); + GeneralStatusPayload(prg, receiveProc, requestq_count, rules); BankLevelInformation(rules); RuleStatus(rules); OutputStatus(previousRelayState); diff --git a/ESPController/src/pylon_canbus.cpp b/ESPController/src/pylon_canbus.cpp new file mode 100644 index 00000000..4f6836ce --- /dev/null +++ b/ESPController/src/pylon_canbus.cpp @@ -0,0 +1,269 @@ +/* + ____ ____ _ _ ____ __ __ ___ +( _ \(_ _)( \/ )( _ \( \/ )/ __) + )(_) )_)(_ \ / ) _ < ) ( \__ \ +(____/(____) (__) (____/(_/\/\_)(___/ + + (c) 2022 Stuart Pittaway + +This code communicates emulates a PYLON TECH BATTERY using CANBUS @ 500kbps and 11 bit addresses. + +*/ + +#define USE_ESP_IDF_LOG 1 +static constexpr const char *const TAG = "diybms-pylon"; + +#include "pylon_canbus.h" + +// 0x351 – Battery voltage + current limits +void pylon_message_351() +{ + struct data351 + { + uint16_t battery_charge_voltage; + // positive number + int16_t battery_charge_current_limit; + // negative number + int16_t battery_discharge_current_limit; + uint16_t battery_discharge_voltage; + }; + + data351 data; + + //If we pass ZERO's to SOFAR inverter it appears to ignore them + //so send 0.1V and 0.1Amps instead to indicate "stop" + + // Defaults (do nothing) + data.battery_charge_voltage = 1; + data.battery_charge_current_limit = 1; + data.battery_discharge_current_limit = 1; + data.battery_discharge_voltage = mysettings.dischargevolt; + + if (rules.IsChargeAllowed(&mysettings)) + { + if (rules.numberOfBalancingModules > 0 && mysettings.stopchargebalance == true) + { + // Balancing is active, so stop charging + data.battery_charge_voltage = 1; + data.battery_charge_current_limit = 1; + } + else + { + // Default - normal behaviour + data.battery_charge_voltage = rules.DynamicChargeVoltage(); + data.battery_charge_current_limit = rules.DynamicChargeCurrent(); + } + } + + if (rules.IsDischargeAllowed(&mysettings)) + { + data.battery_discharge_current_limit = mysettings.dischargecurrent; + } + + send_canbus_message(0x351, (uint8_t *)&data, sizeof(data351)); +} +// 0x355 – 1A 00 64 00 – State of Health (SOH) / State of Charge (SOC) +void pylon_message_355() +{ + if (_controller_state != ControllerState::Running) + return; + + struct data355 + { + uint16_t stateofchargevalue; + uint16_t stateofhealthvalue; + }; + + //Only send CANBUS message if we have a current monitor enabled & valid + if (mysettings.currentMonitoringEnabled && currentMonitor.validReadings && mysettings.currentMonitoringDevice == CurrentMonitorDevice::DIYBMS_CURRENT_MON) + { + data355 data; + // 0 SOC value un16 1 % + data.stateofchargevalue = rules.StateOfChargeWithRulesApplied(&mysettings, currentMonitor.stateofcharge); + + // 2 SOH value un16 1 % + // TODO: Need to determine this based on age of battery/cycles etc. + data.stateofhealthvalue = 100; + + send_canbus_message(0x355, (uint8_t *)&data, sizeof(data355)); + } +} + +// 0x359 – 00 00 00 00 0A 50 4E – Protection & Alarm flags +void pylon_message_359() +{ + struct data359 + { + // Protection - Table 1 + uint8_t byte0; + // Protection - Table 2 + uint8_t byte1; + // Warnings - Table + uint8_t byte2; + // Warnings - Table 4 + uint8_t byte3; + // Quantity of banks in parallel + uint8_t byte4; + uint8_t byte5; + uint8_t byte6; + // Online address of banks in parallel - Table 5 + uint8_t byte7; + }; + + data359 data; + + memset(&data, 0, sizeof(data359)); + + if (_controller_state == ControllerState::Running) + { + // bit 0 = unused + //(bit 1) Battery high voltage alarm + data.byte0 |= ((rules.rule_outcome[Rule::BankOverVoltage] | rules.rule_outcome[Rule::CurrentMonitorOverVoltage]) ? B00000010 : 0); + + //(bit 2) Battery low voltage alarm + data.byte0 |= ((rules.rule_outcome[Rule::BankUnderVoltage] | rules.rule_outcome[Rule::CurrentMonitorUnderVoltage]) ? B00000100 : 0); + + //(bit 3) Battery high temperature alarm + if (rules.moduleHasExternalTempSensor) + { + data.byte0 |= (rules.rule_outcome[Rule::ModuleOverTemperatureExternal] ? B00001000 : 0); + } + // (bit 4) Battery low temperature alarm + if (rules.moduleHasExternalTempSensor) + { + data.byte0 |= (rules.rule_outcome[Rule::ModuleUnderTemperatureExternal] ? B00010000 : 0); + } + // bit 5 = unused + // bit 6 = unused + // bit 7 = Discharge over current + + // Byte2, Warnings - Table 3 + data.byte2 = 0; + + // WARNING:Battery high voltage + if (rules.highestBankVoltage / 100 > mysettings.chargevolt) + { + data.byte2 |= B00000010; + } + + // WARNING:Battery low voltage + // dischargevolt=490, lowestbankvoltage=48992 (scale down 100) + if (rules.lowestBankVoltage / 100 < mysettings.dischargevolt) + { + data.byte2 |= B00000100; + } + + // WARNING: Battery high temperature + if (rules.moduleHasExternalTempSensor && rules.highestExternalTemp > mysettings.chargetemphigh) + { + data.byte2 |= B00001000; + } + + // WARNING: Battery low temperature + if (rules.moduleHasExternalTempSensor && rules.lowestExternalTemp < mysettings.chargetemplow) + { + data.byte2 |= B00010000; + } + } + + // byte3,table4, Bit 3 = Internal communication failure + data.byte3 |= ((rules.rule_outcome[Rule::BMSError] | rules.rule_outcome[Rule::EmergencyStop]) ? B00001000 : 0); + data.byte3 |= ((_controller_state != ControllerState::Running) ? B00001000 : 0); + + if (mysettings.currentMonitoringEnabled && currentMonitor.validReadings) + { + // Pylon can have multiple battery each of 74Ah capacity, so emulate this based on total Ah capacity + // this drives the inverter to assume certain charge/discharge parameters based on number of battery banks installed + // Set inverter to use "Pylontech US3000C 3.5kWh" in its settings (these are 74Ah each) + data.byte4 = min((uint8_t)1, (uint8_t)round(mysettings.nominalbatcap / 74.0)); + } + else + { + // Default 1 battery + data.byte4 = 1; + } + + data.byte5 = 0x50; // P + data.byte6 = 0x4e; // N + + send_canbus_message(0x359, (uint8_t *)&data, sizeof(data359)); +} + +// 0x35C – C0 00 – Battery charge request flags +void pylon_message_35c() +{ + struct data35c + { + uint8_t byte0; + // uint8_t byte1; + }; + + data35c data; + + // bit 0/1/2/3 unused + // bit 4 Force charge 2 + // bit 5 Force charge 1 + // bit 6 Discharge enable + // bit 7 Charge enable + data.byte0 = 0; + // data.byte1 = 0; + + if (rules.IsChargeAllowed(&mysettings)) + { + data.byte0 = data.byte0 | B10000000; + } + + if (rules.IsDischargeAllowed(&mysettings)) + { + data.byte0 = data.byte0 | B01000000; + } + + send_canbus_message(0x35c, (uint8_t *)&data, sizeof(data35c)); +} + +// 0x35E – 50 59 4C 4F 4E 20 20 20 – Manufacturer name ("PYLON ") +void pylon_message_35e() +{ + // Send 8 byte "magic string" PYLON (with 3 trailing spaces) + const char pylon[] = "\x50\x59\x4c\x4f\x4e\x20\x20\x20"; + send_canbus_message(0x35e, (uint8_t *)&pylon, sizeof(pylon) - 1); +} + +// Battery voltage - 0x356 – 4e 13 02 03 04 05 – Voltage / Current / Temp +void pylon_message_356() +{ + struct data356 + { + int16_t voltage; + int16_t current; + int16_t temperature; + }; + + data356 data; + + // If current shunt is installed, use the voltage from that as it should be more accurate + if (mysettings.currentMonitoringEnabled && currentMonitor.validReadings) + { + data.voltage = currentMonitor.modbus.voltage * 100.0; + data.current = currentMonitor.modbus.current * 10; + } + else + { + // Use highest bank voltage calculated by controller and modules + data.voltage = rules.highestBankVoltage / 10; + data.current = 0; + } + + // Temperature 0.1 C using external temperature sensor + if (rules.moduleHasExternalTempSensor) + { + data.temperature = (int16_t)rules.highestExternalTemp * (int16_t)10; + } + else + { + // No external temp sensors + data.temperature = 0; + } + + send_canbus_message(0x356, (uint8_t *)&data, sizeof(data356)); +} diff --git a/ESPController/src/settings.cpp b/ESPController/src/settings.cpp new file mode 100644 index 00000000..3f5a6dab --- /dev/null +++ b/ESPController/src/settings.cpp @@ -0,0 +1,1077 @@ +#define USE_ESP_IDF_LOG 1 +static constexpr const char *const TAG = "diybms-set"; + +#include "settings.h" + +/* +THESE STRINGS ARE USED AS KEYS IN THE JSON SETTINGS BACKUP FILES +DEFINED HERE (ONCE) TO ENSURE TYPOS ARE NOT MADE +*/ +static const char totalNumberOfBanks_JSONKEY[] = "totalNumberOfBanks"; +static const char totalNumberOfSeriesModules_JSONKEY[] = "totalNumberOfSeriesModules"; +static const char baudRate_JSONKEY[] = "baudRate"; +static const char interpacketgap_JSONKEY[] = "interpacketgap"; +static const char graph_voltagehigh_JSONKEY[] = "graph_voltagehigh"; +static const char graph_voltagelow_JSONKEY[] = "graph_voltagelow"; +static const char BypassOverTempShutdown_JSONKEY[] = "BypassOverTempShutdown"; +static const char BypassThresholdmV_JSONKEY[] = "BypassThresholdmV"; +static const char timeZone_JSONKEY[] = "timeZone"; +static const char minutesTimeZone_JSONKEY[] = "minutesTimeZone"; +static const char daylight_JSONKEY[] = "daylight"; +static const char ntpServer_JSONKEY[] = "ntpServer"; +static const char loggingEnabled_JSONKEY[] = "loggingEnabled"; +static const char loggingFrequencySeconds_JSONKEY[] = "loggingFrequencySeconds"; +static const char currentMonitoringEnabled_JSONKEY[] = "currentMonitoringEnabled"; +static const char currentMonitoringModBusAddress_JSONKEY[] = "currentMonitoringModBusAddress"; +static const char rs485baudrate_JSONKEY[] = "rs485baudrate"; +static const char rs485databits_JSONKEY[] = "rs485databits"; +static const char rs485parity_JSONKEY[] = "rs485parity"; +static const char rs485stopbits_JSONKEY[] = "rs485stopbits"; +static const char language_JSONKEY[] = "language"; +static const char mqtt_enabled_JSONKEY[] = "enabled"; +static const char mqtt_uri_JSONKEY[] = "uri"; +static const char mqtt_topic_JSONKEY[] = "topic"; +static const char mqtt_username_JSONKEY[] = "username"; +static const char mqtt_password_JSONKEY[] = "password"; +static const char influxdb_enabled_JSONKEY[] = "enabled"; +static const char influxdb_apitoken_JSONKEY[] = "apitoken"; +static const char influxdb_databasebucket_JSONKEY[] = "bucket"; +static const char influxdb_orgid_JSONKEY[] = "org"; +static const char influxdb_serverurl_JSONKEY[] = "url"; +static const char influxdb_loggingFreqSeconds_JSONKEY[] = "logfreq"; +static const char canbusprotocol_JSONKEY[] = "canbusprotocol"; +static const char nominalbatcap_JSONKEY[] = "nominalbatcap"; +static const char chargevolt_JSONKEY[] = "chargevolt"; +static const char chargecurrent_JSONKEY[] = "chargecurrent"; +static const char dischargecurrent_JSONKEY[] = "dischargecurrent"; +static const char dischargevolt_JSONKEY[] = "dischargevolt"; +static const char chargetemplow_JSONKEY[] = "chargetemplow"; +static const char chargetemphigh_JSONKEY[] = "chargetemphigh"; +static const char dischargetemplow_JSONKEY[] = "dischargetemplow"; +static const char dischargetemphigh_JSONKEY[] = "dischargetemphigh"; +static const char stopchargebalance_JSONKEY[] = "stopchargebalance"; +static const char socoverride_JSONKEY[] = "socoverride"; +static const char socforcelow_JSONKEY[] = "socforcelow"; +static const char dynamiccharge_JSONKEY[] = "dynamiccharge"; +static const char preventdischarge_JSONKEY[] = "preventdischarge"; +static const char preventcharging_JSONKEY[] = "preventcharging"; +static const char cellminmv_JSONKEY[] = "cellminmv"; +static const char cellmaxmv_JSONKEY[] = "cellmaxmv"; +static const char kneemv_JSONKEY[] = "kneemv"; +static const char cellmaxspikemv_JSONKEY[] = "cellmaxspikemv"; +static const char sensitivity_JSONKEY[] = "sensitivity"; +static const char current_value1_JSONKEY[] = "cur_val1"; +static const char current_value2_JSONKEY[] = "cur_val2"; + +/* NVS KEYS +THESE STRINGS ARE USED TO HOLD THE PARAMETER IN NVS FLASH, MAXIMUM LENGTH OF 16 CHARACTERS +*/ +static const char totalNumberOfBanks_NVSKEY[] = "totalBanks"; +static const char totalNumberOfSeriesModules_NVSKEY[] = "totalSeriesMod"; +static const char baudRate_NVSKEY[] = "baudRate"; +static const char interpacketgap_NVSKEY[] = "interpacketgap"; +static const char rulevalue_NVSKEY[] = "rulevalue"; +static const char rulehysteresis_NVSKEY[] = "rulehysteresis"; +static const char rulerelaystate_NVSKEY[] = "rulerelaystate"; +static const char rulerelaydefault_NVSKEY[] = "rulerelaydef"; +static const char relaytype_NVSKEY[] = "relaytype"; +static const char graph_voltagehigh_NVSKEY[] = "g_voltagehigh"; +static const char graph_voltagelow_NVSKEY[] = "g_voltagelow"; +static const char BypassOverTempShutdown_NVSKEY[] = "BypassOverTemp"; +static const char BypassThresholdmV_NVSKEY[] = "BypassThresmV"; +static const char timeZone_NVSKEY[] = "TZ"; +static const char minutesTimeZone_NVSKEY[] = "minutesTZ"; +static const char daylight_NVSKEY[] = "daylight"; +static const char loggingEnabled_NVSKEY[] = "logEnabled"; +static const char loggingFrequencySeconds_NVSKEY[] = "logFreqSec"; +static const char currentMonitoringEnabled_NVSKEY[] = "curMonEnabled"; +static const char currentMonitoringModBusAddress_NVSKEY[] = "curMonMBAddress"; +static const char currentMonitoringDevice_NVSKEY[] = "curMonDevice"; +static const char rs485baudrate_NVSKEY[] = "485baudrate"; +static const char rs485databits_NVSKEY[] = "485databits"; +static const char rs485parity_NVSKEY[] = "485parity"; +static const char rs485stopbits_NVSKEY[] = "485stopbits"; +static const char canbusprotocol_NVSKEY[] = "canbusprotocol"; +static const char nominalbatcap_NVSKEY[] = "nominalbatcap"; +static const char chargevolt_NVSKEY[] = "cha_volt"; +static const char chargecurrent_NVSKEY[] = "cha_current"; +static const char dischargecurrent_NVSKEY[] = "dis_current"; +static const char dischargevolt_NVSKEY[] = "dis_volt"; +static const char cellminmv_NVSKEY[] = "cellminmv"; +static const char cellmaxmv_NVSKEY[] = "cellmaxmv"; +static const char kneemv_NVSKEY[] = "kneemv"; +static const char sensitivity_NVSKEY[] = "sensitivity"; +static const char current_value1_NVSKEY[] = "cur_val1"; +static const char current_value2_NVSKEY[] = "cur_val2"; +static const char cellmaxspikemv_NVSKEY[] = "cellmaxspikemv"; +static const char chargetemplow_NVSKEY[] = "cha_templow"; +static const char chargetemphigh_NVSKEY[] = "cha_temphigh"; +static const char dischargetemplow_NVSKEY[] = "dis_templow"; +static const char dischargetemphigh_NVSKEY[] = "dis_temphigh"; +static const char stopchargebalance_NVSKEY[] = "stopchargebal"; +static const char socoverride_NVSKEY[] = "socoverride"; +static const char socforcelow_NVSKEY[] = "socforcelow"; +static const char dynamiccharge_NVSKEY[] = "dynamiccharge"; +static const char preventcharging_NVSKEY[] = "preventchar"; +static const char preventdischarge_NVSKEY[] = "preventdis"; +static const char mqtt_enabled_NVSKEY[] = "mqttenable"; +static const char influxdb_enabled_NVSKEY[] = "infenabled"; +static const char influxdb_loggingFreqSeconds_NVSKEY[] = "inflogFreq"; +static const char tileconfig_NVSKEY[] = "tileconfig"; +static const char ntpServer_NVSKEY[] = "ntpServer"; +static const char language_NVSKEY[] = "language"; +static const char mqtt_uri_NVSKEY[] = "mqtt_uri"; +static const char mqtt_topic_NVSKEY[] = "mqtt_topic"; +static const char mqtt_username_NVSKEY[] = "mqtt_usern"; +static const char mqtt_password_NVSKEY[] = "mqtt_pword"; +static const char influxdb_serverurl_NVSKEY[] = "inf_serverurl"; +static const char influxdb_databasebucket_NVSKEY[] = "inf_bucket"; +static const char influxdb_apitoken_NVSKEY[] = "inf_apitoken"; +static const char influxdb_orgid_NVSKEY[] = "inf_orgid"; + +#define MACRO_NVSWRITE(VARNAME) writeSetting(nvs_handle, VARNAME##_NVSKEY, settings->VARNAME); +#define MACRO_NVSWRITE_UINT8(VARNAME) writeSetting(nvs_handle, VARNAME##_NVSKEY, (uint8_t)settings->VARNAME); +#define MACRO_NVSWRITESTRING(VARNAME) writeSetting(nvs_handle, VARNAME##_NVSKEY, &settings->VARNAME[0]); +#define MACRO_NVSWRITEBLOB(VARNAME) writeSettingBlob(nvs_handle, VARNAME##_NVSKEY, settings->VARNAME, sizeof(settings->VARNAME)); + +// Macros to read NVS keys into variables +#define MACRO_NVSREAD(VARNAME) getSetting(nvs_handle, VARNAME##_NVSKEY, &settings->VARNAME); +#define MACRO_NVSREAD_UINT8(VARNAME) getSetting(nvs_handle, VARNAME##_NVSKEY, (uint8_t *)&settings->VARNAME); +#define MACRO_NVSREADSTRING(VARNAME) getString(nvs_handle, VARNAME##_NVSKEY, &settings->VARNAME[0], sizeof(settings->VARNAME)); +#define MACRO_NVSREADBLOB(VARNAME) getSettingBlob(nvs_handle, VARNAME##_NVSKEY, &settings->VARNAME, sizeof(settings->VARNAME)); + +bool ValidateGetSetting(esp_err_t err, const char *key) +{ + switch (err) + { + case ESP_OK: + ESP_LOGI(TAG, "Read key (%s)", key); + return true; + break; + case ESP_ERR_NVS_NOT_FOUND: + ESP_LOGW(TAG, "Key not initialized (%s)", key); + break; + default: + ESP_LOGE(TAG, "Error (%s) reading (%s)", esp_err_to_name(err), key); + } + return false; +} + +bool getString(nvs_handle_t handle, const char *key, char *out_value, size_t size) +{ + size_t length = size; + return ValidateGetSetting(nvs_get_str(handle, key, out_value, &length), key); +} +bool getSetting(nvs_handle_t handle, const char *key, float *out_value) +{ + size_t required_size = sizeof(float); + return ValidateGetSetting(nvs_get_blob(handle, key, (void *)out_value, &required_size), key); +} +bool getSetting(nvs_handle_t handle, const char *key, uint8_t *out_value) +{ + return ValidateGetSetting(nvs_get_u8(handle, key, out_value), key); +} +bool getSetting(nvs_handle_t handle, const char *key, int32_t *out_value) +{ + return ValidateGetSetting(nvs_get_i32(handle, key, out_value), key); +} +/* +bool getSetting(nvs_handle_t handle, const char *key, uint32_t *out_value) +{ + return ValidateGetSetting(nvs_get_u32(handle, key, out_value), key); +} +*/ +bool getSetting(nvs_handle_t handle, const char *key, int8_t *out_value) +{ + return ValidateGetSetting(nvs_get_i8(handle, key, out_value), key); +} + +bool getSettingBlob(nvs_handle_t handle, const char *key, void *out_value, size_t size) +{ + size_t stored_size = 0; + esp_err_t err = nvs_get_blob(handle, key, NULL, &stored_size); + if (err == ESP_ERR_NVS_NOT_FOUND) + { + ESP_LOGW(TAG, "Key not initialized (%s)", key); + } + if (err != ESP_OK) + { + return false; + } + + // Size is different + if (stored_size != size) + { + ESP_LOGW(TAG, "Rejecting (%s) blob size changed, old=%d, new=%d", key, stored_size, size); + return false; + } + + size_t required_size = size; + return ValidateGetSetting(nvs_get_blob(handle, key, out_value, &required_size), key); +} + +bool getSetting(nvs_handle_t handle, const char *key, uint16_t *out_value) +{ + return ValidateGetSetting(nvs_get_u16(handle, key, out_value), key); +} +bool getSetting(nvs_handle_t handle, const char *key, bool *out_value) +{ + return ValidateGetSetting(nvs_get_u8(handle, key, (uint8_t *)out_value), key); +} +bool getSetting(nvs_handle_t handle, const char *key, int16_t *out_value) +{ + return ValidateGetSetting(nvs_get_i16(handle, key, out_value), key); +} + +void InitializeNVS() +{ + // Initialize NVS + ESP_LOGI(TAG, "nvs_flash_init"); + esp_err_t err = nvs_flash_init(); + if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) + { + // NVS partition was truncated and needs to be erased + // Retry nvs_flash_init + ESP_ERROR_CHECK(nvs_flash_erase()); + err = nvs_flash_init(); + } + ESP_ERROR_CHECK(err); +} + +void writeSetting(nvs_handle_t handle, const char *key, bool value) +{ + writeSetting(handle, key, (uint8_t)value); +} + +void writeSetting(nvs_handle_t handle, const char *key, int8_t value) +{ + ESP_LOGD(TAG, "Writing (%s)=%i", key, value); + ESP_ERROR_CHECK(nvs_set_i8(handle, key, value)); +} +void writeSetting(nvs_handle_t handle, const char *key, uint8_t value) +{ + ESP_LOGD(TAG, "Writing (%s)=%u", key, value); + ESP_ERROR_CHECK(nvs_set_u8(handle, key, value)); +} +void writeSetting(nvs_handle_t handle, const char *key, int16_t value) +{ + ESP_LOGD(TAG, "Writing (%s)=%i", key, value); + ESP_ERROR_CHECK(nvs_set_i16(handle, key, value)); +} +void writeSetting(nvs_handle_t handle, const char *key, int32_t value) +{ + ESP_LOGD(TAG, "Writing (%s)=%i", key, value); + ESP_ERROR_CHECK(nvs_set_i32(handle, key, value)); +} +void writeSetting(nvs_handle_t handle, const char *key, uint16_t value) +{ + ESP_LOGD(TAG, "Writing (%s)=%u", key, value); + ESP_ERROR_CHECK(nvs_set_u16(handle, key, value)); +} +void writeSetting(nvs_handle_t handle, const char *key, const char *value) +{ + ESP_LOGD(TAG, "Writing (%s)=%s", key, value); + ESP_ERROR_CHECK(nvs_set_str(handle, key, value)); +} +void writeSettingBlob(nvs_handle_t handle, const char *key, const void *value, size_t length) +{ + ESP_LOGD(TAG, "Writing (%s), length=%u", key, length); + ESP_ERROR_CHECK(nvs_set_blob(handle, key, value, length)); +} + +void SaveConfiguration(diybms_eeprom_settings *settings) +{ + const char *partname = "diybms-ctrl"; + ESP_LOGI(TAG, "Write config"); + + nvs_handle_t nvs_handle; + esp_err_t err = nvs_open(partname, NVS_READWRITE, &nvs_handle); + if (err != ESP_OK) + { + ESP_LOGE(TAG, "Error %s opening NVS handle!", esp_err_to_name(err)); + } + else + { + + // Save settings + MACRO_NVSWRITE(totalNumberOfBanks) + MACRO_NVSWRITE(totalNumberOfSeriesModules) + MACRO_NVSWRITE(baudRate) + MACRO_NVSWRITE(interpacketgap) + + MACRO_NVSWRITEBLOB(rulevalue); + MACRO_NVSWRITEBLOB(rulehysteresis); + MACRO_NVSWRITEBLOB(rulerelaystate); + MACRO_NVSWRITEBLOB(rulerelaydefault); + MACRO_NVSWRITEBLOB(relaytype); + + MACRO_NVSWRITE(graph_voltagehigh) + MACRO_NVSWRITE(graph_voltagelow) + MACRO_NVSWRITE(BypassOverTempShutdown) + MACRO_NVSWRITE(BypassThresholdmV) + MACRO_NVSWRITE(timeZone) + MACRO_NVSWRITE(minutesTimeZone) + MACRO_NVSWRITE(daylight) + MACRO_NVSWRITE(loggingEnabled) + MACRO_NVSWRITE(loggingFrequencySeconds) + + MACRO_NVSWRITE(currentMonitoringEnabled) + MACRO_NVSWRITE(currentMonitoringModBusAddress) + MACRO_NVSWRITE_UINT8(currentMonitoringDevice); + MACRO_NVSWRITE(rs485baudrate) + MACRO_NVSWRITE_UINT8(rs485databits); + MACRO_NVSWRITE_UINT8(rs485parity); + MACRO_NVSWRITE_UINT8(rs485stopbits); + MACRO_NVSWRITE_UINT8(canbusprotocol); + + MACRO_NVSWRITE(nominalbatcap) + + MACRO_NVSWRITE(chargevolt) + MACRO_NVSWRITE(chargecurrent) + MACRO_NVSWRITE(dischargecurrent) + MACRO_NVSWRITE(dischargevolt) + MACRO_NVSWRITE(cellminmv) + MACRO_NVSWRITE(cellmaxmv) + MACRO_NVSWRITE(kneemv) + MACRO_NVSWRITE(sensitivity); + MACRO_NVSWRITE(current_value1); + MACRO_NVSWRITE(current_value2); + MACRO_NVSWRITE(cellmaxspikemv); + MACRO_NVSWRITE(chargetemplow); + MACRO_NVSWRITE(chargetemphigh); + MACRO_NVSWRITE(dischargetemplow); + MACRO_NVSWRITE(dischargetemphigh); + MACRO_NVSWRITE(stopchargebalance); + MACRO_NVSWRITE(socoverride); + MACRO_NVSWRITE(socforcelow); + + MACRO_NVSWRITE(dynamiccharge); + MACRO_NVSWRITE(preventcharging); + MACRO_NVSWRITE(preventdischarge); + MACRO_NVSWRITE(mqtt_enabled); + MACRO_NVSWRITE(influxdb_enabled); + MACRO_NVSWRITE(influxdb_loggingFreqSeconds); + + MACRO_NVSWRITEBLOB(tileconfig); + + MACRO_NVSWRITESTRING(ntpServer); + MACRO_NVSWRITESTRING(language); + MACRO_NVSWRITESTRING(mqtt_uri); + MACRO_NVSWRITESTRING(mqtt_topic); + MACRO_NVSWRITESTRING(mqtt_username); + MACRO_NVSWRITESTRING(mqtt_password); + MACRO_NVSWRITESTRING(influxdb_serverurl); + MACRO_NVSWRITESTRING(influxdb_databasebucket); + MACRO_NVSWRITESTRING(influxdb_apitoken); + MACRO_NVSWRITESTRING(influxdb_orgid); + + ESP_ERROR_CHECK(nvs_commit(nvs_handle)); + nvs_close(nvs_handle); + } +} + +void LoadConfiguration(diybms_eeprom_settings *settings) +{ + const char *partname = "diybms-ctrl"; + ESP_LOGI(TAG, "Load config"); + + // Set all settings in the STRUCT to be the defaults + DefaultConfiguration(settings); + // Apply validation rules, just to ensure the defaults make sense + ValidateConfiguration(settings); + + nvs_stats_t nvs_stats; + esp_err_t err = nvs_get_stats(NULL, &nvs_stats); + if (err == ESP_OK) + { + ESP_LOGI(TAG, "Count: UsedEntries = (%d), FreeEntries = (%d), AllEntries = (%d)", nvs_stats.used_entries, nvs_stats.free_entries, nvs_stats.total_entries); + } + + nvs_handle_t nvs_handle; + err = nvs_open(partname, NVS_READONLY, &nvs_handle); + if (err != ESP_OK) + { + ESP_LOGE(TAG, "Error (%s) opening NVS handle", esp_err_to_name(err)); + } + else + { + // Open + MACRO_NVSREAD(totalNumberOfBanks); + MACRO_NVSREAD(totalNumberOfSeriesModules); + MACRO_NVSREAD(baudRate); + MACRO_NVSREAD(interpacketgap); + + MACRO_NVSREADBLOB(rulevalue); + MACRO_NVSREADBLOB(rulehysteresis); + MACRO_NVSREADBLOB(rulerelaystate); + MACRO_NVSREADBLOB(rulerelaydefault); + MACRO_NVSREADBLOB(relaytype); + + MACRO_NVSREAD(graph_voltagehigh); + MACRO_NVSREAD(graph_voltagelow); + MACRO_NVSREAD(BypassOverTempShutdown); + MACRO_NVSREAD(BypassThresholdmV); + MACRO_NVSREAD(minutesTimeZone); + MACRO_NVSREAD(daylight); + MACRO_NVSREAD(loggingEnabled); + MACRO_NVSREAD(loggingFrequencySeconds); + MACRO_NVSREAD(currentMonitoringEnabled); + MACRO_NVSREAD(currentMonitoringModBusAddress); + MACRO_NVSREAD_UINT8(currentMonitoringModBusAddress); + MACRO_NVSREAD(rs485baudrate); + MACRO_NVSREAD_UINT8(rs485databits); + MACRO_NVSREAD_UINT8(rs485parity); + MACRO_NVSREAD_UINT8(rs485stopbits); + MACRO_NVSREAD_UINT8(canbusprotocol); + MACRO_NVSREAD(nominalbatcap); + MACRO_NVSREAD(chargevolt); + MACRO_NVSREAD(chargecurrent); + MACRO_NVSREAD(dischargecurrent); + MACRO_NVSREAD(dischargevolt); + MACRO_NVSREAD(cellminmv); + MACRO_NVSREAD(cellmaxmv); + MACRO_NVSREAD(kneemv); + MACRO_NVSREAD(sensitivity); + MACRO_NVSREAD(current_value1); + MACRO_NVSREAD(current_value2); + MACRO_NVSREAD(cellmaxspikemv); + MACRO_NVSREAD(chargetemplow); + MACRO_NVSREAD(chargetemphigh); + MACRO_NVSREAD(dischargetemplow); + MACRO_NVSREAD(dischargetemphigh); + MACRO_NVSREAD(stopchargebalance); + MACRO_NVSREAD(socoverride); + MACRO_NVSREAD(socforcelow); + + MACRO_NVSREAD(dynamiccharge); + MACRO_NVSREAD(preventcharging); + MACRO_NVSREAD(preventdischarge); + + MACRO_NVSREAD(mqtt_enabled); + MACRO_NVSREAD(influxdb_enabled); + MACRO_NVSREAD(influxdb_loggingFreqSeconds); + + MACRO_NVSREADBLOB(tileconfig); + + MACRO_NVSREADSTRING(ntpServer); + MACRO_NVSREADSTRING(language); + MACRO_NVSREADSTRING(mqtt_uri); + MACRO_NVSREADSTRING(mqtt_topic); + MACRO_NVSREADSTRING(mqtt_username); + MACRO_NVSREADSTRING(mqtt_password); + MACRO_NVSREADSTRING(influxdb_serverurl); + MACRO_NVSREADSTRING(influxdb_databasebucket); + MACRO_NVSREADSTRING(influxdb_apitoken); + MACRO_NVSREADSTRING(influxdb_orgid); + + nvs_close(nvs_handle); + } + + // Ensure values make sense + ValidateConfiguration(settings); +} + +void DefaultConfiguration(diybms_eeprom_settings *_myset) +{ + ESP_LOGD(TAG, "Apply default config"); + + // Zero all the bytes + memset(_myset, 0, sizeof(diybms_eeprom_settings)); + + // Default to a single module + _myset->totalNumberOfBanks = 1; + _myset->totalNumberOfSeriesModules = 1; + // Default serial port speed + _myset->baudRate = COMMS_BAUD_RATE; + _myset->BypassOverTempShutdown = 65; + _myset->interpacketgap = 6000; + // 4.10V bypass + _myset->BypassThresholdmV = 4100; + _myset->graph_voltagehigh = 4500; + _myset->graph_voltagelow = 2750; + + // EEPROM settings are invalid so default configuration + _myset->mqtt_enabled = false; + + _myset->canbusprotocol = CanBusProtocolEmulation::CANBUS_DISABLED; + _myset->nominalbatcap = 280; // Scale 1 + _myset->chargevolt = 565; // Scale 0.1 + _myset->chargecurrent = 650; // Scale 0.1 + _myset->dischargecurrent = 650; // Scale 0.1 + _myset->dischargevolt = 488; // Scale 0.1 + _myset->chargetemplow = 0; + _myset->chargetemphigh = 50; + _myset->dischargetemplow = -30; + _myset->dischargetemphigh = 55; + // Just outside the ranges of 56.0V and 49.6V + _myset->cellminmv = 3050; + _myset->cellmaxmv = 3450; + _myset->kneemv = 3320; + _myset->sensitivity = 30; // Scale 0.1 + + _myset->current_value1 = 50; // 5.0 + _myset->current_value2 = 03; // 0.3 + + // Allow this "safe" cell voltage to allow a bit of wiggle room/spike control + _myset->cellmaxspikemv = 3550; + _myset->stopchargebalance = false; + _myset->socoverride = false; + _myset->socforcelow = false; + _myset->dynamiccharge = true; + _myset->preventcharging = false; + _myset->preventdischarge = false; + + _myset->loggingEnabled = false; + _myset->loggingFrequencySeconds = 15; + + _myset->currentMonitoringEnabled = false; + _myset->currentMonitoringModBusAddress = 90; + _myset->currentMonitoringDevice = CurrentMonitorDevice::DIYBMS_CURRENT_MON; + + _myset->rs485baudrate = 19200; + _myset->rs485databits = uart_word_length_t::UART_DATA_8_BITS; + _myset->rs485parity = uart_parity_t::UART_PARITY_DISABLE; + _myset->rs485stopbits = uart_stop_bits_t::UART_STOP_BITS_1; + + _myset->currentMonitoringEnabled = false; + + strncpy(_myset->language, "en", sizeof(_myset->language)); + + // Default to EMONPI default MQTT settings + strncpy(_myset->mqtt_topic, "emon/diybms", sizeof(_myset->mqtt_topic)); + strncpy(_myset->mqtt_uri, "mqtt://192.168.0.26:1883", sizeof(_myset->mqtt_uri)); + strncpy(_myset->mqtt_username, "emonpi", sizeof(_myset->mqtt_username)); + strncpy(_myset->mqtt_password, "emonpimqtt2016", sizeof(_myset->mqtt_password)); + + _myset->influxdb_enabled = false; + strncpy(_myset->influxdb_serverurl, "http://192.168.0.49:8086/api/v2/write", sizeof(_myset->influxdb_serverurl)); + strncpy(_myset->influxdb_databasebucket, "bucketname", sizeof(_myset->influxdb_databasebucket)); + strncpy(_myset->influxdb_orgid, "organisation", sizeof(_myset->influxdb_orgid)); + _myset->influxdb_loggingFreqSeconds = 15; + + _myset->timeZone = 0; + _myset->minutesTimeZone = 0; + _myset->daylight = false; + strncpy(_myset->ntpServer, "time.google.com", sizeof(_myset->ntpServer)); + + for (size_t x = 0; x < RELAY_TOTAL; x++) + { + _myset->rulerelaydefault[x] = RELAY_OFF; + } + + // Emergency stop + _myset->rulevalue[Rule::EmergencyStop] = 0; + // Internal BMS error (communication issues, fault readings from modules etc) + _myset->rulevalue[Rule::BMSError] = 0; + // Current monitoring maximum AMPS + _myset->rulevalue[Rule::CurrentMonitorOverCurrentAmps] = 100; + // Individual cell over voltage + _myset->rulevalue[Rule::ModuleOverVoltage] = 4150; + // Individual cell under voltage + _myset->rulevalue[Rule::ModuleUnderVoltage] = 3000; + // Individual cell over temperature (external probe) + _myset->rulevalue[Rule::ModuleOverTemperatureExternal] = 50; + // Individual cell under temperature (external probe) + _myset->rulevalue[Rule::ModuleUnderTemperatureExternal] = 2; + // Bank Over voltage (mV) + _myset->rulevalue[Rule::BankOverVoltage] = 4200 * 8; + // RULE_BankUnderVoltage + _myset->rulevalue[Rule::BankUnderVoltage] = 3000 * 8; + // Bank range + _myset->rulevalue[Rule::BankRange] = 30; + + _myset->rulevalue[Rule::Timer1] = 60 * 8; // 8am + _myset->rulevalue[Rule::Timer2] = 60 * 17; // 5pm + + // Temperature of the actual module/PCB attached to a cell (internal temperature) + _myset->rulevalue[Rule::ModuleOverTemperatureInternal] = 75; + _myset->rulevalue[Rule::ModuleUnderTemperatureInternal] = 5; + + _myset->rulevalue[Rule::CurrentMonitorOverVoltage] = 4200 * 8; + _myset->rulevalue[Rule::CurrentMonitorUnderVoltage] = 3000 * 8; + + // Set rulehysteresis to match the rulevalue as the default + for (size_t i = 0; i < RELAY_RULES; i++) + { + _myset->rulehysteresis[i] = _myset->rulevalue[i]; + + // Set all relays to don't care + for (size_t x = 0; x < RELAY_TOTAL; x++) + { + _myset->rulerelaystate[i][x] = RELAY_X; + } + } + + for (size_t x = 0; x < RELAY_TOTAL; x++) + { + _myset->relaytype[x] = RELAY_STANDARD; + } + + // Default which "tiles" are visible on the web gui + // For the meaning, look at array "TILE_IDS" in pagecode.js + _myset->tileconfig[0] = 49152; + _myset->tileconfig[1] = 0; + _myset->tileconfig[2] = 62209; + _myset->tileconfig[3] = 0; + _myset->tileconfig[4] = 0; + + // Override hysteresis values if needed + _myset->rulehysteresis[Rule::BankRange] = 15; +} + +void SaveWIFI(wifi_eeprom_settings *wifi) +{ + const char *partname = "diybms-wifi"; + ESP_LOGI(TAG, "Save WIFI config"); + + wifi_eeprom_settings x; + nvs_handle_t nvs_handle; + esp_err_t err = nvs_open(partname, NVS_READWRITE, &nvs_handle); + if (err != ESP_OK) + { + ESP_LOGE(TAG, "Error (%s) opening NVS handle", esp_err_to_name(err)); + } + else + { + // Write values + ESP_ERROR_CHECK(nvs_set_str(nvs_handle, "SSID", &wifi->wifi_ssid[0])); + ESP_ERROR_CHECK(nvs_set_str(nvs_handle, "PASS", &wifi->wifi_passphrase[0])); + nvs_close(nvs_handle); + } +} + +bool LoadWIFI(wifi_eeprom_settings *wifi) +{ + const char *partname = "diybms-wifi"; + ESP_LOGI(TAG, "Load WIFI config"); + + bool result = false; + wifi_eeprom_settings x; + nvs_handle_t nvs_handle; + esp_err_t err = nvs_open(partname, NVS_READONLY, &nvs_handle); + if (err != ESP_OK) + { + ESP_LOGE(TAG, "Error (%s) opening NVS handle", esp_err_to_name(err)); + } + else + { + if (getString(nvs_handle, "SSID", &x.wifi_ssid[0], sizeof(x.wifi_ssid))) + { + if (getString(nvs_handle, "PASS", &x.wifi_passphrase[0], sizeof(x.wifi_passphrase))) + { + // Only return success if both values are retrieved, don't corrupt + // external copy of wifi settings otherwise. + memcpy(wifi, &x, sizeof(x)); + result = true; + } + } + nvs_close(nvs_handle); + } + + return result; +} + +// Validate configuration and force correction if needed. +void ValidateConfiguration(diybms_eeprom_settings *settings) +{ + diybms_eeprom_settings defaults; + DefaultConfiguration(&defaults); + + // Check its not zero + if (settings->influxdb_loggingFreqSeconds < 5) + { + settings->influxdb_loggingFreqSeconds = defaults.influxdb_loggingFreqSeconds; + } + + if (settings->rs485baudrate < 300) + { + settings->rs485baudrate = defaults.rs485baudrate; + } + + if (settings->baudRate < 300) + { + settings->baudRate = defaults.baudRate; + } + + if (settings->graph_voltagehigh > 5000 || settings->graph_voltagehigh < 2000 || settings->graph_voltagehigh < 0) + { + settings->graph_voltagehigh = defaults.graph_voltagehigh; + } + + if (settings->graph_voltagelow > settings->graph_voltagehigh || settings->graph_voltagelow < 0) + { + settings->graph_voltagelow = 0; + } + + if (settings->cellmaxmv > settings->cellmaxspikemv) + { + settings->cellmaxmv = defaults.cellmaxmv; + } + if (settings->cellmaxmv < settings->cellminmv) + { + settings->cellmaxmv = settings->cellminmv; + } + if (settings->cellminmv > settings->cellmaxmv) + { + settings->cellminmv = settings->cellmaxmv; + } + if (settings->kneemv > settings->cellmaxmv || settings->kneemv > settings->cellmaxspikemv) + { + settings->kneemv = defaults.kneemv; + } + + // Limit to 1 + if (settings->sensitivity < 1 * 10) + { + settings->sensitivity = 1 * 10; + } + // Limit to 100 + if (settings->sensitivity > 100 * 10) + { + settings->sensitivity = 100 * 10; + } + + // Limit to 100 + if (settings->current_value1 > 100 * 10) + { + settings->current_value1 = 100 * 10; + } + if (settings->current_value2 > 100 * 10) + { + settings->current_value2 = 100 * 10; + } + + // Ensure that all PULSE relays default to OFF (pulse will only pulse on/off not off/on) + for (uint8_t i = 0; i < RELAY_TOTAL; i++) + { + if (settings->relaytype[i] == RelayType::RELAY_PULSE) + { + settings->rulerelaydefault[i] = RelayState::RELAY_OFF; + } + } + + // Ensure trigger and reset (rulevalue and rulehysteresis) values make sense and + // the rulehysteresis value is either greater or lower than rulevalue as required. + + // These rules expect the hysteresis (reset) value to be LOWER than the trigger value + const Rule hysteresis_lower[] = {Rule::CurrentMonitorOverCurrentAmps, + Rule::ModuleOverVoltage, + Rule::ModuleOverTemperatureInternal, + Rule::ModuleOverTemperatureExternal, + Rule::CurrentMonitorOverVoltage, + Rule::BankOverVoltage, + Rule::BankRange}; + + for (size_t i = 0; i < sizeof(hysteresis_lower); i++) + { + Rule index = hysteresis_lower[i]; + + if (settings->rulehysteresis[index] > settings->rulevalue[index]) + { + ESP_LOGI(TAG, "Fixed LOWER hysteresis %u from %i to %i", (uint8_t)index, settings->rulehysteresis[index], settings->rulevalue[index]); + settings->rulehysteresis[index] = settings->rulevalue[index]; + } + } + + // These rules expect the hysteresis (reset) value to be GREATER than the trigger value + const Rule hysteresis_greater[] = {Rule::ModuleUnderVoltage, + Rule::ModuleUnderTemperatureInternal, + Rule::ModuleUnderTemperatureExternal, + Rule::CurrentMonitorUnderVoltage, + Rule::BankUnderVoltage, + Rule::Timer2, + Rule::Timer1}; + + for (size_t i = 0; i < sizeof(hysteresis_greater); i++) + { + Rule index = hysteresis_greater[i]; + + if (settings->rulehysteresis[index] < settings->rulevalue[index]) + { + ESP_LOGI(TAG, "Fixed GREATER hysteresis %u from %i to %i", (uint8_t)index, settings->rulehysteresis[index], settings->rulevalue[index]); + settings->rulehysteresis[index] = settings->rulevalue[index]; + } + } +} + +// Builds up a JSON document which mirrors the parameters inside "diybms_eeprom_settings" +void GenerateSettingsJSONDocument(DynamicJsonDocument *doc, diybms_eeprom_settings *settings) +{ + JsonObject root = doc->createNestedObject("diybms_settings"); + + root[totalNumberOfBanks_JSONKEY] = settings->totalNumberOfBanks; + root[totalNumberOfSeriesModules_JSONKEY] = settings->totalNumberOfSeriesModules; + root[baudRate_JSONKEY] = settings->baudRate; + root[interpacketgap_JSONKEY] = settings->interpacketgap; + root[graph_voltagehigh_JSONKEY] = settings->graph_voltagehigh; + root[graph_voltagelow_JSONKEY] = settings->graph_voltagelow; + root[BypassOverTempShutdown_JSONKEY] = settings->BypassOverTempShutdown; + root[BypassThresholdmV_JSONKEY] = settings->BypassThresholdmV; + root[timeZone_JSONKEY] = settings->timeZone; + root[minutesTimeZone_JSONKEY] = settings->minutesTimeZone; + root[daylight_JSONKEY] = settings->daylight; + root[ntpServer_JSONKEY] = settings->ntpServer; + root[loggingEnabled_JSONKEY] = settings->loggingEnabled; + root[loggingFrequencySeconds_JSONKEY] = settings->loggingFrequencySeconds; + root[currentMonitoringEnabled_JSONKEY] = settings->currentMonitoringEnabled; + root[currentMonitoringModBusAddress_JSONKEY] = settings->currentMonitoringModBusAddress; + root[rs485baudrate_JSONKEY] = settings->rs485baudrate; + root[rs485databits_JSONKEY] = settings->rs485databits; + root[rs485parity_JSONKEY] = settings->rs485parity; + root[rs485stopbits_JSONKEY] = settings->rs485stopbits; + root[language_JSONKEY] = settings->language; + + JsonObject mqtt = root.createNestedObject("mqtt"); + mqtt[mqtt_enabled_JSONKEY] = settings->mqtt_enabled; + mqtt[mqtt_uri_JSONKEY] = settings->mqtt_uri; + mqtt[mqtt_topic_JSONKEY] = settings->mqtt_topic; + mqtt[mqtt_username_JSONKEY] = settings->mqtt_username; + mqtt[mqtt_password_JSONKEY] = settings->mqtt_password; + + JsonObject influxdb = root.createNestedObject("influxdb"); + influxdb[influxdb_enabled_JSONKEY] = settings->influxdb_enabled; + influxdb[influxdb_apitoken_JSONKEY] = settings->influxdb_apitoken; + influxdb[influxdb_databasebucket_JSONKEY] = settings->influxdb_databasebucket; + influxdb[influxdb_orgid_JSONKEY] = settings->influxdb_orgid; + influxdb[influxdb_serverurl_JSONKEY] = settings->influxdb_serverurl; + influxdb[influxdb_loggingFreqSeconds_JSONKEY] = settings->influxdb_loggingFreqSeconds; + + JsonObject outputs = root.createNestedObject("outputs"); + JsonArray d = outputs.createNestedArray("default"); + JsonArray t = outputs.createNestedArray("type"); + for (uint8_t i = 0; i < RELAY_TOTAL; i++) + { + d.add(settings->rulerelaydefault[i]); + t.add(settings->relaytype[i]); + } + + JsonObject rules = root.createNestedObject("rules"); + for (uint8_t rr = 0; rr < RELAY_RULES; rr++) + { + // This is a default "catch all" + String elementName = String("rule") + String(rr); + + if (rr >= 0 && rr <= MAXIMUM_RuleNumber) + { + // Map enum to string so when this file is re-imported we are not locked to specific index offsets + // which may no longer map to the correct rule + elementName = String(RuleTextDescription[rr]); + } + else + { + ESP_LOGE(TAG, "Loop outside bounds of MAXIMUM_RuleNumber"); + } + + JsonObject state = rules.createNestedObject(elementName); + + state["value"] = settings->rulevalue[rr]; + state["hysteresis"] = settings->rulehysteresis[rr]; + + JsonArray relaystate = state.createNestedArray("state"); + for (uint8_t rt = 0; rt < RELAY_TOTAL; rt++) + { + relaystate.add(settings->rulerelaystate[rr][rt]); + } + } // end for + + root[canbusprotocol_JSONKEY] = (uint8_t)settings->canbusprotocol; + root[nominalbatcap_JSONKEY] = settings->nominalbatcap; + + root[chargevolt_JSONKEY] = settings->chargevolt; + root[chargecurrent_JSONKEY] = settings->chargecurrent; + root[dischargecurrent_JSONKEY] = settings->dischargecurrent; + root[dischargevolt_JSONKEY] = settings->dischargevolt; + + root[chargetemplow_JSONKEY] = settings->chargetemplow; + root[chargetemphigh_JSONKEY] = settings->chargetemphigh; + root[dischargetemplow_JSONKEY] = settings->dischargetemplow; + root[dischargetemphigh_JSONKEY] = settings->dischargetemphigh; + root[stopchargebalance_JSONKEY] = settings->stopchargebalance; + root[socoverride_JSONKEY] = settings->socoverride; + root[socforcelow_JSONKEY] = settings->socforcelow; + root[dynamiccharge_JSONKEY] = settings->dynamiccharge; + root[preventdischarge_JSONKEY] = settings->preventdischarge; + root[preventcharging_JSONKEY] = settings->preventcharging; + root[cellminmv_JSONKEY] = settings->cellminmv; + root[cellmaxmv_JSONKEY] = settings->cellmaxmv; + root[kneemv_JSONKEY] = settings->kneemv; + + root[cellmaxspikemv_JSONKEY] = settings->cellmaxspikemv; + root[sensitivity_JSONKEY] = settings->sensitivity; + root[current_value1_JSONKEY] = settings->current_value1; + root[current_value2_JSONKEY] = settings->current_value2; + + JsonArray tv = root.createNestedArray("tilevisibility"); + for (uint8_t i = 0; i < sizeof(settings->tileconfig) / sizeof(uint16_t); i++) + { + tv.add(settings->tileconfig[i]); + } + + // wifi["password"] = DIYBMSSoftAP::Config().wifi_passphrase; +} + +void JSONToSettings(DynamicJsonDocument &doc, diybms_eeprom_settings *settings) +{ + // Use defaults to populate the settings, just in case we are missing values from the JSON + DefaultConfiguration(settings); + + if (!doc.containsKey("diybms_settings")) + { + // Wrong document type - quit... + return; + } + + JsonObject root = doc["diybms_settings"]; + + settings->totalNumberOfBanks = root[totalNumberOfBanks_JSONKEY]; + settings->totalNumberOfSeriesModules = root[totalNumberOfSeriesModules_JSONKEY]; + settings->baudRate = root[baudRate_JSONKEY]; + settings->interpacketgap = root[interpacketgap_JSONKEY]; + + settings->graph_voltagehigh = root[graph_voltagehigh_JSONKEY]; + settings->graph_voltagelow = root[graph_voltagelow_JSONKEY]; + + settings->BypassOverTempShutdown = root[BypassOverTempShutdown_JSONKEY]; + settings->BypassThresholdmV = root[BypassThresholdmV_JSONKEY]; + + settings->timeZone = root[timeZone_JSONKEY]; + settings->minutesTimeZone = root[minutesTimeZone_JSONKEY]; + settings->daylight = root[daylight_JSONKEY]; + strncpy(settings->ntpServer, root[ntpServer_JSONKEY].as().c_str(), sizeof(settings->ntpServer)); + + settings->loggingEnabled = root[loggingEnabled_JSONKEY]; + settings->loggingFrequencySeconds = root[loggingFrequencySeconds_JSONKEY]; + + settings->currentMonitoringEnabled = root[currentMonitoringEnabled_JSONKEY]; + settings->currentMonitoringModBusAddress = root[currentMonitoringModBusAddress_JSONKEY]; + + settings->rs485baudrate = root[rs485baudrate_JSONKEY]; + settings->rs485databits = root[rs485databits_JSONKEY]; + settings->rs485parity = root[rs485parity_JSONKEY]; + settings->rs485stopbits = root[rs485stopbits_JSONKEY]; + + strncpy(settings->language, root[language_JSONKEY].as().c_str(), sizeof(settings->language)); + + settings->canbusprotocol = (CanBusProtocolEmulation)root[canbusprotocol_JSONKEY]; + settings->nominalbatcap = root[nominalbatcap_JSONKEY]; + settings->chargevolt = root[chargevolt_JSONKEY]; + settings->chargecurrent = root[chargecurrent_JSONKEY]; + settings->dischargecurrent = root[dischargecurrent_JSONKEY]; + settings->dischargevolt = root[dischargevolt_JSONKEY]; + settings->chargetemplow = root[chargetemplow_JSONKEY]; + settings->chargetemphigh = root[chargetemphigh_JSONKEY]; + settings->dischargetemplow = root[dischargetemplow_JSONKEY]; + settings->dischargetemphigh = root[dischargetemphigh_JSONKEY]; + settings->stopchargebalance = root[stopchargebalance_JSONKEY]; + settings->socoverride = root[socoverride_JSONKEY]; + settings->socforcelow = root[socforcelow_JSONKEY]; + settings->dynamiccharge = root[dynamiccharge_JSONKEY]; + settings->preventdischarge = root[preventdischarge_JSONKEY]; + settings->preventcharging = root[preventcharging_JSONKEY]; + settings->cellminmv = root[cellminmv_JSONKEY]; + settings->cellmaxmv = root[cellmaxmv_JSONKEY]; + settings->kneemv = root[kneemv_JSONKEY]; + settings->cellmaxspikemv = root[cellmaxspikemv_JSONKEY]; + settings->sensitivity = root[sensitivity_JSONKEY]; + settings->current_value1 = root[current_value1_JSONKEY]; + settings->current_value2 = root[current_value2_JSONKEY]; + + JsonObject mqtt = root["mqtt"]; + if (!mqtt.isNull()) + { + settings->mqtt_enabled = mqtt[mqtt_enabled_JSONKEY]; + strncpy(settings->mqtt_uri, mqtt[mqtt_uri_JSONKEY].as().c_str(), sizeof(settings->mqtt_uri)); + strncpy(settings->mqtt_topic, mqtt[mqtt_topic_JSONKEY].as().c_str(), sizeof(settings->mqtt_topic)); + strncpy(settings->mqtt_username, mqtt[mqtt_username_JSONKEY].as().c_str(), sizeof(settings->mqtt_username)); + strncpy(settings->mqtt_password, mqtt[mqtt_password_JSONKEY].as().c_str(), sizeof(settings->mqtt_password)); + } + + JsonObject influxdb = root["influxdb"]; + if (!influxdb.isNull()) + { + settings->influxdb_enabled = influxdb[influxdb_enabled_JSONKEY]; + strncpy(settings->influxdb_apitoken, influxdb[influxdb_apitoken_JSONKEY].as().c_str(), sizeof(settings->influxdb_apitoken)); + strncpy(settings->influxdb_databasebucket, influxdb[influxdb_databasebucket_JSONKEY].as().c_str(), sizeof(settings->influxdb_databasebucket)); + strncpy(settings->influxdb_orgid, influxdb[influxdb_orgid_JSONKEY].as().c_str(), sizeof(settings->influxdb_orgid)); + strncpy(settings->influxdb_serverurl, influxdb[influxdb_serverurl_JSONKEY].as().c_str(), sizeof(settings->influxdb_serverurl)); + settings->influxdb_loggingFreqSeconds = influxdb[influxdb_loggingFreqSeconds_JSONKEY]; + } + + JsonObject outputs = root["outputs"]; + if (!outputs.isNull()) + { + JsonArray d = outputs["default"].as(); + + uint8_t i = 0; + for (JsonVariant v : d) + { + settings->rulerelaydefault[i] = (RelayState)v.as(); + // ESP_LOGI(TAG, "relay default %u=%u", i, myset.rulerelaydefault[i]); + i++; + + if (i > RELAY_TOTAL) + { + break; + } + } + + JsonArray t = outputs["type"].as(); + i = 0; + for (JsonVariant v : t) + { + settings->relaytype[i] = (RelayType)v.as(); + // ESP_LOGI(TAG, "relay type %u=%u", i, myset.relaytype[i]); + i++; + if (i > RELAY_TOTAL) + { + break; + } + } + } + + JsonObject rules = root["rules"]; + if (!rules.isNull()) + { + for (JsonPair kv : rules) + { + char key[64]; + strncpy(key, kv.key().c_str(), sizeof(key)); + ESP_LOGI(TAG, "rule %s", key); + + for (size_t rulenumber = 0; rulenumber <= MAXIMUM_RuleNumber; rulenumber++) + { + if (strcmp(RuleTextDescription[rulenumber], key) == 0) + { + ESP_LOGI(TAG, "Matched to rule %u", rulenumber); + JsonVariant v = kv.value(); + settings->rulevalue[rulenumber] = v["value"].as(); + // ESP_LOGI(TAG, "value=%i", myset.rulevalue[rulenumber]); + settings->rulehysteresis[rulenumber] = v["hysteresis"].as(); + // ESP_LOGI(TAG, "hysteresis=%i", myset.rulehysteresis[rulenumber]); + JsonArray states = v["state"].as(); + + uint8_t i = 0; + for (JsonVariant v : states) + { + settings->rulerelaystate[rulenumber][i] = (RelayState)v.as(); + // ESP_LOGI(TAG, "rulerelaystate %u", myset.rulerelaystate[rulenumber][i]); + i++; + if (i > RELAY_TOTAL) + { + break; + } + } + + break; + } + } + } + } + + uint8_t i = 0; + for (JsonVariant v : root["tilevisibility"].as()) + { + // Need to check for over flow of tileconfig array + settings->tileconfig[i] = v.as(); + } +} \ No newline at end of file diff --git a/ESPController/src/tft.cpp b/ESPController/src/tft.cpp index 12c76ee5..bb5e536e 100644 --- a/ESPController/src/tft.cpp +++ b/ESPController/src/tft.cpp @@ -25,6 +25,8 @@ Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales (CC BY-NC-SA 2.0 UK #define USE_ESP_IDF_LOG 1 static constexpr const char *const TAG = "diybms-tft"; +#define CONFIG_DISABLE_HAL_LOCKS 1 + #include "defines.h" #include "HAL_ESP32.h" #include @@ -840,7 +842,7 @@ void DrawTFT_VoltageFourBank() tft.setTextColor(TFT_GREEN, TFT_BLACK); tft.setTextFont(7); - float value = rules.packvoltage[i] / 1000.0; + float value = rules.bankvoltage[i] / 1000.0; x += tft.drawFloat(value, 2, x, y); // Clear right hand side of display @@ -900,7 +902,7 @@ void DrawTFT_VoltageOneBank() const int16_t xoffset = 32; int16_t y = fontHeight_2; int16_t x = tft.width() / 2; - float value = rules.packvoltage[0] / 1000.0; + float value = rules.bankvoltage[0] / 1000.0; x += tft.drawFloat(value, 2, x, y); // Clear right hand side of display tft.fillRect(x, y, tft.width() - x, tft.fontHeight(), TFT_BLACK); @@ -990,7 +992,7 @@ void DrawTFT_Error() { case InternalErrorCode::CommunicationsError: { - tft.drawCentreString("Module", x, y, 4); + tft.drawCentreString("Module or RS485", x, y, 4); y += fontHeight_4; tft.drawCentreString("communications", x, y, 4); y += fontHeight_4; diff --git a/ESPController/src/victron_canbus.cpp b/ESPController/src/victron_canbus.cpp index 195ee42a..64c2df36 100644 --- a/ESPController/src/victron_canbus.cpp +++ b/ESPController/src/victron_canbus.cpp @@ -13,35 +13,10 @@ The code supports the VICTRON CAN BUS BMS style messages. */ #define USE_ESP_IDF_LOG 1 -static constexpr const char * const TAG = "diybms-victron"; +static constexpr const char *const TAG = "diybms-victron"; #include "victron_canbus.h" -void send_canbus_message(uint32_t identifier, uint8_t *buffer, uint8_t length) -{ - //static const char *TAG = "canbus"; - - twai_message_t message; - message.identifier = identifier; - message.flags = TWAI_MSG_FLAG_NONE; - message.data_length_code = length; - - memcpy(&message.data, buffer, length); - - // Queue message for transmission - if (twai_transmit(&message, pdMS_TO_TICKS(250)) != ESP_OK) - { - ESP_LOGE(TAG, "Fail to queue message"); - canbus_messages_failed_sent++; - } - - else - { - // ESP_LOGD(TAG, "Sent CAN message %u", identifier); - // ESP_LOG_BUFFER_HEX_LEVEL(TAG, &message, sizeof(can_message_t), esp_log_level_t::ESP_LOG_DEBUG); - canbus_messages_sent++; - } -} // Transmit the DIYBMS hostname via two CAN Messages void victron_message_370_371() { @@ -71,14 +46,7 @@ void victron_message_35f() // Need to swap bytes for this to make sense. data.Firmwareversion = ((uint16_t)COMPILE_WEEK_NUMBER_BYTE << 8) | COMPILE_YEAR_BYTE; - if (mysettings.currentMonitoringEnabled && mysettings.currentMonitoringDevice == CurrentMonitorDevice::DIYBMS_CURRENT_MON) - { - data.OnlinecapacityinAh = currentMonitor.modbus.batterycapacityamphour; - } - else - { - data.OnlinecapacityinAh = 0; - } + data.OnlinecapacityinAh = mysettings.nominalbatcap; send_canbus_message(0x35f, (uint8_t *)&data, sizeof(data35f)); } @@ -155,28 +123,8 @@ That strategy does not work with a Victron system. */ void victron_message_351() { - uint8_t number_of_active_errors = 0; - if (_controller_state == ControllerState::Running) - { - number_of_active_errors += (rules.rule_outcome[Rule::BankOverVoltage] ? 1 : 0); - //(bit 4+5) Battery high voltage alarm - number_of_active_errors += (rules.rule_outcome[Rule::BankUnderVoltage] ? 1 : 0); - //(bit 6+7) Battery high temperature alarm - if (rules.moduleHasExternalTempSensor) - { - number_of_active_errors += (rules.rule_outcome[Rule::ModuleOverTemperatureExternal] ? 1 : 0); - } - - if (rules.moduleHasExternalTempSensor) - { - number_of_active_errors += (rules.rule_outcome[Rule::ModuleUnderTemperatureExternal] ? 1 : 0); - } - - number_of_active_errors += ((rules.rule_outcome[Rule::BMSError] | rules.rule_outcome[Rule::EmergencyStop]) ? 1 : 0); - } - struct data351 { // CVL @@ -186,35 +134,38 @@ void victron_message_351() // DCL int16_t maxdischargecurrent; // Not currently used by Victron - // uint16_t dischargevoltage; + uint16_t dischargevoltage; }; data351 data; - if ((_controller_state != ControllerState::Running) || (number_of_active_errors > 0)) - { - ESP_LOGW(TAG, "active_errors=%u", number_of_active_errors); - // Error condition - data.chargevoltagelimit = mysettings.cvl[VictronDVCC::ControllerError]; - data.maxchargecurrent = mysettings.ccl[VictronDVCC::ControllerError]; - data.maxdischargecurrent = mysettings.dcl[VictronDVCC::ControllerError]; - // data.dischargevoltage = 0; - } - else if (rules.numberOfBalancingModules > 0) + + // Defaults (do nothing) + data.chargevoltagelimit = 0; + data.maxchargecurrent = 0; + + if (rules.IsChargeAllowed(&mysettings) == false) { - // Balancing - data.chargevoltagelimit = mysettings.cvl[VictronDVCC::Balance]; - data.maxchargecurrent = mysettings.ccl[VictronDVCC::Balance]; - data.maxdischargecurrent = mysettings.dcl[VictronDVCC::Balance]; - // data.dischargevoltage = 0; + if (rules.numberOfBalancingModules > 0 && mysettings.stopchargebalance == true) + { + // Balancing, stop charge, allow discharge + data.chargevoltagelimit = 0; + data.maxchargecurrent = 0; + } + else + { + // Default - normal behaviour + data.chargevoltagelimit = rules.DynamicChargeVoltage(); + data.maxchargecurrent = rules.DynamicChargeCurrent(); + } } - else + + data.maxdischargecurrent = 0; + data.dischargevoltage = mysettings.dischargevolt; + + if (rules.IsDischargeAllowed(&mysettings)) { - // Default - normal behaviour - data.chargevoltagelimit = mysettings.cvl[VictronDVCC::Default]; - data.maxchargecurrent = mysettings.ccl[VictronDVCC::Default]; - data.maxdischargecurrent = mysettings.dcl[VictronDVCC::Default]; - // data.dischargevoltage = 0; + data.maxdischargecurrent = mysettings.dischargecurrent; } send_canbus_message(0x351, (uint8_t *)&data, sizeof(data351)); @@ -234,7 +185,7 @@ void victron_message_355() { data355 data; // 0 SOC value un16 1 % - data.stateofchargevalue = currentMonitor.stateofcharge; + data.stateofchargevalue = rules.StateOfChargeWithRulesApplied(&mysettings, currentMonitor.stateofcharge); // 2 SOH value un16 1 % // data.stateofhealthvalue = 100; @@ -254,8 +205,8 @@ void victron_message_356() data356 data; - // Use highest pack voltage calculated by controller and modules - data.voltage = rules.highestPackVoltage / 10; + // Use highest bank voltage calculated by controller and modules + data.voltage = rules.highestBankVoltage / 10; // If current shunt is installed, use the voltage from that as it should be more accurate if (mysettings.currentMonitoringEnabled && currentMonitor.validReadings) @@ -328,9 +279,9 @@ void victron_message_35a() if (_controller_state == ControllerState::Running) { /* - ESP_LOGI(TAG, "Rule PackOverVoltage=%u, PackUnderVoltage=%u, OverTemp=%u, UnderTemp=%u", - rules.rule_outcome[Rule::PackOverVoltage], - rules.rule_outcome[Rule::PackUnderVoltage], + ESP_LOGI(TAG, "Rule BankOverVoltage=%u, BankUnderVoltage=%u, OverTemp=%u, UnderTemp=%u", + rules.rule_outcome[Rule::BankOverVoltage], + rules.rule_outcome[Rule::BankUnderVoltage], rules.rule_outcome[Rule::IndividualcellovertemperatureExternal], rules.rule_outcome[Rule::IndividualcellundertemperatureExternal]); */ @@ -410,7 +361,8 @@ void victron_message_35a() // ESP_LOGI(TAG, "numberOfBalancingModules=%u", rules.numberOfBalancingModules); // 7 (bit 0+1) Cell imbalance warning - data.byte7 |= (rules.numberOfBalancingModules > 0 ? BIT01_ALARM : BIT01_OK); + //data.byte7 |= (rules.numberOfBalancingModules > 0 ? BIT01_ALARM : BIT01_OK); + // 7 (bit 2+3) System status (online/offline) [1] data.byte7 |= ((_controller_state != ControllerState::Running) ? BIT23_ALARM : BIT23_OK); // 7 (rest) Reserved diff --git a/ESPController/src/webserver.cpp b/ESPController/src/webserver.cpp index ef46fecd..fabf95b1 100644 --- a/ESPController/src/webserver.cpp +++ b/ESPController/src/webserver.cpp @@ -1,11 +1,11 @@ #define USE_ESP_IDF_LOG 1 -static constexpr const char * const TAG = "diybms-web"; +static constexpr const char *const TAG = "diybms-web"; -//Enable USE_WEBSOCKET_DEBUG_LOG to redirect console/debug serial port output -//to a websocket stream, viewable in the browser DEBUG window/console. -//Experimental feature -//#define USE_WEBSOCKET_DEBUG_LOG +// Enable USE_WEBSOCKET_DEBUG_LOG to redirect console/debug serial port output +// to a websocket stream, viewable in the browser DEBUG window/console. +// Experimental feature +// #define USE_WEBSOCKET_DEBUG_LOG #include "webserver.h" #include "webserver_helper_funcs.h" @@ -14,6 +14,7 @@ static constexpr const char * const TAG = "diybms-web"; #include #include +#include "esp_ota_ops.h" httpd_handle_t _myserver; @@ -78,24 +79,23 @@ int printBoolean(char *buffer, size_t bufferLen, const char *fieldName, boolean esp_err_t SendFailure(httpd_req_t *req) { + ESP_LOGD(TAG, "Failure"); return httpd_resp_send_500(req); } esp_err_t SendSuccess(httpd_req_t *req) { + ESP_LOGD(TAG, "Success"); httpd_resp_set_type(req, "application/json"); setNoStoreCacheControl(req); - - StaticJsonDocument<100> doc; - doc["success"] = true; - int bufferused = 0; - bufferused += serializeJson(doc, httpbuf, BUFSIZE); + int bufferused = snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, "{\"success\":true}"); return httpd_resp_send(req, httpbuf, bufferused); } void saveConfiguration() { - Settings::WriteConfig("diybms", (char *)(&mysettings), sizeof(diybms_eeprom_settings)); + ValidateConfiguration(&mysettings); + SaveConfiguration(&mysettings); } // The main home page @@ -176,7 +176,10 @@ esp_err_t default_htm_handler(httpd_req_t *req) } // Indicate last chunk (zero byte length) - return httpd_resp_send_chunk(req, p, 0); + esp_err_t e = httpd_resp_send_chunk(req, p, 0); + + ESP_LOGI(TAG, "default.htm complete"); + return e; } void SetCacheAndETag(httpd_req_t *req, const char *ETag) @@ -196,10 +199,10 @@ esp_err_t static_content_handler(httpd_req_t *req) enum enum_mimetype : uint8_t { - text_css , - application_javascript , - image_x_icon , - image_png + text_css, + application_javascript, + image_x_icon, + image_png }; typedef struct @@ -231,7 +234,7 @@ esp_err_t static_content_handler(httpd_req_t *req) const char *uri_array[] = { "/style.css", "/pagecode.js", "/jquery.js", "/notify.min.js", "/echarts.min.js", - "/lang_fr.js","/lang_ru.js", "/lang_hr.js", "/lang_nl.js", "/lang_pt.js", "/lang_de.js", "/lang_es.js", "/lang_en.js", + "/lang_fr.js", "/lang_ru.js", "/lang_hr.js", "/lang_nl.js", "/lang_pt.js", "/lang_de.js", "/lang_es.js", "/lang_en.js", "/favicon.ico", "/logo.png", "/wait.png", "/patron.png", "/warning.png"}; WEBKIT_RESPONSE_ARGS arguments[] = { @@ -296,7 +299,6 @@ esp_err_t static_content_handler(httpd_req_t *req) return httpd_resp_send_404(req); } - /* Our URI handler function to be called during GET /uri request */ esp_err_t get_root_handler(httpd_req_t *req) { @@ -317,6 +319,210 @@ static esp_err_t ws_handler(httpd_req_t *req) static const httpd_uri_t uri_ws_get = {.uri = "/ws", .method = HTTP_GET, .handler = ws_handler, .user_ctx = NULL, .is_websocket = true}; #endif +static esp_err_t uploadfile_post_handler(httpd_req_t *req) +{ + if (!validateXSS(req)) + { + // validateXSS has already sent httpd_resp_send_err... + return false; + } + + ESP_LOGI(TAG, "Upload file"); + + httpd_resp_set_status(req, HTTPD_500); // Assume failure + + int ret, remaining = req->content_len; + + if (req->content_len > (10 * 1024)) + { + ESP_LOGE("UPLOAD", "File too large : %d bytes", req->content_len); + /* Respond with 400 Bad Request */ + httpd_resp_send_err(req, HTTPD_400_BAD_REQUEST, "File too large"); + /* Return failure to close underlying connection else the + * incoming file content will keep the socket busy */ + return ESP_FAIL; + } + + struct tm timeinfo; + + // getLocalTime has delay() functions in it :-( + if (getLocalTime(&timeinfo, 1)) + { + timeinfo.tm_year += 1900; + // Month is 0 to 11 based! + timeinfo.tm_mon++; + } + else + { + memset(&timeinfo, 0, sizeof(tm)); + } + + // LittleFS only supports short filenames + char filename[32]; + snprintf(filename, sizeof(filename), "/upld_%04u%02u%02u_%02u%02u%02u.json", timeinfo.tm_year, timeinfo.tm_mon, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec); + + // Get the file + ESP_LOGI(TAG, "Generating LittleFS file %s", filename); + + // SD card not installed, so write to LITTLEFS instead (internal flash) + File file = LittleFS.open(filename, "w"); + + int received; + while (remaining > 0) + { + ESP_LOGI(TAG, "Remaining size : %d", remaining); + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + + /* Receive the file part by part into a buffer */ + if ((received = httpd_req_recv(req, httpbuf, MIN(remaining, BUFSIZE))) <= 0) + { + if (received == HTTPD_SOCK_ERR_TIMEOUT) + { + /* Retry if timeout occurred */ + continue; + } + + /* In case of unrecoverable error, + * close and delete the unfinished file*/ + file.close(); + LittleFS.remove(filename); + + ESP_LOGE(TAG, "File reception failed!"); + /* Respond with 500 Internal Server Error */ + httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to receive file"); + return ESP_FAIL; + } + + /* Write buffer content to file on storage */ + if (received && (received != file.write((uint8_t *)httpbuf, received))) + { + /* Couldn't write everything to file! Storage may be full? */ + file.close(); + LittleFS.remove(filename); + + ESP_LOGE(TAG, "File write failed!"); + /* Respond with 500 Internal Server Error */ + httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to write file to storage"); + return ESP_FAIL; + } + + /* Keep track of remaining size of + * the file left to be uploaded */ + remaining -= received; + + // Allow other tasks to do stuff (avoid watchdog timeouts) + vTaskDelay(10); + } + + file.close(); + ESP_LOGI(TAG, "File upload complete"); + + httpd_resp_set_status(req, HTTPD_200); + httpd_resp_send(req, NULL, 0); + return ESP_OK; +} +//----------------------------------------------------------------------------- +// Over the air firmware upgrade - note this is not securely implemented +// anyone on the local LAN can send new ESP32 firmware to the controller +// +static esp_err_t ota_post_handler(httpd_req_t *req) +{ + if (!validateXSS(req)) + { + // validateXSS has already sent httpd_resp_send_err... + return false; + } + + httpd_resp_set_status(req, HTTPD_500); // Assume failure + + int ret, remaining = req->content_len; + ESP_LOGI(TAG, "OTA Receiving"); + + esp_ota_handle_t update_handle = 0; + const esp_partition_t *update_partition = esp_ota_get_next_update_partition(NULL); + const esp_partition_t *running = esp_ota_get_running_partition(); + esp_err_t err = ESP_OK; + + if (update_partition == NULL) + { + ESP_LOGE(TAG, "OTA Failed, no partition"); + goto return_failure; + } + + ESP_LOGD(TAG, "OTA Writing: type %d, subtype %d, offset 0x%08x", update_partition->type, update_partition->subtype, update_partition->address); + ESP_LOGD(TAG, "OTA Running: type %d, subtype %d, offset 0x%08x", running->type, running->subtype, running->address); + err = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle); + if (err != ESP_OK) + { + ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); + goto return_failure; + } + + suspendTasksDuringFirmwareUpdate(); + + while (remaining > 0) + { +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + // Read the data for the request + if ((ret = httpd_req_recv(req, httpbuf, MIN(remaining, BUFSIZE))) <= 0) + { + if (ret == HTTPD_SOCK_ERR_TIMEOUT) + { + // Retry receiving if timeout occurred + continue; + } + + goto return_failure; + } + + size_t bytes_read = ret; + + remaining -= bytes_read; + err = esp_ota_write(update_handle, httpbuf, bytes_read); + if (err != ESP_OK) + { + goto return_failure; + } + ESP_LOGD(TAG, "OTA Write: remaining %d", remaining); + + // Allow other tasks to do stuff (avoid watchdog timeouts) + vTaskDelay(10); + } + + ESP_LOGI(TAG, "OTA Receiving complete"); + + // End response + if ((esp_ota_end(update_handle) == ESP_OK) && + (esp_ota_set_boot_partition(update_partition) == ESP_OK)) + { + ESP_LOGI(TAG, "OTA Success?! - Rebooting"); + + httpd_resp_set_status(req, HTTPD_200); + httpd_resp_send(req, NULL, 0); + + vTaskDelay(2000 / portTICK_RATE_MS); + esp_restart(); + + return ESP_OK; + } + + ESP_LOGE(TAG, "OTA End failed-%s", esp_err_to_name(err)); + +return_failure: + + if (update_handle) + { + esp_ota_abort(update_handle); + } + + resumeTasksAfterFirmwareUpdateFailure(); + + httpd_resp_set_status(req, HTTPD_500); // Assume failure + httpd_resp_send(req, NULL, 0); + return ESP_FAIL; +} + /* URI handler structure for GET /uri */ static const httpd_uri_t uri_root_get = {.uri = "/", .method = HTTP_GET, .handler = get_root_handler, .user_ctx = NULL}; static const httpd_uri_t uri_defaulthtm_get = {.uri = "/default.htm", .method = HTTP_GET, .handler = default_htm_handler, .user_ctx = NULL}; @@ -325,27 +531,35 @@ static const httpd_uri_t uri_download_get = {.uri = "/download", .method = HTTP_ static const httpd_uri_t uri_save_data_post = {.uri = "/post/*", .method = HTTP_POST, .handler = save_data_handler, .user_ctx = NULL}; static const httpd_uri_t uri_static_content_get = {.uri = "*", .method = HTTP_GET, .handler = static_content_handler, .user_ctx = NULL}; +static const httpd_uri_t uri_ota_post = {.uri = "/ota", .method = HTTP_POST, .handler = ota_post_handler, .user_ctx = NULL}; +static const httpd_uri_t uri_uploadfile_post = {.uri = "/uploadfile", .method = HTTP_POST, .handler = uploadfile_post_handler, .user_ctx = NULL}; + +void resetModuleMinMaxVoltage(uint8_t module) +{ + cmi[module].voltagemVMin = 6000; + cmi[module].voltagemVMax = 0; +} + void clearModuleValues(uint8_t module) { cmi[module].valid = false; cmi[module].voltagemV = 0; - cmi[module].voltagemVMin = 6000; - cmi[module].voltagemVMax = 0; cmi[module].badPacketCount = 0; cmi[module].inBypass = false; cmi[module].bypassOverTemp = false; cmi[module].internalTemp = -40; cmi[module].externalTemp = -40; + resetModuleMinMaxVoltage(module); } #ifdef USE_WEBSOCKET_DEBUG_LOG -extern "C" int log_output_redirector(const char * format, va_list args) +extern "C" int log_output_redirector(const char *format, va_list args) { size_t fd_count = CONFIG_LWIP_MAX_LISTENING_TCP; int client_fds[CONFIG_LWIP_MAX_LISTENING_TCP] = {0}; httpd_ws_frame_t ws_pkt = {}; char log_buffer[64]; - char * temp = &log_buffer[0]; + char *temp = &log_buffer[0]; va_list copy; va_copy(copy, args); @@ -367,8 +581,8 @@ extern "C" int log_output_redirector(const char * format, va_list args) format_len = vsnprintf(temp, format_len + 1, format, args); } va_end(args); - //Don't use printf - uses lots of stack space and causes task stack crash/growth. - //printf(temp); + // Don't use printf - uses lots of stack space and causes task stack crash/growth. + // printf(temp); fputs(temp, stdout); ws_pkt.len = format_len; ws_pkt.type = HTTPD_WS_TYPE_TEXT; @@ -376,7 +590,7 @@ extern "C" int log_output_redirector(const char * format, va_list args) // blast the message out to any connected websocket clients httpd_get_client_list(_myserver, &fd_count, client_fds); - for (int idx = 0; idx < fd_count ; idx++) + for (int idx = 0; idx < fd_count; idx++) { if (httpd_ws_get_fd_info(_myserver, client_fds[idx]) == HTTPD_WS_CLIENT_WEBSOCKET) { @@ -391,18 +605,18 @@ extern "C" int log_output_redirector(const char * format, va_list args) } #endif - /* Function for starting the webserver */ httpd_handle_t start_webserver(void) { /* Generate default configuration */ httpd_config_t config = HTTPD_DEFAULT_CONFIG(); - config.max_uri_handlers = 8; - config.max_open_sockets = 5; + config.max_uri_handlers = 10; + config.max_open_sockets = 7; config.max_resp_headers = 16; config.stack_size = 5000; config.uri_match_fn = httpd_uri_match_wildcard; + config.lru_purge_enable = true; /* Empty handle to esp_http_server */ httpd_handle_t server = NULL; @@ -421,6 +635,10 @@ httpd_handle_t start_webserver(void) // Post services ESP_ERROR_CHECK(httpd_register_uri_handler(server, &uri_save_data_post)); + // OTA services + ESP_ERROR_CHECK(httpd_register_uri_handler(server, &uri_ota_post)); + ESP_ERROR_CHECK(httpd_register_uri_handler(server, &uri_uploadfile_post)); + #ifdef USE_WEBSOCKET_DEBUG_LOG // Websocket ESP_ERROR_CHECK(httpd_register_uri_handler(server, &uri_ws_get)); diff --git a/ESPController/src/webserver_helper_funcs.cpp b/ESPController/src/webserver_helper_funcs.cpp index 3a812361..fd810ef3 100644 --- a/ESPController/src/webserver_helper_funcs.cpp +++ b/ESPController/src/webserver_helper_funcs.cpp @@ -1,5 +1,5 @@ #define USE_ESP_IDF_LOG 1 -static constexpr const char * const TAG = "diybms-webfuncs"; +static constexpr const char *const TAG = "diybms-webfuncs"; #include "webserver_helper_funcs.h" @@ -114,7 +114,7 @@ bool GetKeyValue(const char *buffer, const char *key, uint8_t *value, bool urlEn bool reply = GetKeyValue(buffer, key, &uint32Variable, urlEncoded); if (reply) { - // Truncate down to uint16 + // Truncate down to uint8 if (uint32Variable > 0xFF) { ESP_LOGW(TAG, "Overflow %i", uint32Variable); @@ -148,7 +148,7 @@ bool GetKeyValue(const char *buffer, const char *key, int8_t *value, bool urlEnc { // Truncate down to int8 // Check for overflow? - if (int32Variable > 255) + if (int32Variable > 0xFF) { ESP_LOGW(TAG, "Overflow %i", int32Variable); } @@ -252,12 +252,9 @@ char from_hex(char ch) } /* Returns a url-decoded version of str */ -/* IMPORTANT: be sure to free() the returned string after use */ void url_decode(char *str, char *buf) { - // ESP_LOGD(TAG, "Encoded: %s", str); - //*buf = malloc(strlen(str) + 1), char *pstr = str, *pbuf = buf; while (*pstr) { @@ -281,7 +278,7 @@ void url_decode(char *str, char *buf) } *pbuf = '\0'; - //ESP_LOGD(TAG, "Decoded: %s", buf); + ESP_LOGD(TAG, "Decoded: %s", buf); } bool validateXSS(httpd_req_t *req) @@ -302,11 +299,16 @@ bool validateXSS(httpd_req_t *req) } // Cookie found and returned correctly (not truncated etc) - ESP_LOGW(TAG, "Incorrect cookie received %s", requestcookie); + ESP_LOGW(TAG, "Incorrect cookie rec %s", requestcookie); + + httpd_resp_send_err(req, httpd_err_code_t::HTTPD_400_BAD_REQUEST, "Invalid cookie 1"); + return false; } + ESP_LOGE(TAG, "httpd_req_get_cookie_val (%s)", esp_err_to_name(result)); + // Fail - wrong cookie or not supplied etc. - httpd_resp_send_err(req, httpd_err_code_t::HTTPD_400_BAD_REQUEST, "Invalid cookie"); + httpd_resp_send_err(req, httpd_err_code_t::HTTPD_400_BAD_REQUEST, "Invalid cookie 2"); return false; } @@ -344,7 +346,6 @@ bool validateXSSWithPOST(httpd_req_t *req, const char *postbuffer, bool urlencod char param[2 * sizeof(CookieValue)]; if (httpd_query_key_value(postbuffer, "xss", param, sizeof(param)) == ESP_OK) { - if (urlencoded) { // Decode the incoming char array @@ -363,13 +364,20 @@ bool validateXSSWithPOST(httpd_req_t *req, const char *postbuffer, bool urlencod // Cookie found and returned correctly (not truncated etc) ESP_LOGW(TAG, "Incorrect POST cookie %s", param); + + // Failed POST XSS check + httpd_resp_send_err(req, httpd_err_code_t::HTTPD_400_BAD_REQUEST, "Invalid cookie 3"); + return false; } else { ESP_LOGW(TAG, "xss query key returned not OK"); + // Failed POST XSS check + httpd_resp_send_err(req, httpd_err_code_t::HTTPD_400_BAD_REQUEST, "Invalid cookie 4"); + return false; } // Failed POST XSS check - httpd_resp_send_err(req, httpd_err_code_t::HTTPD_400_BAD_REQUEST, "Invalid cookie"); + httpd_resp_send_err(req, httpd_err_code_t::HTTPD_400_BAD_REQUEST, "Invalid cookie 5"); return false; } diff --git a/ESPController/src/webserver_json_post.cpp b/ESPController/src/webserver_json_post.cpp index e8d94b9e..aab260c1 100644 --- a/ESPController/src/webserver_json_post.cpp +++ b/ESPController/src/webserver_json_post.cpp @@ -187,168 +187,68 @@ esp_err_t post_saveinfluxdbsetting_json_handler(httpd_req_t *req, bool urlEncode return SendSuccess(req); } -esp_err_t post_saveconfigurationtosdcard_json_handler(httpd_req_t *req, bool urlEncoded) +// Saves all the BMS controller settings to a JSON file in FLASH +esp_err_t post_saveconfigurationtoflash_json_handler(httpd_req_t *req, bool urlEncoded) { - if (!_sd_card_installed) - { - return SendFailure(req); - } + DynamicJsonDocument doc(5000); + GenerateSettingsJSONDocument(&doc, &mysettings); - if (_avrsettings.programmingModeEnabled) + struct tm timeinfo; + + // getLocalTime has delay() functions in it :-( + if (getLocalTime(&timeinfo, 1)) { - return SendFailure(req); + timeinfo.tm_year += 1900; + // Month is 0 to 11 based! + timeinfo.tm_mon++; } - - if (hal.GetVSPIMutex()) + else { + memset(&timeinfo, 0, sizeof(tm)); + } - struct tm timeinfo; - - // getLocalTime has delay() functions in it :-( - if (getLocalTime(&timeinfo, 1)) - { - timeinfo.tm_year += 1900; - // Month is 0 to 11 based! - timeinfo.tm_mon++; - } - else + /* + if (!_sd_card_installed) { - memset(&timeinfo, 0, sizeof(tm)); - } - - char filename[128]; - snprintf(filename, sizeof(filename), "/backup_config_%04u%02u%02u_%02u%02u%02u.json", timeinfo.tm_year, timeinfo.tm_mon, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec); - - // ESP_LOGI(TAG, "Creating folder"); - //_sdcard->mkdir("/diybms"); + */ + // LittleFS only supports short filenames + char filename[32]; + snprintf(filename, sizeof(filename), "/cfg_%04u%02u%02u_%02u%02u%02u.json", timeinfo.tm_year, timeinfo.tm_mon, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec); - // Get the file - ESP_LOGI(TAG, "Generating SD file %s", filename); + // Get the file + ESP_LOGI(TAG, "Generating LittleFS file %s", filename); - if (SD.exists(filename)) - { - ESP_LOGI(TAG, "Delete existing file %s", filename); - SD.remove(filename); + // SD card not installed, so write to LITTLEFS instead (internal flash) + File file = LittleFS.open(filename, "w"); + serializeJson(doc, file); + file.close(); + /* } - - DynamicJsonDocument doc(4096); - - // This code builds up a JSON document which mirrors the structure "diybms_eeprom_settings" - JsonObject root = doc.createNestedObject("diybms_settings"); - - root["totalNumberOfBanks"] = mysettings.totalNumberOfBanks; - root["totalNumberOfSeriesModules"] = mysettings.totalNumberOfSeriesModules; - root["baudRate"] = mysettings.baudRate; - root["interpacketgap"] = mysettings.interpacketgap; - - root["graph_voltagehigh"] = mysettings.graph_voltagehigh; - root["graph_voltagelow"] = mysettings.graph_voltagelow; - - root["BypassOverTempShutdown"] = mysettings.BypassOverTempShutdown; - root["BypassThresholdmV"] = mysettings.BypassThresholdmV; - - root["timeZone"] = mysettings.timeZone; - root["minutesTimeZone"] = mysettings.minutesTimeZone; - root["daylight"] = mysettings.daylight; - root["ntpServer"] = mysettings.ntpServer; - - root["loggingEnabled"] = mysettings.loggingEnabled; - root["loggingFrequencySeconds"] = mysettings.loggingFrequencySeconds; - - root["currentMonitoringEnabled"] = mysettings.currentMonitoringEnabled; - root["currentMonitoringModBusAddress"] = mysettings.currentMonitoringModBusAddress; - - root["rs485baudrate"] = mysettings.rs485baudrate; - root["rs485databits"] = mysettings.rs485databits; - root["rs485parity"] = mysettings.rs485parity; - root["rs485stopbits"] = mysettings.rs485stopbits; - - root["language"] = mysettings.language; - - root["VictronEnabled"] = mysettings.VictronEnabled; - - JsonObject mqtt = root.createNestedObject("mqtt"); - mqtt["enabled"] = mysettings.mqtt_enabled; - mqtt["uri"] = mysettings.mqtt_uri; - mqtt["topic"] = mysettings.mqtt_topic; - mqtt["username"] = mysettings.mqtt_username; - mqtt["password"] = mysettings.mqtt_password; - - JsonObject influxdb = root.createNestedObject("influxdb"); - influxdb["enabled"] = mysettings.influxdb_enabled; - influxdb["apitoken"] = mysettings.influxdb_apitoken; - influxdb["bucket"] = mysettings.influxdb_databasebucket; - influxdb["org"] = mysettings.influxdb_orgid; - influxdb["url"] = mysettings.influxdb_serverurl; - influxdb["logfreq"] = mysettings.influxdb_loggingFreqSeconds; - - JsonObject outputs = root.createNestedObject("outputs"); - - JsonArray d = outputs.createNestedArray("default"); - JsonArray t = outputs.createNestedArray("type"); - for (uint8_t i = 0; i < RELAY_TOTAL; i++) + else { - d.add(mysettings.rulerelaydefault[i]); - t.add(mysettings.relaytype[i]); - } + if (hal.GetVSPIMutex()) + { - JsonObject rules = root.createNestedObject("rules"); - for (uint8_t rr = 0; rr < RELAY_RULES; rr++) - { - // This is a default "catch all" - String elementName = String("rule") + String(rr); + char filename[128]; + snprintf(filename, sizeof(filename), "/backup_config_%04u%02u%02u_%02u%02u%02u.json", timeinfo.tm_year, timeinfo.tm_mon, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec); - if (rr >= 0 && rr <= MAXIMUM_RuleNumber) - { - // Map enum to string so when this file is re-imported we are not locked to specific index offsets - // which may no longer map to the correct rule - elementName = String(RuleTextDescription[rr]); - } - else - { - ESP_LOGE(TAG, "Loop outside bounds of MAXIMUM_RuleNumber"); - } + // Get the file + ESP_LOGI(TAG, "Generating SD file %s", filename); - JsonObject state = rules.createNestedObject(elementName); + if (SD.exists(filename)) + { + ESP_LOGI(TAG, "Delete existing file %s", filename); + SD.remove(filename); + } - state["value"] = mysettings.rulevalue[rr]; - state["hysteresis"] = mysettings.rulehysteresis[rr]; + File file = SD.open(filename, "w"); + serializeJson(doc, file); + file.close(); - JsonArray relaystate = state.createNestedArray("state"); - for (uint8_t rt = 0; rt < RELAY_TOTAL; rt++) - { - relaystate.add(mysettings.rulerelaystate[rr][rt]); + hal.ReleaseVSPIMutex(); } - } // end for - - JsonObject victron = root.createNestedObject("victron"); - JsonArray cvl = victron.createNestedArray("cvl"); - JsonArray ccl = victron.createNestedArray("ccl"); - JsonArray dcl = victron.createNestedArray("dcl"); - for (uint8_t i = 0; i < 3; i++) - { - cvl.add(mysettings.cvl[i]); - ccl.add(mysettings.ccl[i]); - dcl.add(mysettings.dcl[i]); } - - /* - struct diybms_eeprom_settings - { - //Use a bit pattern to indicate the relay states - RelayState rulerelaystate[RELAY_RULES][RELAY_TOTAL]; - }; */ - - // wifi["password"] = DIYBMSSoftAP::Config().wifi_passphrase; - - File file = SD.open(filename, "w"); - serializeJson(doc, file); - file.close(); - - hal.ReleaseVSPIMutex(); - } - return SendSuccess(req); } @@ -469,6 +369,27 @@ esp_err_t post_savestorage_json_handler(httpd_req_t *req, bool urlEncoded) return SendSuccess(req); } +esp_err_t post_visibletiles_json_handler(httpd_req_t *req, bool urlEncoded) +{ + char keyBuffer[16]; + + for (int i = 0; i < sizeof(mysettings.tileconfig) / sizeof(uint16_t); i++) + { + mysettings.tileconfig[i] = 0; + snprintf(keyBuffer, sizeof(keyBuffer), "v%i", i); + uint16_t temp; + if (GetKeyValue(httpbuf, keyBuffer, &temp, urlEncoded)) + { + ESP_LOGD(TAG, "%s=%u", keyBuffer, temp); + mysettings.tileconfig[i] = temp; + } + } + + saveConfiguration(); + + return SendSuccess(req); +} + esp_err_t post_savedisplaysetting_json_handler(httpd_req_t *req, bool urlEncoded) { if (GetKeyValue(httpbuf, "VoltageHigh", &mysettings.graph_voltagehigh, urlEncoded)) @@ -595,41 +516,100 @@ esp_err_t post_savers485settings_json_handler(httpd_req_t *req, bool urlEncoded) return SendSuccess(req); } -esp_err_t post_savevictron_json_handler(httpd_req_t *req, bool urlEncoded) +esp_err_t post_savechargeconfig_json_handler(httpd_req_t *req, bool urlEncoded) { - // uint32_t tempVariable; - - mysettings.VictronEnabled = false; - if (GetKeyValue(httpbuf, "VictronEnabled", &mysettings.VictronEnabled, urlEncoded)) + uint8_t temp; + if (GetKeyValue(httpbuf, "canbusprotocol", &temp, urlEncoded)) { + mysettings.canbusprotocol = (CanBusProtocolEmulation)temp; } - - for (int i = 0; i < 3; i++) + else { - // TODO: Check return values are correct here... floats vs ints? - String name = "cvl"; - name = name + i; - - float tempFloat; + // Field not found/invalid, so disable + mysettings.canbusprotocol = CanBusProtocolEmulation::CANBUS_DISABLED; + } + if (GetKeyValue(httpbuf, "nominalbatcap", &mysettings.nominalbatcap, urlEncoded)) + { + } + if (GetKeyValue(httpbuf, "cellminmv", &mysettings.cellminmv, urlEncoded)) + { + } + if (GetKeyValue(httpbuf, "cellmaxmv", &mysettings.cellmaxmv, urlEncoded)) + { + } + if (GetKeyValue(httpbuf, "kneemv", &mysettings.kneemv, urlEncoded)) + { + } + if (GetKeyValue(httpbuf, "cellmaxspikemv", &mysettings.cellmaxspikemv, urlEncoded)) + { + } - if (GetKeyValue(httpbuf, name.c_str(), &tempFloat, urlEncoded)) - { - mysettings.cvl[i] = tempFloat * 10; - } + float temp_float; - name = "ccl"; - name = name + i; - if (GetKeyValue(httpbuf, name.c_str(), &tempFloat, urlEncoded)) - { - mysettings.ccl[i] = tempFloat * 10; - } + if (GetKeyValue(httpbuf, "cur_val1", &temp_float, urlEncoded)) + { + mysettings.current_value1 = 10 * temp_float; + } + if (GetKeyValue(httpbuf, "cur_val2", &temp_float, urlEncoded)) + { + mysettings.current_value2 = 10 * temp_float; + } - name = "dcl"; - name = name + i; - if (GetKeyValue(httpbuf, name.c_str(), &tempFloat, urlEncoded)) - { - mysettings.dcl[i] = tempFloat * 10; - } + if (GetKeyValue(httpbuf, "sensitivity", &temp_float, urlEncoded)) + { + mysettings.sensitivity = 10 * temp_float; + } + if (GetKeyValue(httpbuf, "chargevolt", &temp_float, urlEncoded)) + { + mysettings.chargevolt = 10 * temp_float; + } + if (GetKeyValue(httpbuf, "chargecurrent", &temp_float, urlEncoded)) + { + mysettings.chargecurrent = 10 * temp_float; + } + if (GetKeyValue(httpbuf, "dischargecurrent", &temp_float, urlEncoded)) + { + mysettings.dischargecurrent = 10 * temp_float; + } + if (GetKeyValue(httpbuf, "dischargevolt", &temp_float, urlEncoded)) + { + mysettings.dischargevolt = 10 * temp_float; + } + mysettings.stopchargebalance = false; + if (GetKeyValue(httpbuf, "stopchargebalance", &mysettings.stopchargebalance, urlEncoded)) + { + } + mysettings.socoverride = false; + if (GetKeyValue(httpbuf, "socoverride", &mysettings.socoverride, urlEncoded)) + { + } + mysettings.socforcelow = false; + if (GetKeyValue(httpbuf, "socforcelow", &mysettings.socforcelow, urlEncoded)) + { + } + mysettings.dynamiccharge = false; + if (GetKeyValue(httpbuf, "dynamiccharge", &mysettings.dynamiccharge, urlEncoded)) + { + } + mysettings.preventcharging = false; + if (GetKeyValue(httpbuf, "preventcharging", &mysettings.preventcharging, urlEncoded)) + { + } + mysettings.preventdischarge = false; + if (GetKeyValue(httpbuf, "preventdischarge", &mysettings.preventdischarge, urlEncoded)) + { + } + if (GetKeyValue(httpbuf, "chargetemplow", &mysettings.chargetemplow, urlEncoded)) + { + } + if (GetKeyValue(httpbuf, "chargetemphigh", &mysettings.chargetemphigh, urlEncoded)) + { + } + if (GetKeyValue(httpbuf, "dischargetemplow", &mysettings.dischargetemplow, urlEncoded)) + { + } + if (GetKeyValue(httpbuf, "dischargetemphigh", &mysettings.dischargetemphigh, urlEncoded)) + { } saveConfiguration(); @@ -686,6 +666,28 @@ esp_err_t post_savecmrelay_json_handler(httpd_req_t *req, bool urlEncoded) return SendSuccess(req); } +esp_err_t post_setsoc_json_handler(httpd_req_t *req, bool urlEncoded) +{ + float new_soc = 0; + if (GetKeyValue(httpbuf, "setsoc", &new_soc, urlEncoded)) + { + if (CurrentMonitorSetSOC(new_soc)) + { + return SendSuccess(req); + } + } + return SendFailure(req); +} + +esp_err_t post_resetdailyahcount_json_handler(httpd_req_t *req, bool urlEncoded) +{ + if (CurrentMonitorResetDailyAmpHourCounters()) + { + return SendSuccess(req); + } + return SendFailure(req); +} + esp_err_t post_savecmbasic_json_handler(httpd_req_t *req, bool urlEncoded) { int shuntmaxcur = 0; @@ -945,20 +947,20 @@ esp_err_t post_saverules_json_handler(httpd_req_t *req, bool urlEncoded) { snprintf(keyBuffer, sizeof(keyBuffer), "rule%ivalue", rule); - uint32_t tempuint32; - if (GetKeyValue(httpbuf, keyBuffer, &tempuint32, urlEncoded)) + int32_t tempint32; + if (GetKeyValue(httpbuf, keyBuffer, &tempint32, urlEncoded)) { - ESP_LOGD(TAG, "%s=%u", keyBuffer, tempuint32); + ESP_LOGD(TAG, "%s=%u", keyBuffer, tempint32); - mysettings.rulevalue[rule] = tempuint32; + mysettings.rulevalue[rule] = tempint32; } - snprintf(keyBuffer, sizeof(keyBuffer), "rule%ihysteresis", rule); - if (GetKeyValue(httpbuf, keyBuffer, &tempuint32, urlEncoded)) + snprintf(keyBuffer, sizeof(keyBuffer), "rule%ihyst", rule); + if (GetKeyValue(httpbuf, keyBuffer, &tempint32, urlEncoded)) { - ESP_LOGD(TAG, "%s=%u", keyBuffer, tempuint32); + ESP_LOGD(TAG, "%s=%u", keyBuffer, tempint32); - mysettings.rulehysteresis[rule] = tempuint32; + mysettings.rulehysteresis[rule] = tempint32; } // Rule/relay processing @@ -990,18 +992,13 @@ esp_err_t post_restoreconfig_json_handler(httpd_req_t *req, bool urlEncoded) { bool success = false; - if (!_sd_card_installed) - { - return SendFailure(req); - } - if (_avrsettings.programmingModeEnabled) { return SendFailure(req); } char filename[128]; - //Prepend "/" + // Prepend "/" strcpy(filename, "/"); if (!GetTextFromKeyValue(httpbuf, "filename", &filename[1], sizeof(filename) - 1, urlEncoded)) @@ -1010,207 +1007,88 @@ esp_err_t post_restoreconfig_json_handler(httpd_req_t *req, bool urlEncoded) return SendFailure(req); } - if (hal.GetVSPIMutex()) + uint16_t flashram = 0; + if (GetKeyValue(httpbuf, "flashram", &flashram, urlEncoded)) { + } - if (SD.exists(filename)) + if (flashram == 0) + { + if (!_sd_card_installed) { - ESP_LOGI(TAG, "Restore configuration from %s", filename); - - DynamicJsonDocument doc(4096); - - File file = SD.open(filename, "r"); + return SendFailure(req); + } - // Deserialize the JSON document - DeserializationError error = deserializeJson(doc, file); - if (error) - { - ESP_LOGE(TAG, "Deserialization Error"); - } - else + if (hal.GetVSPIMutex()) + { + if (SD.exists(filename)) { - // Restore the config... - JsonObject root = doc["diybms_settings"]; - - diybms_eeprom_settings myset; - - DefaultConfiguration(&myset); - - myset.totalNumberOfBanks = root["totalNumberOfBanks"]; - myset.totalNumberOfSeriesModules = root["totalNumberOfSeriesModules"]; - myset.baudRate = root["baudRate"]; - myset.interpacketgap = root["interpacketgap"]; - - myset.graph_voltagehigh = root["graph_voltagehigh"]; - myset.graph_voltagelow = root["graph_voltagelow"]; - - myset.BypassOverTempShutdown = root["BypassOverTempShutdown"]; - myset.BypassThresholdmV = root["BypassThresholdmV"]; - - myset.timeZone = root["timeZone"]; - myset.minutesTimeZone = root["minutesTimeZone"]; - myset.daylight = root["daylight"]; - strncpy(myset.ntpServer, root["ntpServer"].as().c_str(), sizeof(myset.ntpServer)); - - myset.loggingEnabled = root["loggingEnabled"]; - myset.loggingFrequencySeconds = root["loggingFrequencySeconds"]; + ESP_LOGI(TAG, "Restore SD config from %s", filename); - myset.currentMonitoringEnabled = root["currentMonitoringEnabled"]; - myset.currentMonitoringModBusAddress = root["currentMonitoringModBusAddress"]; + // Needs to be large enough to de-serialize the JSON file + DynamicJsonDocument doc(5000); - myset.rs485baudrate = root["rs485baudrate"]; - myset.rs485databits = root["rs485databits"]; - myset.rs485parity = root["rs485parity"]; - myset.rs485stopbits = root["rs485stopbits"]; + File file = SD.open(filename, "r"); - strncpy(myset.language, root["language"].as().c_str(), sizeof(myset.language)); - - myset.VictronEnabled = root["VictronEnabled"]; - - JsonObject mqtt = root["mqtt"]; - if (!mqtt.isNull()) - { - myset.mqtt_enabled = mqtt["enabled"]; - strncpy(myset.mqtt_uri, mqtt["uri"].as().c_str(), sizeof(myset.mqtt_uri)); - strncpy(myset.mqtt_topic, mqtt["topic"].as().c_str(), sizeof(myset.mqtt_topic)); - strncpy(myset.mqtt_username, mqtt["username"].as().c_str(), sizeof(myset.mqtt_username)); - strncpy(myset.mqtt_password, mqtt["password"].as().c_str(), sizeof(myset.mqtt_password)); - } - - JsonObject influxdb = root["influxdb"]; - if (!influxdb.isNull()) + // Deserialize the JSON document + DeserializationError error = deserializeJson(doc, file); + if (error) { - myset.influxdb_enabled = influxdb["enabled"]; - strncpy(myset.influxdb_apitoken, influxdb["apitoken"].as().c_str(), sizeof(myset.influxdb_apitoken)); - strncpy(myset.influxdb_databasebucket, influxdb["bucket"].as().c_str(), sizeof(myset.influxdb_databasebucket)); - strncpy(myset.influxdb_orgid, influxdb["org"].as().c_str(), sizeof(myset.influxdb_orgid)); - strncpy(myset.influxdb_serverurl, influxdb["url"].as().c_str(), sizeof(myset.influxdb_serverurl)); - myset.influxdb_loggingFreqSeconds = influxdb["logfreq"]; + ESP_LOGE(TAG, "Deserialization Error"); } - - JsonObject outputs = root["outputs"]; - if (!outputs.isNull()) + else { - JsonArray d = outputs["default"].as(); + // Restore the config... + diybms_eeprom_settings myset; - uint8_t i = 0; - for (JsonVariant v : d) - { - myset.rulerelaydefault[i] = (RelayState)v.as(); + JSONToSettings(doc, &myset); + // Repair any bad values + ValidateConfiguration(&myset); - // ESP_LOGI(TAG, "relay default %u=%u", i, myset.rulerelaydefault[i]); + // Copy the new settings over top of old + memcpy(&mysettings, &myset, sizeof(mysettings)); - i++; + saveConfiguration(); - if (i > RELAY_TOTAL) - { - break; - } - } - - JsonArray t = outputs["type"].as(); - i = 0; - for (JsonVariant v : t) - { - myset.relaytype[i] = (RelayType)v.as(); - // ESP_LOGI(TAG, "relay type %u=%u", i, myset.relaytype[i]); - i++; - if (i > RELAY_TOTAL) - { - break; - } - } + success = true; } - JsonObject rules = root["rules"]; - if (!rules.isNull()) - { - for (JsonPair kv : rules) - { - char key[64]; - strncpy(key, kv.key().c_str(), sizeof(key)); - ESP_LOGI(TAG, "rule %s", key); - - for (size_t rulenumber = 0; rulenumber <= MAXIMUM_RuleNumber; rulenumber++) - { - if (strcmp(RuleTextDescription[rulenumber], key) == 0) - { - ESP_LOGI(TAG, "Matched to rule %u", rulenumber); - JsonVariant v = kv.value(); - - myset.rulevalue[rulenumber] = v["value"].as(); - // ESP_LOGI(TAG, "value=%u", myset.rulevalue[rulenumber]); - - myset.rulehysteresis[rulenumber] = v["hysteresis"].as(); - // ESP_LOGI(TAG, "hysteresis=%u", myset.rulehysteresis[rulenumber]); - - JsonArray states = v["state"].as(); - - uint8_t i = 0; - for (JsonVariant v : states) - { - myset.rulerelaystate[rulenumber][i] = (RelayState)v.as(); - // ESP_LOGI(TAG, "rulerelaystate %u", myset.rulerelaystate[rulenumber][i]); - i++; - if (i > RELAY_TOTAL) - { - break; - } - } - - break; - } - } - } - } - - // Victron - JsonObject victron = root["victron"]; - if (!victron.isNull()) - { + file.close(); + } + else + { + ESP_LOGE(TAG, "File does not exist %s", filename); + } - JsonArray cvl = victron["cvl"].as(); + hal.ReleaseVSPIMutex(); + } + } - uint8_t i = 0; - for (JsonVariant v : cvl) - { - myset.cvl[i] = v.as(); - ESP_LOGI(TAG, "cvl %u %u", i, myset.cvl[i]); - i++; - if (i > 3) - { - break; - } - } + if (flashram == 1) + { + if (LittleFS.exists(filename)) + { + ESP_LOGI(TAG, "Restore LittleFS config from %s", filename); - JsonArray ccl = victron["ccl"].as(); + // Needs to be large enough to de-serialize the JSON file + DynamicJsonDocument doc(5500); - i = 0; - for (JsonVariant v : ccl) - { - myset.ccl[i] = v.as(); - ESP_LOGI(TAG, "ccl %u %u", i, myset.ccl[i]); - i++; - if (i > 3) - { - break; - } - } + File file = LittleFS.open(filename, "r"); - JsonArray dcl = victron["dcl"].as(); + // Deserialize the JSON document + DeserializationError error = deserializeJson(doc, file); + if (error) + { + ESP_LOGE(TAG, "Deserialization Error"); + } + else + { + // Restore the config... + diybms_eeprom_settings myset; - i = 0; - for (JsonVariant v : dcl) - { - myset.dcl[i] = v.as(); - ESP_LOGI(TAG, "dcl %u %u", i, myset.dcl[i]); - i++; - if (i > 3) - { - break; - } - } - } + JSONToSettings(doc, &myset); + // Repair any bad values + ValidateConfiguration(&myset); // Copy the new settings over top of old memcpy(&mysettings, &myset, sizeof(mysettings)); @@ -1226,8 +1104,6 @@ esp_err_t post_restoreconfig_json_handler(httpd_req_t *req, bool urlEncoded) { ESP_LOGE(TAG, "File does not exist %s", filename); } - - hal.ReleaseVSPIMutex(); } if (success) @@ -1262,18 +1138,20 @@ esp_err_t save_data_handler(httpd_req_t *req) "restartcontroller", "saverules", "savedisplaysetting", "savestorage", "resetcounters", "sdmount", "sdunmount", "enableavrprog", "disableavrprog", "avrprog", "savers485settings", "savecurrentmon", - "savecmbasic", "savecmadvanced", "savecmrelay", "savevictron", "restoreconfig"}; + "savecmbasic", "savecmadvanced", "savecmrelay", "restoreconfig", "savechargeconfig", + "visibletiles", "dailyahreset", "setsoc"}; esp_err_t (*func_ptr[])(httpd_req_t * req, bool urlEncoded) = { post_savebankconfig_json_handler, post_saventp_json_handler, post_saveglobalsetting_json_handler, post_savemqtt_json_handler, post_saveinfluxdbsetting_json_handler, - post_saveconfigurationtosdcard_json_handler, post_savewificonfigtosdcard_json_handler, + post_saveconfigurationtoflash_json_handler, post_savewificonfigtosdcard_json_handler, post_savesetting_json_handler, post_restartcontroller_json_handler, post_saverules_json_handler, post_savedisplaysetting_json_handler, post_savestorage_json_handler, post_resetcounters_json_handler, post_sdmount_json_handler, post_sdunmount_json_handler, post_enableavrprog_json_handler, post_disableavrprog_json_handler, post_avrprog_json_handler, post_savers485settings_json_handler, post_savecurrentmon_json_handler, post_savecmbasic_json_handler, post_savecmadvanced_json_handler, - post_savecmrelay_json_handler, post_savevictron_json_handler, post_restoreconfig_json_handler}; + post_savecmrelay_json_handler, post_restoreconfig_json_handler, post_savechargeconfig_json_handler, + post_visibletiles_json_handler, post_resetdailyahcount_json_handler, post_setsoc_json_handler}; // Sanity check arrays are the same size ESP_ERROR_CHECK(sizeof(func_ptr) == sizeof(uri_array) ? ESP_OK : ESP_FAIL); diff --git a/ESPController/src/webserver_json_requests.cpp b/ESPController/src/webserver_json_requests.cpp index 1d815973..9bead8dc 100644 --- a/ESPController/src/webserver_json_requests.cpp +++ b/ESPController/src/webserver_json_requests.cpp @@ -69,10 +69,10 @@ esp_err_t content_handler_currentmonitor(httpd_req_t *req) currentMonitor.modbus.fullychargedvoltage, currentMonitor.chargeefficiency); bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, - "\"voltage\":%.4f,\"current\":%.4f,\"mahout\":%u,\"mahin\":%u,\"temperature\":%i,\"watchdog\":%u,\"power\":%.4f,\"actualshuntmv\":%.4f,\"currentlsb\":%.4f,\"resistance\":%.4f,\"calibration\":%u,\"templimit\":%i,\"undervlimit\":%.4f,\"overvlimit\":%.4f,\"overclimit\":%.4f,\"underclimit\":%.4f,\"overplimit\":%.4f,\"tempcoeff\":%u,\"model\":%u,\"firmwarev\":%u,\"firmwaredate\":%u,", + "\"voltage\":%.4f,\"current\":%.4f,\"mahout\":%u,\"mahin\":%u,\"temperature\":%i,\"watchdog\":%u,\"power\":%.4f,\"resistance\":%.4f,\"calibration\":%u,\"templimit\":%i,\"undervlimit\":%.4f,\"overvlimit\":%.4f,\"overclimit\":%.4f,\"underclimit\":%.4f,\"overplimit\":%.4f,\"tempcoeff\":%u,\"model\":%u,\"firmwarev\":%u,\"firmwaredate\":%u,", currentMonitor.modbus.voltage, currentMonitor.modbus.current, currentMonitor.modbus.milliamphour_out, currentMonitor.modbus.milliamphour_in, currentMonitor.modbus.temperature, currentMonitor.modbus.watchdogcounter, currentMonitor.modbus.power, - currentMonitor.modbus.shuntmV, currentMonitor.modbus.currentlsb, currentMonitor.modbus.shuntresistance, + currentMonitor.modbus.shuntresistance, currentMonitor.modbus.shuntcal, currentMonitor.modbus.temperaturelimit, currentMonitor.modbus.undervoltagelimit, currentMonitor.modbus.overvoltagelimit, currentMonitor.modbus.overcurrentlimit, currentMonitor.modbus.undercurrentlimit, @@ -497,17 +497,54 @@ esp_err_t content_handler_avrstatus(httpd_req_t *req) return httpd_resp_send(req, httpbuf, bufferused); } -esp_err_t content_handler_victron(httpd_req_t *req) +esp_err_t content_handler_tileconfig(httpd_req_t *req) +{ + StaticJsonDocument<200> doc; + JsonObject root = doc.to(); + JsonObject settings = root.createNestedObject("tileconfig"); + JsonArray v = settings.createNestedArray("values"); + for (uint8_t i = 0; i < 5; i++) + { + v.add(mysettings.tileconfig[i]); + } + int bufferused = serializeJson(doc, httpbuf, BUFSIZE); + return httpd_resp_send(req, httpbuf, bufferused); +} + +esp_err_t content_handler_chargeconfig(httpd_req_t *req) { int bufferused = 0; DynamicJsonDocument doc(2048); JsonObject root = doc.to(); - - JsonObject settings = root.createNestedObject("victron"); - - settings["enabled"] = mysettings.VictronEnabled; - + JsonObject settings = root.createNestedObject("chargeconfig"); + + settings["canbusprotocol"] = mysettings.canbusprotocol; + settings["nominalbatcap"] = mysettings.nominalbatcap; + settings["chargevolt"] = mysettings.chargevolt; + settings["chargecurrent"] = mysettings.chargecurrent; + settings["dischargecurrent"] = mysettings.dischargecurrent; + settings["dischargevolt"] = mysettings.dischargevolt; + settings["chargetemplow"] = mysettings.chargetemplow; + settings["chargetemphigh"] = mysettings.chargetemphigh; + settings["dischargetemplow"] = mysettings.dischargetemplow; + settings["dischargetemphigh"] = mysettings.dischargetemphigh; + settings["stopchargebalance"] = mysettings.stopchargebalance; + settings["socoverride"] = mysettings.socoverride; + settings["socforcelow"] = mysettings.socforcelow; + settings["dynamiccharge"] = mysettings.dynamiccharge; + settings["preventdischarge"] = mysettings.preventdischarge; + settings["preventcharging"] = mysettings.preventcharging; + settings["cellminmv"] = mysettings.cellminmv; + settings["cellmaxmv"] = mysettings.cellmaxmv; + settings["kneemv"] = mysettings.kneemv; + settings["sensitivity"] = mysettings.sensitivity; + settings["cellmaxspikemv"] = mysettings.cellmaxspikemv; + + settings["cur_val1"] = mysettings.current_value1; + settings["cur_val2"] = mysettings.current_value2; + + /*settings["enabled"] = mysettings.VictronEnabled; JsonArray cvl = settings.createNestedArray("cvl"); JsonArray ccl = settings.createNestedArray("ccl"); JsonArray dcl = settings.createNestedArray("dcl"); @@ -516,13 +553,12 @@ esp_err_t content_handler_victron(httpd_req_t *req) cvl.add(mysettings.cvl[i]); ccl.add(mysettings.ccl[i]); dcl.add(mysettings.dcl[i]); - } + }*/ bufferused += serializeJson(doc, httpbuf, BUFSIZE); return httpd_resp_send(req, httpbuf, bufferused); } - esp_err_t content_handler_rules(httpd_req_t *req) { int bufferused = 0; @@ -598,7 +634,7 @@ esp_err_t content_handler_rules(httpd_req_t *req) data.add(true); break; default: - //Null + // Null data.add((char *)0); break; } @@ -646,9 +682,8 @@ esp_err_t content_handler_settings(httpd_req_t *req) } char strftime_buf[64]; - formatCurrentDateTime(strftime_buf,sizeof(strftime_buf)); - settings["datetime"]= String(strftime_buf); - + formatCurrentDateTime(strftime_buf, sizeof(strftime_buf)); + settings["datetime"] = String(strftime_buf); bufferused += serializeJson(doc, httpbuf, BUFSIZE); @@ -778,7 +813,7 @@ esp_err_t content_handler_monitor2(httpd_req_t *req) const char *nullstring = "null"; // Output the first batch of settings/parameters/values - bufferused += snprintf(&httpbuf[bufferused], BUFSIZE, + bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, "{\"banks\":%u,\"seriesmodules\":%u,\"sent\":%u,\"received\":%u,\"modulesfnd\":%u,\"badcrc\":%u,\"ignored\":%u,\"roundtrip\":%u,\"oos\":%u,\"activerules\":%u,\"uptime\":%u,\"can_fail\":%u,\"can_sent\":%u,\"can_rec\":%u,\"sec\":\"%s\",\"qlen\":%u,", mysettings.totalNumberOfBanks, mysettings.totalNumberOfSeriesModules, @@ -794,17 +829,29 @@ esp_err_t content_handler_monitor2(httpd_req_t *req) canbus_messages_received, &CookieValue[sizeof(CookieValue) - 3], prg.queueLength()); + if (mysettings.canbusprotocol != CanBusProtocolEmulation::CANBUS_DISABLED && mysettings.dynamiccharge) + { + bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, + "\"dyncv\":%u,\"dyncc\":%u,", + rules.DynamicChargeVoltage(), + rules.DynamicChargeCurrent()); + } + // current bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, "\"current\":["); if (mysettings.currentMonitoringEnabled && currentMonitor.validReadings) { - // Output current monitor values, this is inside an array, so could be more than 1 - bufferused += snprintf(&httpbuf[bufferused], BUFSIZE, - "{\"c\":%.4f,\"v\":%.4f,\"mahout\":%u,\"mahin\":%u,\"p\":%.2f,\"soc\":%.2f}", + bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, + "{\"c\":%.4f,\"v\":%.4f,\"mahout\":%u,\"mahin\":%u,\"p\":%.2f,\"soc\":%.2f,\"dmahout\":%u,\"dmahin\":%u", currentMonitor.modbus.current, currentMonitor.modbus.voltage, currentMonitor.modbus.milliamphour_out, - currentMonitor.modbus.milliamphour_in, currentMonitor.modbus.power, currentMonitor.stateofcharge); + currentMonitor.modbus.milliamphour_in, currentMonitor.modbus.power, currentMonitor.stateofcharge, + currentMonitor.modbus.daily_milliamphour_out, currentMonitor.modbus.daily_milliamphour_in); + + bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, ",\"time100\":%u,\"time20\":%u,\"time10\":%u", time100, time20, time10); + + bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, "}"); } else { @@ -1070,7 +1117,7 @@ esp_err_t content_handler_monitor2(httpd_req_t *req) if (i) bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, ","); - bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, "%u", rules.packvoltage[i]); + bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, "%u", rules.bankvoltage[i]); } bufferused += snprintf(&httpbuf[bufferused], BUFSIZE - bufferused, "],"); @@ -1111,9 +1158,9 @@ esp_err_t api_handler(httpd_req_t *req) const char *uri_array[] = { "monitor2", "monitor3", "integration", "settings", "rules", - "victron", "rs485settings", "currentmonitor", + "rs485settings", "currentmonitor", "avrstatus", "modules", "identifyModule", "storage", - "avrstorage"}; + "avrstorage", "chargeconfig", "tileconfig"}; esp_err_t (*func_ptr[])(httpd_req_t * req) = { content_handler_monitor2, @@ -1121,14 +1168,15 @@ esp_err_t api_handler(httpd_req_t *req) content_handler_integration, content_handler_settings, content_handler_rules, - content_handler_victron, content_handler_rs485settings, content_handler_currentmonitor, content_handler_avrstatus, content_handler_modules, content_handler_identifymodule, content_handler_storage, - content_handler_avrstorage}; + content_handler_avrstorage, + content_handler_chargeconfig, + content_handler_tileconfig}; // Sanity check arrays are the same size ESP_ERROR_CHECK(sizeof(func_ptr) == sizeof(uri_array) ? ESP_OK : ESP_FAIL); diff --git a/ESPController/web_src/default.htm b/ESPController/web_src/default.htm index 80ce08cc..da372bb0 100644 --- a/ESPController/web_src/default.htm +++ b/ESPController/web_src/default.htm @@ -1,1370 +1,2047 @@ - - + - + + + - + DIY BMS CONTROLLER v4 - + - -
Please wait
+ +
+ Please wait +
-
-
- - - - -
- - Rules -
- - +
+ +
+
+
+ Home +
+
+ Tiles
+
+ Modules +
+
+ + Rules +
+ +
-
The controller is having difficulty communicating with the cell monitoring - modules.
-
Controller found modules, but is configured for - .
-
Controller is configured to use more modules than it can cope with.
-
Waiting for modules to reply
-
Module has returned ZERO volt reading, check configuration
-
Controller has run out of memory.
-
Emergency Stop
-
Cannot communicate with the controller for status updates.
-
Controller error
- -
Javascript library has failed to load correctly, please refresh page.
-
Failed to save settings.
-
Settings saved
- -
Controller warning
- -
Warning: Module bypass voltage is different to global setting
-
Warning: Module bypass temperature is different to global setting
-
Warning: Modules have mixed versions of code, may cause instability
-
Warning: Modules have mixed versions of hardware/boards
-
Warning: Logging enabled but SD card not installed/found
-
Some features are disabled whilst AVR programming mode enabled
-
Web page is unsynchronised with controller, refresh web page (F5)
+
+ The controller is having difficulty communicating with the cell modules and/or RS485 comms. +
+
+ Controller found + + modules, but is configured for + + . +
+
Controller is configured to use more modules than it can cope with.
+
Waiting for modules to reply
+
Module has returned ZERO volt reading, check configuration
+
Controller has run out of memory.
+
Emergency Stop
+
Cannot communicate with the controller for status updates.
+
+ Controller error + +
+ +
Javascript library has failed to load correctly, please refresh page.
+
Failed to save settings.
+
Settings saved
+ +
+ Controller warning + +
+ +
Warning: Module bypass voltage is different to global setting
+
Warning: Module bypass temperature is different to global setting
+
Warning: Modules have mixed versions of code, may cause instability
+
Warning: Modules have mixed versions of hardware/boards
+
Warning: Logging enabled but SD card not installed/found
+
Some features are disabled whilst AVR programming mode enabled
+
Charging is prevented (charge settings)
+
Discharging is prevented (discharge settings)
+
External cell temperature sensor is missing
+
Web page is unsynchronised with controller, refresh web page (F5)
-
S.o.C:
-
Current:
-
Shunt voltage:
-
Power:
-
Ah out:
-
Ah in:
-
O.O.S errors:
-
CRC Errors:
-
Ignored requests:
- -
CAN send error:
+
+ S.o.C: + +
+
+ Current: + +
+
+ Shunt voltage: + +
+
+ Power: + +
+
+ Ah out: + +
+
+ Ah in: + +
+
+ Daily Ah out: + +
+
+ Daily Ah in: + +
+
+ O.O.S errors: + +
+
+ CRC Errors: + +
+
+ Ignored requests: + +
+
+ CAN send error: + +
+
+ Cell temps: + +
-
-
-
-
+
+
+
+
+ +
+
+ Packets sent: +
- -
-
Packets sent:
-
Packets rec'd:
-
Roundtrip (ms):
-
Uptime:
-
Send Q length:
- -
CAN sent:
-
CAN received:
- -
Graph: - - 2D - 3D - -
- +
+ Packets rec'd: + +
+
+ Roundtrip (ms): + +
+
+ Uptime: + +
+
+ Send Q length: +
-
+
+ CAN sent: + +
+
+ CAN received: + +
+
+ Dyn. Chg. V: + +
+
+ Dyn. Chg. Cur: + +
-
-

About

-
-

Source Code & Hardware

-

Code:https://github.com/stuartpittaway/diyBMSv4ESP32

-

Hardware: https://github.com/stuartpittaway/diyBMSv4

-

Videos

- YouTube videos on installation and configuration -

Patreon

-

Remember, this product is free for personal use, if you would like to make a regular donation to - keep the - features and improvements flowing, use the Patreon link below. Even just a coffee/beer a month makes a - difference. Thank you! - Patron -

+
+ Time to 100%%: +
-
-

WARNING

-

This is a DIY product/solution so don’t use this for safety critical systems or in any situation - where - there could be a risk to life.

-

There is no warranty, it may not work as expected or at all.

-

The use of this project is done so entirely at your own risk. It may involve electrical voltages - which - could kill - if in doubt, seek help.

-

The use of this project may not be compliant with local laws or regulations - if in doubt, seek - help.

+
+ Time to 20%%: +
-
-

License

-

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: - England & - Wales License.

- https://creativecommons.org/licenses/by-nc-sa/2.0/uk/ +
+ Time to 10%%: +
-
-

Platform & Version

-

Host name:

-

Processor: %PLATFORM%

-

Version: %GIT_VERSION%

-

Compiled: %COMPILE_DATE_TIME%

-

Language: %LANGUAGE%

-

SDK Version:

-

Min free Heap:

-

Free heap:

-

Heap size:

+ +
+ Graph: + + 2D + 3D +
+
+
+ +
+

About

+
+

Source Code & Hardware

+

+ Code: + + https://github.com/stuartpittaway/diyBMSv4ESP32 + +

+

+ Hardware: + + https://github.com/stuartpittaway/diyBMSv4 + +

+

Videos

+ + YouTube videos on installation and configuration + +

Patreon

+

+ Remember, this product is free for personal use, if you would like to make a regular donation to keep the + features and improvements flowing, use the Patreon link below. Even just a coffee/beer a month makes a + difference. Thank you! + + Patron + +

+
+
+

WARNING

+

+ This is a DIY product/solution so don’t use this for safety critical systems or in any situation where there + could be a risk to life. +

+

There is no warranty, it may not work as expected or at all.

+

+ The use of this project is done so entirely at your own risk. It may involve electrical voltages which could + kill - if in doubt, seek help. +

+

+ The use of this project may not be compliant with local laws or regulations - if in doubt, seek help. +

+
+
+

License

+

+ This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales + License. +

+ + https://creativecommons.org/licenses/by-nc-sa/2.0/uk/ + +
+
+

Platform & Version

+

+ Host name: + +

+

Processor: %PLATFORM%

+

+ Version: + + %GIT_VERSION% + +

+

Compiled: %COMPILE_DATE_TIME%

+

+ Language: + %LANGUAGE% +

+

+ SDK Version: + +

+

+ Min free Heap: + +

+

+ Free heap: + +

+

+ Heap size: + +

+
-

Modules

-
- - - - - - - - - - - - - - - - - - - - -
BankModuleVoltageV. MinV. MaxTemp Int °CTemp Ext °CBypass PWM %Bad packet countPackets receivedBalance energy used (mAh)
-
-

Settings for module

-
-
- - - -
- - -
-
- - -
-
- - -
-
- - -
-
- - - - - -
-
- - -
-
- - -
-
- - -
-
- - -
- - -
-
+

Modules

+
+ + + + + + + + + + + + + + + + + + +
BankModuleVoltageV. MinV. MaxTemp Int °CTemp Ext °CBypass PWM %Bad packet countPackets receivedBalance energy used (mAh)
+
+

Settings for module

+
+
+ + + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
-
-

Global Settings

-

Configure all modules to use following parameters:

-
-
-
- - -
-
- - -
-
- -
-
+
+
+

Global Settings

+

Configure all modules to use following parameters:

+
+
+
+ + +
+
+ + +
+
+ +
+
-
-

Integration

-

For security, you will need to re-enter the password for the service(s) you want to enable or - modify, before you save.

+

Integration

+

+ For security, you will need to re-enter the password for the service(s) you want to enable or modify, before you + save. +

+
+

MQTT

URI should be similar to mqtt://192.168.0.26:1833

-
-

MQTT

-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
-
-
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ +
+

Influx DB

+

API Version 2.X

+

+ Influx DB version 2 protocol is supported. Server URL should be the full URL to the + + write API + + , for example http://192.168.0.49:8086/api/v2/write +

+

Only HTTP is supported, for local servers use the IP address not a domain name.

+

API Version 1.X

+

+ Influx DB v1.8 has forward + + compatibility APIs + + which mimic the v2 protocol. +

+

+ For this to work, use the v1 username and password as the token, in the format of + username:password +

+

The organisation is not used, just set to the word "organisation".

+

The URL is the same as the v2 example above.

+ +
+
+
+ + +
-
-

Influx DB

-

API Version 2.X

-

Influx DB version 2 protocol is supported. Server URL should be the full URL to the write API, for - example http://192.168.0.49:8086/api/v2/write

-

Only HTTP is supported, for local servers use the IP address not a domain name.

-

API Version 1.X

-

Influx DB v1.8 has forward compatibility - APIs which mimic the v2 protocol.

-

For this to work, use the v1 username and password as the token, in the format of - username:password

-

The organisation is not used, just set to the word "organisation".

-

The URL is the same as the v2 example above.

- - -
-
- - -
- -
- - -
- -
- - -
-
- - -
-
- - -
-
- - -
- -
- -
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
-

Rules

-
-

DIYBMS supports relay modules to safely disconnect chargers, contactors or consumers. The rules - allow you - to configure the relays for your situation.

-

Rules are processed from lowest priorty to highest (bottom up). Control the relays using the - options. A - value of "X" means - don't care/leave at value defined by lower priority rules.

-

Rules are triggered when the relevant value meets or exceeds the 'trigger' value. The rule will - only disable when the value then passes the 'reset' value. This can help prevent relay clatter and rules - firing on/off rapidly.

-

'Timer 1' and 'Timer 2' rules allow timed operation, this rule is active when the number of - minutes past - midnight has been reached, for instance setting 'Timer 1' trigger to 495 and reset to 555 would switch - on at 8:15am and off at 9:15am. This only works if connected to internet for regular time updates.

-

Minutes since midnight now is:

-

Emergency stop is triggered by connector J1, once triggered controller needs to be reset to - disable.

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RuleTrigger valueReset valueRelay state
   - - - -
   - - - -
-
- -
-
+

Rules

+
+

+ DIYBMS supports relay modules to safely disconnect chargers, contactors or consumers. The rules allow you to + configure the relays for your situation. +

+

+ Rules are processed from lowest priorty to highest (bottom up). Control the relays using the options. A value + of "X" means don't care/leave at value defined by lower priority rules. +

+

+ Rules are triggered when the relevant value meets or exceeds the 'trigger' value. The rule will only disable + when the value then passes the 'reset' value. This can help prevent relay clatter and rules firing on/off + rapidly. +

+

+ 'Timer 1' and 'Timer 2' rules allow timed operation, this rule is active when the number of minutes past + midnight has been reached, for instance setting 'Timer 1' trigger to 495 and reset to 555 would switch on at + 8:15am and off at 9:15am. This only works if connected to internet for regular time updates. +

+

+ Minutes since midnight now is: + +

+

+ Emergency stop is triggered by connector J1, once triggered controller needs to be reset to disable. +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RuleTrigger valueReset valueRelay state
+ + + +
+ + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + +
+ + + +
+ + + +
   + + + + +
   + + + + +
+
+ +
+
-
-

Victron CANBUS integration

+
+

Charge/Discharge configuration

+ +
+

+ This feature allows diyBMS to provide battery and BMS data to CANBUS devices using various 3rd party + protocols. +

+

+ These settings require an external inverter/charger to be able to integrate using CANBUS to control + charge/discharge parameters. +

+

+ Temperature control utilises the external temperature sensors on the diyBMS modules. This is very useful for + LIFEPO4 cells which cannot be charged when below 0°C. +

+

Current shunt/monitor is required for reliable integration with external inverter/chargers.

+ +
+
+
+ + +
-
-

This feature allows diyBMS to provide battery and BMS data to Victron "GX" devices using the - Victron CAN BMS protocol.

-

Remember to install terminator resistors on the CAN L/H connections. On the controller, jumper - JP1 can be soldered closed for this purpose.

-

diyBMS will send alarms to the Victron device based off the rules for low/high - voltages and temperatures.

-

This allows Victron devices to operate in Distributed Voltage and Current Control "DVCC" mode (optional).

+
+ + +
+

Charging

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

Dynamic Charging Algorithm

-

These parameters can be controlled:

-
    -
  • Charge voltage limit (CVL): the maximum charge voltage that the battery currently accepts
  • -
  • Charge current limit (CCL): the maximum charge current requested by the battery
  • -
  • Discharge current limit (DCL): the maximum discharge current as requested by the battery
  • -
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
-

- WarningIncorrect use of these - settings could destroy your battery and cause harm! -

-

- WarningVictron integration is currently at an - EXPERIMENTAL stage, please report issues -

+ + +
+
+ + +
+

Discharging

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

Options

+
+ + +
+
+ + +
+
+ +
-
-
- -
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
When?Charge voltage limit (CVL)Charge current limit (CCL)Discharge current limit (DCL)
Default
Balancing
Error
-
- - -
- - -
- - -
- +
+ + +
+
+ +
+ +
+ +
+ +
+

+ Warning + Incorrect use of these settings could destroy your battery and cause harm! +

+

+ Warning + CANBUS BMS integration is currently at an EXPERIMENTAL stage, please report issues. +

+

+ Remember to install terminator resistors at both ends of CAN connection. On the controller, jumper JP1 can be + soldered closed for this purpose. +

+
+ +
+

Maximum Charge Current

+
+ +
- +
-

Current & Voltage Monitoring

- -
-

Connection

-

Configure the MODBUS connection to the current monitor using the settings below.

-

PZEM-017 device uses 9600,8,None,2 serial settings

-
-
-
- - -
-
- - -
-
- - -
- -
-
-
+

Current & Voltage Monitoring

+ +
+

Connection

+

Configure the MODBUS connection to the current monitor using the settings below.

+

PZEM-017 device uses 9600,8,None,2 serial settings

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

RS485

+

Configuration options for RS485 interface. Communication is half-duplex.

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

Basic Settings

+

Ensure the current shunt parameters match the data sheet for your particular shunt resistor.

+

+ The DIYBMS current monitor uses a 40.96mV maximum scale, so shunt voltages over this will be scaled down + proportionally. +

+

+ Battery capacity and charge voltage/tail current are used to calculate the battery 'state of charge' (SOC). +

+

+ PZEM-017 uses 75mV shunts, state of charge and alarms are not supported on this device. Only 50, 100, 200, + 300A shunts are supported. +

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
-

RS485

-

Configuration options for RS485 interface. Communication is half-duplex.

- -
-
- - -
-
- - -
-
- - -
-
- - -
- -
- -
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
-

Basic Settings

-

Ensure the current shunt parameters match the data sheet for your particular shunt resistor.

-

The DIYBMS current monitor uses a 40.96mV maximum scale, so shunt voltages over this will be - scaled down - proportionally.

-

Battery capacity and charge voltage/tail current are used to calculate the battery 'state of - charge' (SOC).

-

PZEM-017 uses 75mV shunts, state of charge and alarms are not supported on this device. Only 50, - 100, 200, 300A shunts are supported.

-
-
-
- - -
- -
- - -
- -
- - -
-
- - -
-
- - -
-
- - -
- -
- - -
-
- - -
-
- - -
- -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
- - -
- -
- - -
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - -
-
-
+
+ + +
-
-

Advanced Current Monitor Settings

-

If you wish to use the relay control on the shunt monitor, set the parameters here. You should - not - normally need to change the calibration value.

-

Current limit is for use whilst discharging the battery, under current limit is used when - charging, so - different discharge/charge current limits can be used.

-

Temperature limit is based on the chip die temperature, which may not match the shunt - temperature. Only - positive temperature coefficient is supported.

-

Relay triggers define which rules are used to trigger the relay into a closed state.

-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- - - -
-
-
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
-
-

Current Monitor Relay Settings & Temperature coefficient

-

Relay triggers define which rules are used to trigger the relay into a closed state.

-
-
-
- - -
- -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- - -
-
-
+
+ + +
- -
+
+ + +
+ + +
+ +
+ +
+

Advanced Current Monitor Settings

+

+ If you wish to use the relay control on the shunt monitor, set the parameters here. + You should not normally need to change the calibration value. +

+

+ Current limit is for use whilst discharging the battery, under current limit is used when charging, so + different discharge/charge current limits can be used. +

+

+ Temperature limit is based on the chip die temperature, which may not match the shunt temperature. Only + positive temperature coefficient is supported. +

+

Relay triggers define which rules are used to trigger the relay into a closed state.

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
-
-

Controller Settings

-
-

Modules & Banks

-

DIYBMS supports up to X modules in total. These modules can be - split into banks to support parallel configurations.

-

Example: You have 16 cells configured as 8 in series and 2 in parallel (8S2P).

-

Only hardware module version 4.4 or newer support faster communication speeds. You will need to - reboot the controller manually if you change the speed, and also ensure all modules are using the - correct firmware.

-
-
-
- - -
-
- - -
-
- - -
- -
- - -
- -
-
-
+
+

Current Monitor Relay Settings & Temperature coefficient

+

Relay triggers define which rules are used to trigger the relay into a closed state.

+
+
+
+ + +
-
-

Network Time Protocol

-

Time is set via NTP, if your controller is not connected to the Internet. Time based rules will - be - incorrect. This does not automatically correct for daylight saving.

-

Controller time is

- -
-
- - -
-
- - -
-
- - -
-
- - -
- -
- -
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
-

Display Settings

-
-
- -
- - -
- -
- - -
- -
- - -
- -
-
-
+ +
+ +
-
-

Reset Counters

-
-
- - -
-
-
-
-

Restart Controller

-
-
- - -
-
+ +
+
+

Utilities

+ +
+

Reset Counters

+
+
+ + +
+
+ +

Reset Daily Amp Hour Count

+
+
+ + +
+
+ +

Restart Controller

+
+
+ + +
+
+ + +

Set DIYBMS Current Monitor State Of Charge

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

Controller Firmware Upgrade

+

+ Use this feature to upload a new firmware to a running controller. Recommend saving configuration before + updating. Controller will reboot after update. This function will not update module firmware or files. +

+

+ Warning + Note: Do not attempt this when the battery is charging/discharging. The BMS will not operate whilst update is + running, external interfaces like RS485 and CAN will be disabled during update. +

+
+ + +
+
+
+
- +
-
-

AVR Programmer

-
-

Controller can program modules and devices using the files below. Do not - connect a - device to be programmed before enabling programming mode.

-

Instructions: -

    -
  1. "Enable programming mode", this will stop SD card logging and TFT touch screen response. -
  2. -
  3. Select the relevant file to program
  4. -
  5. Read the warnings
  6. -
  7. Attach/connect device to be programmed to the ISP connector on the controller
  8. -
  9. Select "Program Device"
  10. -
  11. When complete, remove the device
  12. -
  13. Program other devices as needed
  14. -
  15. Disable programming mode
  16. -
-

-
    - -
-
- - -
-
- - Warning -
    -
  • Ensure you disconnect all battery and communication cables from the module/device before - programming.
  • -
  • Connect the module to the ISP port on the controller using a ribbon cable or adapter, ensure - the - notch is - aligned with pin 1 on the module.
  • -
  • Click 'Program Device' to start programming
  • -
  • Remove cable as soon as programming is complete
  • -
- - -

+
+

Controller Settings

+
+

Modules & Banks

+

+ DIYBMS supports up to + X + modules in total. These modules can be split into banks to support parallel configurations. +

+

Example: You have 16 cells configured as 8 in series and 2 in parallel (8S2P).

+

+ Only hardware module version 4.4 or newer support faster communication speeds. You will need to reboot the + controller if you change the speed, and also ensure all modules are using the correct firmware. +

+
+
+
+ +
-
+
+ + +
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+

Network Time Protocol

+

+ Time is set via NTP, if your controller is not connected to the Internet. Time based rules will be incorrect. + This does not automatically correct for daylight saving. +

+

+ Controller time is + +

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

Display Settings

+
+
+
+ + +
+ +
+ + +
+
+ + +
+ +
+
+
+ +
-
-

Storage

-
-

SD Card

-

SD card not installed/currently available

- Used KiB (%) of KiB -

- - - - -

-
    +
    +

    AVR Programmer

    +
    +

    + Controller can program modules and devices using the files below. + Do not connect + a device to be programmed before enabling programming mode. +

    +

    Instructions:

    +
      +
    1. "Enable programming mode", this will stop SD card logging and TFT touch screen response.
    2. +
    3. Select the relevant file to program
    4. +
    5. Read the warnings
    6. +
    7. Attach/connect device to be programmed to the ISP connector on the controller
    8. +
    9. Select "Program Device"
    10. +
    11. When complete, remove the device
    12. +
    13. Program other devices as needed
    14. +
    15. Disable programming mode
    16. +
    + +
      +
      + +
      -
      -

      Flash Memory

      -

      Used KiB (%) of KiB

      -
        +
        + + Warning +
          +
        • + Ensure you disconnect all battery and communication cables from the module/device before programming. +
        • +
        • + Connect the module to the ISP port on the controller using a ribbon cable or adapter, ensure the notch is + aligned with pin 1 on the module. +
        • +
        • Click 'Program Device' to start programming
        • +
        • Remove cable as soon as programming is complete
        • +
        + + +

        +
        +
        -
        -

        Logging

        -

        Cell data and output states can be stored as log files using an SD card.

        -
        -
        -
        - - -
        -
        - - -
        - -
        -
        +
        +

        Storage & Logging

        +
        +

        SD Card

        +

        SD card not installed/currently available

        + Used + + KiB ( + + %) of + + KiB +

        + + + +

        +
          +
          +
          +

          Flash Memory

          +

          + Used + + KiB ( + + %) of + + KiB +

          +
            + + +
            + + +
            +
            + +
            +

            Logging

            +

            Cell data and output states can be stored as log files using an SD card.

            +
            +
            +
            + + +
            +
            + + +
            + +
            +
            +
            - - + diff --git a/ESPController/web_src/echarts.min.js b/ESPController/web_src/echarts.min.js index dc0b2c6f..39835d44 100644 --- a/ESPController/web_src/echarts.min.js +++ b/ESPController/web_src/echarts.min.js @@ -1,18 +1,17 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){function n(){this.constructor=t}nm(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function n(){for(var t=0,e=0,n=arguments.length;n>e;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;n>e;e++)for(var o=arguments[e],a=0,s=o.length;s>a;a++,r++)i[r]=o[a];return i}function i(t,e){var n=e.browser,i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(n.firefox=!0,n.version=i[1]),r&&(n.ie=!0,n.version=r[1]),o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18),a&&(n.weChat=!0),e.canvasSupported=!!document.createElement("canvas").getContext,e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}function r(t,e){vm[t]=e}function o(){return mm++}function a(){for(var t=[],e=0;ei;i++)e[i]=s(t[i])}}else if(lm[n]){if(!X(t)){var o=t.constructor;if(o.from)e=o.from(t);else{e=new o(t.length);for(var i=0,r=t.length;r>i;i++)e[i]=s(t[i])}}}else if(!sm[n]&&!X(t)&&!P(t)){e={};for(var a in t)t.hasOwnProperty(a)&&(e[a]=s(t[a]))}return e}function l(t,e,n){if(!D(e)||!D(t))return n?s(e):t;for(var i in e)if(e.hasOwnProperty(i)){var r=t[i],o=e[i];!D(o)||!D(r)||M(o)||M(r)||P(o)||P(r)||k(o)||k(r)||X(o)||X(r)?!n&&i in t||(t[i]=s(e[i])):l(r,o,n)}return t}function u(t,e){for(var n=t[0],i=1,r=t.length;r>i;i++)n=l(n,t[i],e);return n}function h(t,e){if(Object.assign)Object.assign(t,e);else for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function c(t,e,n){for(var i=b(e),r=0;rn;n++)if(t[n]===e)return n}return-1}function f(t,e){function n(){}var i=t.prototype;n.prototype=e.prototype,t.prototype=new n;for(var r in i)i.hasOwnProperty(r)&&(t.prototype[r]=i[r]);t.prototype.constructor=t,t.superClass=e}function d(t,e,n){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var i=Object.getOwnPropertyNames(e),r=0;ri;i++)e.call(n,t[i],i,t);else for(var o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}function v(t,e,n){if(!t)return[];if(!e)return V(t);if(t.map&&t.map===dm)return t.map(e,n);for(var i=[],r=0,o=t.length;o>r;r++)i.push(e.call(n,t[r],r,t));return i}function m(t,e,n,i){if(t&&e){for(var r=0,o=t.length;o>r;r++)n=e.call(i,n,t[r],r,t);return n}}function _(t,e,n){if(!t)return[];if(!e)return V(t);if(t.filter&&t.filter===pm)return t.filter(e,n);for(var i=[],r=0,o=t.length;o>r;r++)e.call(n,t[r],r,t)&&i.push(t[r]);return i}function x(t,e,n){if(t&&e)for(var i=0,r=t.length;r>i;i++)if(e.call(n,t[i],i,t))return t[i]}function b(t){if(!t)return[];if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}function w(t,e){for(var n=[],i=2;in;n++)if(null!=t[n])return t[n]}function z(t,e){return null!=t?t:e}function F(t,e,n){return null!=t?t:null!=e?e:n}function V(t){for(var e=[],n=1;np;p++){var d=1<a;a++)for(var s=0;8>s;s++)null==o[s]&&(o[s]=0),o[s]+=((a+s)%2?-1:1)*me(n,7,0===a?1:0,1<o;o++){var a=document.createElement("div"),s=a.style,l=o%2,u=(o>>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[l]+":0",r[u]+":0",i[1-l]+":auto",r[1-u]+":auto",""].join("!important;"),t.appendChild(a),n.push(a)}return n}function Se(t,e,n){for(var i=n?"invTrans":"trans",r=e[i],o=e.srcCoords,a=[],s=[],l=!0,u=0;4>u;u++){var h=t[u].getBoundingClientRect(),c=2*u,p=h.left,f=h.top;a.push(p,f),l=l&&o&&p===o[c]&&f===o[c+1],s.push(t[u].offsetLeft,t[u].offsetTop)}return l&&r?r:(e.srcCoords=a,e[i]=n?_e(s,a):_e(a,s))}function Me(t){return"CANVAS"===t.nodeName.toUpperCase()}function Te(t,e,n,i){return n=n||{},i||!am.canvasSupported?Ce(t,e,n):am.browser.firefox&&null!=e.layerX&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):null!=e.offsetX?(n.zrX=e.offsetX,n.zrY=e.offsetY):Ce(t,e,n),n}function Ce(t,e,n){if(am.domSupported&&t.getBoundingClientRect){var i=e.clientX,r=e.clientY;if(Me(t)){var o=t.getBoundingClientRect();return n.zrX=i-o.left,void(n.zrY=r-o.top)}if(be(Bm,t,i,r))return n.zrX=Bm[0],void(n.zrY=Bm[1])}n.zrX=n.zrY=0}function Ie(t){return t||window.event}function Ae(t,e,n){if(e=Ie(e),null!=e.zrX)return e;var i=e.type,r=i&&i.indexOf("touch")>=0;if(r){var o="touchend"!==i?e.targetTouches[0]:e.changedTouches[0];o&&Te(t,o,e,n)}else{Te(t,e,e,n);var a=De(e);e.zrDelta=a?a/120:-(e.detail||0)/3}var s=e.button;return null==e.which&&void 0!==s&&Nm.test(e.type)&&(e.which=1&s?1:2&s?3:4&s?2:0),e}function De(t){var e=t.wheelDelta;if(e)return e;var n=t.deltaX,i=t.deltaY;if(null==n||null==i)return e;var r=Math.abs(0!==i?i:n),o=i>0?-1:0>i?1:n>0?-1:1;return 3*r*o}function ke(t,e,n,i){Em?t.addEventListener(e,n,i):t.attachEvent("on"+e,n)}function Le(t,e,n,i){Em?t.removeEventListener(e,n,i):t.detachEvent("on"+e,n)}function Pe(t){var e=t[1][0]-t[0][0],n=t[1][1]-t[0][1];return Math.sqrt(e*e+n*n)}function Oe(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}function Re(t,e,n){return{type:t,event:n,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:Ee}}function Ee(){zm(this.event)}function Ne(t,e,n){if(t[t.rectHover?"rectContain":"contain"](e,n)){for(var i=t,r=void 0,o=!1;i;){if(i.ignoreClip&&(o=!0),!o){var a=i.getClipPath();if(a&&!a.contain(e,n))return!1;i.silent&&(r=!0)}var s=i.__hostTarget;i=s?s:i.parent}return r?Hm:!0}return!1}function Be(t,e,n){var i=t.painter;return 0>e||e>i.getWidth()||0>n||n>i.getHeight()}function ze(){return[1,0,0,1,0,0]}function Fe(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Ve(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function He(t,e,n){var i=e[0]*n[0]+e[2]*n[1],r=e[1]*n[0]+e[3]*n[1],o=e[0]*n[2]+e[2]*n[3],a=e[1]*n[2]+e[3]*n[3],s=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t}function Ge(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t}function We(t,e,n){var i=e[0],r=e[2],o=e[4],a=e[1],s=e[3],l=e[5],u=Math.sin(n),h=Math.cos(n);return t[0]=i*h+a*u,t[1]=-i*u+a*h,t[2]=r*h+s*u,t[3]=-r*u+h*s,t[4]=h*o+u*l,t[5]=h*l-u*o,t}function Ue(t,e,n){var i=n[0],r=n[1];return t[0]=e[0]*i,t[1]=e[1]*r,t[2]=e[2]*i,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*r,t}function Xe(t,e){var n=e[0],i=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=n*a-o*i;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-i*l,t[3]=n*l,t[4]=(i*s-a*r)*l,t[5]=(o*r-n*s)*l,t):null}function Ye(t){var e=ze();return Ve(e,t),e}function je(t){return t>Km||-Km>t}function qe(t){return t=Math.round(t),0>t?0:t>255?255:t}function Ze(t){return t=Math.round(t),0>t?0:t>360?360:t}function Ke(t){return 0>t?0:t>1?1:t}function $e(t){var e=t;return qe(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100*255:parseInt(e,10))}function Je(t){var e=t;return Ke(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100:parseFloat(e))}function Qe(t,e,n){return 0>n?n+=1:n>1&&(n-=1),1>6*n?t+(e-t)*n*6:1>2*n?e:2>3*n?t+(e-t)*(2/3-n)*6:t}function tn(t,e,n){return t+(e-t)*n}function en(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function nn(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function rn(t,e){u_&&nn(u_,e),u_=l_.put(t,u_||e.slice())}function on(t,e){if(t){e=e||[];var n=l_.get(t);if(n)return nn(e,n);t+="";var i=t.replace(/ /g,"").toLowerCase();if(i in s_)return nn(e,s_[i]),rn(t,e),e;var r=i.length;if("#"!==i.charAt(0)){var o=i.indexOf("("),a=i.indexOf(")");if(-1!==o&&a+1===r){var s=i.substr(0,o),l=i.substr(o+1,a-(o+1)).split(","),u=1;switch(s){case"rgba":if(4!==l.length)return 3===l.length?en(e,+l[0],+l[1],+l[2],1):en(e,0,0,0,1);u=Je(l.pop());case"rgb":return 3!==l.length?void en(e,0,0,0,1):(en(e,$e(l[0]),$e(l[1]),$e(l[2]),u),rn(t,e),e);case"hsla":return 4!==l.length?void en(e,0,0,0,1):(l[3]=Je(l[3]),an(l,e),rn(t,e),e);case"hsl":return 3!==l.length?void en(e,0,0,0,1):(an(l,e),rn(t,e),e);default:return}}en(e,0,0,0,1)}else{if(4===r||5===r){var h=parseInt(i.slice(1,4),16);return h>=0&&4095>=h?(en(e,(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,5===r?parseInt(i.slice(4),16)/15:1),rn(t,e),e):void en(e,0,0,0,1)}if(7===r||9===r){var h=parseInt(i.slice(1,7),16);return h>=0&&16777215>=h?(en(e,(16711680&h)>>16,(65280&h)>>8,255&h,9===r?parseInt(i.slice(7),16)/255:1),rn(t,e),e):void en(e,0,0,0,1)}}}}function an(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=Je(t[1]),r=Je(t[2]),o=.5>=r?r*(i+1):r+i-r*i,a=2*r-o;return e=e||[],en(e,qe(255*Qe(a,o,n+1/3)),qe(255*Qe(a,o,n)),qe(255*Qe(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function sn(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=.5>u?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,p=((s-o)/6+l/2)/l;i===s?e=p-c:r===s?e=1/3+h-p:o===s&&(e=2/3+c-h),0>e&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}function ln(t,e){var n=on(t);if(n){for(var i=0;3>i;i++)n[i]=0>e?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return dn(n,4===n.length?"rgba":"rgb")}}function un(t){var e=on(t);return e?((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1):void 0}function hn(t,e,n){if(e&&e.length&&t>=0&&1>=t){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],l=i-r;return n[0]=qe(tn(a[0],s[0],l)),n[1]=qe(tn(a[1],s[1],l)),n[2]=qe(tn(a[2],s[2],l)),n[3]=Ke(tn(a[3],s[3],l)),n}}function cn(t,e,n){if(e&&e.length&&t>=0&&1>=t){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=on(e[r]),s=on(e[o]),l=i-r,u=dn([qe(tn(a[0],s[0],l)),qe(tn(a[1],s[1],l)),qe(tn(a[2],s[2],l)),Ke(tn(a[3],s[3],l))],"rgba");return n?{color:u,leftIndex:r,rightIndex:o,value:i}:u}}function pn(t,e,n,i){var r=on(t);return t?(r=sn(r),null!=e&&(r[0]=Ze(e)),null!=n&&(r[1]=Je(n)),null!=i&&(r[2]=Je(i)),dn(an(r),"rgba")):void 0}function fn(t,e){var n=on(t);return n&&null!=e?(n[3]=Ke(e),dn(n,"rgba")):void 0}function dn(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return("rgba"===e||"hsva"===e||"hsla"===e)&&(n+=","+t[3]),e+"("+n+")"}}function gn(t,e){var n=on(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function yn(){var t=Math.round(255*Math.random()),e=Math.round(255*Math.random()),n=Math.round(255*Math.random());return"rgb("+t+","+e+","+n+")"}function vn(t,e,n){return(e-t)*n+t}function mn(t,e,n){return n>.5?e:t}function _n(t,e,n,i){for(var r=e.length,o=0;r>o;o++)t[o]=vn(e[o],n[o],i)}function xn(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;r>a;a++){t[a]||(t[a]=[]);for(var s=0;o>s;s++)t[a][s]=vn(e[a][s],n[a][s],i)}}function bn(t,e,n,i){for(var r=e.length,o=0;r>o;o++)t[o]=e[o]+n[o]*i;return t}function wn(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;r>a;a++){t[a]||(t[a]=[]);for(var s=0;o>s;s++)t[a][s]=e[a][s]+n[a][s]*i}return t}function Sn(t,e,n){var i=t,r=e;if(i.push&&r.push){var o=i.length,a=r.length;if(o!==a){var s=o>a;if(s)i.length=a;else for(var l=o;a>l;l++)i.push(1===n?r[l]:f_.call(r[l]))}for(var u=i[0]&&i[0].length,l=0;lh;h++)isNaN(i[l][h])&&(i[l][h]=r[l][h])}}function Mn(t,e){var n=t.length;if(n!==e.length)return!1;for(var i=0;n>i;i++)if(t[i]!==e[i])return!1;return!0}function Tn(t,e,n,i,r,o,a){var s=.5*(n-t),l=.5*(i-e);return(2*(e-n)+s+l)*a+(-3*(e-n)-2*s-l)*o+s*r+e}function Cn(t,e,n,i,r,o,a,s){for(var l=e.length,u=0;l>u;u++)t[u]=Tn(e[u],n[u],i[u],r[u],o,a,s)}function In(t,e,n,i,r,o,a,s){for(var l=e.length,u=e[0].length,h=0;l>h;h++){t[h]||(t[1]=[]);for(var c=0;u>c;c++)t[h][c]=Tn(e[h][c],n[h][c],i[h][c],r[h][c],o,a,s)}}function An(t){if(g(t)){var e=t.length;if(g(t[0])){for(var n=[],i=0;e>i;i++)n.push(f_.call(t[i]));return n}return f_.call(t)}return t}function Dn(t){return t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.floor(t[2]),"rgba("+t.join(",")+")"}function kn(t){return g(t&&t[0])?2:1}function Ln(t,e){return Ym||(Ym=_m().getContext("2d")),jm!==e&&(jm=Ym.font=e||A_),Ym.measureText(t)}function Pn(t,e){e=e||A_;var n=I_[e];n||(n=I_[e]=new a_(500));var i=n.get(t);return null==i&&(i=D_.measureText(t,e).width,n.put(t,i)),i}function On(t,e,n,i){var r=Pn(t,e),o=Bn(e),a=En(0,r,n),s=Nn(0,o,i),l=new C_(a,s,r,o);return l}function Rn(t,e,n,i){var r=((t||"")+"").split("\n"),o=r.length;if(1===o)return On(r[0],e,n,i);for(var a=new C_(0,0,0,0),s=0;s=0?parseFloat(t)/100*e:parseFloat(t):t}function Fn(t,e,n){var i=e.position||"inside",r=null!=e.distance?e.distance:5,o=n.height,a=n.width,s=o/2,l=n.x,u=n.y,h="left",c="top";if(i instanceof Array)l+=zn(i[0],n.width),u+=zn(i[1],n.height),h=null,c=null;else switch(i){case"left":l-=r,u+=s,h="right",c="middle";break;case"right":l+=r+a,u+=s,c="middle";break;case"top":l+=a/2,u-=r,h="center",c="bottom";break;case"bottom":l+=a/2,u+=o+r,h="center";break;case"inside":l+=a/2,u+=s,h="center",c="middle";break;case"insideLeft":l+=r,u+=s,c="middle";break;case"insideRight":l+=a-r,u+=s,h="right",c="middle";break;case"insideTop":l+=a/2,u+=r,h="center";break;case"insideBottom":l+=a/2,u+=o-r,h="center",c="bottom";break;case"insideTopLeft":l+=r,u+=r;break;case"insideTopRight":l+=a-r,u+=r,h="right";break;case"insideBottomLeft":l+=r,u+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,u+=o-r,h="right",c="bottom"}return t=t||{},t.x=l,t.y=u,t.align=h,t.verticalAlign=c,t}function Vn(t,e,n,i,r){n=n||{};var o=[];Un(t,"",t,e,n,i,o,r);var a=o.length,s=!1,l=n.done,u=n.aborted,h=function(){s=!0,a--,0>=a&&(s?l&&l():u&&u())},c=function(){a--,0>=a&&(s?l&&l():u&&u())};a||l&&l(),o.length>0&&n.during&&o[0].during(function(t,e){n.during(e)});for(var p=0;pi;i++)t[i]=e[i]}function Gn(t){return g(t[0])}function Wn(t,e,n){if(g(e[n]))if(g(t[n])||(t[n]=[]),L(e[n])){var i=e[n].length;t[n].length!==i&&(t[n]=new e[n].constructor(i),Hn(t[n],e[n],i))}else{var r=e[n],o=t[n],a=r.length;if(Gn(r))for(var s=r[0].length,l=0;a>l;l++)o[l]?Hn(o[l],r[l],s):o[l]=Array.prototype.slice.call(r[l]);else Hn(o,r,a);o.length=r.length}else t[n]=e[n]}function Un(t,e,n,i,r,o,a,s){for(var l=[],u=[],h=b(i),c=r.duration,f=r.delay,d=r.additive,y=r.setToFinal,v=!D(o),m=0;m0||r.force&&!a.length){for(var w=t.animators,S=[],M=0;MM;M++){var _=l[M];A[_]=n[_],y?I[_]=i[_]:n[_]=i[_]}}else if(y){k={};for(var M=0;x>M;M++){var _=l[M];k[_]=An(n[_]),Wn(n,i,_)}}var L=new y_(n,!1,d?S:null);L.targetName=e,r.scope&&(L.scope=r.scope),y&&I&&L.whenWithKeys(0,I,l),k&&L.whenWithKeys(0,k,l),L.whenWithKeys(null==c?500:c,s?A:i,l).delay(f||0),t.addAnimator(L,e),a.push(L)}}function Xn(t){for(var e=0;t>=W_;)e|=1&t,t>>=1;return t+e}function Yn(t,e,n,i){var r=e+1;if(r===n)return 1;if(i(t[r++],t[e])<0){for(;n>r&&i(t[r],t[r-1])<0;)r++;jn(t,e,r)}else for(;n>r&&i(t[r],t[r-1])>=0;)r++;return r-e}function jn(t,e,n){for(n--;n>e;){var i=t[e];t[e++]=t[n],t[n--]=i}}function qn(t,e,n,i,r){for(i===e&&i++;n>i;i++){for(var o,a=t[i],s=e,l=i;l>s;)o=s+l>>>1,r(a,t[o])<0?l=o:s=o+1;var u=i-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function Zn(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])>0){for(s=i-r;s>l&&o(t,e[n+r+l])>0;)a=l,l=(l<<1)+1,0>=l&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;s>l&&o(t,e[n+r-l])<=0;)a=l,l=(l<<1)+1,0>=l&&(l=s);l>s&&(l=s);var u=a;a=r-l,l=r-u}for(a++;l>a;){var h=a+(l-a>>>1);o(t,e[n+h])>0?a=h+1:l=h}return l}function Kn(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])<0){for(s=r+1;s>l&&o(t,e[n+r-l])<0;)a=l,l=(l<<1)+1,0>=l&&(l=s);l>s&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=i-r;s>l&&o(t,e[n+r+l])>=0;)a=l,l=(l<<1)+1,0>=l&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;l>a;){var h=a+(l-a>>>1);o(t,e[n+h])<0?l=h:a=h+1}return l}function $n(t,e){function n(t,e){l[c]=t,u[c]=e,c+=1}function i(){for(;c>1;){var t=c-2;if(t>=1&&u[t-1]<=u[t]+u[t+1]||t>=2&&u[t-2]<=u[t]+u[t-1])u[t-1]u[t+1])break;o(t)}}function r(){for(;c>1;){var t=c-2;t>0&&u[t-1]=r?a(i,r,o,h):s(i,r,o,h)))}function a(n,i,r,o){var a=0;for(a=0;i>a;a++)p[a]=t[n+a];var s=0,l=r,u=n;if(t[u++]=t[l++],0!==--o){if(1===i){for(a=0;o>a;a++)t[u+a]=t[l+a];return void(t[u+o]=p[s])}for(var c,f,d,g=h;;){c=0,f=0,d=!1;do if(e(t[l],p[s])<0){if(t[u++]=t[l++],f++,c=0,0===--o){d=!0;break}}else if(t[u++]=p[s++],c++,f=0,1===--i){d=!0;break}while(g>(c|f));if(d)break;do{if(c=Kn(t[l],p,s,i,0,e),0!==c){for(a=0;c>a;a++)t[u+a]=p[s+a];if(u+=c,s+=c,i-=c,1>=i){d=!0;break}}if(t[u++]=t[l++],0===--o){d=!0;break}if(f=Zn(p[s],t,l,o,0,e),0!==f){for(a=0;f>a;a++)t[u+a]=t[l+a];if(u+=f,l+=f,o-=f,0===o){d=!0;break}}if(t[u++]=p[s++],1===--i){d=!0;break}g--}while(c>=U_||f>=U_);if(d)break;0>g&&(g=0),g+=2}if(h=g,1>h&&(h=1),1===i){for(a=0;o>a;a++)t[u+a]=t[l+a];t[u+o]=p[s]}else{if(0===i)throw new Error;for(a=0;i>a;a++)t[u+a]=p[s+a]}}else for(a=0;i>a;a++)t[u+a]=p[s+a]}function s(n,i,r,o){var a=0;for(a=0;o>a;a++)p[a]=t[r+a];var s=n+i-1,l=o-1,u=r+o-1,c=0,f=0;if(t[u--]=t[s--],0!==--i){if(1===o){for(u-=i,s-=i,f=u+1,c=s+1,a=i-1;a>=0;a--)t[f+a]=t[c+a];return void(t[u]=p[l])}for(var d=h;;){var g=0,y=0,v=!1;do if(e(p[l],t[s])<0){if(t[u--]=t[s--],g++,y=0,0===--i){v=!0;break}}else if(t[u--]=p[l--],y++,g=0,1===--o){v=!0;break}while(d>(g|y));if(v)break;do{if(g=i-Kn(p[l],t,n,i,i-1,e),0!==g){for(u-=g,s-=g,i-=g,f=u+1,c=s+1,a=g-1;a>=0;a--)t[f+a]=t[c+a];if(0===i){v=!0;break}}if(t[u--]=p[l--],1===--o){v=!0;break}if(y=o-Zn(t[s],p,0,o,o-1,e),0!==y){for(u-=y,l-=y,o-=y,f=u+1,c=l+1,a=0;y>a;a++)t[f+a]=p[c+a];if(1>=o){v=!0;break}}if(t[u--]=t[s--],0===--i){v=!0;break}d--}while(g>=U_||y>=U_);if(v)break;0>d&&(d=0),d+=2}if(h=d,1>h&&(h=1),1===o){for(u-=i,s-=i,f=u+1,c=s+1,a=i-1;a>=0;a--)t[f+a]=t[c+a];t[u]=p[l]}else{if(0===o)throw new Error;for(c=u-(o-1),a=0;o>a;a++)t[c+a]=p[a]}}else for(c=u-(o-1),a=0;o>a;a++)t[c+a]=p[a]}var l,u,h=U_,c=0,p=[];return l=[],u=[],{mergeRuns:i,forceMergeRuns:r,pushRun:n}}function Jn(t,e,n,i){n||(n=0),i||(i=t.length);var r=i-n;if(!(2>r)){var o=0;if(W_>r)return o=Yn(t,n,i,e),void qn(t,n,i,n+o,e);var a=$n(t,e),s=Xn(r);do{if(o=Yn(t,n,i,e),s>o){var l=r;l>s&&(l=s),qn(t,n,n+l,n+o,e),o=l}a.pushRun(n,o),a.mergeRuns(),r-=o,n+=o}while(0!==r);a.forceMergeRuns()}}function Qn(){X_||(X_=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function ti(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}function ei(t){var e=t.pointerType;return"pen"===e||"touch"===e}function ni(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout(function(){t.touching=!1,t.touchTimer=null},700)}function ii(t){t&&(t.zrByTouch=!0)}function ri(t,e){return Ae(t.dom,new tx(t,e),!0)}function oi(t,e){for(var n=e,i=!1;n&&9!==n.nodeType&&!(i=n.domBelongToZr||n!==e&&n===t.painterRoot);)n=n.parentNode;return i}function ai(t,e){var n=e.domHandlers;am.pointerEventsSupported?y($_.pointer,function(i){li(e,i,function(e){n[i].call(t,e)})}):(am.touchEventsSupported&&y($_.touch,function(i){li(e,i,function(r){n[i].call(t,r),ni(e)})}),y($_.mouse,function(i){li(e,i,function(r){r=Ie(r),e.touching||n[i].call(t,r)})}))}function si(t,e){function n(n){function i(i){i=Ie(i),oi(t,i.target)||(i=ri(t,i),e.domHandlers[n].call(t,i))}li(e,n,i,{capture:!0})}am.pointerEventsSupported?y(J_.pointer,n):am.touchEventsSupported||y(J_.mouse,n)}function li(t,e,n,i){t.mounted[e]=n,t.listenerOpts[e]=i,ke(t.domTarget,e,n,i)}function ui(t){var e=t.mounted;for(var n in e)e.hasOwnProperty(n)&&Le(t.domTarget,n,e[n],t.listenerOpts[n]);t.mounted={}}function hi(t){delete lx[t]}function ci(t){if(!t)return!1;if("string"==typeof t)return gn(t,1)r;r++)n+=gn(e[r].color,1);return n/=i,P_>n}return!1}function pi(t,e){var n=new ux(o(),t,e);return lx[n.id]=n,n}function fi(t){t.dispose()}function di(){for(var t in lx)lx.hasOwnProperty(t)&&lx[t].dispose();lx={}}function gi(t){return lx[t]}function yi(t,e){sx[t]=e}function vi(t){return t.replace(/^\s+|\s+$/g,"")}function mi(t,e,n,i){var r=e[1]-e[0],o=n[1]-n[0];if(0===r)return 0===o?n[0]:(n[0]+n[1])/2;if(i)if(r>0){if(t<=e[0])return n[0];if(t>=e[1])return n[1]}else{if(t>=e[0])return n[0];if(t<=e[1])return n[1]}else{if(t===e[0])return n[0];if(t===e[1])return n[1]}return(t-e[0])/r*o+n[0]}function _i(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?vi(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?0/0:+t}function xi(t,e,n){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),t=(+t).toFixed(e),n?t:+t}function bi(t){return t.sort(function(t,e){return t-e}),t}function wi(t){if(t=+t,isNaN(t))return 0;for(var e=1,n=0;Math.round(t*e)/e!==t;)e*=10,n++;return n}function Si(t){var e=t.toString(),n=e.indexOf("e");if(n>0){var i=+e.slice(n+1);return 0>i?-i:0}var r=e.indexOf(".");return 0>r?0:e.length-1-r}function Mi(t,e){var n=Math.log,i=Math.LN10,r=Math.floor(n(t[1]-t[0])/i),o=Math.round(n(Math.abs(e[1]-e[0]))/i),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20}function Ti(t,e,n){if(!t[e])return 0;var i=m(t,function(t,e){return t+(isNaN(e)?0:e)},0);if(0===i)return 0;for(var r=Math.pow(10,n),o=v(t,function(t){return(isNaN(t)?0:t)/i*r*100}),a=100*r,s=v(o,function(t){return Math.floor(t)}),l=m(s,function(t,e){return t+e},0),u=v(o,function(t,e){return t-s[e]});a>l;){for(var h=Number.NEGATIVE_INFINITY,c=null,p=0,f=u.length;f>p;++p)u[p]>h&&(h=u[p],c=p);++s[c],u[c]=0,++l}return s[e]/r}function Ci(t){var e=2*Math.PI;return(t%e+e)%e}function Ii(t){return t>-px&&px>t}function Ai(t){if(t instanceof Date)return t;if("string"==typeof t){var e=dx.exec(t);if(!e)return new Date(0/0);if(e[8]){var n=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(n-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,n,+(e[5]||0),+e[6]||0,+e[7]||0))}return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,+e[7]||0)}return new Date(null==t?0/0:Math.round(t))}function Di(t){return Math.pow(10,ki(t))}function ki(t){if(0===t)return 0;var e=Math.floor(Math.log(t)/Math.LN10);return t/Math.pow(10,e)>=10&&e++,e}function Li(t,e){var n,i=ki(t),r=Math.pow(10,i),o=t/r;return n=e?1.5>o?1:2.5>o?2:4>o?3:7>o?5:10:1>o?1:2>o?2:3>o?3:5>o?5:10,t=n*r,i>=-20?+t.toFixed(0>i?-i:0):t}function Pi(t,e){var n=(t.length-1)*e+1,i=Math.floor(n),r=+t[i-1],o=n-i;return o?r+o*(t[i]-r):r}function Oi(t){function e(t,n,i){return t.interval[i]s;s++)o[s]<=n&&(o[s]=n,a[s]=s?1:1-i),n=o[s],i=a[s];o[0]===o[1]&&a[0]*a[1]!==1?t.splice(r,1):r++}return t}function Ri(t){var e=parseFloat(t);return e==t&&(0!==e||"string"!=typeof t||t.indexOf("x")<=0)?e:0/0}function Ei(t){return!isNaN(Ri(t))}function Ni(){return Math.round(9*Math.random())}function Bi(t,e){return 0===e?t:Bi(e,t%e)}function zi(t,e){return null==t?e:null==e?t:t*e/Bi(t,e)}function Fi(t){throw new Error(t)}function Vi(t){return t instanceof Array?t:null==t?[]:[t]}function Hi(t,e,n){if(t){t[e]=t[e]||{},t.emphasis=t.emphasis||{},t.emphasis[e]=t.emphasis[e]||{};for(var i=0,r=n.length;r>i;i++){var o=n[i];!t.emphasis[e].hasOwnProperty(o)&&t[e].hasOwnProperty(o)&&(t.emphasis[e][o]=t[e][o])}}}function Gi(t){return!D(t)||M(t)||t instanceof Date?t:t.value}function Wi(t){return D(t)&&!(t instanceof Array)}function Ui(t,e,n){var i="normalMerge"===n,r="replaceMerge"===n,o="replaceAll"===n;t=t||[],e=(e||[]).slice();var a=Y();y(e,function(t,n){return D(t)?void 0:void(e[n]=null)});var s=Xi(t,a,n);return(i||r)&&Yi(s,t,a,e),i&&ji(s,e),i||r?qi(s,e,r):o&&Zi(s,e),Ki(s),s}function Xi(t,e,n){var i=[];if("replaceAll"===n)return i;for(var r=0;rr?n:i;for(var s=[],l=n,u=i,h=Math.max(l?l.length:0,u.length),c=0;h>c;++c){var p=t.getDimensionInfo(c);if("ordinal"===p.type)s[c]=(1>r&&l?l:u)[c];else{var f=l&&l[c]?l[c]:0,d=u[c],a=vn(f,d,r);s[c]=xi(a,o?Math.max(Si(f),Si(d)):e)}}return s}function fr(t){var e={main:"",sub:""};if(t){var n=t.split(xx);e.main=n[0]||"",e.sub=n[1]||""}return e}function dr(t){G(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(t),'componentType "'+t+'" illegal')}function gr(t){return!(!t||!t[Sx])}function yr(t){t.$constructor=t,t.extend=function(t){function e(){for(var r=[],o=0;o=0||r&&p(r,s)<0)){var l=n.getShallow(s,e);null!=l&&(o[t[a][0]]=l)}}return o}}function Mr(t){if("string"==typeof t){var e=Ax.get(t);return e&&e.image}return t}function Tr(t,e,n,i,r){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!n)return e;var o=Ax.get(t),a={hostEl:n,cb:i,cbPayload:r};return o?(e=o.image,!Ir(e)&&o.pending.push(a)):(e=new Image,e.onload=e.onerror=Cr,Ax.put(t,e.__cachedImgObj={image:e,pending:[a]}),e.src=e.__zrImageSrc=t),e}return t}return e}function Cr(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;ea;a++)o[a]=kr(o[a],r);return o.join("\n")}function Dr(t,e,n,i){i=i||{};var r=h({},i);r.font=e,n=z(n,"..."),r.maxIterations=z(i.maxIterations,2);var o=r.minChar=z(i.minChar,0);r.cnCharWidth=Pn("国",e);var a=r.ascCharWidth=Pn("a",e);r.placeholder=z(i.placeholder,"");for(var s=t=Math.max(0,t-1),l=0;o>l&&s>=a;l++)s-=a;var u=Pn(n,e);return u>s&&(n="",u=0),s=t-u,r.ellipsis=n,r.ellipsisWidth=u,r.contentWidth=s,r.containerWidth=t,r}function kr(t,e){var n=e.containerWidth,i=e.font,r=e.contentWidth;if(!n)return"";var o=Pn(t,i);if(n>=o)return t;for(var a=0;;a++){if(r>=o||a>=e.maxIterations){t+=e.ellipsis;break}var s=0===a?Lr(t,r,e.ascCharWidth,e.cnCharWidth):o>0?Math.floor(t.length*r/o):0;t=t.substr(0,s),o=Pn(t,i)}return""===t&&(t=e.placeholder),t}function Lr(t,e,n,i){for(var r=0,o=0,a=t.length;a>o&&e>r;o++){var s=t.charCodeAt(o);r+=s>=0&&127>=s?n:i}return o}function Pr(t,e){null!=t&&(t+="");var n,i=e.overflow,r=e.padding,o=e.font,a="truncate"===i,s=Bn(o),l=z(e.lineHeight,s),u="truncate"===e.lineOverflow,h=e.width;n=null!=h&&"break"===i||"breakAll"===i?t?Br(t,e.font,h,"breakAll"===i,0).lines:[]:t?t.split("\n"):[];var c=n.length*l,p=z(e.height,c);if(c>p&&u){var f=Math.floor(p/l);n=n.slice(0,f)}var d=p,g=h;if(r&&(d+=r[0]+r[2],null!=g&&(g+=r[1]+r[3])),t&&a&&null!=g)for(var y=Dr(h,o,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),v=0;vu&&Rr(i,t.substring(u,h),e,l),Rr(i,r[2],e,l,r[1]),u=Dx.lastIndex}ua){b>0?(m.tokens=m.tokens.slice(0,b),n(m,x,_),i.lines=i.lines.slice(0,v+1)):i.lines=i.lines.slice(0,v);break t}var A=S.width,D=null==A||"auto"===A;if("string"==typeof A&&"%"===A.charAt(A.length-1))w.percentWidth=A,c.push(w),w.contentWidth=Pn(w.text,C);else{if(D){var k=S.backgroundColor,L=k&&k.image;L&&(L=Mr(L),Ir(L)&&(w.width=Math.max(w.width,L.width*I/L.height)))}var P=g&&null!=o?o-x:null;null!=P&&PP?(w.text="",w.width=w.contentWidth=0):(w.text=Ar(w.text,P-T,C,e.ellipsis,{minChar:e.truncateMinChar}),w.width=w.contentWidth=Pn(w.text,C)):w.contentWidth=Pn(w.text,C)}w.width+=T,x+=w.width,S&&(_=Math.max(_,w.lineHeight))}n(m,x,_)}i.outerWidth=i.width=z(o,f),i.outerHeight=i.height=z(a,p),i.contentHeight=p,i.contentWidth=f,d&&(i.outerWidth+=d[1]+d[3],i.outerHeight+=d[0]+d[2]);for(var v=0;v0&&d+i.accumWidth>i.width&&(o=e.split("\n"),c=!0),i.accumWidth=d}else{var g=Br(e,h,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+f,a=g.linesWidths,o=g.lines}}else o=e.split("\n");for(var y=0;y=33&&255>=e}function Nr(t){return Er(t)?Ox[t]?!0:!1:!0}function Br(t,e,n,i,r){for(var o=[],a=[],s="",l="",u=0,h=0,c=0;cn:r+h+f>n)?h?(s||l)&&(d?(s||(s=l,l="",u=0,h=u),o.push(s),a.push(h-u),l+=p,u+=f,s="",h=u):(l&&(s+=l,h+=u,l="",u=0),o.push(s),a.push(h),s=p,h=f)):d?(o.push(l),a.push(u),l=p,u=f):(o.push(p),a.push(f)):(h+=f,d?(l+=p,u+=f):(l&&(s+=l,l="",u=0),s+=p))}else l&&(s+=l,h+=u),o.push(s),a.push(h),s="",l="",u=0,h=0}return o.length||s||(s=t,l="",u=0),l&&(s+=l),s&&(o.push(s),a.push(h)),1===o.length&&(h+=r),{accumWidth:h,lines:o,linesWidths:a}}function zr(t,e,n){return Fx.copy(t.getBoundingRect()),t.transform&&Fx.applyTransform(t.transform),Vx.width=e,Vx.height=n,!Fx.intersect(Vx)}function Fr(t){return t>-Wx&&Wx>t}function Vr(t){return t>Wx||-Wx>t}function Hr(t,e,n,i,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*i+3*o*n)}function Gr(t,e,n,i,r){var o=1-r;return 3*(((e-t)*o+2*(n-e)*r)*o+(i-n)*r*r)}function Wr(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,p=l*l-3*s*u,f=0;if(Fr(h)&&Fr(c))if(Fr(s))o[0]=0;else{var d=-l/s;d>=0&&1>=d&&(o[f++]=d)}else{var g=c*c-4*h*p;if(Fr(g)){var y=c/h,d=-s/a+y,v=-y/2;d>=0&&1>=d&&(o[f++]=d),v>=0&&1>=v&&(o[f++]=v)}else if(g>0){var m=Gx(g),_=h*s+1.5*a*(-c+m),x=h*s+1.5*a*(-c-m);_=0>_?-Hx(-_,Yx):Hx(_,Yx),x=0>x?-Hx(-x,Yx):Hx(x,Yx);var d=(-s-(_+x))/(3*a);d>=0&&1>=d&&(o[f++]=d)}else{var b=(2*h*s-3*a*c)/(2*Gx(h*h*h)),w=Math.acos(b)/3,S=Gx(h),M=Math.cos(w),d=(-s-2*S*M)/(3*a),v=(-s+S*(M+Xx*Math.sin(w)))/(3*a),T=(-s+S*(M-Xx*Math.sin(w)))/(3*a);d>=0&&1>=d&&(o[f++]=d),v>=0&&1>=v&&(o[f++]=v),T>=0&&1>=T&&(o[f++]=T)}}return f}function Ur(t,e,n,i,r){var o=6*n-12*e+6*t,a=9*e+3*i-3*t-9*n,s=3*e-3*t,l=0;if(Fr(a)){if(Vr(o)){var u=-s/o;u>=0&&1>=u&&(r[l++]=u)}}else{var h=o*o-4*a*s;if(Fr(h))r[0]=-o/(2*a);else if(h>0){var c=Gx(h),u=(-o+c)/(2*a),p=(-o-c)/(2*a);u>=0&&1>=u&&(r[l++]=u),p>=0&&1>=p&&(r[l++]=p)}}return l}function Xr(t,e,n,i,r,o){var a=(e-t)*r+t,s=(n-e)*r+e,l=(i-n)*r+n,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=i}function Yr(t,e,n,i,r,o,a,s,l,u,h){var c,p,f,d,g,y=.005,v=1/0;jx[0]=l,jx[1]=u;for(var m=0;1>m;m+=.05)qx[0]=Hr(t,n,r,a,m),qx[1]=Hr(e,i,o,s,m),d=Im(jx,qx),v>d&&(c=m,v=d);v=1/0;for(var _=0;32>_&&!(Ux>y);_++)p=c-y,f=c+y,qx[0]=Hr(t,n,r,a,p),qx[1]=Hr(e,i,o,s,p),d=Im(qx,jx),p>=0&&v>d?(c=p,v=d):(Zx[0]=Hr(t,n,r,a,f),Zx[1]=Hr(e,i,o,s,f),g=Im(Zx,jx),1>=f&&v>g?(c=f,v=g):y*=.5);return h&&(h[0]=Hr(t,n,r,a,c),h[1]=Hr(e,i,o,s,c)),Gx(v)}function jr(t,e,n,i,r,o,a,s,l){for(var u=t,h=e,c=0,p=1/l,f=1;l>=f;f++){var d=f*p,g=Hr(t,n,r,a,d),y=Hr(e,i,o,s,d),v=g-u,m=y-h;c+=Math.sqrt(v*v+m*m),u=g,h=y}return c}function qr(t,e,n,i){var r=1-i;return r*(r*t+2*i*e)+i*i*n}function Zr(t,e,n,i){return 2*((1-i)*(e-t)+i*(n-e))}function Kr(t,e,n,i,r){var o=t-2*e+n,a=2*(e-t),s=t-i,l=0;if(Fr(o)){if(Vr(a)){var u=-s/a;u>=0&&1>=u&&(r[l++]=u)}}else{var h=a*a-4*o*s;if(Fr(h)){var u=-a/(2*o);u>=0&&1>=u&&(r[l++]=u)}else if(h>0){var c=Gx(h),u=(-a+c)/(2*o),p=(-a-c)/(2*o);u>=0&&1>=u&&(r[l++]=u),p>=0&&1>=p&&(r[l++]=p)}}return l}function $r(t,e,n){var i=t+n-2*e;return 0===i?.5:(t-e)/i}function Jr(t,e,n,i,r){var o=(e-t)*i+t,a=(n-e)*i+e,s=(a-o)*i+o;r[0]=t,r[1]=o,r[2]=s,r[3]=s,r[4]=a,r[5]=n}function Qr(t,e,n,i,r,o,a,s,l){var u,h=.005,c=1/0;jx[0]=a,jx[1]=s;for(var p=0;1>p;p+=.05){qx[0]=qr(t,n,r,p),qx[1]=qr(e,i,o,p);var f=Im(jx,qx);c>f&&(u=p,c=f)}c=1/0;for(var d=0;32>d&&!(Ux>h);d++){var g=u-h,y=u+h;qx[0]=qr(t,n,r,g),qx[1]=qr(e,i,o,g);var f=Im(qx,jx);if(g>=0&&c>f)u=g,c=f;else{Zx[0]=qr(t,n,r,y),Zx[1]=qr(e,i,o,y);var v=Im(Zx,jx);1>=y&&c>v?(u=y,c=v):h*=.5}}return l&&(l[0]=qr(t,n,r,u),l[1]=qr(e,i,o,u)),Gx(c)}function to(t,e,n,i,r,o,a){for(var s=t,l=e,u=0,h=1/a,c=1;a>=c;c++){var p=c*h,f=qr(t,n,r,p),d=qr(e,i,o,p),g=f-s,y=d-l;u+=Math.sqrt(g*g+y*y),s=f,l=d}return u}function eo(t,e,n){if(0!==t.length){for(var i=t[0],r=i[0],o=i[0],a=i[1],s=i[1],l=1;lf;f++){var d=c(t,n,r,a,rb[f]);l[0]=Kx(d,l[0]),u[0]=$x(d,u[0])}p=h(e,i,o,s,ob);for(var f=0;p>f;f++){var g=c(e,i,o,s,ob[f]);l[1]=Kx(g,l[1]),u[1]=$x(g,u[1])}l[0]=Kx(t,l[0]),u[0]=$x(t,u[0]),l[0]=Kx(a,l[0]),u[0]=$x(a,u[0]),l[1]=Kx(e,l[1]),u[1]=$x(e,u[1]),l[1]=Kx(s,l[1]),u[1]=$x(s,u[1])}function ro(t,e,n,i,r,o,a,s){var l=$r,u=qr,h=$x(Kx(l(t,n,r),1),0),c=$x(Kx(l(e,i,o),1),0),p=u(t,n,r,h),f=u(e,i,o,c);a[0]=Kx(t,r,p),a[1]=Kx(e,o,f),s[0]=$x(t,r,p),s[1]=$x(e,o,f)}function oo(t,e,n,i,r,o,a,s,l){var u=ye,h=ve,c=Math.abs(r-o);if(1e-4>c%tb&&c>1e-4)return s[0]=t-n,s[1]=e-i,l[0]=t+n,void(l[1]=e+i);if(eb[0]=Qx(r)*n+t,eb[1]=Jx(r)*i+e,nb[0]=Qx(o)*n+t,nb[1]=Jx(o)*i+e,u(s,eb,nb),h(l,eb,nb),r%=tb,0>r&&(r+=tb),o%=tb,0>o&&(o+=tb),r>o&&!a?o+=tb:o>r&&a&&(r+=tb),a){var p=o;o=r,r=p}for(var f=0;o>f;f+=Math.PI/2)f>r&&(ib[0]=Qx(f)*n+t,ib[1]=Jx(f)*i+e,u(s,ib,s),h(l,ib,l))}function ao(t){var e=Math.round(t/_b*1e8)/1e8;return e%2*_b}function so(t,e){var n=ao(t[0]);0>n&&(n+=xb);var i=n-t[0],r=t[1];r+=i,!e&&r-n>=xb?r=n+xb:e&&n-r>=xb?r=n-xb:!e&&n>r?r=n+(xb-ao(n-r)):e&&r>n&&(r=n-(xb-ao(r-n))),t[0]=n,t[1]=r}function lo(t,e,n,i,r,o,a){if(0===r)return!1;var s=r,l=0,u=t;if(a>e+s&&a>i+s||e-s>a&&i-s>a||o>t+s&&o>n+s||t-s>o&&n-s>o)return!1;if(t===n)return Math.abs(o-t)<=s/2;l=(e-i)/(t-n),u=(t*i-n*e)/(t-n);var h=l*o-a+u,c=h*h/(l*l+1);return s/2*s/2>=c}function uo(t,e,n,i,r,o,a,s,l,u,h){if(0===l)return!1;var c=l;if(h>e+c&&h>i+c&&h>o+c&&h>s+c||e-c>h&&i-c>h&&o-c>h&&s-c>h||u>t+c&&u>n+c&&u>r+c&&u>a+c||t-c>u&&n-c>u&&r-c>u&&a-c>u)return!1;var p=Yr(t,e,n,i,r,o,a,s,u,h,null);return c/2>=p}function ho(t,e,n,i,r,o,a,s,l){if(0===a)return!1;var u=a;if(l>e+u&&l>i+u&&l>o+u||e-u>l&&i-u>l&&o-u>l||s>t+u&&s>n+u&&s>r+u||t-u>s&&n-u>s&&r-u>s)return!1;var h=Qr(t,e,n,i,r,o,s,l,null);return u/2>=h}function co(t){return t%=Mb,0>t&&(t+=Mb),t}function po(t,e,n,i,r,o,a,s,l){if(0===a)return!1;var u=a;s-=t,l-=e;var h=Math.sqrt(s*s+l*l);if(h-u>n||n>h+u)return!1;if(Math.abs(i-r)%Tb<1e-4)return!0;if(o){var c=i;i=co(r),r=co(c)}else i=co(i),r=co(r);i>r&&(r+=Tb);var p=Math.atan2(l,s);return 0>p&&(p+=Tb),p>=i&&r>=p||p+Tb>=i&&r>=p+Tb}function fo(t,e,n,i,r,o){if(o>e&&o>i||e>o&&i>o)return 0;if(i===e)return 0;var a=(o-e)/(i-e),s=e>i?1:-1;(1===a||0===a)&&(s=e>i?.5:-.5);var l=a*(n-t)+t;return l===r?1/0:l>r?s:0}function go(t,e){return Math.abs(t-e)e&&u>i&&u>o&&u>s||e>u&&i>u&&o>u&&s>u)return 0;var h=Wr(e,i,o,s,u,Db);if(0===h)return 0;for(var c=0,p=-1,f=void 0,d=void 0,g=0;h>g;g++){var y=Db[g],v=0===y||1===y?.5:1,m=Hr(t,n,r,a,y);l>m||(0>p&&(p=Ur(e,i,o,s,kb),kb[1]1&&yo(),f=Hr(e,i,o,s,kb[0]),p>1&&(d=Hr(e,i,o,s,kb[1]))),c+=2===p?yf?v:-v:yd?v:-v:d>s?v:-v:yf?v:-v:f>s?v:-v)}return c}function mo(t,e,n,i,r,o,a,s){if(s>e&&s>i&&s>o||e>s&&i>s&&o>s)return 0;var l=Kr(e,i,o,s,Db);if(0===l)return 0;var u=$r(e,i,o);if(u>=0&&1>=u){for(var h=0,c=qr(e,i,o,u),p=0;l>p;p++){var f=0===Db[p]||1===Db[p]?.5:1,d=qr(t,n,r,Db[p]);a>d||(h+=Db[p]c?f:-f:c>o?f:-f)}return h}var f=0===Db[0]||1===Db[0]?.5:1,d=qr(t,n,r,Db[0]);return a>d?0:e>o?f:-f}function _o(t,e,n,i,r,o,a,s){if(s-=e,s>n||-n>s)return 0;var l=Math.sqrt(n*n-s*s);Db[0]=-l,Db[1]=l;var u=Math.abs(i-r);if(1e-4>u)return 0;if(u>=Ib-1e-4){i=0,r=Ib;var h=o?1:-1;return a>=Db[0]+t&&a<=Db[1]+t?h:0}if(i>r){var c=i;i=r,r=c}0>i&&(i+=Ib,r+=Ib);for(var p=0,f=0;2>f;f++){var d=Db[f];if(d+t>a){var g=Math.atan2(s,d),h=o?1:-1;0>g&&(g=Ib+g),(g>=i&&r>=g||g+Ib>=i&&r>=g+Ib)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),p+=h)}}return p}function xo(t,e,n,i,r){for(var o,a,s=t.data,l=t.len(),u=0,h=0,c=0,p=0,f=0,d=0;l>d;){var g=s[d++],y=1===d;switch(g===Cb.M&&d>1&&(n||(u+=fo(h,c,p,f,i,r))),y&&(h=s[d],c=s[d+1],p=h,f=c),g){case Cb.M:p=s[d++],f=s[d++],h=p,c=f;break;case Cb.L:if(n){if(lo(h,c,s[d],s[d+1],e,i,r))return!0}else u+=fo(h,c,s[d],s[d+1],i,r)||0;h=s[d++],c=s[d++];break;case Cb.C:if(n){if(uo(h,c,s[d++],s[d++],s[d++],s[d++],s[d],s[d+1],e,i,r))return!0}else u+=vo(h,c,s[d++],s[d++],s[d++],s[d++],s[d],s[d+1],i,r)||0;h=s[d++],c=s[d++];break;case Cb.Q:if(n){if(ho(h,c,s[d++],s[d++],s[d],s[d+1],e,i,r))return!0}else u+=mo(h,c,s[d++],s[d++],s[d],s[d+1],i,r)||0;h=s[d++],c=s[d++];break;case Cb.A:var v=s[d++],m=s[d++],_=s[d++],x=s[d++],b=s[d++],w=s[d++];d+=1;var S=!!(1-s[d++]);o=Math.cos(b)*_+v,a=Math.sin(b)*x+m,y?(p=o,f=a):u+=fo(h,c,o,a,i,r);var M=(i-v)*x/_+v;if(n){if(po(v,m,x,b,b+w,S,e,M,r))return!0}else u+=_o(v,m,x,b,b+w,S,M,r);h=Math.cos(b+w)*_+v,c=Math.sin(b+w)*x+m;break;case Cb.R:p=h=s[d++],f=c=s[d++];var T=s[d++],C=s[d++];if(o=p+T,a=f+C,n){if(lo(p,f,o,f,e,i,r)||lo(o,f,o,a,e,i,r)||lo(o,a,p,a,e,i,r)||lo(p,a,p,f,e,i,r))return!0}else u+=fo(o,f,o,a,i,r),u+=fo(p,a,p,f,i,r);break;case Cb.Z:if(n){if(lo(h,c,p,f,e,i,r))return!0}else u+=fo(h,c,p,f,i,r);h=p,c=f}}return n||go(c,f)||(u+=fo(h,c,p,f,i,r)||0),0!==u}function bo(t,e,n){return xo(t,0,!1,e,n)}function wo(t,e,n,i){return xo(t,e,!0,n,i)}function So(t){return!!(t&&"string"!=typeof t&&t.width&&t.height)}function Mo(t,e){var n,i,r,o,a=e.x,s=e.y,l=e.width,u=e.height,h=e.r;0>l&&(a+=l,l=-l),0>u&&(s+=u,u=-u),"number"==typeof h?n=i=r=o=h:h instanceof Array?1===h.length?n=i=r=o=h[0]:2===h.length?(n=r=h[0],i=o=h[1]):3===h.length?(n=h[0],i=o=h[1],r=h[2]):(n=h[0],i=h[1],r=h[2],o=h[3]):n=i=r=o=0;var c;n+i>l&&(c=n+i,n*=l/c,i*=l/c),r+o>l&&(c=r+o,r*=l/c,o*=l/c),i+r>u&&(c=i+r,i*=u/c,r*=u/c),n+o>u&&(c=n+o,n*=u/c,o*=u/c),t.moveTo(a+n,s),t.lineTo(a+l-i,s),0!==i&&t.arc(a+l-i,s+i,i,-Math.PI/2,0),t.lineTo(a+l,s+u-r),0!==r&&t.arc(a+l-r,s+u-r,r,0,Math.PI/2),t.lineTo(a+o,s+u),0!==o&&t.arc(a+o,s+u-o,o,Math.PI/2,Math.PI),t.lineTo(a,s+n),0!==n&&t.arc(a+n,s+n,n,Math.PI,1.5*Math.PI)}function To(t,e,n){if(e){var i=e.x1,r=e.x2,o=e.y1,a=e.y2;t.x1=i,t.x2=r,t.y1=o,t.y2=a;var s=n&&n.lineWidth;return s?(Vb(2*i)===Vb(2*r)&&(t.x1=t.x2=Io(i,s,!0)),Vb(2*o)===Vb(2*a)&&(t.y1=t.y2=Io(o,s,!0)),t):t}}function Co(t,e,n){if(e){var i=e.x,r=e.y,o=e.width,a=e.height;t.x=i,t.y=r,t.width=o,t.height=a;var s=n&&n.lineWidth;return s?(t.x=Io(i,s,!0),t.y=Io(r,s,!0),t.width=Math.max(Io(i+o,s,!1)-t.x,0===o?0:1),t.height=Math.max(Io(r+a,s,!1)-t.y,0===a?0:1),t):t}}function Io(t,e,n){if(!e)return t;var i=Vb(2*t);return(i+Vb(e))%2===0?i/2:(i+(n?1:-1))/2}function Ao(t){return Do(t),y(t.rich,Do),t}function Do(t){if(t){t.font=jb.makeFont(t);var e=t.align;"middle"===e&&(e="center"),t.align=null==e||qb[e]?e:"left";var n=t.verticalAlign;"center"===n&&(n="middle"),t.verticalAlign=null==n||Zb[n]?n:"top";var i=t.padding;i&&(t.padding=H(t.padding))}}function ko(t,e){return null==t||0>=e||"transparent"===t||"none"===t?null:t.image||t.colorStops?"#000":t}function Lo(t){return null==t||"none"===t?null:t.image||t.colorStops?"#000":t}function Po(t,e,n){return"right"===e?t-n[1]:"center"===e?t+n[3]/2-n[1]/2:t+n[3]}function Oo(t){var e=t.text;return null!=e&&(e+=""),e}function Ro(t){return!!(t.backgroundColor||t.borderWidth&&t.borderColor)}function Eo(t){return null!=t&&"none"!==t}function No(t){if("string"!=typeof t)return t;var e=pw.get(t);return e||(e=ln(t,-.1),pw.put(t,e)),e}function Bo(t,e,n){t.onHoverStateChange&&(t.hoverState||0)!==n&&t.onHoverStateChange(e),t.hoverState=n}function zo(t){Bo(t,"emphasis",nw)}function Fo(t){t.hoverState===nw&&Bo(t,"normal",tw)}function Vo(t){Bo(t,"blur",ew)}function Ho(t){t.hoverState===ew&&Bo(t,"normal",tw)}function Go(t){t.selected=!0}function Wo(t){t.selected=!1}function Uo(t,e,n){e(t,n)}function Xo(t,e,n){Uo(t,e,n),t.isGroup&&t.traverse(function(t){Uo(t,e,n)})}function Yo(t,e){switch(e){case"emphasis":t.hoverState=nw;break;case"normal":t.hoverState=tw;break;case"blur":t.hoverState=ew;break;case"select":t.selected=!0}}function jo(t,e,n,i){for(var r=t.style,o={},a=0;a=0,o=!1;if(t instanceof Rb){var a=Qb(t),s=r?a.selectFill||a.normalFill:a.normalFill,l=r?a.selectStroke||a.normalStroke:a.normalStroke;if(Eo(s)||Eo(l)){i=i||{};var u=i.style||{};!Eo(u.fill)&&Eo(s)?(o=!0,i=h({},i),u=h({},u),u.fill=No(s)):!Eo(u.stroke)&&Eo(l)&&(o||(i=h({},i),u=h({},u)),u.stroke=No(l)),i.style=u}}if(i&&null==i.z2){o||(i=h({},i));var c=t.z2EmphasisLift;i.z2=t.z2+(null!=c?c:ow)}return i}function Zo(t,e,n){if(n&&null==n.z2){n=h({},n);var i=t.z2SelectLift;n.z2=t.z2+(null!=i?i:aw)}return n}function Ko(t,e,n){var i=p(t.currentStates,e)>=0,r=t.style.opacity,o=i?null:jo(t,["opacity"],e,{opacity:1});n=n||{};var a=n.style||{};return null==a.opacity&&(n=h({},n),a=h({opacity:i?r:.1*o.opacity},a),n.style=a),n}function $o(t,e){var n=this.states[t];if(this.style){if("emphasis"===t)return qo(this,t,e,n);if("blur"===t)return Ko(this,t,n);if("select"===t)return Zo(this,t,n)}return n}function Jo(t){t.stateProxy=$o;var e=t.getTextContent(),n=t.getTextGuideLine();e&&(e.stateProxy=$o),n&&(n.stateProxy=$o)}function Qo(t,e){!sa(t,e)&&!t.__highByOuter&&Xo(t,zo)}function ta(t,e){!sa(t,e)&&!t.__highByOuter&&Xo(t,Fo)}function ea(t,e){t.__highByOuter|=1<<(e||0),Xo(t,zo)}function na(t,e){!(t.__highByOuter&=~(1<<(e||0)))&&Xo(t,Fo)}function ia(t){Xo(t,Vo)}function ra(t){Xo(t,Ho)}function oa(t){Xo(t,Go)}function aa(t){Xo(t,Wo)}function sa(t,e){return t.__highDownSilentOnTouch&&e.zrByTouch}function la(t){var e=t.getModel();e.eachComponent(function(e,n){var i="series"===e?t.getViewOfSeriesModel(n):t.getViewOfComponentModel(n);i.group.traverse(function(t){Ho(t)})})}function ua(t,e,n,i){function r(t,e){for(var n=0;nl;)a=r.getItemGraphicEl(l++);if(a){var u=Kb(a);ua(i,u.focus,u.blurScope,n)}else{var h=t.get(["emphasis","focus"]),c=t.get(["emphasis","blurScope"]);null!=h&&ua(i,h,c,n)}}function pa(t,e,n,i){var r={focusSelf:!1,dispatchers:null};if(null==t||"series"===t||null==e||null==n)return r;var o=i.getModel().getComponent(t,e);if(!o)return r;var a=i.getViewOfComponentModel(o);if(!a||!a.findHighDownDispatchers)return r;for(var s,l=a.findHighDownDispatchers(n),u=0;u0){var o={dataIndex:r,seriesIndex:t.seriesIndex};null!=i&&(o.dataType=i),e.push(o)}})}),e}function ma(t,e,n){ba(t,!0),Xo(t,Jo),_a(t,e,n)}function _a(t,e,n){var i=Kb(t);null!=e?(i.focus=e,i.blurScope=n):i.focus&&(i.focus=null)}function xa(t,e,n,i){n=n||"itemStyle";for(var r=0;r=$b&&(e=Jb[t]=$b++),e}function Ma(t){var e=t.type;return e===uw||e===hw||e===cw}function Ta(t){var e=t.type;return e===sw||e===lw}function Ca(t){var e=Qb(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var n=t.states.select||{};e.selectFill=n.style&&n.style.fill||null,e.selectStroke=n.style&&n.style.stroke||null}function Ia(t,e){var n,i,r,o,a,s,l=t.data,u=t.len(),h=gw.M,c=gw.C,p=gw.L,f=gw.R,d=gw.A,g=gw.Q;for(r=0,o=0;u>r;){switch(n=l[r++],o=r,i=0,n){case h:i=1;break;case p:i=1;break;case c:i=3;break;case g:i=2;break;case d:var y=e[4],v=e[5],m=vw(e[0]*e[0]+e[1]*e[1]),_=vw(e[2]*e[2]+e[3]*e[3]),x=mw(-e[1]/_,e[0]/m);l[r]*=m,l[r++]+=y,l[r]*=_,l[r++]+=v,l[r++]*=m,l[r++]*=_,l[r++]+=x,l[r++]+=x,r+=2,o=r;break;case f:s[0]=l[r++],s[1]=l[r++],ge(s,s,e),l[o++]=s[0],l[o++]=s[1],s[0]+=l[r++],s[1]+=l[r++],ge(s,s,e),l[o++]=s[0],l[o++]=s[1]}for(a=0;i>a;a++){var b=yw[a];b[0]=l[r++],b[1]=l[r++],ge(b,b,e),l[o++]=b[0],l[o++]=b[1]}}t.increaseVersion()}function Aa(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Da(t,e){return(t[0]*e[0]+t[1]*e[1])/(Aa(t)*Aa(e))}function ka(t,e){return(t[0]*e[1]1&&(a*=_w(d),s*=_w(d));var g=(r===o?-1:1)*_w((a*a*s*s-a*a*f*f-s*s*p*p)/(a*a*f*f+s*s*p*p))||0,y=g*a*f/s,v=g*-s*p/a,m=(t+n)/2+bw(c)*y-xw(c)*v,_=(e+i)/2+xw(c)*y+bw(c)*v,x=ka([1,0],[(p-y)/a,(f-v)/s]),b=[(p-y)/a,(f-v)/s],w=[(-1*p-y)/a,(-1*f-v)/s],S=ka(b,w);if(Da(b,w)<=-1&&(S=ww),Da(b,w)>=1&&(S=0),0>S){var M=Math.round(S/ww*1e6)/1e6;S=2*ww+M%2*ww}h.addData(u,m,_,a,s,x,S,c,o)}function Pa(t){var e=new Sb;if(!t)return e;var n,i=0,r=0,o=i,a=r,s=Sb.CMD,l=t.match(Sw);if(!l)return e;for(var u=0;ug;g++)f[g]=parseFloat(f[g]);for(var y=0;d>y;){var v=void 0,m=void 0,_=void 0,x=void 0,b=void 0,w=void 0,S=void 0,M=i,T=r,C=void 0,I=void 0;switch(c){case"l":i+=f[y++],r+=f[y++],p=s.L,e.addData(p,i,r);break;case"L":i=f[y++],r=f[y++],p=s.L,e.addData(p,i,r);break;case"m":i+=f[y++],r+=f[y++],p=s.M,e.addData(p,i,r),o=i,a=r,c="l";break;case"M":i=f[y++],r=f[y++],p=s.M,e.addData(p,i,r),o=i,a=r,c="L";break;case"h":i+=f[y++],p=s.L,e.addData(p,i,r);break;case"H":i=f[y++],p=s.L,e.addData(p,i,r);break;case"v":r+=f[y++],p=s.L,e.addData(p,i,r);break;case"V":r=f[y++],p=s.L,e.addData(p,i,r);break;case"C":p=s.C,e.addData(p,f[y++],f[y++],f[y++],f[y++],f[y++],f[y++]),i=f[y-2],r=f[y-1];break;case"c":p=s.C,e.addData(p,f[y++]+i,f[y++]+r,f[y++]+i,f[y++]+r,f[y++]+i,f[y++]+r),i+=f[y-2],r+=f[y-1];break;case"S":v=i,m=r,C=e.len(),I=e.data,n===s.C&&(v+=i-I[C-4],m+=r-I[C-3]),p=s.C,M=f[y++],T=f[y++],i=f[y++],r=f[y++],e.addData(p,v,m,M,T,i,r);break;case"s":v=i,m=r,C=e.len(),I=e.data,n===s.C&&(v+=i-I[C-4],m+=r-I[C-3]),p=s.C,M=i+f[y++],T=r+f[y++],i+=f[y++],r+=f[y++],e.addData(p,v,m,M,T,i,r);break;case"Q":M=f[y++],T=f[y++],i=f[y++],r=f[y++],p=s.Q,e.addData(p,M,T,i,r);break;case"q":M=f[y++]+i,T=f[y++]+r,i+=f[y++],r+=f[y++],p=s.Q,e.addData(p,M,T,i,r);break;case"T":v=i,m=r,C=e.len(),I=e.data,n===s.Q&&(v+=i-I[C-4],m+=r-I[C-3]),i=f[y++],r=f[y++],p=s.Q,e.addData(p,v,m,i,r);break;case"t":v=i,m=r,C=e.len(),I=e.data,n===s.Q&&(v+=i-I[C-4],m+=r-I[C-3]),i+=f[y++],r+=f[y++],p=s.Q,e.addData(p,v,m,i,r);break;case"A":_=f[y++],x=f[y++],b=f[y++],w=f[y++],S=f[y++],M=i,T=r,i=f[y++],r=f[y++],p=s.A,La(M,T,i,r,w,S,_,x,b,p,e);break;case"a":_=f[y++],x=f[y++],b=f[y++],w=f[y++],S=f[y++],M=i,T=r,i+=f[y++],r+=f[y++],p=s.A,La(M,T,i,r,w,S,_,x,b,p,e)}}("z"===c||"Z"===c)&&(p=s.Z,e.addData(p),i=o,r=a),n=p}return e.toStatic(),e}function Oa(t){return null!=t.setData}function Ra(t,e){var n=Pa(t),i=h({},e);return i.buildPath=function(t){if(Oa(t)){t.setData(n.data);var e=t.getContext();e&&t.rebuildPath(e,1)}else{var e=t;n.rebuildPath(e,1)}},i.applyTransform=function(t){Ia(n,t),this.dirtyShape()},i}function Ea(t,e){return new Tw(Ra(t,e))}function Na(t,n){var i=Ra(t,n),r=function(t){function n(e){var n=t.call(this,e)||this;return n.applyTransform=i.applyTransform,n.buildPath=i.buildPath,n}return e(n,t),n}(Tw);return r}function Ba(t,e){for(var n=[],i=t.length,r=0;i>r;r++){var o=t[r];o.path||o.createPathProxy(),o.shapeChanged()&&o.buildPath(o.path,o.shape,!0),n.push(o.path)}var a=new Rb(e);return a.createPathProxy(),a.buildPath=function(t){if(Oa(t)){t.appendPath(n);var e=t.getContext();e&&t.rebuildPath(e,1)}},a}function za(t,e,n,i,r,o,a,s){var l=n-t,u=i-e,h=a-r,c=s-o,p=c*l-h*u;return Vw>p*p?void 0:(p=(h*(e-o)-c*(t-r))/p,[t+p*l,e+p*u])}function Fa(t,e,n,i,r,o,a){var s=t-n,l=e-i,u=(a?o:-o)/Bw(s*s+l*l),h=u*l,c=-u*s,p=t+h,f=e+c,d=n+h,g=i+c,y=(p+d)/2,v=(f+g)/2,m=d-p,_=g-f,x=m*m+_*_,b=r-o,w=p*g-d*f,S=(0>_?-1:1)*Bw(zw(0,b*b*x-w*w)),M=(w*_-m*S)/x,T=(-w*m-_*S)/x,C=(w*_+m*S)/x,I=(-w*m+_*S)/x,A=M-y,D=T-v,k=C-y,L=I-v;return A*A+D*D>k*k+L*L&&(M=C,T=I),{cx:M,cy:T,x01:-h,y01:-c,x11:M*(r/b-1),y11:T*(r/b-1)}}function Va(t,e){var n=zw(e.r,0),i=zw(e.r0||0,0),r=n>0,o=i>0;if(r||o){if(r||(n=i,i=0),i>n){var a=n;n=i,i=a}var s,l=!!e.clockwise,u=e.startAngle,h=e.endAngle;if(u===h)s=0;else{var c=[u,h];so(c,!l),s=Nw(c[0]-c[1])}var p=e.cx,f=e.cy,d=e.cornerRadius||0,g=e.innerCornerRadius||0;if(n>Vw)if(s>Lw-Vw)t.moveTo(p+n*Ow(u),f+n*Pw(u)),t.arc(p,f,n,u,h,!l),i>Vw&&(t.moveTo(p+i*Ow(h),f+i*Pw(h)),t.arc(p,f,i,h,u,l));else{var y=Nw(n-i)/2,v=Fw(y,d),m=Fw(y,g),_=m,x=v,b=n*Ow(u),w=n*Pw(u),S=i*Ow(h),M=i*Pw(h),T=void 0,C=void 0,I=void 0,A=void 0;if((v>Vw||m>Vw)&&(T=n*Ow(h),C=n*Pw(h),I=i*Ow(u),A=i*Pw(u),kw>s)){var D=za(b,w,I,A,T,C,S,M);if(D){var k=b-D[0],L=w-D[1],P=T-D[0],O=C-D[1],R=1/Pw(Rw((k*P+L*O)/(Bw(k*k+L*L)*Bw(P*P+O*O)))/2),E=Bw(D[0]*D[0]+D[1]*D[1]);_=Fw(m,(i-E)/(R-1)),x=Fw(v,(n-E)/(R+1))}}if(s>Vw)if(x>Vw){var N=Fa(I,A,b,w,n,x,l),B=Fa(T,C,S,M,n,x,l); -t.moveTo(p+N.cx+N.x01,f+N.cy+N.y01),v>x?t.arc(p+N.cx,f+N.cy,x,Ew(N.y01,N.x01),Ew(B.y01,B.x01),!l):(t.arc(p+N.cx,f+N.cy,x,Ew(N.y01,N.x01),Ew(N.y11,N.x11),!l),t.arc(p,f,n,Ew(N.cy+N.y11,N.cx+N.x11),Ew(B.cy+B.y11,B.cx+B.x11),!l),t.arc(p+B.cx,f+B.cy,x,Ew(B.y11,B.x11),Ew(B.y01,B.x01),!l))}else t.moveTo(p+b,f+w),t.arc(p,f,n,u,h,!l);else t.moveTo(p+b,f+w);if(i>Vw&&s>Vw)if(_>Vw){var N=Fa(S,M,T,C,i,-_,l),B=Fa(b,w,I,A,i,-_,l);t.lineTo(p+N.cx+N.x01,f+N.cy+N.y01),m>_?t.arc(p+N.cx,f+N.cy,_,Ew(N.y01,N.x01),Ew(B.y01,B.x01),!l):(t.arc(p+N.cx,f+N.cy,_,Ew(N.y01,N.x01),Ew(N.y11,N.x11),!l),t.arc(p,f,i,Ew(N.cy+N.y11,N.cx+N.x11),Ew(B.cy+B.y11,B.cx+B.x11),l),t.arc(p+B.cx,f+B.cy,_,Ew(B.y11,B.x11),Ew(B.y01,B.x01),!l))}else t.lineTo(p+S,f+M),t.arc(p,f,i,h,u,l);else t.lineTo(p+S,f+M)}else t.moveTo(p,f);t.closePath()}}function Ha(t,e,n,i,r,o,a){var s=.5*(n-t),l=.5*(i-e);return(2*(e-n)+s+l)*a+(-3*(e-n)-2*s-l)*o+s*r+e}function Ga(t,e){for(var n=t.length,i=[],r=0,o=1;n>o;o++)r+=ce(t[o-1],t[o]);var a=r/2;a=n>a?n:a;for(var o=0;a>o;o++){var s=o/(a-1)*(e?n:n-1),l=Math.floor(s),u=s-l,h=void 0,c=t[l%n],p=void 0,f=void 0;e?(h=t[(l-1+n)%n],p=t[(l+1)%n],f=t[(l+2)%n]):(h=t[0===l?l:l-1],p=t[l>n-2?n-1:l+1],f=t[l>n-3?n-1:l+2]);var d=u*u,g=u*d;i.push([Ha(h[0],c[0],p[0],f[0],u,d,g),Ha(h[1],c[1],p[1],f[1],u,d,g)])}return i}function Wa(t,e,n,i){var r,o,a,s,l=[],u=[],h=[],c=[];if(i){a=[1/0,1/0],s=[-1/0,-1/0];for(var p=0,f=t.length;f>p;p++)ye(a,a,t[p]),ve(s,s,t[p]);ye(a,a,i[0]),ve(s,s,i[1])}for(var p=0,f=t.length;f>p;p++){var d=t[p];if(n)r=t[p?p-1:f-1],o=t[(p+1)%f];else{if(0===p||p===f-1){l.push(Q(t[p]));continue}r=t[p-1],o=t[p+1]}ie(u,o,r),ue(u,u,e);var g=ce(d,r),y=ce(d,o),v=g+y;0!==v&&(g/=v,y/=v),ue(h,u,-g),ue(c,u,y);var m=ee([],d,h),_=ee([],d,c);i&&(ve(m,m,a),ye(m,m,s),ve(_,_,a),ye(_,_,s)),l.push(m),l.push(_)}return n&&l.push(l.shift()),l}function Ua(t,e,n){var i=e.smooth,r=e.points;if(r&&r.length>=2){if(i&&"spline"!==i){var o=Wa(r,i,n,e.smoothConstraint);t.moveTo(r[0][0],r[0][1]);for(var a=r.length,s=0;(n?a:a-1)>s;s++){var l=o[2*s],u=o[2*s+1],h=r[(s+1)%a];t.bezierCurveTo(l[0],l[1],u[0],u[1],h[0],h[1])}}else{"spline"===i&&(r=Ga(r,n)),t.moveTo(r[0][0],r[0][1]);for(var s=1,c=r.length;c>s;s++)t.lineTo(r[s][0],r[s][1])}n&&t.closePath()}}function Xa(t,e,n){var i=t.cpx2,r=t.cpy2;return null===i||null===r?[(n?Gr:Hr)(t.x1,t.cpx1,t.cpx2,t.x2,e),(n?Gr:Hr)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(n?Zr:qr)(t.x1,t.cpx1,t.x2,e),(n?Zr:qr)(t.y1,t.cpy1,t.y2,e)]}function Ya(t){return Rb.extend(t)}function ja(t,e){return vS(t,e)}function qa(t,e){yS[t]=e}function Za(t){return yS.hasOwnProperty(t)?yS[t]:void 0}function Ka(t,e,n,i){var r=Ea(t,e);return n&&("center"===i&&(n=Ja(n,r.getBoundingRect())),Qa(r,n)),r}function $a(t,e,n){var i=new Fb({style:{image:t,x:e.x,y:e.y,width:e.width,height:e.height},onload:function(t){if("center"===n){var r={width:t.width,height:t.height};i.setStyle(Ja(e,r))}}});return i}function Ja(t,e){var n,i=e.width/e.height,r=t.height*i;r<=t.width?n=t.height:(r=t.width,n=r/i);var o=t.x+t.width/2,a=t.y+t.height/2;return{x:o-r/2,y:a-n/2,width:r,height:n}}function Qa(t,e){if(t.applyTransform){var n=t.getBoundingRect(),i=n.calculateTransform(e);t.applyTransform(i)}}function ts(t){return To(t.shape,t.shape,t.style),t}function es(t){return Co(t.shape,t.shape,t.style),t}function ns(t,e,n,i,r,o,a){var s,l=!1;"function"==typeof r?(a=o,o=r,r=null):D(r)&&(o=r.cb,a=r.during,l=r.isFrom,s=r.removeOpt,r=r.dataIndex);var u,h="update"===t,c="remove"===t;if(i&&i.ecModel){var p=i.ecModel.getUpdatePayload();u=p&&p.animation}var f=i&&i.isAnimationEnabled();if(c||e.stopAnimation("remove"),f){var d=void 0,g=void 0,y=void 0;u?(d=u.duration||0,g=u.easing||"cubicOut",y=u.delay||0):c?(s=s||{},d=z(s.duration,200),g=z(s.easing,"cubicOut"),y=0):(d=i.getShallow(h?"animationDurationUpdate":"animationDuration"),g=i.getShallow(h?"animationEasingUpdate":"animationEasing"),y=i.getShallow(h?"animationDelayUpdate":"animationDelay")),"function"==typeof y&&(y=y(r,i.getAnimationDelayParams?i.getAnimationDelayParams(e,r):null)),"function"==typeof d&&(d=d(r)),d>0?l?e.animateFrom(n,{duration:d,delay:y||0,easing:g,done:o,force:!!o||!!a,scope:t,during:a}):e.animateTo(n,{duration:d,delay:y||0,easing:g,done:o,force:!!o||!!a,setToFinal:!0,scope:t,during:a}):(e.stopAnimation(),!l&&e.attr(n),o&&o())}else e.stopAnimation(),!l&&e.attr(n),a&&a(1),o&&o()}function is(t,e,n,i,r,o){ns("update",t,e,n,i,r,o)}function rs(t,e,n,i,r,o){ns("init",t,e,n,i,r,o)}function os(t,e,n,i,r,o){ls(t)||ns("remove",t,e,n,i,r,o)}function as(t,e,n,i){t.removeTextContent(),t.removeTextGuideLine(),os(t,{style:{opacity:0}},e,n,i)}function ss(t,e,n){function i(){t.parent&&t.parent.remove(t)}t.isGroup?t.traverse(function(t){t.isGroup||as(t,e,n,i)}):as(t,e,n,i)}function ls(t){if(!t.__zr)return!0;for(var e=0;eMath.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"}function ps(t){return!t.isGroup}function fs(t){return null!=t.shape}function ds(t,e,n){function i(t){var e={};return t.traverse(function(t){ps(t)&&t.anid&&(e[t.anid]=t)}),e}function r(t){var e={x:t.x,y:t.y,rotation:t.rotation};return fs(t)&&(e.shape=h({},t.shape)),e}if(t&&e){var o=i(t);e.traverse(function(t){if(ps(t)&&t.anid){var e=o[t.anid];if(e){var i=r(t);t.attr(r(e)),is(t,i,n,Kb(t).dataIndex)}}})}}function gs(t,e){return v(t,function(t){var n=t[0];n=dS(n,e.x),n=gS(n,e.x+e.width);var i=t[1];return i=dS(i,e.y),i=gS(i,e.y+e.height),[n,i]})}function ys(t,e){var n=dS(t.x,e.x),i=gS(t.x+t.width,e.x+e.width),r=dS(t.y,e.y),o=gS(t.y+t.height,e.y+e.height);return i>=n&&o>=r?{x:n,y:r,width:i-n,height:o-r}:void 0}function vs(t,e,n){var i=h({rectHover:!0},e),r=i.style={strokeNoScale:!0};return n=n||{x:-1,y:-1,width:2,height:2},t?0===t.indexOf("image://")?(r.image=t.slice(8),c(r,n),new Fb(i)):Ka(t.replace("path://",""),i,n,"center"):void 0}function ms(t,e,n,i,r){for(var o=0,a=r[r.length-1];og||g>1)return!1;var y=xs(f,d,h,c)/p;return 0>y||y>1?!1:!0}function xs(t,e,n,i){return t*i-n*e}function bs(t){return 1e-6>=t&&t>=-1e-6}function ws(t){var e=t.itemTooltipOption,n=t.componentModel,i=t.itemName,r=C(e)?{formatter:e}:e,o=n.mainType,a=n.componentIndex,s={componentType:o,name:i,$vars:["name"]};s[o+"Index"]=a;var l=t.formatterParamsExtra;l&&y(b(l),function(t){Z(s,t)||(s[t]=l[t],s.$vars.push(t))});var u=Kb(t.el);u.componentMainType=o,u.componentIndex=a,u.tooltipConfig={name:i,option:c({content:i,formatterParams:s},r)}}function Ss(t,e){for(var n=0;n=0&&n.push(t)}),n}t.topologicalTravel=function(t,e,i,r){function o(t){l[t].entryCount--,0===l[t].entryCount&&u.push(t)}function a(t){h[t]=!0,o(t)}if(t.length){var s=n(e),l=s.graph,u=s.noEntryList,h={};for(y(t,function(t){h[t]=!0});u.length;){var c=u.pop(),p=l[c],f=!!h[c];f&&(i.call(r,c,p.originalDeps.slice()),delete h[c]),y(p.successor,f?a:o)}y(h,function(){var t="";throw new Error(t)})}}}function zs(t,e){return l(l({},t,!0),e,!0)}function Fs(t,e){t=t.toUpperCase(),WS[t]=new ES(e),GS[t]=e}function Vs(t){if(C(t)){var e=GS[t.toUpperCase()]||{};return t===FS||t===VS?s(e):l(s(e),s(GS[HS]),!1)}return l(s(t),s(GS[HS]),!1)}function Hs(t){return WS[t]}function Gs(){return WS[HS]}function Ws(t,e){return t+="","0000".substr(0,e-t.length)+t}function Us(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function Xs(t){return t===Us(t)}function Ys(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function js(t,e,n,i){var r=Ai(t),o=r[$s(n)](),a=r[Js(n)]()+1,s=Math.floor((a-1)/4)+1,l=r[Qs(n)](),u=r["get"+(n?"UTC":"")+"Day"](),h=r[tl(n)](),c=(h-1)%12+1,p=r[el(n)](),f=r[nl(n)](),d=r[il(n)](),g=i instanceof ES?i:Hs(i||US)||Gs(),y=g.getModel("time"),v=y.get("month"),m=y.get("monthAbbr"),_=y.get("dayOfWeek"),x=y.get("dayOfWeekAbbr");return(e||"").replace(/{yyyy}/g,o+"").replace(/{yy}/g,o%100+"").replace(/{Q}/g,s+"").replace(/{MMMM}/g,v[a-1]).replace(/{MMM}/g,m[a-1]).replace(/{MM}/g,Ws(a,2)).replace(/{M}/g,a+"").replace(/{dd}/g,Ws(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,_[u]).replace(/{ee}/g,x[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Ws(h,2)).replace(/{H}/g,h+"").replace(/{hh}/g,Ws(c+"",2)).replace(/{h}/g,c+"").replace(/{mm}/g,Ws(p,2)).replace(/{m}/g,p+"").replace(/{ss}/g,Ws(f,2)).replace(/{s}/g,f+"").replace(/{SSS}/g,Ws(d,3)).replace(/{S}/g,d+"")}function qs(t,e,n,i,r){var o=null;if("string"==typeof n)o=n;else if("function"==typeof n)o=n(t.value,e,{level:t.level});else{var a=h({},KS);if(t.level>0)for(var s=0;s=0;--s)if(l[u]){o=l[u];break}o=o||a.none}if(M(o)){var f=null==t.level?0:t.level>=0?t.level:o.length+t.level;f=Math.min(f,o.length-1),o=o[f]}}return js(new Date(t.value),o,r,i)}function Zs(t,e){var n=Ai(t),i=n[Js(e)]()+1,r=n[Qs(e)](),o=n[tl(e)](),a=n[el(e)](),s=n[nl(e)](),l=n[il(e)](),u=0===l,h=u&&0===s,c=h&&0===a,p=c&&0===o,f=p&&1===r,d=f&&1===i;return d?"year":f?"month":p?"day":c?"hour":h?"minute":u?"second":"millisecond"}function Ks(t,e,n){var i="number"==typeof t?Ai(t):t;switch(e=e||Zs(t,n)){case"year":return i[$s(n)]();case"half-year":return i[Js(n)]()>=6?1:0;case"quarter":return Math.floor((i[Js(n)]()+1)/4);case"month":return i[Js(n)]();case"day":return i[Qs(n)]();case"half-day":return i[tl(n)]()/24;case"hour":return i[tl(n)]();case"minute":return i[el(n)]();case"second":return i[nl(n)]();case"millisecond":return i[il(n)]()}}function $s(t){return t?"getUTCFullYear":"getFullYear"}function Js(t){return t?"getUTCMonth":"getMonth"}function Qs(t){return t?"getUTCDate":"getDate"}function tl(t){return t?"getUTCHours":"getHours"}function el(t){return t?"getUTCMinutes":"getMinutes"}function nl(t){return t?"getUTCSeconds":"getSeconds"}function il(t){return t?"getUTCSeconds":"getSeconds"}function rl(t){return t?"setUTCFullYear":"setFullYear"}function ol(t){return t?"setUTCMonth":"setMonth"}function al(t){return t?"setUTCDate":"setDate"}function sl(t){return t?"setUTCHours":"setHours"}function ll(t){return t?"setUTCMinutes":"setMinutes"}function ul(t){return t?"setUTCSeconds":"setSeconds"}function hl(t){return t?"setUTCSeconds":"setSeconds"}function cl(t,e,n,i,r,o,a,s){var l=new jb({style:{text:t,font:e,align:n,verticalAlign:i,padding:r,rich:o,overflow:a?"truncate":null,lineHeight:s}});return l.getBoundingRect()}function pl(t){if(!Ei(t))return C(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function fl(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}function dl(t){return null==t?"":(t+"").replace(nM,function(t,e){return iM[e]})}function gl(t,e,n){function i(t){return t&&W(t)?t:"-"}function r(t){return!(null==t||isNaN(t)||!isFinite(t))}var o="{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}",a="time"===e,s=t instanceof Date;if(a||s){var l=a?Ai(t):t;if(!isNaN(+l))return js(l,o,n);if(s)return"-"}if("ordinal"===e)return I(t)?i(t):A(t)&&r(t)?t+"":"-";var u=Ri(t);return r(u)?pl(u):I(t)?i(t):"-"}function yl(t,e,n){M(e)||(e=[e]);var i=e.length;if(!i)return"";for(var r=e[0].$vars||[],o=0;os;s++)for(var l=0;l':'';var a=n.markerId||"markerX";return{renderMode:o,content:"{"+a+"|} ",style:"subItem"===r?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}}function ml(t,e,n){("week"===t||"month"===t||"quarter"===t||"half-year"===t||"year"===t)&&(t="MM-dd\nyyyy");var i=Ai(e),r=n?"UTC":"",o=i["get"+r+"FullYear"](),a=i["get"+r+"Month"]()+1,s=i["get"+r+"Date"](),l=i["get"+r+"Hours"](),u=i["get"+r+"Minutes"](),h=i["get"+r+"Seconds"](),c=i["get"+r+"Milliseconds"]();return t=t.replace("MM",Ws(a,2)).replace("M",a).replace("yyyy",o).replace("yy",o%100+"").replace("dd",Ws(s,2)).replace("d",s).replace("hh",Ws(l,2)).replace("h",l).replace("mm",Ws(u,2)).replace("m",u).replace("ss",Ws(h,2)).replace("s",h).replace("SSS",Ws(c,3))}function _l(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function xl(t,e){return e=e||"transparent",C(t)?t:D(t)?t.colorStops&&(t.colorStops[0]||{}).color||e:e}function bl(t,e){if("_blank"===e||"blank"===e){var n=window.open();n.opener=null,n.location.href=t}else window.open(t,e)}function wl(t,e,n,i,r){var o=0,a=0;null==i&&(i=1/0),null==r&&(r=1/0);var s=0;e.eachChild(function(l,u){var h,c,p=l.getBoundingRect(),f=e.childAt(u+1),d=f&&f.getBoundingRect();if("horizontal"===t){var g=p.width+(d?-d.x+p.x:0);h=o+g,h>i||l.newline?(o=0,h=g,a+=s+n,s=p.height):s=Math.max(s,p.height)}else{var y=p.height+(d?-d.y+p.y:0);c=a+y,c>r||l.newline?(o+=s+n,a=0,c=y,s=p.width):s=Math.max(s,p.width)}l.newline||(l.x=o,l.y=a,l.markRedraw(),"horizontal"===t?o=h+n:a=c+n)})}function Sl(t,e,n){n=eM(n||0);var i=e.width,r=e.height,o=_i(t.left,i),a=_i(t.top,r),s=_i(t.right,i),l=_i(t.bottom,r),u=_i(t.width,i),h=_i(t.height,r),c=n[2]+n[0],p=n[1]+n[3],f=t.aspect;switch(isNaN(u)&&(u=i-s-p-o),isNaN(h)&&(h=r-l-c-a),null!=f&&(isNaN(u)&&isNaN(h)&&(f>i/r?u=.8*i:h=.8*r),isNaN(u)&&(u=f*h),isNaN(h)&&(h=u/f)),isNaN(o)&&(o=i-s-u-p),isNaN(a)&&(a=r-l-h-c),t.left||t.right){case"center":o=i/2-u/2-n[3];break;case"right":o=i-u-p}switch(t.top||t.bottom){case"middle":case"center":a=r/2-h/2-n[0];break;case"bottom":a=r-h-c}o=o||0,a=a||0,isNaN(u)&&(u=i-p-o-(s||0)),isNaN(h)&&(h=r-c-a-(l||0));var d=new C_(o+n[3],a+n[0],u,h);return d.margin=n,d}function Ml(t){var e=t.layoutMode||t.constructor.layoutMode;return D(e)?e:e?{type:e}:null}function Tl(t,e,n){function i(n,i){var a={},l=0,u={},h=0,c=2;if(aM(n,function(e){u[e]=t[e]}),aM(n,function(t){r(e,t)&&(a[t]=u[t]=e[t]),o(a,t)&&l++,o(u,t)&&h++}),s[i])return o(e,n[1])?u[n[2]]=null:o(e,n[2])&&(u[n[1]]=null),u;if(h!==c&&l){if(l>=c)return a;for(var p=0;pi;i++)t.push(e+i)}function r(t){var e=t.dimsDef;return e?e.length:1}var o={},a=Pl(e);if(!a||!t)return o;var s,l,u=[],h=[],c=e.ecModel,p=IM(c).datasetMap,f=a.uid+"_"+n.seriesLayoutBy;t=t.slice(),y(t,function(e,n){var i=D(e)?e:t[n]={name:e};"ordinal"===i.type&&null==s&&(s=n,l=r(i)),o[i.name]=[]});var d=p.get(f)||p.set(f,{categoryWayDim:l,valueWayDim:0});return y(t,function(t,e){var n=t.name,a=r(t);if(null==s){var l=d.valueWayDim;i(o[n],l,a),i(h,l,a),d.valueWayDim+=a}else if(s===e)i(o[n],0,a),i(u,0,a);else{var l=d.categoryWayDim;i(o[n],l,a),i(h,l,a),d.categoryWayDim+=a}}),u.length&&(o.itemName=u),h.length&&(o.seriesName=h),o}function Ll(t,e,n){var i={},r=Pl(t);if(!r)return i;var o,a=e.sourceFormat,s=e.dimensionsDefine;(a===xM||a===bM)&&y(s,function(t,e){"name"===(D(t)?t.name:t)&&(o=e)});var l=function(){function t(t){return null!=t.v&&null!=t.n}for(var i={},r={},l=[],u=0,h=Math.min(5,n);h>u;u++){var c=El(e.data,a,e.seriesLayoutBy,s,e.startIndex,u);l.push(c);var p=c===CM.Not;if(p&&null==i.v&&u!==o&&(i.v=u),(null==i.n||i.n===i.v||!p&&l[i.n]===CM.Not)&&(i.n=u),t(i)&&l[i.n]!==CM.Not)return i;p||(c===CM.Might&&null==r.v&&u!==o&&(r.v=u),(null==r.n||r.n===r.v)&&(r.n=u))}return t(i)?i:t(r)?r:null}();if(l){i.value=[l.v];var u=null!=o?o:l.n;i.itemName=[u],i.seriesName=[u]}return i}function Pl(t){var e=t.get("data",!0);return e?void 0:lr(t.ecModel,"dataset",{index:t.get("datasetIndex",!0),id:t.get("datasetId",!0)},_x).models[0]}function Ol(t){return t.get("transform",!0)||t.get("fromTransformResult",!0)?lr(t.ecModel,"dataset",{index:t.get("fromDatasetIndex",!0),id:t.get("fromDatasetId",!0)},_x).models:[]}function Rl(t,e){return El(t.data,t.sourceFormat,t.seriesLayoutBy,t.dimensionsDefine,t.startIndex,e)}function El(t,e,n,i,r,o){function a(t){var e=C(t);return null!=t&&isFinite(t)&&""!==t?e?CM.Might:CM.Not:e&&"-"!==t?CM.Must:void 0}var s,l=5;if(L(t))return CM.Not;var u,h;if(i){var c=i[o];D(c)?(u=c.name,h=c.type):C(c)&&(u=c)}if(null!=h)return"ordinal"===h?CM.Must:CM.Not;if(e===_M){var p=t;if(n===TM){for(var f=p[o],d=0;d<(f||[]).length&&l>d;d++)if(null!=(s=a(f[r+d])))return s}else for(var d=0;dd;d++){var g=p[r+d];if(g&&null!=(s=a(g[o])))return s}}else if(e===xM){var y=t;if(!u)return CM.Not;for(var d=0;dd;d++){var v=y[d];if(v&&null!=(s=a(v[u])))return s}}else if(e===bM){var m=t;if(!u)return CM.Not;var f=m[u];if(!f||L(f))return CM.Not;for(var d=0;dd;d++)if(null!=(s=a(f[d])))return s}else if(e===mM)for(var _=t,d=0;d<_.length&&l>d;d++){var v=_[d],x=Gi(v);if(!M(x))return CM.Not;if(null!=(s=a(x[o])))return s}return CM.Not}function Nl(t,e,n){var i=AM.get(e);if(!i)return n;var r=i(t);return r?n.concat(r):n}function Bl(t,e){for(var n=t.length,i=0;n>i;i++)if(t[i].length>e)return t[i];return t[n-1]}function zl(t,e,n,i,r,o,a){o=o||t;var s=e(o),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(r))return u[r];var h=null!=a&&i?Bl(i,a):n;if(h=h||n,h&&h.length){var c=h[l];return r&&(u[r]=c),s.paletteIdx=(l+1)%h.length,c}}function Fl(t,e){e(t).paletteIdx=0,e(t).paletteNameMap={}}function Vl(t,e){if(e){var n=e.seriesIndex,i=e.seriesId,r=e.seriesName;return null!=n&&t.componentIndex!==n||null!=i&&t.id!==i||null!=r&&t.name!==r}}function Hl(t,e){var n=t.color&&!t.colorLayer;y(e,function(e,i){"colorLayer"===i&&n||cM.hasClass(i)||("object"==typeof e?t[i]=t[i]?l(t[i],e,!1):s(e):null==t[i]&&(t[i]=e))})}function Gl(t,e,n){if(M(e)){var i=Y();return y(e,function(t){if(null!=t){var e=Qi(t,null);null!=e&&i.set(t,!0)}}),_(n,function(e){return e&&i.get(e[t])})}var r=Qi(e,null);return _(n,function(e){return e&&null!=r&&e[t]===r})}function Wl(t,e){return e.hasOwnProperty("subType")?_(t,function(t){return t&&t.subType===e.subType}):t}function Ul(t){var e=Y();return t&&y(Vi(t.replaceMerge),function(t){e.set(t,!0)}),{replaceMergeMainTypeMap:e}}function Xl(t,e,n){function i(t){y(e,function(e){e(t,n)})}var r,o,a=[],s=t.baseOption,l=t.timeline,u=t.options,h=t.media,c=!!t.media,p=!!(u||l||s&&s.timeline);return s?(o=s,o.timeline||(o.timeline=l)):((p||c)&&(t.options=t.media=null),o=t),c&&M(h)&&y(h,function(t){t&&t.option&&(t.query?a.push(t):r||(r=t))}),i(o),y(u,function(t){return i(t)}),y(a,function(t){return i(t.option)}),{baseOption:o,timelineOptions:u||[],mediaDefault:r,mediaList:a}}function Yl(t,e,n){var i={width:e,height:n,aspectratio:e/n},r=!0;return y(t,function(t,e){var n=e.match(WM);if(n&&n[1]&&n[2]){var o=n[1],a=n[2].toLowerCase();jl(i[a],t,o)||(r=!1)}}),r}function jl(t,e,n){return"min"===n?t>=e:"max"===n?e>=t:t===e}function ql(t,e){return t.join(",")===e.join(",")}function Zl(t){var e=t&&t.itemStyle;if(e)for(var n=0,i=jM.length;i>n;n++){var r=jM[n],o=e.normal,a=e.emphasis;o&&o[r]&&(t[r]=t[r]||{},t[r].normal?l(t[r].normal,o[r]):t[r].normal=o[r],o[r]=null),a&&a[r]&&(t[r]=t[r]||{},t[r].emphasis?l(t[r].emphasis,a[r]):t[r].emphasis=a[r],a[r]=null)}}function Kl(t,e,n){if(t&&t[e]&&(t[e].normal||t[e].emphasis)){var i=t[e].normal,r=t[e].emphasis;i&&(n?(t[e].normal=t[e].emphasis=null,c(t[e],i)):t[e]=i),r&&(t.emphasis=t.emphasis||{},t.emphasis[e]=r,r.focus&&(t.emphasis.focus=r.focus),r.blurScope&&(t.emphasis.blurScope=r.blurScope))}}function $l(t){Kl(t,"itemStyle"),Kl(t,"lineStyle"),Kl(t,"areaStyle"),Kl(t,"label"),Kl(t,"labelLine"),Kl(t,"upperLabel"),Kl(t,"edgeLabel")}function Jl(t,e){var n=YM(t)&&t[e],i=YM(n)&&n.textStyle;if(i)for(var r=0,o=vx.length;o>r;r++){var a=vx[r];i.hasOwnProperty(a)&&(n[a]=i[a])}}function Ql(t){t&&($l(t),Jl(t,"label"),t.emphasis&&Jl(t.emphasis,"label"))}function tu(t){if(YM(t)){Zl(t),$l(t),Jl(t,"label"),Jl(t,"upperLabel"),Jl(t,"edgeLabel"),t.emphasis&&(Jl(t.emphasis,"label"),Jl(t.emphasis,"upperLabel"),Jl(t.emphasis,"edgeLabel"));var e=t.markPoint;e&&(Zl(e),Ql(e));var n=t.markLine;n&&(Zl(n),Ql(n));var i=t.markArea;i&&Ql(i);var r=t.data;if("graph"===t.type){r=r||t.nodes;var o=t.links||t.edges;if(o&&!L(o))for(var a=0;a=0;d--){var g=t[d];if(s||(p=g.data.rawIndexOf(g.stackedByDimension,c)),p>=0){var y=g.data.getByRawIndex(g.stackResultDimension,p);if(h>=0&&y>0||0>=h&&0>y){h+=y,f=y;break}}}return i[0]=h,i[1]=f,i});a.hostModel.setData(l),e.data=l})}function gu(t){return t instanceof $M}function yu(t,e,n,i){n=n||xu(t);var r=e.seriesLayoutBy,o=bu(t,n,r,e.sourceHeader,e.dimensions),a=new $M({data:t,sourceFormat:n,seriesLayoutBy:r,dimensionsDefine:o.dimensionsDefine,startIndex:o.startIndex,dimensionsDetectedCount:o.dimensionsDetectedCount,encodeDefine:_u(i),metaRawOption:s(e)}); -return a}function vu(t){return new $M({data:t,sourceFormat:L(t)?wM:mM})}function mu(t){return new $M({data:t.data,sourceFormat:t.sourceFormat,seriesLayoutBy:t.seriesLayoutBy,dimensionsDefine:s(t.dimensionsDefine),startIndex:t.startIndex,dimensionsDetectedCount:t.dimensionsDetectedCount,encodeDefine:_u(t.encodeDefine)})}function _u(t){return t?Y(t):null}function xu(t){var e=SM;if(L(t))e=wM;else if(M(t)){0===t.length&&(e=_M);for(var n=0,i=t.length;i>n;n++){var r=t[n];if(null!=r){if(M(r)){e=_M;break}if(D(r)){e=xM;break}}}}else if(D(t))for(var o in t)if(Z(t,o)&&g(t[o])){e=bM;break}return e}function bu(t,e,n,i,r){var o,a;if(!t)return{dimensionsDefine:Su(r),startIndex:a,dimensionsDetectedCount:o};if(e===_M){var s=t;"auto"===i||null==i?Mu(function(t){null!=t&&"-"!==t&&(C(t)?null==a&&(a=1):a=0)},n,s,10):a=A(i)?i:i?1:0,r||1!==a||(r=[],Mu(function(t,e){r[e]=null!=t?t+"":""},n,s,1/0)),o=r?r.length:n===TM?s.length:s[0]?s[0].length:null}else if(e===xM)r||(r=wu(t));else if(e===bM)r||(r=[],y(t,function(t,e){r.push(e)}));else if(e===mM){var l=Gi(t[0]);o=M(l)&&l.length||1}return{startIndex:a,dimensionsDefine:Su(r),dimensionsDetectedCount:o}}function wu(t){for(var e,n=0;nr;r++)t(n[r]?n[r][0]:null,r);else for(var o=n[0]||[],r=0;rr;r++)t(o[r],r)}function Tu(t,e){var n=tT[Au(t,e)];return n}function Cu(t,e){var n=nT[Au(t,e)];return n}function Iu(t){var e=rT[t];return e}function Au(t,e){return t===_M?t+"_"+e:t}function Du(t,e,n){if(t){var i=t.getRawDataItem(e);if(null!=i){var r,o,a=t.getProvider().getSource().sourceFormat,s=t.getDimensionInfo(n);return s&&(r=s.name,o=s.index),Iu(a)(i,o,r)}}}function ku(t){var e,n;return D(t)?t.type&&(n=t):e=t,{markupText:e,markupFragment:n}}function Lu(t){return new sT(t)}function Pu(t,e){var n=e&&e.type;if("ordinal"===n){var i=e&&e.ordinalMeta;return i?i.parseAndCollect(t):t}return"time"===n&&"number"!=typeof t&&null!=t&&"-"!==t&&(t=+Ai(t)),null==t||""===t?0/0:+t}function Ou(t,e){var n=new cT,i=t.data,r=n.sourceFormat=t.sourceFormat,o=t.startIndex,a="";t.seriesLayoutBy!==MM&&Fi(a);var s=[],l={},u=t.dimensionsDefine;if(u)y(u,function(t,e){var n=t.name,i={index:e,name:n,displayName:t.displayName};if(s.push(i),null!=n){var r="";Z(l,n)&&Fi(r),l[n]=i}});else for(var h=0;ho;o++)r.push(n[o].slice());return r}if(e===xM){for(var r=[],o=0,a=n.length;a>o;o++)r.push(h({},n[o]));return r}}function Nu(t,e,n){return null!=n?"number"==typeof n||!isNaN(n)&&!Z(e,n)?t[n]:Z(e,n)?e[n]:void 0:void 0}function Bu(t){return s(t)}function zu(t){t=s(t);var e=t.type,n="";e||Fi(n);var i=e.split(":");2!==i.length&&Fi(n);var r=!1;"echarts"===i[0]&&(e=i[1],r=!0),t.__isBuiltIn=r,pT.set(e,t)}function Fu(t,e,n){var i=Vi(t),r=i.length,o="";r||Fi(o);for(var a=0,s=r;s>a;a++){var l=i[a];e=Vu(l,e,n,1===r?null:a),a!==s-1&&(e.length=Math.max(e.length,1))}return e}function Vu(t,e){var n="";e.length||Fi(n),D(t)||Fi(n);var i=t.type,r=pT.get(i);r||Fi(n);var o=v(e,function(t){return Ou(t,r)}),a=Vi(r.transform({upstream:o[0],upstreamList:o,config:s(t.config)}));return v(a,function(t,n){var i="";D(t)||Fi(i),t.data||Fi(i);var r=xu(t.data);Hu(r)||Fi(i);var o,a=e[0];if(a&&0===n&&!t.dimensions){var s=a.startIndex;s&&(t.data=a.data.slice(0,s).concat(t.data)),o={seriesLayoutBy:MM,sourceHeader:s,dimensions:a.metaRawOption.dimensions}}else o={seriesLayoutBy:MM,sourceHeader:0,dimensions:t.dimensions};return yu(t.data,o,null,null)})}function Hu(t){return t===_M||t===xM}function Gu(t){var e=t.option.transform;e&&U(t.option.transform)}function Wu(t){return"series"===t.mainType}function Uu(t){throw new Error(t)}function Xu(t,e){var n=t.color||"#6e7079",i=t.fontSize||12,r=t.fontWeight||"400",o=t.color||"#464646",a=t.fontSize||14,s=t.fontWeight||"900";return"html"===e?{nameStyle:"font-size:"+dl(i+"")+"px;color:"+dl(n)+";font-weight:"+dl(r+""),valueStyle:"font-size:"+dl(a+"")+"px;color:"+dl(o)+";font-weight:"+dl(s+"")}:{nameStyle:{fontSize:i,fill:n,fontWeight:r},valueStyle:{fontSize:a,fill:o,fontWeight:s}}}function Yu(t,e){return e.type=t,e}function ju(t){return Z(vT,t.type)&&vT[t.type]}function qu(t,e,n,i){var r=[],o=e.blocks||[];G(!o||M(o)),o=o||[];var a=t.orderMode;if(e.sortBlocks&&a){o=o.slice();var s={valueAsc:"asc",valueDesc:"desc"};if(Z(s,a)){var l=new hT(s[a],null);o.sort(function(t,e){return l.evaluate(t.sortParam,e.sortParam)})}else"seriesDesc"===a&&o.reverse()}var u=Ku(e);return y(o,function(e,n){var o=ju(e).build(t,e,n>0?u.html:0,i);null!=o&&r.push(o)}),r.length?"richText"===t.renderMode?r.join(u.richText):$u(r.join(""),n):void 0}function Zu(t,e,n,i,r,o){if(t){var a=ju(t);a.planLayout(t);var s={useUTC:r,renderMode:n,orderMode:i,markupStyleCreator:e};return a.build(s,t,0,o)}}function Ku(t){var e=t.__gapLevelBetweenSubBlocks;return{html:gT[e],richText:yT[e]}}function $u(t,e){var n='
            ',i="margin: "+e+"px 0 0";return'
            '+t+n+"
            "}function Ju(t,e,n){var i=e?"margin-left:2px":"";return''+dl(t)+""}function Qu(t,e,n,i){var r=n?"10px":"20px",o=e?"float:right;margin-left:"+r:"";return''+v(t,function(t){return dl(t)}).join("  ")+""}function th(t,e,n){return t.markupStyleCreator.wrapRichTextStyle(e,n)}function eh(t,e,n,i,r){var o=[r],a=i?10:20;return n&&o.push({padding:[0,0,0,a],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(e.join(" "),o)}function nh(t,e){var n=t.getData().getItemVisual(e,"style"),i=n[t.visualDrawType];return xl(i)}function ih(t,e){var n=t.get("padding");return null!=n?n:"richText"===e?[8,10]:10}function rh(t){var e,n,i,r,o=t.series,a=t.dataIndex,s=t.multipleSeries,l=o.getData(),u=l.mapDimensionsAll("defaultedTooltip"),h=u.length,c=o.getRawValue(a),p=M(c),f=nh(o,a);if(h>1||p&&!h){var d=oh(c,o,a,u,f);e=d.inlineValues,n=d.inlineValueTypes,i=d.blocks,r=d.inlineValues[0]}else if(h){var g=l.getDimensionInfo(u[0]);r=e=Du(l,a,u[0]),n=g.type}else r=e=p?c[0]:c;var y=tr(o),v=y&&o.name||"",m=l.getName(a),_=s?v:m;return Yu("section",{header:v,noHeader:s||!y,sortParam:r,blocks:[Yu("nameValue",{markerType:"item",markerColor:f,name:_,noName:!W(_),value:e,valueType:n})].concat(i||[])})}function oh(t,e,n,i,r){function o(t,e){var n=a.getDimensionInfo(e);n&&n.otherDims.tooltip!==!1&&(s?h.push(Yu("nameValue",{markerType:"subItem",markerColor:r,name:n.displayName,value:t,valueType:n.type})):(l.push(t),u.push(n.type)))}var a=e.getData(),s=m(t,function(t,e,n){var i=a.getDimensionInfo(n);return t=t||i&&i.tooltip!==!1&&null!=i.displayName},!1),l=[],u=[],h=[];return i.length?y(i,function(t){o(Du(a,n,t),t)}):y(t,o),{inlineValues:l,inlineValueTypes:u,blocks:h}}function ah(t,e){return t.getName(e)||t.getId(e)}function sh(t){var e=t.name;tr(t)||(t.name=lh(t)||e)}function lh(t){var e=t.getRawData(),n=e.mapDimensionsAll("seriesName"),i=[];return y(n,function(t){var n=e.getDimensionInfo(t);n.displayName&&i.push(n.displayName)}),i.join(" ")}function uh(t){return t.model.getRawData().count()}function hh(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),ch}function ch(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function ph(t,e){y(n(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),function(n){t.wrapMethod(n,S(fh,e))})}function fh(t,e){var n=dh(t);return n&&n.setOutputEnd((e||this).count()),e}function dh(t){var e=(t.ecModel||{}).scheduler,n=e&&e.getPipeline(t.uid);if(n){var i=n.currentTask;if(i){var r=i.agentStubMap;r&&(i=r.get(t.uid))}return i}}function gh(){var t=or();return function(e){var n=t(e),i=e.pipelineContext,r=!!n.large,o=!!n.progressiveRender,a=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(r===a&&o===s)&&"reset"}}function yh(t,e,n){t&&("emphasis"===e?ea:na)(t,n)}function vh(t,e,n){var i=rr(t,e),r=e&&null!=e.highlightKey?Sa(e.highlightKey):null;null!=i?y(Vi(i),function(e){yh(t.getItemGraphicEl(e),n,r)}):t.eachItemGraphicEl(function(t){yh(t,n,r)})}function mh(t){return ST(t.model)}function _h(t){var e=t.model,n=t.ecModel,i=t.api,r=t.payload,o=e.pipelineContext.progressiveRender,a=t.view,s=r&&wT(r).updateMethod,l=o?"incrementalPrepareRender":s&&a[s]?s:"render";return"render"!==l&&a[l](e,n,i,r),CT[l]}function xh(t,e,n){function i(){h=(new Date).getTime(),c=null,t.apply(a,s||[])}var r,o,a,s,l,u=0,h=0,c=null;e=e||0;var p=function(){for(var t=[],p=0;p=0?i():c=setTimeout(i,-o),u=r};return p.clear=function(){c&&(clearTimeout(c),c=null)},p.debounceNextCall=function(t){l=t},p}function bh(t,e,n,i){var r=t[e];if(r){var o=r[IT]||r,a=r[DT],s=r[AT];if(s!==n||a!==i){if(null==n||!i)return t[e]=o;r=t[e]=xh(o,n,"debounce"===i),r[IT]=o,r[DT]=i,r[AT]=n}return r}}function wh(t,e){var n=t.visualStyleMapper||LT[e];return n?n:(console.warn("Unkown style type '"+e+"'."),LT.itemStyle)}function Sh(t,e){var n=t.visualDrawType||PT[e];return n?n:(console.warn("Unkown style type '"+e+"'."),"fill")}function Mh(t,e){e=e||{},c(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var n=new ox,i=new Wb({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});n.add(i);var r=new jb({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),o=new Wb({style:{fill:"none"},textContent:r,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});n.add(o);var a;return e.showSpinner&&(a=new nS({shape:{startAngle:-BT/2,endAngle:-BT/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001}),a.animateShape(!0).when(1e3,{endAngle:3*BT/2}).start("circularInOut"),a.animateShape(!0).when(1e3,{startAngle:3*BT/2}).delay(300).start("circularInOut"),n.add(a)),n.resize=function(){var n=r.getBoundingRect().width,s=e.showSpinner?e.spinnerRadius:0,l=(t.getWidth()-2*s-(e.showSpinner&&n?10:0)-n)/2-(e.showSpinner&&n?0:5+n/2)+(e.showSpinner?0:n/2)+(n?0:s),u=t.getHeight()/2;e.showSpinner&&a.setShape({cx:l,cy:u}),o.setShape({x:l-s,y:u-s,width:2*s,height:2*s}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},n.resize(),n}function Th(t){t.overallReset(t.ecModel,t.api,t.payload)}function Ch(t){return t.overallProgress&&Ih}function Ih(){this.agent.dirty(),this.getDownstream().dirty()}function Ah(){this.agent&&this.agent.dirty()}function Dh(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function kh(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=Vi(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?v(e,function(t,e){return Lh(e)}):FT}function Lh(t){return function(e,n){var i=n.data,r=n.resetDefines[t];if(r&&r.dataEach)for(var o=e.start;or&&(r+=JT);var f=Math.atan2(s,a);if(0>f&&(f+=JT),f>=i&&r>=f||f+JT>=i&&r>=f+JT)return l[0]=h,l[1]=c,u-n;var d=n*Math.cos(i)+t,g=n*Math.sin(i)+e,y=n*Math.cos(r)+t,v=n*Math.sin(r)+e,m=(d-a)*(d-a)+(g-s)*(g-s),_=(y-a)*(y-a)+(v-s)*(v-s);return _>m?(l[0]=d,l[1]=g,Math.sqrt(m)):(l[0]=y,l[1]=v,Math.sqrt(_))}function Fh(t,e,n,i,r,o,a,s){var l=r-t,u=o-e,h=n-t,c=i-e,p=Math.sqrt(h*h+c*c);h/=p,c/=p;var f=l*h+u*c,d=f/p;s&&(d=Math.min(Math.max(d,0),1)),d*=p;var g=a[0]=t+d*h,y=a[1]=e+d*c;return Math.sqrt((g-r)*(g-r)+(y-o)*(y-o))}function Vh(t,e,n,i,r,o,a){0>n&&(t+=n,n=-n),0>i&&(e+=i,i=-i);var s=t+n,l=e+i,u=a[0]=Math.min(Math.max(r,t),s),h=a[1]=Math.min(Math.max(o,e),l);return Math.sqrt((u-r)*(u-r)+(h-o)*(h-o))}function Hh(t,e,n){var i=Vh(e.x,e.y,e.width,e.height,t.x,t.y,eC);return n.set(eC[0],eC[1]),i}function Gh(t,e,n){for(var i,r,o=0,a=0,s=0,l=0,u=1/0,h=e.data,c=t.x,p=t.y,f=0;f=f&&(s=i,l=r);var S=(c-y)*_/m+y;g=zh(y,v,_,x,x+b,w,S,p,eC),o=Math.cos(x+b)*m+y,a=Math.sin(x+b)*_+v;break;case QT.R:s=o=h[f++],l=a=h[f++];var M=h[f++],T=h[f++];g=Vh(s,l,M,T,c,p,eC);break;case QT.Z:g=Fh(o,a,s,l,c,p,eC,!0),o=s,a=l}u>g&&(u=g,n.set(eC[0],eC[1]))}return u}function Wh(t,e){if(t){var n=t.getTextGuideLine(),i=t.getTextContent();if(i&&n){var r=t.textGuideLineConfig||{},o=[[0,0],[0,0],[0,0]],a=r.candidates||tC,s=i.getBoundingRect().clone();s.applyTransform(i.getComputedTransform());var l=1/0,u=r.anchor,h=t.getComputedTransform(),c=h&&Xe([],h),p=e.get("length2")||0;u&&rC.copy(u);for(var f=0;fy&&(l=y,iC.transform(h),rC.transform(h),rC.toArray(o[0]),iC.toArray(o[1]),nC.toArray(o[2]))}Uh(o,e.get("minTurnAngle")),n.setShape({points:o})}}}function Uh(t,e){if(180>=e&&e>0){e=e/180*Math.PI,nC.fromArray(t[0]),iC.fromArray(t[1]),rC.fromArray(t[2]),v_.sub(oC,nC,iC),v_.sub(aC,rC,iC);var n=oC.len(),i=aC.len();if(!(.001>n||.001>i)){oC.scale(1/n),aC.scale(1/i);var r=oC.dot(aC),o=Math.cos(e);if(r>o){var a=Fh(iC.x,iC.y,rC.x,rC.y,nC.x,nC.y,sC,!1);lC.fromArray(sC),lC.scaleAndAdd(aC,a/Math.tan(Math.PI-e));var s=rC.x!==iC.x?(lC.x-iC.x)/(rC.x-iC.x):(lC.y-iC.y)/(rC.y-iC.y);if(isNaN(s))return;0>s?v_.copy(lC,iC):s>1&&v_.copy(lC,rC),lC.toArray(t[1])}}}}function Xh(t,e,n){if(180>=n&&n>0){n=n/180*Math.PI,nC.fromArray(t[0]),iC.fromArray(t[1]),rC.fromArray(t[2]),v_.sub(oC,iC,nC),v_.sub(aC,rC,iC);var i=oC.len(),r=aC.len();if(!(.001>i||.001>r)){oC.scale(1/i),aC.scale(1/r);var o=oC.dot(e),a=Math.cos(n);if(a>o){var s=Fh(iC.x,iC.y,rC.x,rC.y,nC.x,nC.y,sC,!1);lC.fromArray(sC);var l=Math.PI/2,u=Math.acos(aC.dot(e)),h=l+u-n;if(h>=l)v_.copy(lC,rC);else{lC.scaleAndAdd(aC,s/Math.tan(Math.PI/2-h));var c=rC.x!==iC.x?(lC.x-iC.x)/(rC.x-iC.x):(lC.y-iC.y)/(rC.y-iC.y);if(isNaN(c))return;0>c?v_.copy(lC,iC):c>1&&v_.copy(lC,rC)}lC.toArray(t[1])}}}}function Yh(t,e,n,i){var r="normal"===n,o=r?t:t.ensureState(n);o.ignore=e;var a=i.get("smooth");a&&a===!0&&(a=.3),o.shape=o.shape||{},a>0&&(o.shape.smooth=a);var s=i.getModel("lineStyle").getLineStyle();r?t.useStyle(s):o.style=s}function jh(t,e){var n=e.smooth,i=e.points;if(i)if(t.moveTo(i[0][0],i[0][1]),n>0&&i.length>=3){var r=Cm(i[0],i[1]),o=Cm(i[1],i[2]);if(!r||!o)return t.lineTo(i[1][0],i[1][1]),void t.lineTo(i[2][0],i[2][1]);var a=Math.min(r,o)*n,s=de([],i[1],i[0],a/r),l=de([],i[1],i[2],a/o),u=de([],s,l,.5);t.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),t.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var h=1;ht){var i=Math.min(e,-t);if(i>0){l(i*n,0,c);var r=i+t;0>r&&u(-r*n,1)}else u(-t*n,1)}}function l(n,i,r){0!==n&&(d=!0);for(var o=i;r>o;o++){var a=t[o],s=a.rect;s[e]+=n,a.label[e]+=n}}function u(i,r){for(var o=[],a=0,s=1;c>s;s++){var u=t[s-1].rect,h=Math.max(t[s].rect[e]-u[e]-u[n],0);o.push(h),a+=h}if(a){var p=Math.min(Math.abs(i)/a,r);if(i>0)for(var s=0;c-1>s;s++){var f=o[s]*p;l(f,0,s+1)}else for(var s=c-1;s>0;s--){var f=o[s-1]*p;l(-f,s,c)}}}function h(t){var e=0>t?-1:1;t=Math.abs(t);for(var n=Math.ceil(t/(c-1)),i=0;c-1>i;i++)if(e>0?l(n,0,i+1):l(-n,c-i-1,c),t-=n,0>=t)return}var c=t.length;if(!(2>c)){t.sort(function(t,n){return t.rect[e]-n.rect[e]});for(var p,f=0,d=!1,g=[],y=0,v=0;c>v;v++){var m=t[v],_=m.rect;p=_[e]-f,0>p&&(_[e]-=p,m.label[e]-=p,d=!0);var x=Math.max(-p,0);g.push(x),y+=x,f=_[e]+_[n]}y>0&&o&&l(-y/c,0,c);var b,w,S=t[0],M=t[c-1];return a(),0>b&&u(-b,.8),0>w&&u(w,.8),a(),s(b,w,1),s(w,b,-1),a(),0>b&&h(-b),0>w&&h(w),d}}function Jh(t,e,n,i){return $h(t,"x","width",e,n,i)}function Qh(t,e,n,i){return $h(t,"y","height",e,n,i)}function tc(t){function e(t){if(!t.ignore){var e=t.ensureState("emphasis");null==e.ignore&&(e.ignore=!1)}t.ignore=!0}var n=[];t.sort(function(t,e){return e.priority-t.priority});for(var i=new C_(0,0,0,0),r=0;r0?(e=e||1,"dashed"===t?[4*e,2*e]:"dotted"===t?[e]:A(t)?[t]:M(t)?t:null):null}function gc(t){var e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))}function yc(t){var e=t.fill;return null!=e&&"none"!==e}function vc(t,e){if(null!=e.fillOpacity&&1!==e.fillOpacity){var n=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=n}else t.fill()}function mc(t,e){if(null!=e.strokeOpacity&&1!==e.strokeOpacity){var n=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=n}else t.stroke()}function _c(t,e,n){var i=Tr(e.image,e.__image,n);if(Ir(i)){var r=t.createPattern(i,e.repeat||"repeat");if("function"==typeof DOMMatrix&&r.setTransform){var o=new DOMMatrix;o.rotateSelf(0,0,(e.rotation||0)/Math.PI*180),o.scaleSelf(e.scaleX||1,e.scaleY||1),o.translateSelf(e.x||0,e.y||0),r.setTransform(o)}return r}}function xc(t,e,n,i){var r=gc(n),o=yc(n),a=n.strokePercent,s=1>a,l=!e.path;e.silent&&!s||!l||e.createPathProxy();var u=e.path||CC;if(!i){var h=n.fill,c=n.stroke,p=o&&!!h.colorStops,f=r&&!!c.colorStops,d=o&&!!h.image,g=r&&!!c.image,y=void 0,m=void 0,_=void 0,x=void 0,b=void 0;(p||f)&&(b=e.getBoundingRect()),p&&(y=e.__dirty?pc(t,h,b):e.__canvasFillGradient,e.__canvasFillGradient=y),f&&(m=e.__dirty?pc(t,c,b):e.__canvasStrokeGradient,e.__canvasStrokeGradient=m),d&&(_=e.__dirty||!e.__canvasFillPattern?_c(t,h,e):e.__canvasFillPattern,e.__canvasFillPattern=_),g&&(x=e.__dirty||!e.__canvasStrokePattern?_c(t,c,e):e.__canvasStrokePattern,e.__canvasStrokePattern=_),p?t.fillStyle=y:d&&(_?t.fillStyle=_:o=!1),f?t.strokeStyle=m:g&&(x?t.strokeStyle=x:r=!1)}var w=n.lineDash&&n.lineWidth>0&&dc(n.lineDash,n.lineWidth),S=n.lineDashOffset,M=!!t.setLineDash,T=e.getGlobalScale();if(u.setScale(T[0],T[1],e.segmentIgnoreThreshold),w){var C=n.strokeNoScale&&e.getLineScale?e.getLineScale():1;C&&1!==C&&(w=v(w,function(t){return t/C}),S/=C)}var I=!0;(l||e.__dirty&Rb.SHAPE_CHANGED_BIT||w&&!M&&r)&&(u.setDPR(t.dpr),s?u.setContext(null):(u.setContext(t),I=!1),u.reset(),w&&!M&&(u.setLineDash(w),u.setLineDashOffset(S)),e.buildPath(u,e.shape,i),u.toStatic(),e.pathUpdated()),I&&u.rebuildPath(t,s?a:1),w&&M&&(t.setLineDash(w),t.lineDashOffset=S),i||(n.strokeFirst?(r&&mc(t,n),o&&vc(t,n)):(o&&vc(t,n),r&&mc(t,n))),w&&M&&t.setLineDash([])}function bc(t,e,n){var i=e.__image=Tr(n.image,e.__image,e,e.onload);if(i&&Ir(i)){var r=n.x||0,o=n.y||0,a=e.getWidth(),s=e.getHeight(),l=i.width/i.height;if(null==a&&null!=s?a=s*l:null==s&&null!=a?s=a/l:null==a&&null==s&&(a=i.width,s=i.height),n.sWidth&&n.sHeight){var u=n.sx||0,h=n.sy||0;t.drawImage(i,u,h,n.sWidth,n.sHeight,r,o,a,s)}else if(n.sx&&n.sy){var u=n.sx,h=n.sy,c=a-u,p=s-h;t.drawImage(i,u,h,c,p,r,o,a,s)}else t.drawImage(i,r,o,a,s)}}function wc(t,e,n){var i=n.text;if(null!=i&&(i+=""),i){t.font=n.font||A_,t.textAlign=n.textAlign,t.textBaseline=n.textBaseline;var r=void 0;if(t.setLineDash){var o=n.lineDash&&n.lineWidth>0&&dc(n.lineDash,n.lineWidth),a=n.lineDashOffset;if(o){var s=n.strokeNoScale&&e.getLineScale?e.getLineScale():1;s&&1!==s&&(o=v(o,function(t){return t/s}),a/=s),t.setLineDash(o),t.lineDashOffset=a,r=!0}}n.strokeFirst?(gc(n)&&t.strokeText(i,n.x,n.y),yc(n)&&t.fillText(i,n.x,n.y)):(yc(n)&&t.fillText(i,n.x,n.y),gc(n)&&t.strokeText(i,n.x,n.y)),r&&t.setLineDash([])}}function Sc(t,e,n,i,r){var o=!1;if(!i&&(n=n||{},e===n))return!1;if(i||e.opacity!==n.opacity){o||(kc(t,r),o=!0);var a=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(a)?Ex.opacity:a}(i||e.blend!==n.blend)&&(o||(kc(t,r),o=!0),t.globalCompositeOperation=e.blend||Ex.blend);for(var s=0;so;o++){var l=i[o];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),Oc(t,l,s,o===a-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),s.prevEl=l}for(var u=0,h=r.length;h>u;u++){var l=r[u];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),Oc(t,l,s,u===h-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),s.prevEl=l}e.clearTemporalDisplayables(),e.notClear=!0,t.restore()}function Ec(t,e){function n(t){function e(){for(var t=1,e=0,n=m.length;n>e;++e)t=zi(t,m[e]);for(var i=1,e=0,n=v.length;n>e;++e)i=zi(i,v[e].length);t*=i;var r=_*m.length*v.length;return{width:Math.max(1,Math.min(t,s.maxTileWidth)),height:Math.max(1,Math.min(r,s.maxTileHeight))}}function n(){function t(t,e,n,a,l){var u=o?1:i,h=uc(l,t*u,e*u,n*u,a*u,s.color,s.symbolKeepAspect);o?b.appendChild(r.painter.paintOne(h)):Pc(d,h)}d&&(d.clearRect(0,0,x.width,x.height),s.backgroundColor&&(d.fillStyle=s.backgroundColor,d.fillRect(0,0,x.width,x.height)));for(var e=0,n=0;n=e))for(var a=-_,l=0,u=0,h=0;a=S)break;if(f%2===0){var M=.5*(1-s.symbolSize),T=p+g[h][f]*M,C=a+y[l]*M,I=g[h][f]*s.symbolSize,A=y[l]*s.symbolSize,D=m/2%v[c].length;t(T,C,I,A,v[c][D])}p+=g[h][f],++m,++f,f===g[h].length&&(f=0)}++h,h===g.length&&(h=0)}a+=y[l],++u,++l,l===y.length&&(l=0)}}for(var a=[i],l=!0,u=0;u0?parseInt(i,10)/100:i?parseFloat(i):0;var o={};Qc(n,o,o);var a=o.stopColor||n.getAttribute("stop-color")||"#000000";e.colorStops.push({offset:r,color:a})}n=n.nextSibling}}function Xc(t,e){t&&t.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),c(e.__inheritedStyle,t.__inheritedStyle))}function Yc(t){for(var e=$c(t),n=[],i=0;i0;o-=2){var a=i[o],s=i[o-1],l=void 0;switch(r=r||ze(),s){case"translate":l=$c(a),Ge(r,r,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":l=$c(a),Ue(r,r,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":l=$c(a),We(r,r,-parseFloat(l[0])/180*Math.PI);break;case"skew":l=$c(a),console.warn("Skew transform is not supported yet");break;case"matrix":l=$c(a),r[0]=parseFloat(l[0]),r[1]=parseFloat(l[1]),r[2]=parseFloat(l[2]),r[3]=parseFloat(l[3]),r[4]=parseFloat(l[4]),r[5]=parseFloat(l[5])}}e.setLocalTransform(r)}}function Qc(t,e,n){var i=t.getAttribute("style");if(i){XC.lastIndex=0;for(var r;null!=(r=XC.exec(i));){var o=r[1],a=Z(NC,o)?NC[o]:null;a&&(e[a]=r[2]);var s=Z(zC,o)?zC[o]:null;s&&(n[s]=r[2])}}}function tp(t,e,n){for(var i=0;i>1^-(1&s),l=l>>1^-(1&l),s+=r,l+=o,r=s,o=l,i.push([s/n,l/n])}return i}function up(t,e){return t=sp(t),v(_(t.features,function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0}),function(t){var n=t.properties,i=t.geometry,r=[];if("Polygon"===i.type){var o=i.coordinates;r.push({type:"polygon",exterior:o[0],interiors:o.slice(1)})}if("MultiPolygon"===i.type){var o=i.coordinates;y(o,function(t){t[0]&&r.push({type:"polygon",exterior:t[0],interiors:t.slice(1)})})}var a=new ZC(n[e||"name"],r,n.cp);return a.properties=n,a})}function hp(t,e){"china"===t&&e.push(new ZC("南海诸岛",v(tI,function(t){return{type:"polygon",exterior:t}}),QC))}function cp(t,e){if("china"===t){var n=iI[e.name];if(n){var i=e.getCenter();i[0]+=n[0]/10.5,i[1]+=-n[1]/14,e.setCenter(i)}}}function pp(t,e){if("world"===t){var n=rI[e.name];if(n){var i=[n[0],n[1]];e.setCenter(i)}}}function fp(t,e){"china"===t&&"台湾"===e.name&&e.geometries.push({type:"polygon",exterior:oI[0]})}function dp(t){for(var e,n=0;n=0)){kA.push(n);var o=zT.wrapStageHandler(n,r);o.__prio=e,o.__raw=n,t.push(o)}}function Np(t,e){SA[t]=e}function Bp(t){r("createCanvas",t)}function zp(t,e,n){uI.registerMap(t,e,n)}function Fp(t){return uI.getMapForUser(t)}function Vp(t){return null==t?0:t.length||1}function Hp(t){return t}function Gp(t){var e={},n=e.encode={},i=Y(),r=[],o=[],a=e.userOutput={dimensionNames:t.dimensions.slice(),encode:{}};y(t.dimensions,function(e){var s=t.getDimensionInfo(e),l=s.coordDim;if(l){var u=s.coordDimIndex;Wp(n,l)[u]=e,s.isExtraCoord||(i.set(l,1),Xp(s.type)&&(r[0]=e),Wp(a.encode,l)[u]=s.index),s.defaultTooltip&&o.push(e)}vM.each(function(t,e){var i=Wp(n,e),r=s.otherDims[e];null!=r&&r!==!1&&(i[r]=s.name)})});var s=[],l={};i.each(function(t,e){var i=n[e];l[e]=i[0],s=s.concat(i)}),e.dataDimsOnCoord=s,e.encodeFirstDimNotExtra=l;var u=n.label;u&&u.length&&(r=u.slice());var h=n.tooltip;return h&&h.length?o=h.slice():o.length||(o=r.slice()),n.defaultedLabel=r,n.defaultedTooltip=o,e}function Wp(t,e){return t.hasOwnProperty(e)||(t[e]=[]),t[e]}function Up(t){return"category"===t?"ordinal":"time"===t?"time":"float"}function Xp(t){return!("ordinal"===t||"time"===t)}function Yp(t,e,n){function i(t,e,n){null!=vM.get(e)?t.otherDims[e]=n:(t.coordDim=e,t.coordDimIndex=n,a.set(e,!0))}gu(e)||(e=vu(e)),n=n||{},t=(t||[]).slice();for(var r=(n.dimsDef||[]).slice(),o=Y(),a=Y(),l=[],u=jp(e,t,r,n.dimCount),p=0;u>p;p++){var f=r[p],d=r[p]=h({},D(f)?f:{name:f}),g=d.name,v=l[p]=new qA;null!=g&&null==o.get(g)&&(v.name=v.displayName=g,o.set(g,p)),null!=d.type&&(v.type=d.type),null!=d.displayName&&(v.displayName=d.displayName)}var m=n.encodeDef;!m&&n.encodeDefaulter&&(m=n.encodeDefaulter(e,u));var _=Y(m);_.each(function(t,e){var n=Vi(t).slice();if(1===n.length&&!C(n[0])&&n[0]<0)return void _.set(e,!1);var r=_.set(e,[]);y(n,function(t,n){var a=C(t)?o.get(t):t;null!=a&&u>a&&(r[n]=a,i(l[a],e,n))})});var x=0;y(t,function(t){var e,n,r,o;if(C(t))e=t,o={};else{o=t,e=o.name;var a=o.ordinalMeta;o.ordinalMeta=null,o=s(o),o.ordinalMeta=a,n=o.dimsDef,r=o.otherDims,o.name=o.coordDim=o.coordDimIndex=o.dimsDef=o.otherDims=null}var u=_.get(e);if(u!==!1){if(u=Vi(u),!u.length)for(var h=0;h<(n&&n.length||1);h++){for(;xT;T++){var v=l[T]=l[T]||new qA,I=v.coordDim;null==I&&(v.coordDim=qp(M,a,S),v.coordDimIndex=0,(!b||0>=w)&&(v.isExtraCoord=!0),w--),null==v.name&&(v.name=qp(v.coordDim,o,!1)),null!=v.type||Rl(e,T)!==CM.Must&&(!v.isExtraCoord||null==v.otherDims.itemName&&null==v.otherDims.seriesName)||(v.type="ordinal")}return l}function jp(t,e,n,i){var r=Math.max(t.dimensionsDetectedCount||1,e.length,n.length,i||0);return y(e,function(t){var e;D(t)&&(e=t.dimsDef)&&(r=Math.max(r,e.length))}),r}function qp(t,e,n){if(n||null!=e.get(t)){for(var i=0;null!=e.get(t+i);)i++;t+=i}return e.set(t,!0),t}function Zp(t,e){return e=e||{},Yp(e.coordDimensions||[],t,{dimsDef:e.dimensionsDefine||t.dimensionsDefine,encodeDef:e.encodeDefine||t.encodeDefine,dimCount:e.dimensionsCount,encodeDefaulter:e.encodeDefaulter,generateCoord:e.generateCoord,generateCoordCount:e.generateCoordCount})}function Kp(t){var e=t.get("coordinateSystem"),n=new lD(e),i=uD[e];return i?(i(t,n,n.axisMap,n.categoryAxisMap),n):void 0}function $p(t){return"category"===t.get("type")}function Jp(t,e,n){n=n||{};var i,r,o,a,s=n.byIndex,l=n.stackedCoordDimension,u=!(!t||!t.get("stack"));if(y(e,function(t,n){C(t)&&(e[n]=t={name:t}),u&&!t.isExtraCoord&&(s||i||!t.ordinalMeta||(i=t),r||"ordinal"===t.type||"time"===t.type||l&&l!==t.coordDim||(r=t))}),!r||s||i||(s=!0),r){o="__\x00ecstackresult",a="__\x00ecstackedover",i&&(i.createInvertedIndices=!0);var h=r.coordDim,c=r.type,p=0;y(e,function(t){t.coordDim===h&&p++}),e.push({name:o,coordDim:h,coordDimIndex:p,type:c,isExtraCoord:!0,isCalculationCoord:!0}),p++,e.push({name:a,coordDim:a,coordDimIndex:p,type:c,isExtraCoord:!0,isCalculationCoord:!0})}return{stackedDimension:r&&r.name,stackedByDimension:i&&i.name,isStackedByIndex:s,stackedOverDimension:a,stackResultDimension:o}}function Qp(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function tf(t,e){return Qp(t,e)?t.getCalculationInfo("stackResultDimension"):e}function ef(t,e,n){n=n||{},gu(t)||(t=vu(t));var i,r=e.get("coordinateSystem"),o=GM.get(r),a=Kp(e);a&&a.coordSysDims&&(i=v(a.coordSysDims,function(t){var e={name:t},n=a.axisMap.get(t);if(n){var i=n.get("type");e.type=Up(i)}return e})),i||(i=o&&(o.getDimensionsInfo?o.getDimensionsInfo():o.dimensions.slice())||["x","y"]);var s,l,u=n.useEncodeDefaulter,h=Zp(t,{coordDimensions:i,generateCoord:n.generateCoord,encodeDefaulter:T(u)?u:u?S(kl,i,e):null});a&&y(h,function(t,e){var i=t.coordDim,r=a.categoryAxisMap.get(i);r&&(null==s&&(s=e),t.ordinalMeta=r.getOrdinalMeta(),n.createInvertedIndices&&(t.createInvertedIndices=!0)),null!=t.otherDims.itemName&&(l=!0)}),l||null==s||(h[s].otherDims.itemName=0);var c=Jp(e,h),p=new sD(h,e);p.setCalculationInfo(c);var f=null!=s&&nf(t)?function(t,e,n,i){return i===s?n:this.defaultDimValueGetter(t,e,n,i)}:null;return p.hasItemOption=!1,p.initData(t,null,f),p}function nf(t){if(t.sourceFormat===mM){var e=rf(t.data||[]);return null!=e&&!M(Gi(e))}}function rf(t){for(var e=0;ea&&(a=r.interval=n),null!=i&&a>i&&(a=r.interval=i);var s=r.intervalPrecision=sf(a),l=r.niceTickExtent=[pD(Math.ceil(t[0]/a)*a,s),pD(Math.floor(t[1]/a)*a,s)];return uf(l,t),r}function sf(t){return Si(t)+2}function lf(t,e,n){t[e]=Math.max(Math.min(t[e],n[1]),n[0])}function uf(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),lf(t,0,e),lf(t,1,e),t[0]>t[1]&&(t[0]=t[1])}function hf(t,e){return t>=e[0]&&t<=e[1]}function cf(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function pf(t,e){return t*(e[1]-e[0])+e[0]}function ff(t){return t.get("stack")||yD+t.seriesIndex}function df(t){return t.dim+t.index}function gf(t,e){var n=[];return e.eachSeriesByType(t,function(t){bf(t)&&!wf(t)&&n.push(t)}),n}function yf(t){var e={};y(t,function(t){var n=t.coordinateSystem,i=n.getBaseAxis();if("time"===i.type||"value"===i.type)for(var r=t.getData(),o=i.dim+"_"+i.index,a=r.mapDimension(i.dim),s=0,l=r.count();l>s;++s){var u=r.get(a,s);e[o]?e[o].push(u):e[o]=[u]}});var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(r){r.sort(function(t,e){return t-e});for(var o=null,a=1;a0&&(o=null===o?s:Math.min(o,s))}n[i]=o}}return n}function vf(t){var e=yf(t),n=[];return y(t,function(t){var i,r=t.coordinateSystem,o=r.getBaseAxis(),a=o.getExtent();if("category"===o.type)i=o.getBandWidth();else if("value"===o.type||"time"===o.type){var s=o.dim+"_"+o.index,l=e[s],u=Math.abs(a[1]-a[0]),h=o.scale.getExtent(),c=Math.abs(h[1]-h[0]);i=l?u/c*l:u}else{var p=t.getData();i=Math.abs(a[1]-a[0])/p.count()}var f=_i(t.get("barWidth"),i),d=_i(t.get("barMaxWidth"),i),g=_i(t.get("barMinWidth")||1,i),y=t.get("barGap"),v=t.get("barCategoryGap");n.push({bandWidth:i,barWidth:f,barMaxWidth:d,barMinWidth:g,barGap:y,barCategoryGap:v,axisKey:df(o),stackId:ff(t)})}),mf(n)}function mf(t){var e={};y(t,function(t){var n=t.axisKey,i=t.bandWidth,r=e[n]||{bandWidth:i,remainedWidth:i,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},o=r.stacks;e[n]=r;var a=t.stackId;o[a]||r.autoWidthCount++,o[a]=o[a]||{width:0,maxWidth:0};var s=t.barWidth;s&&!o[a].width&&(o[a].width=s,s=Math.min(r.remainedWidth,s),r.remainedWidth-=s);var l=t.barMaxWidth;l&&(o[a].maxWidth=l);var u=t.barMinWidth;u&&(o[a].minWidth=u);var h=t.barGap;null!=h&&(r.gap=h);var c=t.barCategoryGap;null!=c&&(r.categoryGap=c)});var n={};return y(e,function(t,e){n[e]={};var i=t.stacks,r=t.bandWidth,o=t.categoryGap;if(null==o){var a=b(i).length;o=Math.max(35-4*a,15)+"%"}var s=_i(o,r),l=_i(t.gap,1),u=t.remainedWidth,h=t.autoWidthCount,c=(u-s)/(h+(h-1)*l);c=Math.max(c,0),y(i,function(t){var e=t.maxWidth,n=t.minWidth;if(t.width){var i=t.width;e&&(i=Math.min(i,e)),n&&(i=Math.max(i,n)),t.width=i,u-=i+l*i,h--}else{var i=c;e&&i>e&&(i=Math.min(e,u)),n&&n>i&&(i=n),i!==c&&(t.width=i,u-=i+l*i,h--)}}),c=(u-s)/(h+(h-1)*l),c=Math.max(c,0);var p,f=0;y(i,function(t){t.width||(t.width=c),p=t,f+=t.width*(1+l)}),p&&(f-=p.width*l);var d=-f/2;y(i,function(t,i){n[e][i]=n[e][i]||{bandWidth:r,offset:d,width:t.width},d+=t.width*(1+l)})}),n}function _f(t,e,n){if(t&&e){var i=t[df(e)];return null!=i&&null!=n?i[ff(n)]:i}}function xf(t,e){var n=gf(t,e),i=vf(n),r={};y(n,function(t){var e=t.getData(),n=t.coordinateSystem,o=n.getBaseAxis(),a=ff(t),s=i[df(o)][a],l=s.offset,u=s.width,h=n.getOtherAxis(o),c=t.get("barMinHeight")||0;r[a]=r[a]||[],e.setLayout({bandWidth:s.bandWidth,offset:l,size:u});for(var p=e.mapDimension(h.dim),f=e.mapDimension(o.dim),d=Qp(e,p),g=h.isHorizontal(),y=Sf(o,h,d),v=0,m=e.count();m>v;v++){var _=e.get(p,v),x=e.get(f,v),b=_>=0?"p":"n",w=y;d&&(r[a][x]||(r[a][x]={p:y,n:y}),w=r[a][x][b]);var S=void 0,M=void 0,T=void 0,C=void 0;if(g){var I=n.dataToPoint([_,x]);S=w,M=I[1]+l,T=I[0]-y,C=u,Math.abs(T)T?-1:1)*c),isNaN(T)||d&&(r[a][x][b]+=T)}else{var I=n.dataToPoint([x,_]);S=I[0]+l,M=w,T=u,C=I[1]-y,Math.abs(C)=C?-1:1)*c),isNaN(C)||d&&(r[a][x][b]+=C)}e.setItemLayout(v,{x:S,y:M,width:T,height:C})}})}function bf(t){return t.coordinateSystem&&"cartesian2d"===t.coordinateSystem.type}function wf(t){return t.pipelineContext&&t.pipelineContext.large}function Sf(t,e){return e.toGlobalCoord(e.dataToCoord("log"===e.type?1:0))}function Mf(t,e,n,i){var r=Ai(e),o=Ai(n),a=function(t){return Ks(r,t,i)===Ks(o,t,i)},s=function(){return a("year")},l=function(){return s()&&a("month")},u=function(){return l()&&a("day")},h=function(){return u()&&a("hour")},c=function(){return h()&&a("minute")},p=function(){return c()&&a("second")},f=function(){return p()&&a("millisecond")};switch(t){case"year":return s();case"month":return l();case"day":return u();case"hour":return h();case"minute":return c();case"second":return p();case"millisecond":return f()}}function Tf(t){return t/=qS,t>16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function Cf(t){var e=30*qS;return t/=e,t>6?6:t>3?3:t>2?2:1}function If(t){return t/=jS,t>12?12:t>6?6:t>3.5?4:t>2?2:1}function Af(t,e){return t/=e?YS:XS,t>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function Df(t){return Li(t,!0)}function kf(t,e,n){var i=new Date(t);switch(Us(e)){case"year":case"month":i[ol(n)](0);case"day":i[al(n)](1);case"hour":i[sl(n)](0);case"minute":i[ll(n)](0);case"second":i[ul(n)](0),i[hl(n)](0)}return i.getTime()}function Lf(t,e,n,i){function r(t,e,n,r,o,a,s){for(var l=new Date(e),u=e,h=l[r]();n>u&&u<=i[1];)s.push({value:u}),h+=t,l[o](h),u=l.getTime();s.push({value:u,notAdd:!0})}function o(t,o,a){var s=[],l=!o.length;if(!Mf(Us(t),i[0],i[1],n)){l&&(o=[{value:kf(new Date(i[0]),t,n)},{value:i[1]}]);for(var u=0;u1&&0===u&&a.unshift({value:a[0].value-p})}}for(var u=0;u=i[0]&&x<=i[1]&&c++)}var b=(i[1]-i[0])/e;if(c>1.5*b&&p>b/1.5)break;if(u.push(y),c>b||t===s[f])break}h=[]}}}for(var w=_(v(u,function(t){return _(t,function(t){return t.value>=i[0]&&t.value<=i[1]&&!t.notAdd})}),function(t){return t.length>0}),S=[],M=w.length-1,f=0;f0&&i>0||0>n&&0>i)}function Vf(t){var e=t.getLabelModel().get("formatter"),n="category"===t.type?t.scale.getExtent()[0]:null;return"time"===t.scale.type?function(e){return function(n,i){return t.scale.getFormattedLabel(n,i,e)}}(e):"string"==typeof e?function(e){return function(n){var i=t.scale.getLabel(n),r=e.replace("{value}",null!=i?i:"");return r}}(e):"function"==typeof e?function(e){return function(i,r){return null!=n&&(r=i.value-n),e(Hf(t,i),r,null!=i.level?{level:i.level}:null)}}(e):function(e){return t.scale.getLabel(e)}}function Hf(t,e){return"category"===t.type?t.scale.getLabel(e):e.value}function Gf(t){var e=t.model,n=t.scale;if(e.get(["axisLabel","show"])&&!n.isBlank()){var i,r,o=n.getExtent();n instanceof fD?r=n.count():(i=n.getTicks(),r=i.length);var a,s=t.getLabelModel(),l=Vf(t),u=1;r>40&&(u=Math.ceil(r/40));for(var h=0;r>h;h+=u){var c=i?i[h]:{value:o[0]+h},p=l(c,h),f=s.getTextRect(p),d=Wf(f,s.get("rotate")||0);a?a.union(d):a=d}return a}}function Wf(t,e){var n=e*Math.PI/180,i=t.width,r=t.height,o=i*Math.abs(Math.cos(n))+Math.abs(r*Math.sin(n)),a=i*Math.abs(Math.sin(n))+Math.abs(r*Math.cos(n)),s=new C_(t.x,t.y,o,a);return s}function Uf(t){var e=t.get("interval");return null==e?"auto":e}function Xf(t){return"category"===t.type&&0===Uf(t.getLabelModel())}function Yf(t,e){var n={};return y(t.mapDimensionsAll(e),function(e){n[tf(t,e)]=!0}),b(n)}function jf(t){return ef(t.getSource(),t)}function qf(t,e){var n=e;e instanceof ES||(n=new ES(e));var i=zf(n);return i.setExtent(t[0],t[1]),Bf(i,n),i}function Zf(t){d(t,ND)}function Kf(t,e){return e=e||{},Is(t,null,null,"normal"!==e.state)}function $f(t){return M(t)?void y(t,function(t){$f(t)}):void(p(FD,t)>=0||(FD.push(t),T(t)&&(t={install:t}),t.install(VD)))}function Jf(t){return"category"===t.type?td(t):id(t)}function Qf(t,e){return"category"===t.type?nd(t,e):{ticks:v(t.scale.getTicks(),function(t){return t.value})}}function td(t){var e=t.getLabelModel(),n=ed(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}function ed(t,e){var n=rd(t,"labels"),i=Uf(e),r=od(n,i);if(r)return r;var o,a;return T(i)?o=cd(t,i):(a="auto"===i?sd(t):i,o=hd(t,a)),ad(n,i,{labels:o,labelCategoryInterval:a})}function nd(t,e){var n=rd(t,"ticks"),i=Uf(e),r=od(n,i);if(r)return r;var o,a;if((!e.get("show")||t.scale.isBlank())&&(o=[]),T(i))o=cd(t,i,!0);else if("auto"===i){var s=ed(t,t.getLabelModel());a=s.labelCategoryInterval,o=v(s.labels,function(t){return t.tickValue})}else a=i,o=hd(t,a,!0);return ad(n,i,{ticks:o,tickCategoryInterval:a})}function id(t){var e=t.scale.getTicks(),n=Vf(t);return{labels:v(e,function(e,i){return{formattedLabel:n(e,i),rawLabel:t.scale.getLabel(e),tickValue:e.value}})}}function rd(t,e){return YD(t)[e]||(YD(t)[e]=[])}function od(t,e){for(var n=0;n40&&(s=Math.max(1,Math.floor(a/40)));for(var l=o[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),h=Math.abs(u*Math.cos(i)),c=Math.abs(u*Math.sin(i)),p=0,f=0;l<=o[1];l+=s){var d=0,g=0,y=Rn(n({value:l}),e.font,"center","top");d=1.3*y.width,g=1.3*y.height,p=Math.max(p,d,7),f=Math.max(f,g,7)}var v=p/h,m=f/c;isNaN(v)&&(v=1/0),isNaN(m)&&(m=1/0);var _=Math.max(0,Math.floor(Math.min(v,m))),x=YD(t.model),b=t.getExtent(),w=x.lastAutoInterval,S=x.lastTickCount;return null!=w&&null!=S&&Math.abs(w-_)<=1&&Math.abs(S-a)<=1&&w>_&&x.axisExtent0===b[0]&&x.axisExtent1===b[1]?_=w:(x.lastTickCount=a,x.lastAutoInterval=_,x.axisExtent0=b[0],x.axisExtent1=b[1]),_}function ud(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function hd(t,e,n){function i(t){var e={value:t};l.push(n?t:{formattedLabel:r(e),rawLabel:o.getLabel(e),tickValue:t})}var r=Vf(t),o=t.scale,a=o.getExtent(),s=t.getLabelModel(),l=[],u=Math.max((e||0)+1,1),h=a[0],c=o.count();0!==h&&u>1&&c/u>2&&(h=Math.round(Math.ceil(h/u)*u));var p=Xf(t),f=s.get("showMinLabel")||p,d=s.get("showMaxLabel")||p;f&&h!==a[0]&&i(a[0]);for(var g=h;g<=a[1];g+=u)i(g);return d&&g-u!==a[1]&&i(a[1]),l}function cd(t,e,n){var i=t.scale,r=Vf(t),o=[];return y(i.getTicks(),function(t){var a=i.getLabel(t),s=t.value;e(t.value,a)&&o.push(n?s:{formattedLabel:r(t),rawLabel:a,tickValue:s})}),o}function pd(t,e){var n=t[1]-t[0],i=e,r=n/i/2;t[0]+=r,t[1]-=r}function fd(t,e,n,i){function r(t,e){return t=xi(t),e=xi(e),p?t>e:e>t}var o=e.length;if(t.onBand&&!n&&o){var a,s,l=t.getExtent();if(1===o)e[0].coord=l[0],a=e[1]={coord:l[0]};else{var u=e[o-1].tickValue-e[0].tickValue,h=(e[o-1].coord-e[0].coord)/u;y(e,function(t){t.coord-=h/2});var c=t.scale.getExtent();s=1+c[1]-e[o-1].tickValue,a={coord:e[o-1].coord+h*s},e.push(a)}var p=l[0]>l[1];r(e[0].coord,l[0])&&(i?e[0].coord=l[0]:e.shift()),i&&r(l[0],e[0].coord)&&e.unshift({coord:l[0]}),r(l[1],a.coord)&&(i?a.coord=l[1]:e.pop()),i&&r(a.coord,l[1])&&e.push({coord:l[1]})}}function dd(t){var e=cM.extend(t);return cM.registerClass(e),e}function gd(t){var e=bT.extend(t);return bT.registerClass(e),e}function yd(t){var e=xT.extend(t);return xT.registerClass(e),e}function vd(t){var e=MT.extend(t);return MT.registerClass(e),e}function md(){return!1}function _d(t,e,n){var i=_m(),r=e.getWidth(),o=e.getHeight(),a=i.style;return a&&(a.position="absolute",a.left="0",a.top="0",a.width=r+"px",a.height=o+"px",i.setAttribute("data-zr-dom-id",t)),i.width=r*n,i.height=o*n,i}function xd(t){return parseInt(t,10)}function bd(t){return t?t.__builtin__?!0:"function"!=typeof t.resize||"function"!=typeof t.refresh?!1:!0:!1}function wd(t,e){var n=document.createElement("div");return n.style.cssText=["position:relative","width:"+t+"px","height:"+e+"px","padding:0","margin:0","border-width:0"].join(";")+";",n}function Sd(t){t.registerPainter("canvas",tk)}function Md(t){t.registerComponentModel(ek),t.registerComponentView(nk)}function Td(t){return{seriesType:t,reset:function(t,e,n){var i=t.getData(),r=t.get("sampling"),o=t.coordinateSystem,a=i.count();if(a>10&&"cartesian2d"===o.type&&r){var s=o.getBaseAxis(),l=o.getOtherAxis(s),u=s.getExtent(),h=n.getDevicePixelRatio(),c=Math.abs(u[1]-u[0])*(h||1),p=Math.round(a/c);if(p>1){"lttb"===r&&t.setData(i.lttbDownSample(i.mapDimension(l.dim),1/p));var f=void 0;"string"==typeof r?f=ik[r]:"function"==typeof r&&(f=r),f&&t.setData(i.downSample(i.mapDimension(l.dim),1/p,f,rk))}}}}}function Cd(t,e,n,i,r){var o=t.getArea(),a=o.x,s=o.y,l=o.width,u=o.height,h=n.get(["lineStyle","width"])||2;a-=h/2,s-=h/2,l+=h,u+=h,a=Math.floor(a),l=Math.round(l);var c=new Wb({shape:{x:a,y:s,width:l,height:u}});if(e){var p=t.getBaseAxis(),f=p.isHorizontal(),d=p.inverse;f?(d&&(c.shape.x+=l),c.shape.width=0):(d||(c.shape.y+=u),c.shape.height=0);var g="function"==typeof r?function(t){r(t,c)}:null;rs(c,{shape:{width:l,height:u,x:a,y:s}},n,null,i,g)}return c}function Id(t,e,n){var i=t.getArea(),r=xi(i.r0,1),o=xi(i.r,1),a=new Gw({shape:{cx:xi(t.cx,1),cy:xi(t.cy,1),r0:r,r:o,startAngle:i.startAngle,endAngle:i.endAngle,clockwise:i.clockwise}});if(e){var s="angle"===t.getBaseAxis().dim;s?a.shape.endAngle=i.startAngle:a.shape.r=r,rs(a,{shape:{endAngle:i.endAngle,r:o}},n)}return a}function Ad(t,e,n,i,r){return t?"polar"===t.type?Id(t,e,n):"cartesian2d"===t.type?Cd(t,e,n,i,r):null:null}function Dd(t,e){return t.type===e}function kd(t,e){var n=t.mapDimensionsAll("defaultedLabel"),i=n.length;if(1===i){var r=Du(t,e,n[0]);return null!=r?r+"":null}if(i){for(var o=[],a=0;a0?"bottom":"top":r.width>0?"left":"right",c=Cs(i);Ts(t,c,{labelFetcher:o,labelDataIndex:n,defaultText:kd(o.getData(),n),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:h});var p=t.getTextContent();Os(p,c,o.getRawValue(n),function(t){return Ld(e,t)})}var f=i.getModel(["emphasis"]); -ma(t,f.get("focus"),f.get("blurScope")),xa(t,i),Ed(r)&&(t.style.fill="none",t.style.stroke="none",y(t.states,function(t){t.style&&(t.style.fill=t.style.stroke="none")}))}function Bd(t,e){var n=t.get(["itemStyle","borderColor"]);if(!n||"none"===n)return 0;var i=t.get(["itemStyle","borderWidth"])||0,r=isNaN(e.width)?Number.MAX_VALUE:Math.abs(e.width),o=isNaN(e.height)?Number.MAX_VALUE:Math.abs(e.height);return Math.min(i,r,o)}function zd(t,e,n){var i=t.getData(),r=[],o=i.getLayout("valueAxisHorizontal")?1:0;r[1-o]=i.getLayout("valueAxisStart");var a=i.getLayout("largeDataIndices"),s=i.getLayout("barWidth"),l=t.getModel("backgroundStyle"),u=t.get("showBackground",!0);if(u){var h=i.getLayout("largeBackgroundPoints"),c=[];c[1-o]=i.getLayout("backgroundStart");var p=new vk({shape:{points:h},incremental:!!n,silent:!0,z2:0});p.__startPoint=c,p.__baseDimIdx=o,p.__largeDataIndices=a,p.__barWidth=s,Hd(p,l,i),e.add(p)}var f=new vk({shape:{points:i.getLayout("largePoints")},incremental:!!n});f.__startPoint=r,f.__baseDimIdx=o,f.__largeDataIndices=a,f.__barWidth=s,e.add(f),Vd(f,t,i),Kb(f).seriesIndex=t.seriesIndex,t.get("silent")||(f.on("mousedown",mk),f.on("mousemove",mk))}function Fd(t,e,n){var i=t.__baseDimIdx,r=1-i,o=t.shape.points,a=t.__largeDataIndices,s=Math.abs(t.__barWidth/2),l=t.__startPoint[r];uk[0]=e,uk[1]=n;for(var u=uk[i],h=uk[1-i],c=u-s,p=u+s,f=0,d=o.length/2;d>f;f++){var g=2*f,y=o[g+i],v=o[g+r];if(y>=c&&p>=y&&(v>=l?h>=l&&v>=h:h>=v&&l>=h))return a[f]}return-1}function Vd(t,e,n){var i=n.getVisual("style");t.useStyle(h({},i)),t.style.fill=null,t.style.stroke=i.fill,t.style.lineWidth=n.getLayout("barWidth")}function Hd(t,e,n){var i=e.get("borderColor")||e.get("color"),r=e.getItemStyle();t.useStyle(r),t.style.fill=null,t.style.stroke=i,t.style.lineWidth=n.getLayout("barWidth")}function Gd(t,e,n){if(Dd(n,"cartesian2d")){var i=e,r=n.getArea();return{x:t?i.x:r.x,y:t?r.y:i.y,width:t?i.width:r.width,height:t?r.height:i.height}}var r=n.getArea(),o=e;return{cx:r.cx,cy:r.cy,r0:t?r.r0:o.r0,r:t?r.r:o.r,startAngle:t?o.startAngle:0,endAngle:t?o.endAngle:2*Math.PI}}function Wd(t,e,n){var i="polar"===t.type?Gw:Wb;return new i({shape:Gd(e,n,t),silent:!0,z2:0})}function Ud(t){t.registerChartView(pk),t.registerSeriesModel(ak),t.registerLayout(t.PRIORITY.VISUAL.LAYOUT,S(xf,"bar")),t.registerLayout(t.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,_D),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,Td("bar")),t.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(t,e){var n=t.componentType||"series";e.eachComponent({mainType:n,query:t},function(e){t.sortInfo&&e.axis.setCategorySortInfo(t.sortInfo)})})}function Xd(t,e){this.parent.drift(t,e)}function Yd(t,e,n,i){return!(!e||isNaN(e[0])||isNaN(e[1])||i.isIgnore&&i.isIgnore(n)||i.clipShape&&!i.clipShape.contain(e[0],e[1])||"none"===t.getItemVisual(n,"symbol"))}function jd(t){return null==t||D(t)||(t={isIgnore:t}),t||{}}function qd(t){var e=t.hostModel,n=e.getModel("emphasis");return{emphasisItemStyle:n.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:n.get("focus"),blurScope:n.get("blurScope"),hoverScale:n.get("scale"),labelStatesModels:Cs(e),cursorStyle:e.get("cursor")}}function Zd(t,e,n){var i=t.getBaseAxis(),r=t.getOtherAxis(i),o=Kd(r,n),a=i.dim,s=r.dim,l=e.mapDimension(s),u=e.mapDimension(a),h="x"===s||"radius"===s?1:0,c=v(t.dimensions,function(t){return e.mapDimension(t)}),p=!1,f=e.getCalculationInfo("stackResultDimension");return Qp(e,c[0])&&(p=!0,c[0]=f),Qp(e,c[1])&&(p=!0,c[1]=f),{dataDimsForPoint:c,valueStart:o,valueAxisDim:s,baseAxisDim:a,stacked:!!p,valueDim:l,baseDim:u,baseDataOffset:h,stackedOverDimension:e.getCalculationInfo("stackedOverDimension")}}function Kd(t,e){var n=0,i=t.scale.getExtent();return"start"===e?n=i[0]:"end"===e?n=i[1]:i[0]>0?n=i[0]:i[1]<0&&(n=i[1]),n}function $d(t,e,n,i){var r=0/0;t.stacked&&(r=n.get(n.getCalculationInfo("stackedOverDimension"),i)),isNaN(r)&&(r=t.valueStart);var o=t.baseDataOffset,a=[];return a[o]=n.get(t.baseDim,i),a[1-o]=r,e.dataToPoint(a)}function Jd(t){return M(t)?wk?new Float32Array(t):t:new Sk(t)}function Qd(t,e){var n=[];return e.diff(t).add(function(t){n.push({cmd:"+",idx:t})}).update(function(t,e){n.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){n.push({cmd:"-",idx:t})}).execute(),n}function tg(t,e,n,i,r,o,a,s){for(var l=Qd(t,e),u=[],h=[],c=[],p=[],f=[],d=[],g=[],y=Zd(r,e,a),v=(Zd(o,t,s),t.getLayout("points")||[]),m=e.getLayout("points")||[],_=0;_y;y++){var v=e[2*g],m=e[2*g+1];if(g>=r||0>g)break;if(eg(v,m)){if(l){g+=o;continue}break}if(g===n)t[o>0?"moveTo":"lineTo"](v,m),c=v,p=m;else{var _=v-u,x=m-h;if(.5>_*_+x*x){g+=o;continue}if(a>0){var b=g+o,w=e[2*b],S=e[2*b+1],M=y+1;if(l)for(;eg(w,S)&&i>M;)M++,b+=o,w=e[2*b],S=e[2*b+1];var T=.5,C=0,I=0,A=void 0,D=void 0;if(M>=i||eg(w,S))f=v,d=m;else{C=w-u,I=S-h;var k=v-u,L=w-v,P=m-h,O=S-m,R=void 0,E=void 0;"x"===s?(R=Math.abs(k),E=Math.abs(L),f=v-R*a,d=m,A=v+R*a,D=m):"y"===s?(R=Math.abs(P),E=Math.abs(O),f=v,d=m-R*a,A=v,D=m+R*a):(R=Math.sqrt(k*k+P*P),E=Math.sqrt(L*L+O*O),T=E/(E+R),f=v-C*a*(1-T),d=m-I*a*(1-T),A=v+C*a*T,D=m+I*a*T,A=Mk(A,Tk(w,v)),D=Mk(D,Tk(S,m)),A=Tk(A,Mk(w,v)),D=Tk(D,Mk(S,m)),C=A-v,I=D-m,f=v-C*R/E,d=m-I*R/E,f=Mk(f,Tk(u,v)),d=Mk(d,Tk(h,m)),f=Tk(f,Mk(u,v)),d=Tk(d,Mk(h,m)),C=v-f,I=m-d,A=v+C*E/R,D=m+I*E/R)}t.bezierCurveTo(c,p,f,d,v,m),c=A,p=D}else t.lineTo(v,m)}u=v,h=m,g+=o}return y}function ig(t,e){if(t.length===e.length){for(var n=0;no;o++){var a=$d(n,t,e,o);r[2*o]=a[0],r[2*o+1]=a[1]}return r}function lg(t,e,n){for(var i=e.getBaseAxis(),r="x"===i.dim||"radius"===i.dim?0:1,o=[],a=0,s=[],l=[],u=[];a=0;o--){var a=n[o].dimension,s=t.dimensions[a],l=t.getDimensionInfo(s);if(i=l&&l.coordDim,"x"===i||"y"===i){r=n[o];break}}if(r){var u=e.getAxis(i),h=v(r.stops,function(t){return{offset:0,coord:u.toGlobalCoord(u.dataToCoord(t.value)),color:t.color}}),c=h.length,p=r.outerColors.slice();c&&h[0].coord>h[c-1].coord&&(h.reverse(),p.reverse());var f=10,d=h[0].coord-f,g=h[c-1].coord+f,m=g-d;if(.001>m)return"transparent";y(h,function(t){t.offset=(t.coord-d)/m}),h.push({offset:c?h[c-1].offset:.5,color:p[1]||"transparent"}),h.unshift({offset:c?h[0].offset:.5,color:p[0]||"transparent"});var _=new oS(0,0,0,0,h,!0);return _[i]=d,_[i+"2"]=g,_}}}function hg(t,e,n){var i=t.get("showAllSymbol"),r="auto"===i;if(!i||r){var o=n.getAxesByScale("ordinal")[0];if(o&&(!r||!cg(o,e))){var a=e.mapDimension(o.dim),s={};return y(o.getViewLabels(),function(t){var e=o.scale.getRawOrdinalNumber(t.tickValue);s[e]=1}),function(t){return!s.hasOwnProperty(e.get(a,t))}}}}function cg(t,e){var n=t.getExtent(),i=Math.abs(n[1]-n[0])/t.scale.count();isNaN(i)&&(i=0);for(var r=e.count(),o=Math.max(1,Math.round(r/5)),a=0;r>a;a+=o)if(1.5*xk.getSymbolSize(e,a)[t.isHorizontal()?1:0]>i)return!1;return!0}function pg(t,e){return isNaN(t)||isNaN(e)}function fg(t){for(var e=t.length/2;e>0&&pg(t[2*e-2],t[2*e-1]);e--);return e-1}function dg(t,e){return[t[2*e],t[2*e+1]]}function gg(t,e,n){for(var i,r,o=t.length/2,a="x"===n?0:1,s=0,l=-1,u=0;o>u;u++)if(r=t[2*u+a],!isNaN(r)&&!isNaN(t[2*u+1-a]))if(0!==u){if(e>=i&&r>=e||i>=e&&e>=r){l=u;break}s=u,i=r}else i=r;return{range:[s,l],t:(e-i)/(r-i)}}function yg(t,e,n,i){if(Dd(e,"cartesian2d")){var r=i.getModel("endLabel"),o=r.get("show"),a=r.get("valueAnimation"),s=i.getData(),l={lastFrameIndex:0},u=o?function(n,i){t._endLabelOnDuring(n,i,s,l,a,r,e)}:null,h=e.getBaseAxis().isHorizontal(),c=Cd(e,n,i,function(){var e=t._endLabel;e&&n&&null!=l.originalX&&e.attr({x:l.originalX,y:l.originalY})},u);if(!i.get("clip",!0)){var p=c.shape,f=Math.max(p.width,p.height);h?(p.y-=f,p.height+=2*f):(p.x-=f,p.width+=2*f)}return u&&u(1,c),c}return Id(e,n,i)}function vg(t,e){var n=e.getBaseAxis(),i=n.isHorizontal(),r=n.inverse,o=i?r?"right":"left":"center",a=i?"middle":r?"top":"bottom";return{normal:{align:t.get("align")||o,verticalAlign:t.get("verticalAlign")||a}}}function mg(t,e){return{seriesType:t,plan:gh(),reset:function(t){var n=t.getData(),i=t.coordinateSystem,r=t.pipelineContext,o=e||r.large;if(i){var a=v(i.dimensions,function(t){return n.mapDimension(t)}).slice(0,2),s=a.length,l=n.getCalculationInfo("stackResultDimension");Qp(n,a[0])&&(a[0]=l),Qp(n,a[1])&&(a[1]=l);var u=n.getDimensionInfo(a[0]),h=n.getDimensionInfo(a[1]),c=u&&u.index,p=h&&h.index;return s&&{progress:function(t,e){for(var n=t.end-t.start,r=o&&Jd(n*s),a=[],l=[],u=t.start,h=0;ui?(i=g,S-=g):T+=t;var r=C+I*i;e.setItemLayout(n,{angle:i,startAngle:C,endAngle:r,clockwise:_,cx:h,cy:c,r0:p,r:x?mi(t,w,[p,f]):f}),C=r}),Lk>S&&y)if(.001>=S){var A=Lk/y;e.each(i,function(t,n){if(!isNaN(t)){var i=e.getItemLayout(n);i.angle=A,i.startAngle=d+I*n*A,i.endAngle=d+I*(n+1)*A}})}else m=S/T,C=d,e.each(i,function(t,n){if(!isNaN(t)){var i=e.getItemLayout(n),r=i.angle===g?g:t*m;i.startAngle=C,i.endAngle=C+I*r,C+=I*r}})})}function wg(t){return{seriesType:t,reset:function(t,e){var n=e.findComponents({mainType:"legend"});if(n&&n.length){var i=t.getData();i.filterSelf(function(t){for(var e=i.getName(t),r=0;rn?a:o,c=Math.abs(l.label.y-n);if(c>u.maxY){var p=l.label.x-e-l.len2*r,f=i+l.len,d=Math.abs(p)f;f++)if("outer"===t[f].position&&"labelLine"===t[f].labelAlignTo){var d=t[f].label.x-u;t[f].linePoints[1][0]+=d,t[f].label.x=u}Qh(t,l,l+a)&&c(t)}}function Mg(t,e,n,i,r,o,a,s){for(var l=[],u=[],h=Number.MAX_VALUE,c=-Number.MAX_VALUE,p=0;pP?-1:1)*C,V=z;I="edge"===b?0>P?p+w:p+c-w:F+(0>P?-x:x),A=V,D=[[E,N],[B,z],[F,V]]}k=R?"center":"edge"===b?P>0?"right":"left":P>0?"left":"right"}var H,G=m.get("rotate");if(H="number"==typeof G?G*(Math.PI/180):G?0>P?-L+Math.PI:-L:0,s=!!H,d.x=I,d.y=A,d.rotation=H,d.setStyle({verticalAlign:"middle"}),R){d.setStyle({align:k});var W=d.states.select;W&&(W.x+=d.x,W.y+=d.y)}else{var U=d.getBoundingRect().clone();U.applyTransform(d.getComputedTransform());var X=(d.style.margin||0)+2.1;U.y-=X/2,U.height+=X,a.push({label:d,labelLine:g,position:_,len:T,len2:C,minTurnAngle:M.get("minTurnAngle"),maxSurfaceAngle:M.get("maxSurfaceAngle"),surfaceNormal:new v_(P,O),linePoints:D,textAlign:k,labelDistance:x,labelAlignTo:b,edgeDistance:w,bleedMargin:S,rect:U})}u.setTextConfig({inside:R})}}),!s&&t.get("avoidLabelOverlap")&&Mg(a,i,r,h,c,d,p,f);for(var g=0;gi[1],l="start"===e&&!s||"start"!==e&&s;return Ii(a-Jk/2)?(o=l?"bottom":"top",r="center"):Ii(a-1.5*Jk)?(o=l?"top":"bottom",r="center"):(o="middle",r=1.5*Jk>a&&a>Jk/2?l?"left":"right":l?"right":"left"),{rotation:a,textAlign:r,textVerticalAlign:o}}function Hg(t,e,n){if(!Xf(t.axis)){var i=t.get(["axisLabel","showMinLabel"]),r=t.get(["axisLabel","showMaxLabel"]);e=e||[],n=n||[];var o=e[0],a=e[1],s=e[e.length-1],l=e[e.length-2],u=n[0],h=n[1],c=n[n.length-1],p=n[n.length-2];i===!1?(Gg(o),Gg(u)):Wg(o,a)&&(i?(Gg(a),Gg(h)):(Gg(o),Gg(u))),r===!1?(Gg(s),Gg(c)):Wg(l,s)&&(r?(Gg(l),Gg(p)):(Gg(s),Gg(c)))}}function Gg(t){t&&(t.ignore=!0)}function Wg(t,e){var n=t&&t.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(n&&i){var r=Fe([]);return We(r,r,-t.rotation),n.applyTransform(He([],r,t.getLocalTransform())),i.applyTransform(He([],r,e.getLocalTransform())),n.intersect(i)}}function Ug(t){return"middle"===t||"center"===t}function Xg(t,e,n,i,r){for(var o=[],a=[],s=[],l=0;l=0||t===e}function ey(t){var e=ny(t);if(e){var n=e.axisPointerModel,i=e.axis.scale,r=n.option,o=n.get("status"),a=n.get("value");null!=a&&(a=i.parse(a));var s=ry(n);null==o&&(r.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==a||a>l[1])&&(a=l[1]),a0?2:0:u[p]=f}for(var d=e.getModel("lineStyle"),g=DS.concat([["inactiveColor"],["inactiveWidth"]]),y={},h=0;h0?2:0:y[p]=f}if("auto"===u.fill&&(u.fill=r.fill),"auto"===u.stroke&&(u.stroke=r.fill),"auto"===y.stroke&&(y.stroke=r.fill),!a){var v=e.get("inactiveBorderWidth"),m=u[t.indexOf("empty")>-1?"fill":"stroke"];u.lineWidth="auto"===v?r.lineWidth>0&&m?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),y.stroke=n.get("inactiveColor"),y.lineWidth=n.get("inactiveWidth")}return{itemStyle:u,lineStyle:y}}function py(t){var e=t.symbolType||"roundRect",n=uc(e,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill,t.symbolKeepAspect);return n.setStyle(t.itemStyle),e.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2),n}function fy(t,e,n,i){yy(t,e,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=t?t:e}),gy(t,e,n,i)}function dy(t){for(var e,n=t.getZr().storage.getDisplayList(),i=0,r=n.length;r>i&&!(e=n[i].states.emphasis);)i++;return e&&e.hoverLayer}function gy(t,e,n,i){dy(n)||n.dispatchAction({type:"highlight",seriesName:t,name:e,excludeSeriesId:i})}function yy(t,e,n,i){dy(n)||n.dispatchAction({type:"downplay",seriesName:t,name:e,excludeSeriesId:i})}function vy(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(t){for(var n=0;na||M(a))return{point:[]};var s=o.getItemGraphicEl(a),l=n.coordinateSystem;if(n.getTooltipPosition)i=n.getTooltipPosition(a)||[];else if(l&&l.dataToPoint)if(t.isStacked){var u=l.getBaseAxis(),h=l.getOtherAxis(u),c=h.dim,p=u.dim,f="x"===c||"radius"===c?1:0,d=o.mapDimension(p),g=[];g[f]=o.get(d,a),g[1-f]=o.get(o.getCalculationInfo("stackResultDimension"),a),i=l.dataToPoint(g)||[]}else i=l.dataToPoint(o.getValues(v(l.dimensions,function(t){return o.mapDimension(t)}),a))||[];else if(s){var y=s.getBoundingRect().clone();y.applyTransform(s.transform),i=[y.x+y.width/2,y.y+y.height/2]}return{point:i,el:s}}function jy(t,e,n){var i=t.currTrigger,r=[t.x,t.y],o=t,a=t.dispatchAction||xm(n.dispatchAction,n),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){iv(r)&&(r=Yy({seriesIndex:o.seriesIndex,dataIndex:o.dataIndex},e).point);var l=iv(r),u=o.axesInfo,h=s.axesInfo,c="leave"===i||iv(r),p={},f={},d={list:[],map:{}},g={showPointer:S(Ky,f),showTooltip:S($y,d)};y(s.coordSysMap,function(t,e){var n=l||t.containPoint(r);y(s.coordSysAxesInfo[e],function(t){var e=t.axis,i=ev(u,t);if(!c&&n&&(!u||i)){var o=i&&i.value;null!=o||l||(o=e.pointToData(r)),null!=o&&qy(t,o,g,!1,p)}})});var v={};return y(h,function(t,e){var n=t.linkGroup;n&&!f[e]&&y(n.axesInfo,function(e,i){var r=f[i];if(e!==t&&r){var o=r.value;n.mapper&&(o=t.axis.scale.parse(n.mapper(o,nv(e),nv(t)))),v[t.key]=o}})}),y(v,function(t,e){qy(h[e],t,g,!0,p)}),Jy(f,h,p),Qy(d,r,t,a),tv(h,a,n),p}}function qy(t,e,n,i,r){var o=t.axis;if(!o.scale.isBlank()&&o.containData(e)){if(!t.involveSeries)return void n.showPointer(t,e);var a=Zy(e,t),s=a.payloadBatch,l=a.snapToValue;s[0]&&null==r.seriesIndex&&h(r,s[0]),!i&&t.snap&&o.containData(l)&&null!=l&&(e=l),n.showPointer(t,e,s),n.showTooltip(t,a,l)}}function Zy(t,e){var n=e.axis,i=n.dim,r=t,o=[],a=Number.MAX_VALUE,s=-1;return y(e.seriesModels,function(e){var l,u,h=e.getData().mapDimensionsAll(i);if(e.getAxisTooltipData){var c=e.getAxisTooltipData(h,t,n);u=c.dataIndices,l=c.nestestValue}else{if(u=e.getData().indicesOfNearest(h[0],t,"category"===n.type?.5:null),!u.length)return;l=e.getData().get(h[0],u[0])}if(null!=l&&isFinite(l)){var p=t-l,f=Math.abs(p);a>=f&&((a>f||p>=0&&0>s)&&(a=f,s=p,r=l,o.length=0),y(u,function(t){o.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})}))}}),{payloadBatch:o,snapToValue:r}}function Ky(t,e,n,i){t[e.key]={value:n,payloadBatch:i}}function $y(t,e,n,i){var r=n.payloadBatch,o=e.axis,a=o.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,u=oy(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:o.dim,axisIndex:a.componentIndex,axisType:a.type,axisId:a.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:r.slice()})}}function Jy(t,e,n){var i=n.axesInfo=[];y(e,function(e,n){var r=e.axisPointerModel.option,o=t[n];o?(!e.useHandle&&(r.status="show"),r.value=o.value,r.seriesDataIndices=(o.payloadBatch||[]).slice()):!e.useHandle&&(r.status="hide"),"show"===r.status&&i.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:r.value})})}function Qy(t,e,n,i){if(iv(e)||!t.list.length)return void i({type:"hideTip"});var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}function tv(t,e,n){var i=n.getZr(),r="axisPointerLastHighlights",o=EL(i)[r]||{},a=EL(i)[r]={};y(t,function(t){var e=t.axisPointerModel.option;"show"===e.status&&y(e.seriesDataIndices,function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t})});var s=[],l=[];y(o,function(t,e){!a[e]&&l.push(t)}),y(a,function(t,e){!o[e]&&s.push(t)}),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function ev(t,e){for(var n=0;n<(t||[]).length;n++){var i=t[n];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}function nv(t){var e=t.axis.model,n={},i=n.axisDim=t.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=e.componentIndex,n.axisName=n[i+"AxisName"]=e.name,n.axisId=n[i+"AxisId"]=e.id,n}function iv(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function rv(t){nL.registerAxisPointerClass("CartesianAxisPointer",DL),t.registerComponentModel(LL),t.registerComponentView(RL),t.registerPreprocessor(function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!M(e)&&(t.axisPointer.link=[e])}}),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=Zg(t,e)}),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},jy)}function ov(t){var e=t.get("confine");return null!=e?!!e:"richText"===t.get("renderMode")}function av(t){if(am.domSupported)for(var e=document.documentElement.style,n=0,i=t.length;i>n;n++)if(t[n]in e)return t[n]}function sv(t,e){if(!t)return e;e=fl(e,!0);var n=t.indexOf(e);return t=-1===n?e:"-"+t.slice(0,n)+"-"+e,t.toLowerCase()}function lv(t,e){var n=t.currentStyle||document.defaultView&&document.defaultView.getComputedStyle(t);return n?e?n[e]:n:null}function uv(t){return t="left"===t?"right":"right"===t?"left":"top"===t?"bottom":"top"}function hv(t,e,n){if(!C(n)||"inside"===n)return"";e=xl(e);var i=uv(n),r=i+":-6px;",o=VL+":";p(["left","right"],i)>-1?(r+="top:50%",o+="translateY(-50%) rotate("+("left"===i?-225:-45)+"deg)"):(r+="left:50%",o+="translateX(-50%) rotate("+("top"===i?225:45)+"deg)");var a=e+" solid 1px;",s=["position:absolute;width:10px;height:10px;",r+";"+o+";","border-bottom:"+a,"border-right:"+a,"background-color:"+t+";","box-shadow:8px 8px 16px -3px #000;"];return'
            '}function cv(t,e){var n="cubic-bezier(0.23,1,0.32,1)",i=" "+t/2+"s "+n,r="opacity"+i+",visibility"+i;return e||(i=" "+t+"s "+n,r+=am.transformSupported?","+BL+i:",left"+i+",top"+i),FL+":"+r}function pv(t,e,n){var i=t.toFixed(0)+"px",r=e.toFixed(0)+"px";if(!am.transformSupported)return n?"top:"+r+";left:"+i+";":[["top",r],["left",i]];var o=am.transform3dSupported,a="translate"+(o?"3d":"")+"("+i+","+r+(o?",0":"")+")";return n?"top:0;left:0;"+VL+":"+a+";":[["top",0],["left",0],[BL,a]]}function fv(t){var e=[],n=t.get("fontSize"),i=t.getTextColor();i&&e.push("color:"+i),e.push("font:"+t.getFont()),n&&e.push("line-height:"+Math.round(3*n/2)+"px");var r=t.get("textShadowColor"),o=t.get("textShadowBlur")||0,a=t.get("textShadowOffsetX")||0,s=t.get("textShadowOffsetY")||0;return r&&o&&e.push("text-shadow:"+a+"px "+s+"px "+o+"px "+r),y(["decoration","align"],function(n){var i=t.get(n);i&&e.push("text-"+n+":"+i)}),e.join(";")}function dv(t,e,n){var i=[],r=t.get("transitionDuration"),o=t.get("backgroundColor"),a=t.get("shadowBlur"),s=t.get("shadowColor"),l=t.get("shadowOffsetX"),u=t.get("shadowOffsetY"),h=t.getModel("textStyle"),c=ih(t,"html"),p=l+"px "+u+"px "+a+"px "+s;return i.push("box-shadow:"+p),e&&r&&i.push(cv(r,n)),o&&(am.canvasSupported?i.push("background-color:"+o):(i.push("background-color:#"+un(o)),i.push("filter:alpha(opacity=70)"))),y(["width","color","radius"],function(e){var n="border-"+e,r=fl(n),o=t.get(r);null!=o&&i.push(n+":"+o+("color"===e?"":"px"))}),i.push(fv(h)),null!=c&&i.push("padding:"+eM(c).join("px ")+"px"),i.join(";")+";"}function gv(t,e,n,i,r){var o=e&&e.painter;if(n){var a=o&&o.getViewportRoot();a&&xe(t,a,document.body,i,r)}else{t[0]=i,t[1]=r;var s=o&&o.getViewportRootOffset();s&&(t[0]+=s.offsetLeft,t[1]+=s.offsetTop)}t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}function yv(t){return Math.max(0,t)}function vv(t){var e=yv(t.shadowBlur||0),n=yv(t.shadowOffsetX||0),i=yv(t.shadowOffsetY||0);return{left:yv(e-n),right:yv(e+n),top:yv(e-i),bottom:yv(e+i)}}function mv(t,e,n,i){t[0]=n,t[1]=i,t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}function _v(t,e,n){var i,r=e.ecModel;n?(i=new ES(n,r,r),i=new ES(e.option,i,r)):i=e;for(var o=t.length-1;o>=0;o--){var a=t[o];a&&(a instanceof ES&&(a=a.get("tooltip",!0)),C(a)&&(a={formatter:a}),a&&(i=new ES(a,i,r)))}return i}function xv(t,e){return t.dispatchAction||xm(e.dispatchAction,e)}function bv(t,e,n,i,r,o,a){var s=n.getOuterSize(),l=s.width,u=s.height;return null!=o&&(t+l+o+2>i?t-=l+o:t+=o),null!=a&&(e+u+a>r?e-=u+a:e+=a),[t,e]}function wv(t,e,n,i,r){var o=n.getOuterSize(),a=o.width,s=o.height;return t=Math.min(t+a,i)-a,e=Math.min(e+s,r)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function Sv(t,e,n){var i=n[0],r=n[1],o=10,a=5,s=0,l=0,u=e.width,h=e.height;switch(t){case"inside":s=e.x+u/2-i/2,l=e.y+h/2-r/2;break;case"top":s=e.x+u/2-i/2,l=e.y-r-o;break;case"bottom":s=e.x+u/2-i/2,l=e.y+h+o;break;case"left":s=e.x-i-o-a,l=e.y+h/2-r/2;break;case"right":s=e.x+u+o+a,l=e.y+h/2-r/2}return[s,l]}function Mv(t){return"center"===t||"middle"===t}function Tv(t,e,n){var i=sr(t).queryOptionMap,r=i.keys()[0];if(r&&"series"!==r){var o=lr(e,r,i.get(r),{useDefault:!1,enableAll:!1,enableNone:!1}),a=o.models[0];if(a){var s,l=n.getViewOfComponentModel(a);return l.group.traverse(function(e){var n=Kb(e).tooltipConfig;return n&&n.name===t.name?(s=e,!0):void 0}),s?{componentMainType:r,componentIndex:a.componentIndex,el:s}:void 0}}}function Cv(t){$f(rv),t.registerComponentModel(NL),t.registerComponentView(qL),t.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},function(){}),t.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},function(){})}function Iv(t,e){if(!t)return!1;for(var n=M(t)?t:[t],i=0;i=0&&(a[o]=+a[o].toFixed(p)),[a,c]}function Pv(t,e){var n=t.getData(),i=t.coordinateSystem;if(e&&!kv(e)&&!M(e.coord)&&i){var r=i.dimensions,o=Ov(e,n,i,t);if(e=s(e),e.type&&JL[e.type]&&o.baseAxis&&o.valueAxis){var a=p(r,o.baseAxis.dim),l=p(r,o.valueAxis.dim),u=JL[e.type](n,o.baseDataDim,o.valueDataDim,a,l);e.coord=u[0],e.value=u[1]}else{for(var h=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],c=0;2>c;c++)JL[h[c]]&&(h[c]=Bv(n,n.mapDimension(r[c]),h[c]));e.coord=h}}return e}function Ov(t,e,n,i){var r={};return null!=t.valueIndex||null!=t.valueDim?(r.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,r.valueAxis=n.getAxis(Rv(i,r.valueDataDim)),r.baseAxis=n.getOtherAxis(r.valueAxis),r.baseDataDim=e.mapDimension(r.baseAxis.dim)):(r.baseAxis=i.getBaseAxis(),r.valueAxis=n.getOtherAxis(r.baseAxis),r.baseDataDim=e.mapDimension(r.baseAxis.dim),r.valueDataDim=e.mapDimension(r.valueAxis.dim)),r}function Rv(t,e){var n=t.getData(),i=n.dimensions;e=n.getDimension(e);for(var r=0;ri?t.coord&&t.coord[i]:t.value}function Bv(t,e,n){if("average"===n){var i=0,r=0;return t.each(e,function(t){isNaN(t)||(i+=t,r++)}),i/r}return"median"===n?t.getMedian(e):t.getDataExtent(e)["max"===n?1:0]}function zv(t,e,n){var i=e.coordinateSystem;t.each(function(r){var o,a=t.getItemModel(r),s=_i(a.get("x"),n.getWidth()),l=_i(a.get("y"),n.getHeight());if(isNaN(s)||isNaN(l)){if(e.getMarkerPosition)o=e.getMarkerPosition(t.getValues(t.dimensions,r));else if(i){var u=t.get(i.dimensions[0],r),h=t.get(i.dimensions[1],r);o=i.dataToPoint([u,h])}}else o=[s,l];isNaN(s)||(o[0]=s),isNaN(l)||(o[1]=l),t.setItemLayout(r,o)})}function Fv(t,e,n){var i;i=t?v(t&&t.dimensions,function(t){var n=e.getData().getDimensionInfo(e.getData().mapDimension(t))||{};return c({name:t},n)}):[{name:"value",type:"float"}];var r=new sD(i,n),o=v(n.get("data"),S(Pv,e));return t&&(o=_(o,S(Ev,t))),r.initData(o,null,t?Nv:function(t){return t.value}),r}function Vv(t){t.registerComponentModel($L),t.registerComponentView(eP),t.registerPreprocessor(function(t){Iv(t.series,"markPoint")&&(t.markPoint=t.markPoint||{})})}function Hv(t){return isNaN(+t.cpx1)||isNaN(+t.cpy1)}function Gv(t){return"_"+t+"Type"}function Wv(t,e,n){var i=e.getItemVisual(n,t);if(i&&"none"!==i){var r=e.getItemVisual(n,t+"Size"),o=e.getItemVisual(n,t+"Rotate"),a=e.getItemVisual(n,t+"Offset")||0,s=e.getItemVisual(n,t+"KeepAspect"),l=M(r)?r:[r,r],u=M(a)?a:[a,a];u[0]=_i(u[0],l[0]),u[1]=_i(z(u[1],u[0]),l[1]);var h=uc(i,-l[0]/2+u[0],-l[1]/2+u[1],l[0],l[1],null,s);return h.__specifiedRotation=null==o||isNaN(o)?void 0:+o*Math.PI/180||0,h.name=t,h}}function Uv(t){var e=new aP({name:"line",subPixelOptimize:!0});return Xv(e.shape,t),e}function Xv(t,e){t.x1=e[0][0],t.y1=e[0][1],t.x2=e[1][0],t.y2=e[1][1],t.percent=1;var n=e[2];n?(t.cpx1=n[0],t.cpy1=n[1]):(t.cpx1=0/0,t.cpy1=0/0)}function Yv(t){return t.animators&&t.animators.length>0}function jv(t){var e=t.hostModel;return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:e.getModel(["emphasis","lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),labelStatesModels:Cs(e)}}function qv(t){return isNaN(t[0])||isNaN(t[1])}function Zv(t){return!qv(t[0])&&!qv(t[1])}function Kv(t){return!isNaN(t)&&!isFinite(t)}function $v(t,e,n,i){var r=1-t,o=i.dimensions[t];return Kv(e[r])&&Kv(n[r])&&e[t]===n[t]&&i.getAxis(o).containData(e[t])}function Jv(t,e){if("cartesian2d"===t.type){var n=e[0].coord,i=e[1].coord;if(n&&i&&($v(1,n,i,t)||$v(0,n,i,t)))return!0}return Ev(t,e[0])&&Ev(t,e[1])}function Qv(t,e,n,i,r){var o,a=i.coordinateSystem,s=t.getItemModel(e),l=_i(s.get("x"),r.getWidth()),u=_i(s.get("y"),r.getHeight());if(isNaN(l)||isNaN(u)){if(i.getMarkerPosition)o=i.getMarkerPosition(t.getValues(t.dimensions,e));else{var h=a.dimensions,c=t.get(h[0],e),p=t.get(h[1],e);o=a.dataToPoint([c,p])}if(Dd(a,"cartesian2d")){var f=a.getAxis("x"),d=a.getAxis("y"),h=a.dimensions;Kv(t.get(h[0],e))?o[0]=f.toGlobalCoord(f.getExtent()[n?0:1]):Kv(t.get(h[1],e))&&(o[1]=d.toGlobalCoord(d.getExtent()[n?0:1]))}isNaN(l)||(o[0]=l),isNaN(u)||(o[1]=u)}else o=[l,u];t.setItemLayout(e,o)}function tm(t,e,n){var i;i=t?v(t&&t.dimensions,function(t){var n=e.getData().getDimensionInfo(e.getData().mapDimension(t))||{};return c({name:t},n)}):[{name:"value",type:"float"}];var r=new sD(i,n),o=new sD(i,n),a=new sD([],n),s=v(n.get("data"),S(cP,e,t,n));t&&(s=_(s,S(Jv,t)));var l=t?Nv:function(t){return t.value};return r.initData(v(s,function(t){return t[0]}),null,l),o.initData(v(s,function(t){return t[1]}),null,l),a.initData(v(s,function(t){return t[2]})),a.hasItemOption=!0,{from:r,to:o,line:a}}function em(t){t.registerComponentModel(nP),t.registerComponentView(pP),t.registerPreprocessor(function(t){Iv(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var nm=function(t,e){return(nm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},im=function(){return im=Object.assign||function(t){for(var e,n=1,i=arguments.length;i>n;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},im.apply(this,arguments)},rm=function(){function t(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return t}(),om=function(){function t(){this.browser=new rm,this.node=!1,this.wxa=!1,this.worker=!1,this.canvasSupported=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1}return t}(),am=new om;"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(am.wxa=!0,am.canvasSupported=!0,am.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?(am.worker=!0,am.canvasSupported=!0):"undefined"==typeof navigator?(am.node=!0,am.canvasSupported=!0,am.svgSupported=!0):i(navigator.userAgent,am);var sm={"[object Function]":!0,"[object RegExp]":!0,"[object Date]":!0,"[object Error]":!0,"[object CanvasGradient]":!0,"[object CanvasPattern]":!0,"[object Image]":!0,"[object Canvas]":!0},lm={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0},um=Object.prototype.toString,hm=Array.prototype,cm=hm.forEach,pm=hm.filter,fm=hm.slice,dm=hm.map,gm=function(){}.constructor,ym=gm?gm.prototype:null,vm={},mm=2311,_m=function(){return vm.createCanvas()};vm.createCanvas=function(){return document.createElement("canvas")};var xm=ym&&T(ym.bind)?ym.call.bind(ym.bind):w,bm="__ec_primitive__",wm=function(){function t(e){function n(t,e){i?r.set(t,e):r.set(e,t)}this.data={};var i=M(e);this.data={};var r=this;e instanceof t?e.each(n):e&&y(e,n)}return t.prototype.get=function(t){return this.data.hasOwnProperty(t)?this.data[t]:null},t.prototype.set=function(t,e){return this.data[t]=e},t.prototype.each=function(t,e){for(var n in this.data)this.data.hasOwnProperty(n)&&t.call(e,this.data[n],n)},t.prototype.keys=function(){return b(this.data)},t.prototype.removeKey=function(t){delete this.data[t]},t}(),Sm=(Object.freeze||Object)({$override:r,guid:o,logError:a,clone:s,merge:l,mergeAll:u,extend:h,defaults:c,createCanvas:_m,indexOf:p,inherits:f,mixin:d,isArrayLike:g,each:y,map:v,reduce:m,filter:_,find:x,keys:b,bind:xm,curry:S,isArray:M,isFunction:T,isString:C,isStringSafe:I,isNumber:A,isObject:D,isBuiltInObject:k,isTypedArray:L,isDom:P,isGradientObject:O,isPatternObject:R,isRegExp:E,eqNaN:N,retrieve:B,retrieve2:z,retrieve3:F,slice:V,normalizeCssArray:H,assert:G,trim:W,setAsPrimitive:U,isPrimitive:X,HashMap:wm,createHashMap:Y,concatArray:j,createObject:q,hasOwn:Z,noop:K}),Mm=re,Tm=oe,Cm=ce,Im=pe,Am=(Object.freeze||Object)({create:$,copy:J,clone:Q,set:te,add:ee,scaleAndAdd:ne,sub:ie,len:re,length:Mm,lenSquare:oe,lengthSquare:Tm,mul:ae,div:se,dot:le,scale:ue,normalize:he,distance:ce,dist:Cm,distanceSquare:pe,distSquare:Im,negate:fe,lerp:de,applyTransform:ge,min:ye,max:ve}),Dm=function(){function t(t,e){this.target=t,this.topTarget=e&&e.topTarget}return t}(),km=function(){function t(t){this.handler=t,t.on("mousedown",this._dragStart,this),t.on("mousemove",this._drag,this),t.on("mouseup",this._dragEnd,this)}return t.prototype._dragStart=function(t){for(var e=t.target;e&&!e.draggable;)e=e.parent;e&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.handler.dispatchToElement(new Dm(e,t),"dragstart",t.event))},t.prototype._drag=function(t){var e=this._draggingTarget;if(e){var n=t.offsetX,i=t.offsetY,r=n-this._x,o=i-this._y;this._x=n,this._y=i,e.drift(r,o,t),this.handler.dispatchToElement(new Dm(e,t),"drag",t.event);var a=this.handler.findHover(n,i,e).target,s=this._dropTarget;this._dropTarget=a,e!==a&&(s&&a!==s&&this.handler.dispatchToElement(new Dm(s,t),"dragleave",t.event),a&&a!==s&&this.handler.dispatchToElement(new Dm(a,t),"dragenter",t.event))}},t.prototype._dragEnd=function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.handler.dispatchToElement(new Dm(e,t),"dragend",t.event),this._dropTarget&&this.handler.dispatchToElement(new Dm(this._dropTarget,t),"drop",t.event),this._draggingTarget=null,this._dropTarget=null},t}(),Lm=function(){function t(t){t&&(this._$eventProcessor=t)}return t.prototype.on=function(t,e,n,i){this._$handlers||(this._$handlers={});var r=this._$handlers;if("function"==typeof e&&(i=n,n=e,e=null),!n||!t)return this;var o=this._$eventProcessor;null!=e&&o&&o.normalizeQuery&&(e=o.normalizeQuery(e)),r[t]||(r[t]=[]);for(var a=0;ar;r++)n[t][r].h!==e&&i.push(n[t][r]);n[t]=i}n[t]&&0===n[t].length&&delete n[t]}else delete n[t];return this},t.prototype.trigger=function(t){for(var e=[],n=1;ns;s++){var l=i[s];if(!r||!r.filter||null==l.query||r.filter(t,l.query))switch(o){case 0:l.h.call(l.ctx);break;case 1:l.h.call(l.ctx,e[0]);break;case 2:l.h.call(l.ctx,e[0],e[1]);break;default:l.h.apply(l.ctx,e)}}return r&&r.afterTrigger&&r.afterTrigger(t),this},t.prototype.triggerWithContext=function(t){if(!this._$handlers)return this;var e=this._$handlers[t],n=this._$eventProcessor;if(e)for(var i=arguments,r=i.length,o=i[r-1],a=e.length,s=0;a>s;s++){var l=e[s];if(!n||!n.filter||null==l.query||n.filter(t,l.query))switch(r){case 0:l.h.call(o);break;case 1:l.h.call(o,i[0]);break;case 2:l.h.call(o,i[0],i[1]);break;default:l.h.apply(o,i.slice(1,r-1))}}return n&&n.afterTrigger&&n.afterTrigger(t),this},t}(),Pm=Math.log(2),Om="___zrEVENTSAVED",Rm=[],Em="undefined"!=typeof window&&!!window.addEventListener,Nm=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Bm=[],zm=Em?function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0}:function(t){t.returnValue=!1,t.cancelBubble=!0},Fm=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,n){return this._doTrack(t,e,n),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,n){var i=t.touches;if(i){for(var r={points:[],touches:[],target:e,event:t},o=0,a=i.length;a>o;o++){var s=i[o],l=Te(n,s,{});r.points.push([l.zrX,l.zrY]),r.touches.push(s)}this._track.push(r)}},t.prototype._recognize=function(t){for(var e in Vm)if(Vm.hasOwnProperty(e)){var n=Vm[e](this._track,t);if(n)return n}},t}(),Vm={pinch:function(t,e){var n=t.length;if(n){var i=(t[n-1]||{}).points,r=(t[n-2]||{}).points||i;if(r&&r.length>1&&i&&i.length>1){var o=Pe(i)/Pe(r);!isFinite(o)&&(o=1),e.pinchScale=o;var a=Oe(i);return e.pinchX=a[0],e.pinchY=a[1],{type:"pinch",target:t[0].target,event:e}}}}},Hm="silent",Gm=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return e(n,t),n.prototype.dispose=function(){},n.prototype.setCursor=function(){},n}(Lm),Wm=function(){function t(t,e){this.x=t,this.y=e}return t}(),Um=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],Xm=function(t){function n(e,n,i,r){var o=t.call(this)||this;return o._hovered=new Wm(0,0),o.storage=e,o.painter=n,o.painterRoot=r,i=i||new Gm,o.proxy=null,o.setHandlerProxy(i),o._draggingMgr=new km(o),o}return e(n,t),n.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(y(Um,function(e){t.on&&t.on(e,this[e],this)},this),t.handler=this),this.proxy=t},n.prototype.mousemove=function(t){var e=t.zrX,n=t.zrY,i=Be(this,e,n),r=this._hovered,o=r.target;o&&!o.__zr&&(r=this.findHover(r.x,r.y),o=r.target);var a=this._hovered=i?new Wm(e,n):this.findHover(e,n),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},n.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},n.prototype.resize=function(){this._hovered=new Wm(0,0)},n.prototype.dispatch=function(t,e){var n=this[t];n&&n.call(this,e)},n.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},n.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},n.prototype.dispatchToElement=function(t,e,n){t=t||{};var i=t.target;if(!i||!i.silent){for(var r="on"+e,o=Re(e,t,n);i&&(i[r]&&(o.cancelBubble=!!i[r].call(i,o)),i.trigger(e,o),i=i.__hostTarget?i.__hostTarget:i.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)}))}},n.prototype.findHover=function(t,e,n){for(var i=this.storage.getDisplayList(),r=new Wm(t,e),o=i.length-1;o>=0;o--){var a=void 0;if(i[o]!==n&&!i[o].ignore&&(a=Ne(i[o],t,e))&&(!r.topTarget&&(r.topTarget=i[o]),a!==Hm)){r.target=i[o];break}}return r},n.prototype.processGesture=function(t,e){this._gestureMgr||(this._gestureMgr=new Fm);var n=this._gestureMgr;"start"===e&&n.clear();var i=n.recognize(t,this.findHover(t.zrX,t.zrY,null).target,this.proxy.dom);if("end"===e&&n.clear(),i){var r=i.type;t.gestureEvent=r;var o=new Wm;o.target=i.target,this.dispatchToElement(o,r,i.event)}},n}(Lm);y(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){Xm.prototype[t]=function(e){var n,i,r=e.zrX,o=e.zrY,a=Be(this,r,o);if("mouseup"===t&&a||(n=this.findHover(r,o),i=n.target),"mousedown"===t)this._downEl=i,this._downPoint=[e.zrX,e.zrY],this._upEl=i;else if("mouseup"===t)this._upEl=i;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||Cm(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,t,e)}});var Ym,jm,qm=(Object.freeze||Object)({create:ze,identity:Fe,copy:Ve,mul:He,translate:Ge,rotate:We,scale:Ue,invert:Xe,clone:Ye}),Zm=Fe,Km=5e-5,$m=[],Jm=[],Qm=ze(),t_=Math.abs,e_=function(){function t(){}return t.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},t.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},t.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},t.prototype.needLocalTransform=function(){return je(this.rotation)||je(this.x)||je(this.y)||je(this.scaleX-1)||je(this.scaleY-1)},t.prototype.updateTransform=function(){var t=this.parent,e=t&&t.transform,n=this.needLocalTransform(),i=this.transform;return n||e?(i=i||ze(),n?this.getLocalTransform(i):Zm(i),e&&(n?He(i,t.transform,i):Ve(i,t.transform)),this.transform=i,void this._resolveGlobalScaleRatio(i)):void(i&&Zm(i))},t.prototype._resolveGlobalScaleRatio=function(t){var e=this.globalScaleRatio;if(null!=e&&1!==e){this.getGlobalScale($m);var n=$m[0]<0?-1:1,i=$m[1]<0?-1:1,r=(($m[0]-n)*e+n)/$m[0]||0,o=(($m[1]-i)*e+i)/$m[1]||0;t[0]*=r,t[1]*=r,t[2]*=o,t[3]*=o}this.invTransform=this.invTransform||ze(),Xe(this.invTransform,t)},t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.getComputedTransform=function(){for(var t=this,e=[];t;)e.push(t),t=t.parent;for(;t=e.pop();)t.updateTransform();return this.transform},t.prototype.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],n=t[2]*t[2]+t[3]*t[3];je(e-1)&&(e=Math.sqrt(e)),je(n-1)&&(n=Math.sqrt(n)),t[0]<0&&(e=-e),t[3]<0&&(n=-n),this.rotation=Math.atan2(-t[1]/n,t[0]/e),0>e&&0>n&&(this.rotation+=Math.PI,e=-e,n=-n),this.x=t[4],this.y=t[5],this.scaleX=e,this.scaleY=n}},t.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(He(Jm,t.invTransform,e),e=Jm);var n=this.originX,i=this.originY;(n||i)&&(Qm[4]=n,Qm[5]=i,He(Jm,e,Qm),Jm[4]-=n,Jm[5]-=i,e=Jm),this.setLocalTransform(e)}},t.prototype.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},t.prototype.transformCoordToLocal=function(t,e){var n=[t,e],i=this.invTransform;return i&&ge(n,n,i),n},t.prototype.transformCoordToGlobal=function(t,e){var n=[t,e],i=this.transform;return i&&ge(n,n,i),n},t.prototype.getLineScale=function(){var t=this.transform;return t&&t_(t[0]-1)>1e-10&&t_(t[3]-1)>1e-10?Math.sqrt(t_(t[0]*t[3]-t[2]*t[1])):1},t.getLocalTransform=function(t,e){e=e||[],Zm(e);var n=t.originX||0,i=t.originY||0,r=t.scaleX,o=t.scaleY,a=t.rotation||0,s=t.x,l=t.y;return e[4]-=n,e[5]-=i,e[0]*=r,e[1]*=o,e[2]*=r,e[3]*=o,e[4]*=r,e[5]*=o,a&&We(e,e,a),e[4]+=n,e[5]+=i,e[4]+=s,e[5]+=l,e},t.initDefaultProps=function(){var e=t.prototype;e.x=0,e.y=0,e.scaleX=1,e.scaleY=1,e.originX=0,e.originY=0,e.rotation=0,e.globalScaleRatio=1}(),t}(),n_={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1) -},elasticIn:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||1>n?(n=1,e=i/4):e=i*Math.asin(1/n)/(2*Math.PI),-(n*Math.pow(2,10*(t-=1))*Math.sin(2*(t-e)*Math.PI/i)))},elasticOut:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||1>n?(n=1,e=i/4):e=i*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*t)*Math.sin(2*(t-e)*Math.PI/i)+1)},elasticInOut:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||1>n?(n=1,e=i/4):e=i*Math.asin(1/n)/(2*Math.PI),(t*=2)<1?-.5*n*Math.pow(2,10*(t-=1))*Math.sin(2*(t-e)*Math.PI/i):n*Math.pow(2,-10*(t-=1))*Math.sin(2*(t-e)*Math.PI/i)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?.5*t*t*((e+1)*t-e):.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-n_.bounceOut(1-t)},bounceOut:function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return.5>t?.5*n_.bounceIn(2*t):.5*n_.bounceOut(2*t-1)+.5}},i_=function(){function t(t){this._initialized=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=null==t.loop?!1:t.loop,this.gap=t.gap||0,this.easing=t.easing||"linear",this.onframe=t.onframe,this.ondestroy=t.ondestroy,this.onrestart=t.onrestart}return t.prototype.step=function(t,e){if(this._initialized||(this._startTime=t+this._delay,this._initialized=!0),this._paused)return void(this._pausedTime+=e);var n=(t-this._startTime-this._pausedTime)/this._life;0>n&&(n=0),n=Math.min(n,1);var i=this.easing,r="string"==typeof i?n_[i]:i,o="function"==typeof r?r(n):n;if(this.onframe&&this.onframe(o),1===n){if(!this.loop)return!0;this._restart(t),this.onrestart&&this.onrestart()}return!1},t.prototype._restart=function(t){var e=(t-this._startTime-this._pausedTime)%this._life;this._startTime=t-e+this.gap,this._pausedTime=0},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t}(),r_=function(){function t(t){this.value=t}return t}(),o_=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new r_(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}(),a_=function(){function t(t){this._list=new o_,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,i=this._map,r=null;if(null==i[t]){var o=n.len(),a=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var s=n.head;n.remove(s),delete i[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new r_(e),a.key=t,n.insertEntry(a),i[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],n=this._list;return null!=e?(e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value):void 0},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}(),s_={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},l_=new a_(20),u_=null,h_=hn,c_=cn,p_=(Object.freeze||Object)({parse:on,lift:ln,toHex:un,fastLerp:hn,fastMapToColor:h_,lerp:cn,mapToColor:c_,modifyHSL:pn,modifyAlpha:fn,stringify:dn,lum:gn,random:yn}),f_=Array.prototype.slice,d_=[0,0,0,0],g_=function(){function t(t){this.keyframes=[],this.maxTime=0,this.arrDim=0,this.interpolable=!0,this._needsSort=!1,this._isAllValueEqual=!0,this._lastFrame=0,this._lastFramePercent=0,this.propName=t}return t.prototype.isFinished=function(){return this._finished},t.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},t.prototype.needsAnimate=function(){return!this._isAllValueEqual&&this.keyframes.length>=2&&this.interpolable},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e){t>=this.maxTime?this.maxTime=t:this._needsSort=!0;var n=this.keyframes,i=n.length;if(this.interpolable)if(g(e)){var r=kn(e);if(i>0&&this.arrDim!==r)return void(this.interpolable=!1);if(1===r&&"number"!=typeof e[0]||2===r&&"number"!=typeof e[0][0])return void(this.interpolable=!1);if(i>0){var o=n[i-1];this._isAllValueEqual&&(1===r?Mn(e,o.value)||(this._isAllValueEqual=!1):this._isAllValueEqual=!1)}this.arrDim=r}else{if(this.arrDim>0)return void(this.interpolable=!1);if("string"==typeof e){var a=on(e);a?(e=a,this.isValueColor=!0):this.interpolable=!1}else if("number"!=typeof e||isNaN(e))return void(this.interpolable=!1);if(this._isAllValueEqual&&i>0){var o=n[i-1];this.isValueColor&&!Mn(o.value,e)?this._isAllValueEqual=!1:o.value!==e&&(this._isAllValueEqual=!1)}}var s={time:t,value:e,percent:0};return this.keyframes.push(s),s},t.prototype.prepare=function(t){var e=this.keyframes;this._needsSort&&e.sort(function(t,e){return t.time-e.time});for(var n=this.arrDim,i=e.length,r=e[i-1],o=0;i>o;o++)e[o].percent=e[o].time/this.maxTime,n>0&&o!==i-1&&Sn(e[o].value,r.value,n);if(t&&this.needsAnimate()&&t.needsAnimate()&&n===t.arrDim&&this.isValueColor===t.isValueColor&&!t._finished){this._additiveTrack=t;for(var a=e[0].value,o=0;i>o;o++)0===n?e[o].additiveValue=this.isValueColor?bn([],e[o].value,a,-1):e[o].value-a:1===n?e[o].additiveValue=bn([],e[o].value,a,-1):2===n&&(e[o].additiveValue=wn([],e[o].value,a,-1))}},t.prototype.step=function(t,e){if(!this._finished){this._additiveTrack&&this._additiveTrack._finished&&(this._additiveTrack=null);var n,i=null!=this._additiveTrack,r=i?"additiveValue":"value",o=this.keyframes,a=this.keyframes.length,s=this.propName,l=this.arrDim,u=this.isValueColor;if(0>e)n=0;else if(e=0&&!(o[n].percent<=e);n--);n=Math.min(n,a-2)}else{for(n=this._lastFrame;a>n&&!(o[n].percent>e);n++);n=Math.min(n-1,a-2)}var c=o[n+1],p=o[n];if(p&&c){this._lastFrame=n,this._lastFramePercent=e;var f=c.percent-p.percent;if(0!==f){var d=(e-p.percent)/f,g=i?this._additiveValue:u?d_:t[s];if((l>0||u)&&!g&&(g=this._additiveValue=[]),this.useSpline){var y=o[n][r],v=o[0===n?n:n-1][r],m=o[n>a-2?a-1:n+1][r],_=o[n>a-3?a-1:n+2][r];if(l>0)1===l?Cn(g,v,y,m,_,d,d*d,d*d*d):In(g,v,y,m,_,d,d*d,d*d*d);else if(u)Cn(g,v,y,m,_,d,d*d,d*d*d),i||(t[s]=Dn(g));else{var x=void 0;x=this.interpolable?Tn(v,y,m,_,d,d*d,d*d*d):m,i?this._additiveValue=x:t[s]=x}}else if(l>0)1===l?_n(g,p[r],c[r],d):xn(g,p[r],c[r],d);else if(u)_n(g,p[r],c[r],d),i||(t[s]=Dn(g));else{var x=void 0;x=this.interpolable?vn(p[r],c[r],d):mn(p[r],c[r],d),i?this._additiveValue=x:t[s]=x}i&&this._addToTarget(t)}}}},t.prototype._addToTarget=function(t){var e=this.arrDim,n=this.propName,i=this._additiveValue;0===e?this.isValueColor?(on(t[n],d_),bn(d_,d_,i,1),t[n]=Dn(d_)):t[n]=t[n]+i:1===e?bn(t[n],t[n],i,1):2===e&&wn(t[n],t[n],i,1)},t}(),y_=function(){function t(t,e,n){return this._tracks={},this._trackKeys=[],this._delay=0,this._maxTime=0,this._paused=!1,this._started=0,this._clip=null,this._target=t,this._loop=e,e&&n?void a("Can' use additive animation on looped animation."):void(this._additiveAnimators=n)}return t.prototype.getTarget=function(){return this._target},t.prototype.changeTarget=function(t){this._target=t},t.prototype.when=function(t,e){return this.whenWithKeys(t,e,b(e))},t.prototype.whenWithKeys=function(t,e,n){for(var i=this._tracks,r=0;rn;n++)t[n].call(this)},t.prototype._abortedCallback=function(){this._setTracksFinished();var t=this.animation,e=this._abortedList;if(t&&t.removeClip(this._clip),this._clip=null,e)for(var n=0;n0)){this._started=1;for(var n=this,i=[],r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(r.getAdditiveTrack())}}}},t}(),v_=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,n=this.y;return this.x=t[0]*e+t[2]*n+t[4],this.y=t[1]*e+t[3]*n+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,n){t.x=e,t.y=n},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,n){t.x=e.x+n.x,t.y=e.y+n.y},t.sub=function(t,e,n){t.x=e.x-n.x,t.y=e.y-n.y},t.scale=function(t,e,n){t.x=e.x*n,t.y=e.y*n},t.scaleAndAdd=function(t,e,n,i){t.x=e.x+n.x*i,t.y=e.y+n.y*i},t.lerp=function(t,e,n,i){var r=1-i;t.x=r*e.x+i*n.x,t.y=r*e.y+i*n.y},t}(),m_=Math.min,__=Math.max,x_=new v_,b_=new v_,w_=new v_,S_=new v_,M_=new v_,T_=new v_,C_=function(){function t(t,e,n,i){0>n&&isFinite(n)&&(t+=n,n=-n),0>i&&isFinite(i)&&(e+=i,i=-i),this.x=t,this.y=e,this.width=n,this.height=i}return t.prototype.union=function(t){var e=m_(t.x,this.x),n=m_(t.y,this.y);this.width=isFinite(this.x)&&isFinite(this.width)?__(t.x+t.width,this.x+this.width)-e:t.width,this.height=isFinite(this.y)&&isFinite(this.height)?__(t.y+t.height,this.y+this.height)-n:t.height,this.x=e,this.y=n},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,n=t.width/e.width,i=t.height/e.height,r=ze();return Ge(r,r,[-e.x,-e.y]),Ue(r,r,[n,i]),Ge(r,r,[t.x,t.y]),r},t.prototype.intersect=function(e,n){if(!e)return!1;e instanceof t||(e=t.create(e));var i=this,r=i.x,o=i.x+i.width,a=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,h=e.y,c=e.y+e.height,p=!(l>o||r>u||h>s||a>c);if(n){var f=1/0,d=0,g=Math.abs(o-l),y=Math.abs(u-r),v=Math.abs(s-h),m=Math.abs(c-a),_=Math.min(g,y),x=Math.min(v,m);l>o||r>u?_>d&&(d=_,y>g?v_.set(T_,-g,0):v_.set(T_,y,0)):f>_&&(f=_,y>g?v_.set(M_,g,0):v_.set(M_,-y,0)),h>s||a>c?x>d&&(d=x,m>v?v_.set(T_,0,-v):v_.set(T_,0,m)):f>_&&(f=_,m>v?v_.set(M_,0,v):v_.set(M_,0,-m))}return n&&v_.copy(n,p?M_:T_),p},t.prototype.contain=function(t,e){var n=this;return t>=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,n,i){if(!i)return void(e!==n&&t.copy(e,n));if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var r=i[0],o=i[3],a=i[4],s=i[5];return e.x=n.x*r+a,e.y=n.y*o+s,e.width=n.width*r,e.height=n.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}x_.x=w_.x=n.x,x_.y=S_.y=n.y,b_.x=S_.x=n.x+n.width,b_.y=w_.y=n.y+n.height,x_.transform(i),S_.transform(i),b_.transform(i),w_.transform(i),e.x=m_(x_.x,b_.x,w_.x,S_.x),e.y=m_(x_.y,b_.y,w_.y,S_.y);var l=__(x_.x,b_.x,w_.x,S_.x),u=__(x_.y,b_.y,w_.y,S_.y);e.width=l-e.x,e.height=u-e.y},t}(),I_={},A_="12px sans-serif",D_={measureText:Ln},k_=1;"undefined"!=typeof window&&(k_=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var L_=k_,P_=.4,O_="#333",R_="#ccc",E_="#eee",N_="__zr_normal__",B_=["x","y","scaleX","scaleY","originX","originY","rotation","ignore"],z_={x:!0,y:!0,scaleX:!0,scaleY:!0,originX:!0,originY:!0,rotation:!0,ignore:!1},F_={},V_=new C_(0,0,0,0),H_=function(){function t(t){this.id=o(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var n=this.transform;n||(n=this.transform=[1,0,0,1,0,0]),n[4]+=t,n[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,r=e.attachedTransform,o=void 0,a=void 0,s=!1;r.parent=i?this:null;var l=!1;if(r.x=e.x,r.y=e.y,r.originX=e.originX,r.originY=e.originY,r.rotation=e.rotation,r.scaleX=e.scaleX,r.scaleY=e.scaleY,null!=n.position){var u=V_;u.copy(n.layoutRect?n.layoutRect:this.getBoundingRect()),i||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(F_,n,u):Fn(F_,n,u),r.x=F_.x,r.y=F_.y,o=F_.align,a=F_.verticalAlign;var h=n.origin;if(h&&null!=n.rotation){var c=void 0,p=void 0;"center"===h?(c=.5*u.width,p=.5*u.height):(c=zn(h[0],u.width),p=zn(h[1],u.height)),l=!0,r.originX=-r.x+c+(i?0:u.x),r.originY=-r.y+p+(i?0:u.y)}}null!=n.rotation&&(r.rotation=n.rotation);var f=n.offset;f&&(r.x+=f[0],r.y+=f[1],l||(r.originX=-f[0],r.originY=-f[1]));var d=null==n.inside?"string"==typeof n.position&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),y=void 0,v=void 0,m=void 0;d&&this.canBeInsideText()?(y=n.insideFill,v=n.insideStroke,(null==y||"auto"===y)&&(y=this.getInsideTextFill()),(null==v||"auto"===v)&&(v=this.getInsideTextStroke(y),m=!0)):(y=n.outsideFill,v=n.outsideStroke,(null==y||"auto"===y)&&(y=this.getOutsideFill()),(null==v||"auto"===v)&&(v=this.getOutsideStroke(y),m=!0)),y=y||"#000",(y!==g.fill||v!==g.stroke||m!==g.autoStroke||o!==g.align||a!==g.verticalAlign)&&(s=!0,g.fill=y,g.stroke=v,g.autoStroke=m,g.align=o,g.verticalAlign=a,e.setDefaultTextStyle(g)),s&&e.dirtyStyle(),e.markRedraw()}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?R_:O_},t.prototype.getOutsideStroke=function(){var t=this.__zr&&this.__zr.getBackgroundColor(),e="string"==typeof t&&on(t);e||(e=[255,255,255,1]);for(var n=e[3],i=this.__zr.isDarkMode(),r=0;3>r;r++)e[r]=e[r]*n+(i?0:255)*(1-n);return e[3]=1,dn(e,"rgba")},t.prototype.traverse=function(){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},h(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if(D(t))for(var n=t,i=b(n),r=0;r0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(N_,!1,t)},t.prototype.useState=function(e,n,i){var r=e===N_,o=this.hasState();if(o||!r){var s=this.currentStates,l=this.stateTransition;if(!(p(s,e)>=0)||!n&&1!==s.length){var u;if(this.stateProxy&&!r&&(u=this.stateProxy(e)),u||(u=this.states&&this.states[e]),!u&&!r)return void a("State "+e+" not exists.");r||this.saveCurrentToNormalState(u);var h=!(!u||!u.hoverLayer);return h&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,u,this._normalState,n,!i&&!this.__inHover&&l&&l.duration>0,l),this._textContent&&this._textContent.useState(e,n),this._textGuide&&this._textGuide.useState(e,n),r?(this.currentStates=[],this._normalState={}):n?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!h&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~t.REDARAW_BIT),u}}},t.prototype.useStates=function(e,n){if(e.length){var i=[],r=this.currentStates,o=e.length,a=o===r.length;if(a)for(var s=0;o>s;s++)if(e[s]!==r[s]){a=!1;break}if(a)return;for(var s=0;o>s;s++){var l=e[s],u=void 0;this.stateProxy&&(u=this.stateProxy(l,e)),u||(u=this.states[l]),u&&i.push(u)}var h=!(!i[o-1]||!i[o-1].hoverLayer);h&&this._toggleHoverLayerFlag(!0);var c=this._mergeStates(i),p=this.stateTransition;this.saveCurrentToNormalState(c),this._applyStateObj(e.join(","),c,this._normalState,!1,!n&&!this.__inHover&&p&&p.duration>0,p),this._textContent&&this._textContent.useStates(e),this._textGuide&&this._textGuide.useStates(e),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!h&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~t.REDARAW_BIT)}else this.clearStates()},t.prototype._updateAnimationTargets=function(){for(var t=0;t=0){var n=this.currentStates.slice();n.splice(e,1),this.useStates(n)}},t.prototype.replaceState=function(t,e,n){var i=this.currentStates.slice(),r=p(i,t),o=p(i,e)>=0;r>=0?o?i.splice(r,1):i[r]=e:n&&!o&&i.push(e),this.useStates(i)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,n={},i=0;i=0&&e.splice(n,1)}),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},t.prototype.updateDuringAnimation=function(){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var n=this.animators,i=n.length,r=[],o=0;i>o;o++){var a=n[o];t&&t!==a.scope?r.push(a):a.stop(e)}return this.animators=r,this},t.prototype.animateTo=function(t,e,n){Vn(this,t,e,n)},t.prototype.animateFrom=function(t,e,n){Vn(this,t,e,n,!0)},t.prototype._transitionState=function(t,e,n,i){for(var r=Vn(this,e,n,i),o=0;o8)&&(n("position","_legacyPos","x","y"),n("scale","_legacyScale","scaleX","scaleY"),n("origin","_legacyOrigin","originX","originY"))}(),t}();d(H_,Lm),d(H_,e_);var G_,W_=32,U_=7,X_=!1,Y_=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=ti}return t.prototype.traverse=function(t,e){for(var n=0;ni;i++)this._updateAndAddDisplayable(e[i],null,t);n.length=this._displayListLen,am.canvasSupported&&Jn(n,ti)},t.prototype._updateAndAddDisplayable=function(t,e,n){if(!t.ignore||n){t.beforeUpdate(),t.update(),t.afterUpdate();var i=t.getClipPath();if(t.ignoreClip)e=null;else if(i){e=e?e.slice():[];for(var r=i,o=t;r;)r.parent=o,r.updateTransform(),e.push(r),o=r,r=r.getClipPath()}if(t.childrenRef){for(var a=t.childrenRef(),s=0;s0&&(u.__clipPaths=[]),isNaN(u.z)&&(Qn(),u.z=0),isNaN(u.z2)&&(Qn(),u.z2=0),isNaN(u.zlevel)&&(Qn(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var h=t.getDecalElement&&t.getDecalElement();h&&this._updateAndAddDisplayable(h,e,n);var c=t.getTextGuideLine();c&&this._updateAndAddDisplayable(c,e,n);var p=t.getTextContent();p&&this._updateAndAddDisplayable(p,e,n)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,n=t.length;n>e;e++)this.delRoot(t[e]);else{var i=p(this._roots,t);i>=0&&this._roots.splice(i,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}();G_="undefined"!=typeof window&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var j_=G_,q_=function(t){function n(e){var n=t.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,e=e||{},n.stage=e.stage||{},n.onframe=e.onframe||function(){},n}return e(n,t),n.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._clipsHead?(this._clipsTail.next=t,t.prev=this._clipsTail,t.next=null,this._clipsTail=t):this._clipsHead=this._clipsTail=t,t.animation=this},n.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},n.prototype.removeClip=function(t){if(t.animation){var e=t.prev,n=t.next;e?e.next=n:this._clipsHead=n,n?n.prev=e:this._clipsTail=e,t.next=t.prev=t.animation=null}},n.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},n.prototype.update=function(t){for(var e=(new Date).getTime()-this._pausedTime,n=e-this._time,i=this._clipsHead;i;){var r=i.next,o=i.step(e,n);o?(i.ondestroy&&i.ondestroy(),this.removeClip(i),i=r):i=r}this._time=e,t||(this.onframe(n),this.trigger("frame",n),this.stage.update&&this.stage.update())},n.prototype._startLoop=function(){function t(){e._running&&(j_(t),!e._paused&&e.update())}var e=this;this._running=!0,j_(t)},n.prototype.start=function(){this._running||(this._time=(new Date).getTime(),this._pausedTime=0,this._startLoop())},n.prototype.stop=function(){this._running=!1},n.prototype.pause=function(){this._paused||(this._pauseStart=(new Date).getTime(),this._paused=!0)},n.prototype.resume=function(){this._paused&&(this._pausedTime+=(new Date).getTime()-this._pauseStart,this._paused=!1)},n.prototype.clear=function(){for(var t=this._clipsHead;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._clipsHead=this._clipsTail=null},n.prototype.isFinished=function(){return null==this._clipsHead},n.prototype.animate=function(t,e){e=e||{},this.start();var n=new y_(t,e.loop);return this.addAnimator(n),n},n}(Lm),Z_=300,K_=am.domSupported,$_=function(){var t=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},i=v(t,function(t){var e=t.replace("mouse","pointer");return n.hasOwnProperty(e)?e:t});return{mouse:t,touch:e,pointer:i}}(),J_={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},Q_=!1,tx=function(){function t(t,e){this.stopPropagation=K,this.stopImmediatePropagation=K,this.preventDefault=K,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY}return t}(),ex={mousedown:function(t){t=Ae(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=Ae(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=Ae(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){t=Ae(this.dom,t);var e=t.toElement||t.relatedTarget;oi(this,e)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){Q_=!0,t=Ae(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){Q_||(t=Ae(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){t=Ae(this.dom,t),ii(t),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),ex.mousemove.call(this,t),ex.mousedown.call(this,t)},touchmove:function(t){t=Ae(this.dom,t),ii(t),this.handler.processGesture(t,"change"),ex.mousemove.call(this,t)},touchend:function(t){t=Ae(this.dom,t),ii(t),this.handler.processGesture(t,"end"),ex.mouseup.call(this,t),+new Date-+this.__lastTouchMoment=0&&(n.splice(i,0,t),this._doAdd(t))}return this},n.prototype.replaceAt=function(t,e){var n=this._children,i=n[e];if(t&&t!==this&&t.parent!==this&&t!==i){n[e]=t,i.parent=null;var r=this.__zr;r&&i.removeSelfFromZr(r),this._doAdd(t)}return this},n.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},n.prototype.remove=function(t){var e=this.__zr,n=this._children,i=p(n,t);return 0>i?this:(n.splice(i,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh(),this)},n.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,n=0;n0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this.animation.start(),this._stillFrameAccum=0},t.prototype.addHover=function(){},t.prototype.removeHover=function(){},t.prototype.clearHover=function(){},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover()},t.prototype.resize=function(t){t=t||{},this.painter.resize(t.width,t.height),this.handler.resize()},t.prototype.clearAnimation=function(){this.animation.clear()},t.prototype.getWidth=function(){return this.painter.getWidth()},t.prototype.getHeight=function(){return this.painter.getHeight()},t.prototype.pathToImage=function(t,e){return this.painter.pathToImage?this.painter.pathToImage(t,e):void 0},t.prototype.setCursorStyle=function(t){this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){return this.handler.findHover(t,e)},t.prototype.on=function(t,e,n){return this.handler.on(t,e,n),this},t.prototype.off=function(t,e){this.handler.off(t,e)},t.prototype.trigger=function(t,e){this.handler.trigger(t,e)},t.prototype.clear=function(){for(var t=this.storage.getRoots(),e=0;e0&&(this._ux=mb(n/L_/t)||0,this._uy=mb(n/L_/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._lineDash&&(this._lineDash=null,this._dashOffset=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this.addData(ab.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var n=mb(t-this._xi)>this._ux||mb(e-this._yi)>this._uy||this._len<5;return this.addData(ab.L,t,e),this._ctx&&n&&(this._needsDash?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),n&&(this._xi=t,this._yi=e),this},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){return this.addData(ab.C,t,e,n,i,r,o),this._ctx&&(this._needsDash?this._dashedBezierTo(t,e,n,i,r,o):this._ctx.bezierCurveTo(t,e,n,i,r,o)),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,n,i){return this.addData(ab.Q,t,e,n,i),this._ctx&&(this._needsDash?this._dashedQuadraticTo(t,e,n,i):this._ctx.quadraticCurveTo(t,e,n,i)),this._xi=n,this._yi=i,this},t.prototype.arc=function(t,e,n,i,r,o){wb[0]=i,wb[1]=r,so(wb,o),i=wb[0],r=wb[1];var a=r-i;return this.addData(ab.A,t,e,n,n,i,a,0,o?0:1),this._ctx&&this._ctx.arc(t,e,n,i,r,o),this._xi=gb(r)*n+t,this._yi=yb(r)*n+e,this},t.prototype.arcTo=function(t,e,n,i,r){return this._ctx&&this._ctx.arcTo(t,e,n,i,r),this},t.prototype.rect=function(t,e,n,i){return this._ctx&&this._ctx.rect(t,e,n,i),this.addData(ab.R,t,e,n,i),this},t.prototype.closePath=function(){this.addData(ab.Z);var t=this._ctx,e=this._x0,n=this._y0;return t&&(this._needsDash&&this._dashedLineTo(e,n),t.closePath()),this._xi=e,this._yi=n,this},t.prototype.fill=function(t){t&&t.fill(),this.toStatic()},t.prototype.stroke=function(t){t&&t.stroke(),this.toStatic()},t.prototype.setLineDash=function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,n=0;nn;n++)this.data[n]=t[n];this._len=e},t.prototype.appendPath=function(t){t instanceof Array||(t=[t]);for(var e=t.length,n=0,i=this._len,r=0;e>r;r++)n+=t[r].len();bb&&this.data instanceof Float32Array&&(this.data=new Float32Array(i+n));for(var r=0;e>r;r++)for(var o=t[r].data,a=0;at.length&&(this._expandData(),t=this.data);for(var e=0;es&&(s=r+s),s%=r,f-=s*h,d-=s*c;h>0&&t>=f||0>h&&f>=t||0===h&&(c>0&&e>=d||0>c&&d>=e);)i=this._dashIdx,n=o[i],f+=h*n,d+=c*n,this._dashIdx=(i+1)%g,h>0&&l>f||0>h&&f>l||c>0&&u>d||0>c&&d>u||a[i%2?"moveTo":"lineTo"](h>=0?fb(f,t):db(f,t),c>=0?fb(d,e):db(d,e));h=f-t,c=d-e,this._dashOffset=-vb(h*h+c*c)},t.prototype._dashedBezierTo=function(t,e,n,i,r,o){var a,s,l,u,h,c=this._ctx,p=this._dashSum,f=this._dashOffset,d=this._lineDash,g=this._xi,y=this._yi,v=0,m=this._dashIdx,_=d.length,x=0;for(0>f&&(f=p+f),f%=p,a=0;1>a;a+=.1)s=Hr(g,t,n,r,a+.1)-Hr(g,t,n,r,a),l=Hr(y,e,i,o,a+.1)-Hr(y,e,i,o,a),v+=vb(s*s+l*l);for(;_>m&&(x+=d[m],!(x>f));m++);for(a=(x-f)/v;1>=a;)u=Hr(g,t,n,r,a),h=Hr(y,e,i,o,a),m%2?c.moveTo(u,h):c.lineTo(u,h),a+=d[m]/v,m=(m+1)%_;m%2!==0&&c.lineTo(r,o),s=r-u,l=o-h,this._dashOffset=-vb(s*s+l*l)},t.prototype._dashedQuadraticTo=function(t,e,n,i){var r=n,o=i;n=(n+2*t)/3,i=(i+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,n,i,r,o)},t.prototype.toStatic=function(){if(this._saveData){var t=this.data;t instanceof Array&&(t.length=this._len,bb&&this._len>11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){ub[0]=ub[1]=cb[0]=cb[1]=Number.MAX_VALUE,hb[0]=hb[1]=pb[0]=pb[1]=-Number.MAX_VALUE;var t,e=this.data,n=0,i=0,r=0,o=0;for(t=0;tc;){var p=t[c++],f=1===c;f&&(r=t[c],o=t[c+1],a=r,s=o);var d=-1;switch(p){case ab.M:r=a=t[c++],o=s=t[c++];break;case ab.L:var g=t[c++],y=t[c++],v=g-r,m=y-o;(mb(v)>n||mb(m)>i||c===e-1)&&(d=Math.sqrt(v*v+m*m),r=g,o=y);break;case ab.C:var _=t[c++],x=t[c++],g=t[c++],y=t[c++],b=t[c++],w=t[c++];d=jr(r,o,_,x,g,y,b,w,10),r=b,o=w;break;case ab.Q:var _=t[c++],x=t[c++],g=t[c++],y=t[c++];d=to(r,o,_,x,g,y,10),r=g,o=y;break;case ab.A:var S=t[c++],M=t[c++],T=t[c++],C=t[c++],I=t[c++],A=t[c++],D=A+I;c+=1;{!t[c++]}f&&(a=gb(I)*T+S,s=yb(I)*C+M),d=db(T,C)*fb(xb,Math.abs(A)),r=gb(D)*T+S,o=yb(D)*C+M;break;case ab.R:a=r=t[c++],s=o=t[c++];var k=t[c++],L=t[c++];d=2*k+2*L;break;case ab.Z:var v=a-r,m=s-o;d=Math.sqrt(v*v+m*m),r=a,o=s}d>=0&&(l[h++]=d,u+=d)}return this._pathLen=u,u},t.prototype.rebuildPath=function(t,e){var n,i,r,o,a,s,l,u,h,c=this.data,p=this._ux,f=this._uy,d=this._len,g=1>e,y=0,v=0;if(!g||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,u=this._pathLen,h=e*u))t:for(var m=0;d>m;){var _=c[m++],x=1===m;switch(x&&(r=c[m],o=c[m+1],n=r,i=o),_){case ab.M:n=r=c[m++],i=o=c[m++],t.moveTo(r,o);break;case ab.L:if(a=c[m++],s=c[m++],mb(a-r)>p||mb(s-o)>f||m===d-1){if(g){var b=l[v++];if(y+b>h){var w=(h-y)/b;t.lineTo(r*(1-w)+a*w,o*(1-w)+s*w);break t}y+=b}t.lineTo(a,s),r=a,o=s}break;case ab.C:var S=c[m++],M=c[m++],T=c[m++],C=c[m++],I=c[m++],A=c[m++];if(g){var b=l[v++];if(y+b>h){var w=(h-y)/b;Xr(r,S,T,I,w,sb),Xr(o,M,C,A,w,lb),t.bezierCurveTo(sb[1],lb[1],sb[2],lb[2],sb[3],lb[3]);break t}y+=b}t.bezierCurveTo(S,M,T,C,I,A),r=I,o=A;break;case ab.Q:var S=c[m++],M=c[m++],T=c[m++],C=c[m++];if(g){var b=l[v++];if(y+b>h){var w=(h-y)/b;Jr(r,S,T,w,sb),Jr(o,M,C,w,lb),t.quadraticCurveTo(sb[1],lb[1],sb[2],lb[2]);break t}y+=b}t.quadraticCurveTo(S,M,T,C),r=T,o=C;break;case ab.A:var D=c[m++],k=c[m++],L=c[m++],P=c[m++],O=c[m++],R=c[m++],E=c[m++],N=!c[m++],B=L>P?L:P,z=mb(L-P)>.001,F=O+R,V=!1;if(g){var b=l[v++];y+b>h&&(F=O+R*(h-y)/b,V=!0),y+=b}if(z&&t.ellipse?t.ellipse(D,k,L,P,E,O,F,N):t.arc(D,k,B,O,F,N),V)break t;x&&(n=gb(O)*L+D,i=yb(O)*P+k),r=gb(F)*L+D,o=yb(F)*P+k;break;case ab.R:n=r=c[m],i=o=c[m+1],a=c[m++],s=c[m++];var H=c[m++],G=c[m++];if(g){var b=l[v++];if(y+b>h){var W=h-y;t.moveTo(a,s),t.lineTo(a+fb(W,H),s),W-=H,W>0&&t.lineTo(a+H,s+fb(W,G)),W-=G,W>0&&t.lineTo(a+db(H-W,0),s+G),W-=H,W>0&&t.lineTo(a,s+db(G-W,0));break t}y+=b}t.rect(a,s,H,G);break;case ab.Z:if(g){var b=l[v++];if(y+b>h){var w=(h-y)/b;t.lineTo(r*(1-w)+n*w,o*(1-w)+i*w);break t}y+=b}t.closePath(),r=n,o=i}}},t.CMD=ab,t.initDefaultProps=function(){var e=t.prototype;e._saveData=!0,e._needsDash=!1,e._dashOffset=0,e._dashIdx=0,e._dashSum=0,e._ux=0,e._uy=0}(),t}(),Mb=2*Math.PI,Tb=2*Math.PI,Cb=Sb.CMD,Ib=2*Math.PI,Ab=1e-4,Db=[-1,-1,-1],kb=[-1,-1],Lb=c({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Ex),Pb={style:c({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},Nx.style)},Ob=["x","y","rotation","scaleX","scaleY","originX","originY","invisible","culling","z","z2","zlevel","parent"],Rb=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.update=function(){var e=this;t.prototype.update.call(this);var i=this.style;if(i.decal){var r=this._decalEl=this._decalEl||new n;r.buildPath===n.prototype.buildPath&&(r.buildPath=function(t){e.buildPath(t,e.shape)}),r.silent=!0;var o=r.style;for(var a in i)o[a]!==i[a]&&(o[a]=i[a]);o.fill=i.fill?i.decal:null,o.decal=null,o.shadowColor=null,i.strokeFirst&&(o.stroke=null);for(var s=0;s.5?O_:e>.2?E_:R_}if(t)return R_}return O_},n.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if(C(e)){var n=this.__zr,i=!(!n||!n.isDarkMode()),r=gn(t,0)0))},n.prototype.hasFill=function(){var t=this.style,e=t.fill;return null!=e&&"none"!==e},n.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,i=!t;if(i){var r=!1;this.path||(r=!0,this.createPathProxy());var o=this.path;(r||this.__dirty&n.SHAPE_CHANGED_BIT)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),t=o.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var a=this._rectWithStroke||(this._rectWithStroke=t.clone());if(this.__dirty||i){a.copy(t);var s=e.strokeNoScale?this.getLineScale():1,l=e.lineWidth;if(!this.hasFill()){var u=this.strokeContainThreshold;l=Math.max(l,null==u?4:u)}s>1e-10&&(a.width+=l/s,a.height+=l/s,a.x-=l/s/2,a.y-=l/s/2)}return a}return t},n.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect(),r=this.style;if(t=n[0],e=n[1],i.contain(t,e)){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),wo(o,a/s,t,e)))return!0}if(this.hasFill())return bo(o,t,e)}return!1},n.prototype.dirtyShape=function(){this.__dirty|=n.SHAPE_CHANGED_BIT,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},n.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},n.prototype.animateShape=function(t){return this.animate("shape",t)},n.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},n.prototype.attrKV=function(e,n){"shape"===e?this.setShape(n):t.prototype.attrKV.call(this,e,n)},n.prototype.setShape=function(t,e){var n=this.shape;return n||(n=this.shape={}),"string"==typeof t?n[t]=e:h(n,t),this.dirtyShape(),this},n.prototype.shapeChanged=function(){return!!(this.__dirty&n.SHAPE_CHANGED_BIT)},n.prototype.createStyle=function(t){return q(Lb,t)},n.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var n=this._normalState;e.shape&&!n.shape&&(n.shape=h({},this.shape))},n.prototype._applyStateObj=function(e,n,i,r,o,a){t.prototype._applyStateObj.call(this,e,n,i,r,o,a);var s,l=!(n&&r);if(n&&n.shape?o?r?s=n.shape:(s=h({},i.shape),h(s,n.shape)):(s=h({},r?this.shape:i.shape),h(s,n.shape)):l&&(s=i.shape),s)if(o){this.shape=h({},this.shape); -for(var u={},c=b(s),p=0;p0},n.prototype.hasFill=function(){var t=this.style,e=t.fill;return null!=e&&"none"!==e},n.prototype.createStyle=function(t){return q(Eb,t)},n.prototype.setBoundingRect=function(t){this._rect=t},n.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var e=t.text;null!=e?e+="":e="";var n=Rn(e,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var i=t.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},n.initDefaultProps=function(){var t=n.prototype;t.dirtyRectTolerance=10}(),n}(zx);Nb.prototype.type="tspan";var Bb=c({x:0,y:0},Ex),zb={style:c({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},Nx.style)},Fb=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.createStyle=function(t){return q(Bb,t)},n.prototype._getSize=function(t){var e=this.style,n=e[t];if(null!=n)return n;var i=So(e.image)?e.image:this.__image;if(!i)return 0;var r="width"===t?"height":"width",o=e[r];return null==o?i[t]:i[t]/i[r]*o},n.prototype.getWidth=function(){return this._getSize("width")},n.prototype.getHeight=function(){return this._getSize("height")},n.prototype.getAnimationStyleProps=function(){return zb},n.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new C_(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},n}(zx);Fb.prototype.type="image";var Vb=Math.round,Hb=function(){function t(){this.x=0,this.y=0,this.width=0,this.height=0}return t}(),Gb={},Wb=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new Hb},n.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=Co(Gb,e,this.style);n=a.x,i=a.y,r=a.width,o=a.height,a.r=e.r,e=a}else n=e.x,i=e.y,r=e.width,o=e.height;e.r?Mo(t,e):t.rect(n,i,r,o)},n.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},n}(Rb);Wb.prototype.type="rect";var Ub={fill:"#000"},Xb=2,Yb={style:c({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},Nx.style)},jb=function(t){function n(e){var n=t.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=Ub,n.attr(e),n}return e(n,t),n.prototype.childrenRef=function(){return this._children},n.prototype.update=function(){this.styleChanged()&&this._updateSubTexts();for(var e=0;e0,T=null!=t.width&&("truncate"===t.overflow||"break"===t.overflow||"breakAll"===t.overflow),C=r.calculatedLineHeight,I=0;IM&&(A=x[M],!A.align||"left"===A.align);)this._placeToken(A,t,w,g,T,"left",v),S-=A.width,T+=A.width,M++;for(;I>=0&&(A=x[I],"right"===A.align);)this._placeToken(A,t,w,g,C,"right",v),S-=A.width,C-=A.width,I--;for(T+=(i-(T-d)-(y-C)-S)/2;I>=M;)A=x[M],this._placeToken(A,t,w,g,T+A.width/2,"center",v),T+=A.width,M++;g+=w}},n.prototype._placeToken=function(t,e,n,i,r,o,a){var s=e.rich[t.styleName]||{};s.text=t.text;var l=t.verticalAlign,u=i+n/2;"top"===l?u=i+t.height/2:"bottom"===l&&(u=i+n-t.height/2);var h=!t.isLineHolder&&Ro(s);h&&this._renderBackground(s,e,"right"===o?r-t.width:"center"===o?r-t.width/2:r,u-t.height/2,t.width,t.height);var c=!!s.backgroundColor,p=t.textPadding;p&&(r=Po(r,o,p),u-=t.height/2-p[0]-t.innerHeight/2);var f=this._getOrCreateChild(Nb),d=f.createStyle();f.useStyle(d);var g=this._defaultStyle,y=!1,v=0,m=ko("fill"in s?s.fill:"fill"in e?e.fill:(y=!0,g.fill)),_=ko("stroke"in s?s.stroke:"stroke"in e?e.stroke:c||a||g.autoStroke&&!y?null:(v=Xb,g.stroke)),x=s.textShadowBlur>0||e.textShadowBlur>0;d.text=t.text,d.x=r,d.y=u,x&&(d.shadowBlur=s.textShadowBlur||e.textShadowBlur||0,d.shadowColor=s.textShadowColor||e.textShadowColor||"transparent",d.shadowOffsetX=s.textShadowOffsetX||e.textShadowOffsetX||0,d.shadowOffsetY=s.textShadowOffsetY||e.textShadowOffsetY||0),d.textAlign=o,d.textBaseline="middle",d.font=t.font||A_,d.opacity=F(s.opacity,e.opacity,1),_&&(d.lineWidth=F(s.lineWidth,e.lineWidth,v),d.lineDash=z(s.lineDash,e.lineDash),d.lineDashOffset=e.lineDashOffset||0,d.stroke=_),m&&(d.fill=m);var b=t.contentWidth,w=t.contentHeight;f.setBoundingRect(new C_(En(d.x,b,d.textAlign),Nn(d.y,w,d.textBaseline),b,w))},n.prototype._renderBackground=function(t,e,n,i,r,o){var a,s,l=t.backgroundColor,u=t.borderWidth,h=t.borderColor,c=C(l),p=t.borderRadius,f=this;if(c||u&&h){a=this._getOrCreateChild(Wb),a.useStyle(a.createStyle()),a.style.fill=null;var d=a.shape;d.x=n,d.y=i,d.width=r,d.height=o,d.r=p,a.dirtyShape()}if(c){var g=a.style;g.fill=l||null,g.fillOpacity=z(t.fillOpacity,1)}else if(l&&l.image){s=this._getOrCreateChild(Fb),s.onload=function(){f.dirtyStyle()};var y=s.style;y.image=l.image,y.x=n,y.y=i,y.width=r,y.height=o}if(u&&h){var g=a.style;g.lineWidth=u,g.stroke=h,g.strokeOpacity=z(t.strokeOpacity,1),g.lineDash=t.borderDash,g.lineDashOffset=t.borderDashOffset||0,a.strokeContainThreshold=0,a.hasFill()&&a.hasStroke()&&(g.strokeFirst=!0,g.lineWidth*=2)}var v=(a||s).style;v.shadowBlur=t.shadowBlur||0,v.shadowColor=t.shadowColor||"transparent",v.shadowOffsetX=t.shadowOffsetX||0,v.shadowOffsetY=t.shadowOffsetY||0,v.opacity=F(t.opacity,e.opacity,1)},n.makeFont=function(t){var e="";if(t.fontSize||t.fontFamily||t.fontWeight){var n="";n="string"!=typeof t.fontSize||-1===t.fontSize.indexOf("px")&&-1===t.fontSize.indexOf("rem")&&-1===t.fontSize.indexOf("em")?isNaN(+t.fontSize)?"12px":t.fontSize+"px":t.fontSize,e=[t.fontStyle,t.fontWeight,n,t.fontFamily||"sans-serif"].join(" ")}return e&&W(e)||t.textFont||t.font},n}(zx),qb={left:!0,right:1,center:1},Zb={top:1,bottom:1,middle:1},Kb=or(),$b=1,Jb={},Qb=or(),tw=0,ew=1,nw=2,iw=["emphasis","blur","select"],rw=["normal","emphasis","blur","select"],ow=10,aw=9,sw="highlight",lw="downplay",uw="select",hw="unselect",cw="toggleSelect",pw=new a_(100),fw=["emphasis","blur","select"],dw={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"},gw=Sb.CMD,yw=[[],[],[]],vw=Math.sqrt,mw=Math.atan2,_w=Math.sqrt,xw=Math.sin,bw=Math.cos,ww=Math.PI,Sw=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,Mw=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g,Tw=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.applyTransform=function(){},n}(Rb),Cw=function(){function t(){this.cx=0,this.cy=0,this.r=0}return t}(),Iw=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new Cw},n.prototype.buildPath=function(t,e,n){n&&t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI)},n}(Rb);Iw.prototype.type="circle";var Aw=function(){function t(){this.cx=0,this.cy=0,this.rx=0,this.ry=0}return t}(),Dw=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new Aw},n.prototype.buildPath=function(t,e){var n=.5522848,i=e.cx,r=e.cy,o=e.rx,a=e.ry,s=o*n,l=a*n;t.moveTo(i-o,r),t.bezierCurveTo(i-o,r-l,i-s,r-a,i,r-a),t.bezierCurveTo(i+s,r-a,i+o,r-l,i+o,r),t.bezierCurveTo(i+o,r+l,i+s,r+a,i,r+a),t.bezierCurveTo(i-s,r+a,i-o,r+l,i-o,r),t.closePath()},n}(Rb);Dw.prototype.type="ellipse";var kw=Math.PI,Lw=2*kw,Pw=Math.sin,Ow=Math.cos,Rw=Math.acos,Ew=Math.atan2,Nw=Math.abs,Bw=Math.sqrt,zw=Math.max,Fw=Math.min,Vw=1e-4,Hw=function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0,this.innerCornerRadius=0}return t}(),Gw=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new Hw},n.prototype.buildPath=function(t,e){Va(t,e)},n.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},n}(Rb);Gw.prototype.type="sector";var Ww=function(){function t(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return t}(),Uw=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new Ww},n.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=2*Math.PI;t.moveTo(n+e.r,i),t.arc(n,i,e.r,0,r,!1),t.moveTo(n+e.r0,i),t.arc(n,i,e.r0,0,r,!0)},n}(Rb);Uw.prototype.type="ring";var Xw=function(){function t(){this.points=null,this.smooth=0,this.smoothConstraint=null}return t}(),Yw=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new Xw},n.prototype.buildPath=function(t,e){Ua(t,e,!0)},n}(Rb);Yw.prototype.type="polygon";var jw=function(){function t(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null}return t}(),qw=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new jw},n.prototype.buildPath=function(t,e){Ua(t,e,!1)},n}(Rb);qw.prototype.type="polyline";var Zw={},Kw=function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return t}(),$w=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new Kw},n.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=To(Zw,e,this.style);n=a.x1,i=a.y1,r=a.x2,o=a.y2}else n=e.x1,i=e.y1,r=e.x2,o=e.y2;var s=e.percent;0!==s&&(t.moveTo(n,i),1>s&&(r=n*(1-s)+r*s,o=i*(1-s)+o*s),t.lineTo(r,o))},n.prototype.pointAt=function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]},n}(Rb);$w.prototype.type="line";var Jw=[],Qw=function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.percent=1}return t}(),tS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new Qw},n.prototype.buildPath=function(t,e){var n=e.x1,i=e.y1,r=e.x2,o=e.y2,a=e.cpx1,s=e.cpy1,l=e.cpx2,u=e.cpy2,h=e.percent;0!==h&&(t.moveTo(n,i),null==l||null==u?(1>h&&(Jr(n,a,r,h,Jw),a=Jw[1],r=Jw[2],Jr(i,s,o,h,Jw),s=Jw[1],o=Jw[2]),t.quadraticCurveTo(a,s,r,o)):(1>h&&(Xr(n,a,l,r,h,Jw),a=Jw[1],l=Jw[2],r=Jw[3],Xr(i,s,u,o,h,Jw),s=Jw[1],u=Jw[2],o=Jw[3]),t.bezierCurveTo(a,s,l,u,r,o)))},n.prototype.pointAt=function(t){return Xa(this.shape,t,!1)},n.prototype.tangentAt=function(t){var e=Xa(this.shape,t,!0);return he(e,e)},n}(Rb);tS.prototype.type="bezier-curve";var eS=function(){function t(){this.cx=0,this.cy=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0}return t}(),nS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new eS},n.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=Math.max(e.r,0),o=e.startAngle,a=e.endAngle,s=e.clockwise,l=Math.cos(o),u=Math.sin(o);t.moveTo(l*r+n,u*r+i),t.arc(n,i,r,o,a,!s)},n}(Rb);nS.prototype.type="arc";var iS=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="compound",e}return e(n,t),n.prototype._updatePathDirty=function(){for(var t=this.shape.paths,e=this.shapeChanged(),n=0;nn;n++)this._corners[n]=new v_;for(var n=0;2>n;n++)this._axes[n]=new v_;t&&this.fromBoundingRect(t,e)}return t.prototype.fromBoundingRect=function(t,e){var n=this._corners,i=this._axes,r=t.x,o=t.y,a=r+t.width,s=o+t.height;if(n[0].set(r,o),n[1].set(a,o),n[2].set(a,s),n[3].set(r,s),e)for(var l=0;4>l;l++)n[l].transform(e);v_.sub(i[0],n[1],n[0]),v_.sub(i[1],n[3],n[0]),i[0].normalize(),i[1].normalize();for(var l=0;2>l;l++)this._origin[l]=i[l].dot(n[0])},t.prototype.intersect=function(t,e){var n=!0,i=!e;return uS.set(1/0,1/0),hS.set(0,0),!this._intersectCheckOneSide(this,t,uS,hS,i,1)&&(n=!1,i)?n:!this._intersectCheckOneSide(t,this,uS,hS,i,-1)&&(n=!1,i)?n:(i||v_.copy(e,n?uS:hS),n)},t.prototype._intersectCheckOneSide=function(t,e,n,i,r,o){for(var a=!0,s=0;2>s;s++){var l=this._axes[s];if(this._getProjMinMaxOnAxis(s,t._corners,sS),this._getProjMinMaxOnAxis(s,e._corners,lS),sS[1]lS[1]){if(a=!1,r)return a;var u=Math.abs(lS[0]-sS[1]),h=Math.abs(sS[0]-lS[1]);Math.min(u,h)>i.len()&&(h>u?v_.scale(i,l,-u*o):v_.scale(i,l,h*o))}else if(n){var u=Math.abs(lS[0]-sS[1]),h=Math.abs(sS[0]-lS[1]);Math.min(u,h)u?v_.scale(n,l,u*o):v_.scale(n,l,-h*o))}}return a},t.prototype._getProjMinMaxOnAxis=function(t,e,n){for(var i=this._axes[t],r=this._origin,o=e[0].dot(i)+r[t],a=o,s=o,l=1;l-1?FS:HS}():HS;Fs(VS,BS),Fs(FS,zS);var XS=1e3,YS=60*XS,jS=60*YS,qS=24*jS,ZS=365*qS,KS={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{hh}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}"},$S="{yyyy}-{MM}-{dd}",JS={year:"{yyyy}",month:"{yyyy}-{MM}",day:$S,hour:$S+" "+KS.hour,minute:$S+" "+KS.minute,second:$S+" "+KS.second,millisecond:KS.none},QS=["year","month","day","hour","minute","second","millisecond"],tM=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"],eM=H,nM=/([&<>"'])/g,iM={"&":"&","<":"<",">":">",'"':""","'":"'"},rM=["a","b","c","d","e","f","g"],oM=function(t,e){return"{"+t+(null==e?"":e)+"}"},aM=y,sM=["left","right","top","bottom","width","height"],lM=[["width","left","right"],["height","top","bottom"]],uM=wl,hM=(S(wl,"vertical"),S(wl,"horizontal"),or()),cM=function(t){function n(e,n,i){var r=t.call(this,e,n,i)||this;return r.uid=Es("ec_cpt_model"),r}return e(n,t),n.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n)},n.prototype.mergeDefaultAndTheme=function(t,e){var n=Ml(this),i=n?Cl(t):{},r=e.getTheme();l(t,r.get(this.mainType)),l(t,this.getDefaultOption()),n&&Tl(t,i,n)},n.prototype.mergeOption=function(t){l(this.option,t,!0);var e=Ml(this);e&&Tl(this.option,t,e)},n.prototype.optionUpdated=function(){},n.prototype.getDefaultOption=function(){var t=this.constructor;if(!gr(t))return t.defaultOption;var e=hM(this);if(!e.defaultOption){for(var n=[],i=t;i;){var r=i.prototype.defaultOption;r&&n.push(r),i=i.superClass}for(var o={},a=n.length-1;a>=0;a--)o=l(o,n[a],!0);e.defaultOption=o}return e.defaultOption},n.prototype.getReferringComponents=function(t,e){var n=t+"Index",i=t+"Id";return lr(this.ecModel,t,{index:this.get(n,!0),id:this.get(i,!0)},e)},n.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},n.protoInitialize=function(){var t=n.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),n}(ES);mr(cM,ES),wr(cM),Ns(cM),Bs(cM,Al);var pM="";"undefined"!=typeof navigator&&(pM=navigator.platform||"");var fM,dM,gM="rgba(0, 0, 0, 0.2)",yM={darkMode:"auto",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:gM,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:gM,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:gM,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:gM,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:gM,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:gM,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:pM.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1},vM=Y(["tooltip","label","itemName","itemId","seriesName"]),mM="original",_M="arrayRows",xM="objectRows",bM="keyedColumns",wM="typedArray",SM="unknown",MM="column",TM="row",CM={Must:1,Might:2,Not:3},IM=or(),AM=Y(),DM=or(),kM=(or(),function(){function t(){}return t.prototype.getColorFromPalette=function(t,e,n){var i=Vi(this.get("color",!0)),r=this.get("colorLayer",!0); -return zl(this,DM,i,r,t,e,n)},t.prototype.clearColorPalette=function(){Fl(this,DM)},t}()),LM="\x00_ec_inner",PM=1,OM=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.init=function(t,e,n,i,r,o){i=i||{},this.option=null,this._theme=new ES(i),this._locale=new ES(r),this._optionManager=o},n.prototype.setOption=function(t,e,n){var i=Ul(e);this._optionManager.setOption(t,n,i),this._resetOption(null,i)},n.prototype.resetOption=function(t,e){return this._resetOption(t,Ul(e))},n.prototype._resetOption=function(t,e){var n=!1,i=this._optionManager;if(!t||"recreate"===t){var r=i.mountOption("recreate"===t);this.option&&"recreate"!==t?(this.restoreData(),this._mergeOption(r,e)):dM(this,r),n=!0}if(("timeline"===t||"media"===t)&&this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(n=!0,this._mergeOption(o,e))}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this);a.length&&y(a,function(t){n=!0,this._mergeOption(t,e)},this)}return n},n.prototype.mergeOption=function(t){this._mergeOption(t,null)},n.prototype._mergeOption=function(t,e){function n(e){var n=Nl(this,e,Vi(t[e])),a=r.get(e),s=a?c&&c.get(e)?"replaceMerge":"normalMerge":"replaceAll",l=Ui(a,n,s);nr(l,e,cM),i[e]=null,r.set(e,null),o.set(e,0);var u=[],p=[],f=0;y(l,function(t,n){var i=t.existing,r=t.newOption;if(r){var o="series"===e,a=cM.getClass(e,t.keyInfo.subType,!o);if(!a)return;if(i&&i.constructor===a)i.name=t.keyInfo.name,i.mergeOption(r,this),i.optionUpdated(r,!1);else{var s=h({componentIndex:n},t.keyInfo);i=new a(r,this,this,s),h(i,s),t.brandNew&&(i.__requireNewView=!0),i.init(r,this,this),i.optionUpdated(null,!0)}}else i&&(i.mergeOption({},this),i.optionUpdated({},!1));i?(u.push(i.option),p.push(i),f++):(u.push(void 0),p.push(void 0))},this),i[e]=u,r.set(e,p),o.set(e,f),"series"===e&&fM(this)}var i=this.option,r=this._componentsMap,o=this._componentsCount,a=[],u=Y(),c=e&&e.replaceMergeMainTypeMap;Dl(this),y(t,function(t,e){null!=t&&(cM.hasClass(e)?e&&(a.push(e),u.set(e,!0)):i[e]=null==i[e]?s(t):l(i[e],t,!0))}),c&&c.each(function(t,e){cM.hasClass(e)&&!u.get(e)&&(a.push(e),u.set(e,!0))}),cM.topologicalTravel(a,cM.getAllClassMainTypes(),n,this),this._seriesIndices||fM(this)},n.prototype.getOption=function(){var t=s(this.option);return y(t,function(e,n){if(cM.hasClass(n)){for(var i=Vi(e),r=i.length,o=!1,a=r-1;a>=0;a--)i[a]&&!er(i[a])?o=!0:(i[a]=null,!o&&r--);i.length=r,t[n]=i}}),delete t[LM],t},n.prototype.getTheme=function(){return this._theme},n.prototype.getLocaleModel=function(){return this._locale},n.prototype.getLocale=function(t){var e=this.getLocaleModel();return e.get(t)},n.prototype.setUpdatePayload=function(t){this._payload=t},n.prototype.getUpdatePayload=function(){return this._payload},n.prototype.getComponent=function(t,e){var n=this._componentsMap.get(t);if(n){var i=n[e||0];if(i)return i;if(null==e)for(var r=0;ra;a++)Yl(n[a].query,t,e)&&r.push(a);return!r.length&&i&&(r=[-1]),r.length&&!ql(r,this._currentMediaIndices)&&(o=v(r,function(t){return s(-1===t?i.option:n[t].option)})),this._currentMediaIndices=r,o},t}(),XM=y,YM=D,jM=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"],qM=[["x","left"],["y","top"],["x2","right"],["y2","bottom"]],ZM=["grid","geo","parallel","legend","toolbox","title","visualMap","dataZoom","timeline"],KM=[["borderRadius","barBorderRadius"],["borderColor","barBorderColor"],["borderWidth","barBorderWidth"]],$M=function(){function t(t){this.data=t.data||(t.sourceFormat===bM?{}:[]),this.sourceFormat=t.sourceFormat||SM,this.seriesLayoutBy=t.seriesLayoutBy||MM,this.startIndex=t.startIndex||0,this.dimensionsDefine=t.dimensionsDefine,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.encodeDefine=t.encodeDefine,this.metaRawOption=t.metaRawOption}return t}(),JM=function(){function t(t,e){var n=gu(t)?t:vu(t);this._source=n;var i=this._data=n.data;n.sourceFormat===wM&&(this._offset=0,this._dimSize=e,this._data=i),zM(this,i,n)}return t.prototype.getSource=function(){return this._source},t.prototype.count=function(){return 0},t.prototype.getItem=function(){},t.prototype.appendData=function(){},t.prototype.clean=function(){},t.protoInitialize=function(){var e=t.prototype;e.pure=!1,e.persistent=!0}(),t.internalField=function(){function t(t){for(var e=0;eo;o++)e[o]=n[r+o];return e},i=function(t,e,n,i){for(var r=this._data,o=this._dimSize,a=0;o>a;a++){for(var s=i[a],l=null==s[0]?1/0:s[0],u=null==s[1]?-1/0:s[1],h=e-t,c=n[a],p=0;h>p;p++){var f=r[p*o+a];c[t+p]=f,l>f&&(l=f),f>u&&(u=f)}s[0]=l,s[1]=u}},r=function(){return this._data?this._data.length/this._dimSize:0};e={},e[_M+"_"+MM]={pure:!0,appendData:t},e[_M+"_"+TM]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[xM]={pure:!0,appendData:t},e[bM]={pure:!0,appendData:function(t){var e=this._data;y(t,function(t,n){for(var i=e[n]||(e[n]=[]),r=0;r<(t||[]).length;r++)i.push(t[r])})}},e[mM]={appendData:t},e[wM]={persistent:!1,pure:!0,appendData:function(t){this._data=t},clean:function(){this._offset+=this.count(),this._data=null}},BM=e}(),t}(),QM=function(t,e,n,i){return t[i]},tT=(RM={},RM[_M+"_"+MM]=function(t,e,n,i){return t[i+e]},RM[_M+"_"+TM]=function(t,e,n,i){i+=e;for(var r=[],o=t,a=0;a=1)&&(t=1),t}var n=this._upstream,i=t&&t.skip;if(this._dirty&&n){var r=this.context;r.data=r.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var o;this._plan&&!i&&(o=this._plan(this.context));var a=e(this._modBy),s=this._modDataCount||0,l=e(t&&t.modBy),u=t&&t.modDataCount||0;(a!==l||s!==u)&&(o="reset");var h;(this._dirty||"reset"===o)&&(this._dirty=!1,h=this._doReset(i)),this._modBy=l,this._modDataCount=u;var c=t&&t.step;if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var p=this._dueIndex,f=Math.min(null!=c?this._dueIndex+c:1/0,this._dueEnd);if(!i&&(h||f>p)){var d=this._progress;if(M(d))for(var g=0;gi?i++:null}function e(){var t=i%a*r+Math.ceil(i/a),e=i>=n?null:o>t?t:i;return i++,e}var n,i,r,o,a,s={reset:function(l,u,h,c){i=l,n=u,r=h,o=c,a=Math.ceil(o/r),s.next=r>1&&o>0?e:t}};return s}(),uT=(Y({number:function(t){return parseFloat(t)},time:function(t){return+Ai(t)},trim:function(t){return"string"==typeof t?W(t):t}}),{lt:function(t,e){return e>t},lte:function(t,e){return e>=t},gt:function(t,e){return t>e},gte:function(t,e){return t>=e}}),hT=(function(){function t(t,e){if("number"!=typeof e){var n="";Fi(n)}this._opFn=uT[t],this._rvalFloat=Ri(e)}return t.prototype.evaluate=function(t){return"number"==typeof t?this._opFn(t,this._rvalFloat):this._opFn(Ri(t),this._rvalFloat)},t}(),function(){function t(t,e){var n="desc"===t;this._resultLT=n?1:-1,null==e&&(e=n?"min":"max"),this._incomparable="min"===e?-1/0:1/0}return t.prototype.evaluate=function(t,e){var n=typeof t,i=typeof e,r="number"===n?t:Ri(t),o="number"===i?e:Ri(e),a=isNaN(r),s=isNaN(o);if(a&&(r=this._incomparable),s&&(o=this._incomparable),a&&s){var l="string"===n,u="string"===i;l&&(r=u?t:0),u&&(o=l?e:0)}return o>r?this._resultLT:r>o?-this._resultLT:0},t}()),cT=(function(){function t(t,e){this._rval=e,this._isEQ=t,this._rvalTypeof=typeof e,this._rvalFloat=Ri(e)}return t.prototype.evaluate=function(t){var e=t===this._rval;if(!e){var n=typeof t;n===this._rvalTypeof||"number"!==n&&"number"!==this._rvalTypeof||(e=Ri(t)===this._rvalFloat)}return this._isEQ?e:!e},t}(),function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(){},t.prototype.retrieveValueFromItem=function(){},t.prototype.convertValue=function(t,e){return Pu(t,e)},t}()),pT=Y(),fT=function(){function t(t){this._sourceList=[],this._upstreamSignList=[],this._versionSignBase=0,this._sourceHost=t}return t.prototype.dirty=function(){this._setLocalSource([],[])},t.prototype._setLocalSource=function(t,e){this._sourceList=t,this._upstreamSignList=e,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&this._createSource()},t.prototype._createSource=function(){this._setLocalSource([],[]);var t,e,n=this._sourceHost,i=this._getUpstreamSourceManagers(),r=!!i.length;if(Wu(n)){var o=n,a=void 0,s=void 0,l=void 0;if(r){var u=i[0];u.prepareSource(),l=u.getSource(),a=l.data,s=l.sourceFormat,e=[u._getVersionSign()]}else a=o.get("data",!0),s=L(a)?wM:mM,e=[];var h=this._getSourceMetaRawOption(),c=l?l.metaRawOption:null,p=z(h.seriesLayoutBy,c?c.seriesLayoutBy:null),f=z(h.sourceHeader,c?c.sourceHeader:null),d=z(h.dimensions,c?c.dimensions:null);t=[yu(a,{seriesLayoutBy:p,sourceHeader:f,dimensions:d},s,o.get("encode",!0))]}else{var g=n;if(r){var y=this._applyTransform(i);t=y.sourceList,e=y.upstreamSignList}else{var v=g.get("source",!0);t=[yu(v,this._getSourceMetaRawOption(),null,null)],e=[]}}this._setLocalSource(t,e)},t.prototype._applyTransform=function(t){var e=this._sourceHost,n=e.get("transform",!0),i=e.get("fromTransformResult",!0);if(null!=i){var r="";1!==t.length&&Uu(r)}var o,a=[],s=[];return y(t,function(t){t.prepareSource();var e=t.getSource(i||0),n="";null==i||e||Uu(n),a.push(e),s.push(t._getVersionSign())}),n?o=Fu(n,a,{datasetIndex:e.componentIndex}):null!=i&&(o=[mu(a[0])]),{sourceList:o,upstreamSignList:s}},t.prototype._isDirty=function(){var t=this._sourceList;if(!t.length)return!0;for(var e=this._getUpstreamSourceManagers(),n=0;n1||e>0&&!t.noHeader,i=0;y(t.blocks,function(t){ju(t).planLayout(t);var e=t.__gapLevelBetweenSubBlocks;e>=i&&(i=e+(!n||e&&("section"!==t.type||t.noHeader)?0:1))}),t.__gapLevelBetweenSubBlocks=i},build:function(t,e,n,i){var r=e.noHeader,o=Ku(e),a=qu(t,e,r?n:o.html,i);if(r)return a;var s=gl(e.header,"ordinal",t.useUTC),l=Xu(i,t.renderMode).nameStyle;return"richText"===t.renderMode?th(t,s,l)+o.richText+a:$u('
            '+dl(s)+"
            "+a,n)}},nameValue:{planLayout:function(t){t.__gapLevelBetweenSubBlocks=0},build:function(t,e,n,i){var r=t.renderMode,o=e.noName,a=e.noValue,s=!e.markerType,l=e.name,u=e.value,h=t.useUTC;if(!o||!a){var c=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",r),p=o?"":gl(l,"ordinal",h),f=e.valueType,d=a?[]:M(u)?v(u,function(t,e){return gl(t,M(f)?f[e]:f,h)}):[gl(u,M(f)?f[0]:f,h)],g=!s||!o,y=!s&&o,m=Xu(i,r),_=m.nameStyle,x=m.valueStyle;return"richText"===r?(s?"":c)+(o?"":th(t,p,_))+(a?"":eh(t,d,g,y,x)):$u((s?"":c)+(o?"":Ju(p,!s,_))+(a?"":Qu(d,g,y,x)),n)}}}},mT=function(){function t(){this.richTextStyles={},this._nextStyleNameId=Ni()}return t.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},t.prototype.makeTooltipMarker=function(t,e,n){var i="richText"===n?this._generateStyleName():null,r=vl({color:e,type:t,renderMode:n,markerId:i});return C(r)?r:(this.richTextStyles[i]=r.style,r.content)},t.prototype.wrapRichTextStyle=function(t,e){var n={};M(e)?y(e,function(t){return h(n,t)}):h(n,e);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+t+"}"},t}(),_T=or(),xT=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectedDataIndicesMap={},e}return e(n,t),n.prototype.init=function(t,e,n){this.seriesIndex=this.componentIndex,this.dataTask=Lu({count:uh,reset:hh}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n);var i=_T(this).sourceManager=new fT(this);i.prepareSource();var r=this.getInitialData(t,n);ph(r,this),this.dataTask.context.data=r,_T(this).dataBeforeProcessed=r,sh(this),this._initSelectedMapFromData(r)},n.prototype.mergeDefaultAndTheme=function(t,e){var n=Ml(this),i=n?Cl(t):{},r=this.subType;cM.hasClass(r)&&(r+="Series"),l(t,e.getTheme().get(this.subType)),l(t,this.getDefaultOption()),Hi(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&Tl(t,i,n)},n.prototype.mergeOption=function(t,e){t=l(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Ml(this);n&&Tl(this.option,t,n);var i=_T(this).sourceManager;i.dirty(),i.prepareSource();var r=this.getInitialData(t,e);ph(r,this),this.dataTask.dirty(),this.dataTask.context.data=r,_T(this).dataBeforeProcessed=r,sh(this),this._initSelectedMapFromData(r)},n.prototype.fillDataTextStyle=function(t){if(t&&!L(t))for(var e=["show"],n=0;nthis.getShallow("animationThreshold")&&(t=!1),!!t},n.prototype.restoreData=function(){this.dataTask.dirty()},n.prototype.getColorFromPalette=function(t,e,n){var i=this.ecModel,r=kM.prototype.getColorFromPalette.call(this,t,e,n);return r||(r=i.getColorFromPalette(t,e,n)),r},n.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},n.prototype.getProgressive=function(){return this.get("progressive")},n.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},n.prototype.select=function(t,e){this._innerSelect(this.getData(e),t)},n.prototype.unselect=function(t,e){var n=this.option.selectedMap;if(n)for(var i=this.getData(e),r=0;r=0&&n.push(r)}return n},n.prototype.isSelected=function(t,e){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(e),r=ah(i,t);return n[r]||!1},n.prototype._innerSelect=function(t,e){var n,i,r=this.option.selectedMode,o=e.length;if(r&&o)if("multiple"===r)for(var a=this.option.selectedMap||(this.option.selectedMap={}),s=0;o>s;s++){var l=e[s],u=ah(t,l);a[u]=!0,this._selectedDataIndicesMap[u]=t.getRawIndex(l)}else if("single"===r||r===!0){var h=e[o-1],u=ah(t,h);this.option.selectedMap=(n={},n[u]=!0,n),this._selectedDataIndicesMap=(i={},i[u]=t.getRawIndex(h),i)}},n.prototype._initSelectedMapFromData=function(t){if(!this.option.selectedMap){var e=[];t.hasItemOption&&t.each(function(n){var i=t.getRawDataItem(n);i&&i.selected&&e.push(n)}),e.length>0&&this._innerSelect(t,e)}},n.registerClass=function(t){return cM.registerClass(t)},n.protoInitialize=function(){var t=n.prototype;t.type="series.__base__",t.seriesIndex=0,t.useColorPaletteOnData=!1,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),n}(cM);d(xT,aT),d(xT,kM),mr(xT,cM);var bT=function(){function t(){this.group=new ox,this.uid=Es("viewComponent")}return t.prototype.init=function(){},t.prototype.render=function(){},t.prototype.dispose=function(){},t.prototype.updateView=function(){},t.prototype.updateLayout=function(){},t.prototype.updateVisual=function(){},t.prototype.blurSeries=function(){},t}();yr(bT),wr(bT);var wT=or(),ST=gh(),MT=function(){function t(){this.group=new ox,this.uid=Es("viewChart"),this.renderTask=Lu({plan:mh,reset:_h}),this.renderTask.context={view:this}}return t.prototype.init=function(){},t.prototype.render=function(){},t.prototype.highlight=function(t,e,n,i){vh(t.getData(),i,"emphasis")},t.prototype.downplay=function(t,e,n,i){vh(t.getData(),i,"normal")},t.prototype.remove=function(){this.group.removeAll()},t.prototype.dispose=function(){},t.prototype.updateView=function(t,e,n,i){this.render(t,e,n,i)},t.prototype.updateLayout=function(t,e,n,i){this.render(t,e,n,i)},t.prototype.updateVisual=function(t,e,n,i){this.render(t,e,n,i)},t.markUpdateMethod=function(t,e){wT(t).updateMethod=e},t.protoInitialize=function(){var e=t.prototype;e.type="chart"}(),t}();yr(MT,["dispose"]),wr(MT);var TT,CT={incrementalPrepareRender:{progress:function(t,e){e.view.incrementalRender(t,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(t,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}},IT="\x00__throttleOriginMethod",AT="\x00__throttleRate",DT="\x00__throttleType",kT=or(),LT={itemStyle:Sr(PS,!0),lineStyle:Sr(DS,!0)},PT={lineStyle:"stroke",itemStyle:"fill"},OT={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=t.getModel(i),o=wh(t,i),a=o(r),s=r.getShallow("decal");s&&(n.setVisual("decal",s),s.dirty=!0);var l=Sh(t,i),u=a[l],c=T(u)?u:null,p="auto"===a.fill||"auto"===a.stroke;if(!a[l]||c||p){var f=t.getColorFromPalette(t.name,null,e.getSeriesCount());a[l]||(a[l]=f,n.setVisual("colorFromPalette",!0)),a.fill="auto"===a.fill||"function"==typeof a.fill?f:a.fill,a.stroke="auto"===a.stroke||"function"==typeof a.stroke?f:a.stroke}return n.setVisual("style",a),n.setVisual("drawType",l),!e.isSeriesFiltered(t)&&c?(n.setVisual("colorFromPalette",!1),{dataEach:function(e,n){var i=t.getDataParams(n),r=h({},a);r[l]=c(i),e.setItemVisual(n,"style",r)}}):void 0}},RT=new ES,ET={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.ignoreStyleOnData&&!e.isSeriesFiltered(t)){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=wh(t,i),o=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(t,e){var n=t.getRawDataItem(e);if(n&&n[i]){RT.option=n[i];var a=r(RT),s=t.ensureUniqueItemVisual(e,"style");h(s,a),RT.option.decal&&(t.setItemVisual(e,"decal",RT.option.decal),RT.option.decal.dirty=!0),o in a&&t.setItemVisual(e,"colorFromPalette",!1)}}:null}}}},NT={performRawSeries:!0,overallReset:function(t){var e=Y();t.eachSeries(function(t){if(t.useColorPaletteOnData){var n=e.get(t.type);n||(n={},e.set(t.type,n)),kT(t).scope=n}}),t.eachSeries(function(e){if(e.useColorPaletteOnData&&!t.isSeriesFiltered(e)){var n=e.getRawData(),i={},r=e.getData(),o=kT(e).scope,a=e.visualStyleAccessPath||"itemStyle",s=Sh(e,a);r.each(function(t){var e=r.getRawIndex(t);i[e]=t}),n.each(function(t){var a=i[t],l=r.getItemVisual(a,"colorFromPalette");if(l){var u=r.ensureUniqueItemVisual(a,"style"),h=n.getName(t)||t+"",c=n.count();u[s]=e.getColorFromPalette(h,o,c)}})}})}},BT=Math.PI,zT=function(){function t(t,e,n,i){this._stageTaskMap=Y(),this.ecInstance=t,this.api=e,n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return t.prototype.restoreData=function(t,e){t.restoreData(e),this._stageTaskMap.each(function(t){var e=t.overallTask;e&&e.dirty()})},t.prototype.getPerformArgs=function(t,e){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),i=n.context,r=!e&&n.progressiveEnabled&&(!i||i.progressiveRender)&&t.__idxInPipeline>n.blockIndex,o=r?n.step:null,a=i&&i.modDataCount,s=null!=a?Math.ceil(a/o):null;return{step:o,modBy:s,modDataCount:a}}},t.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},t.prototype.updateStreamModes=function(t,e){var n=this._pipelineMap.get(t.uid),i=t.getData(),r=i.count(),o=n.progressiveEnabled&&e.incrementalPrepareRender&&r>=n.threshold,a=t.get("large")&&r>=t.get("largeThreshold"),s="mod"===t.get("progressiveChunkMode")?r:null;t.pipelineContext=n.context={progressiveRender:o,modDataCount:s,large:a}},t.prototype.restorePipelines=function(t){var e=this,n=e._pipelineMap=Y();t.eachSeries(function(t){var i=t.getProgressive(),r=t.uid;n.set(r,{id:r,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),e._pipe(t,t.dataTask)})},t.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.api.getModel(),n=this.api;y(this._allHandlers,function(i){var r=t.get(i.uid)||t.set(i.uid,{}),o="";G(!(i.reset&&i.overallReset),o),i.reset&&this._createSeriesStageTask(i,r,e,n),i.overallReset&&this._createOverallStageTask(i,r,e,n)},this)},t.prototype.prepareView=function(t,e,n,i){var r=t.renderTask,o=r.context;o.model=e,o.ecModel=n,o.api=i,r.__block=!t.incrementalPrepareRender,this._pipe(e,r)},t.prototype.performDataProcessorTasks=function(t,e){this._performStageTasks(this._dataProcessorHandlers,t,e,{block:!0})},t.prototype.performVisualTasks=function(t,e,n){this._performStageTasks(this._visualHandlers,t,e,n)},t.prototype._performStageTasks=function(t,e,n,i){function r(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}i=i||{};var o=!1,a=this;y(t,function(t){if(!i.visualType||i.visualType===t.visualType){var s=a._stageTaskMap.get(t.uid),l=s.seriesTaskMap,u=s.overallTask;if(u){var h,c=u.agentStubMap;c.each(function(t){r(i,t)&&(t.dirty(),h=!0)}),h&&u.dirty(),a.updatePayload(u,n);var p=a.getPerformArgs(u,i.block);c.each(function(t){t.perform(p)}),u.perform(p)&&(o=!0)}else l&&l.each(function(s){r(i,s)&&s.dirty();var l=a.getPerformArgs(s,i.block);l.skip=!t.performRawSeries&&e.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(l)&&(o=!0) -})}}),this.unfinished=o||this.unfinished},t.prototype.performSeriesTasks=function(t){var e;t.eachSeries(function(t){e=t.dataTask.perform()||e}),this.unfinished=e||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each(function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)})},t.prototype.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},t.prototype._createSeriesStageTask=function(t,e,n,i){function r(e){var r=e.uid,l=s.set(r,a&&a.get(r)||Lu({plan:Dh,reset:kh,count:Ph}));l.context={model:e,ecModel:n,api:i,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:o},o._pipe(e,l)}var o=this,a=e.seriesTaskMap,s=e.seriesTaskMap=Y(),l=t.seriesType,u=t.getTargetSeries;t.createOnAllSeries?n.eachRawSeries(r):l?n.eachRawSeriesByType(l,r):u&&u(n,i).each(r)},t.prototype._createOverallStageTask=function(t,e,n,i){function r(t){var e=t.uid,n=l.set(e,s&&s.get(e)||(p=!0,Lu({reset:Ch,onDirty:Ah})));n.context={model:t,overallProgress:c},n.agent=a,n.__block=c,o._pipe(t,n)}var o=this,a=e.overallTask=e.overallTask||Lu({reset:Th});a.context={ecModel:n,api:i,overallReset:t.overallReset,scheduler:o};var s=a.agentStubMap,l=a.agentStubMap=Y(),u=t.seriesType,h=t.getTargetSeries,c=!0,p=!1,f="";G(!t.createOnAllSeries,f),u?n.eachRawSeriesByType(u,r):h?h(n,i).each(r):(c=!1,y(n.getSeries(),r)),p&&a.dirty()},t.prototype._pipe=function(t,e){var n=t.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=e),i.tail&&i.tail.pipe(e),i.tail=e,e.__idxInPipeline=i.count++,e.__pipeline=i},t.wrapStageHandler=function(t,e){return T(t)&&(t={overallReset:t,seriesType:Oh(t)}),t.uid=Es("stageHandler"),e&&(t.visualType=e),t},t}(),FT=Lh(0),VT={},HT={};Rh(VT,OM),Rh(HT,VM),VT.eachSeriesByType=VT.eachRawSeriesByType=function(t){TT=t},VT.eachComponent=function(t){"series"===t.mainType&&t.subType&&(TT=t.subType)};var GT=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"],WT={color:GT,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],GT]},UT="#B9B8CE",XT="#100C2A",YT=function(){return{axisLine:{lineStyle:{color:UT}},splitLine:{lineStyle:{color:"#484753"}},splitArea:{areaStyle:{color:["rgba(255,255,255,0.02)","rgba(255,255,255,0.05)"]}},minorSplitLine:{lineStyle:{color:"#20203B"}}}},jT=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"],qT={darkMode:!0,color:jT,backgroundColor:XT,axisPointer:{lineStyle:{color:"#817f91"},crossStyle:{color:"#817f91"},label:{color:"#fff"}},legend:{textStyle:{color:UT}},textStyle:{color:UT},title:{textStyle:{color:"#EEF1FA"},subtextStyle:{color:"#B9B8CE"}},toolbox:{iconStyle:{borderColor:UT}},dataZoom:{borderColor:"#71708A",textStyle:{color:UT},brushStyle:{color:"rgba(135,163,206,0.3)"},handleStyle:{color:"#353450",borderColor:"#C5CBE3"},moveHandleStyle:{color:"#B0B6C3",opacity:.3},fillerColor:"rgba(135,163,206,0.2)",emphasis:{handleStyle:{borderColor:"#91B7F2",color:"#4D587D"},moveHandleStyle:{color:"#636D9A",opacity:.7}},dataBackground:{lineStyle:{color:"#71708A",width:1},areaStyle:{color:"#71708A"}},selectedDataBackground:{lineStyle:{color:"#87A3CE"},areaStyle:{color:"#87A3CE"}}},visualMap:{textStyle:{color:UT}},timeline:{lineStyle:{color:UT},label:{color:UT},controlStyle:{color:UT,borderColor:UT}},calendar:{itemStyle:{color:XT},dayLabel:{color:UT},monthLabel:{color:UT},yearLabel:{color:UT}},timeAxis:YT(),logAxis:YT(),valueAxis:YT(),categoryAxis:YT(),line:{symbol:"circle"},graph:{color:jT},gauge:{title:{color:UT},axisLine:{lineStyle:{color:[[1,"rgba(207,212,219,0.2)"]]}},axisLabel:{color:UT},detail:{color:"#EEF1FA"}},candlestick:{itemStyle:{color:"#f64e56",color0:"#54ea92",borderColor:"#f64e56",borderColor0:"#54ea92"}}};qT.categoryAxis.splitLine.show=!1;var ZT=function(){function t(){}return t.prototype.normalizeQuery=function(t){var e={},n={},i={};if(C(t)){var r=fr(t);e.mainType=r.main||null,e.subType=r.sub||null}else{var o=["Index","Name","Id"],a={name:1,dataIndex:1,dataType:1};y(t,function(t,r){for(var s=!1,l=0;l0&&h===r.length-u.length){var c=r.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,s=!0)}}a.hasOwnProperty(r)&&(n[r]=t,s=!0),s||(i[r]=t)})}return{cptQuery:e,dataQuery:n,otherQuery:i}},t.prototype.filter=function(t,e){function n(t,e,n,i){return null==t[n]||e[i||n]===t[n]}var i=this.eventInfo;if(!i)return!0;var r=i.targetEl,o=i.packedEvent,a=i.model,s=i.view;if(!a||!s)return!0;var l=e.cptQuery,u=e.dataQuery;return n(l,a,"mainType")&&n(l,a,"subType")&&n(l,a,"index","componentIndex")&&n(l,a,"name")&&n(l,a,"id")&&n(u,o,"name")&&n(u,o,"dataIndex")&&n(u,o,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(t,e.otherQuery,r,o))},t.prototype.afterTrigger=function(){this.eventInfo=null},t}(),KT={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){function n(e,n){var i=t.getRawValue(n),a=t.getDataParams(n);u&&e.setItemVisual(n,"symbol",r(i,a)),h&&e.setItemVisual(n,"symbolSize",o(i,a)),c&&e.setItemVisual(n,"symbolRotate",s(i,a)),p&&e.setItemVisual(n,"symbolOffset",l(i,a))}var i=t.getData();if(t.legendSymbol&&i.setVisual("legendSymbol",t.legendSymbol),t.hasSymbolVisual){var r=t.get("symbol"),o=t.get("symbolSize"),a=t.get("symbolKeepAspect"),s=t.get("symbolRotate"),l=t.get("symbolOffset"),u=T(r),h=T(o),c=T(s),p=T(l),f=u||h||c||p,d=!u&&r?r:t.defaultSymbol,g=h?null:o,y=c?null:s,v=p?null:l;if(i.setVisual({legendSymbol:t.legendSymbol||d,symbol:d,symbolSize:g,symbolKeepAspect:a,symbolRotate:y,symbolOffset:v}),!e.isSeriesFiltered(t))return{dataEach:f?n:null}}}},$T={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){function n(t,e){var n=t.getItemModel(e),i=n.getShallow("symbol",!0),r=n.getShallow("symbolSize",!0),o=n.getShallow("symbolRotate",!0),a=n.getShallow("symbolOffset",!0),s=n.getShallow("symbolKeepAspect",!0);null!=i&&t.setItemVisual(e,"symbol",i),null!=r&&t.setItemVisual(e,"symbolSize",r),null!=o&&t.setItemVisual(e,"symbolRotate",o),null!=a&&t.setItemVisual(e,"symbolOffset",a),null!=s&&t.setItemVisual(e,"symbolKeepAspect",s)}if(t.hasSymbolVisual&&!e.isSeriesFiltered(t)){var i=t.getData();return{dataEach:i.hasItemOption?n:null}}}},JT=2*Math.PI,QT=Sb.CMD,tC=["top","right","bottom","left"],eC=[],nC=new v_,iC=new v_,rC=new v_,oC=new v_,aC=new v_,sC=[],lC=new v_,uC=["align","verticalAlign","width","height","fontSize"],hC=new e_,cC=or(),pC=or(),fC=["x","y","rotation"],dC=function(){function t(){this._labelList=[],this._chartViewList=[]}return t.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},t.prototype._addLabel=function(t,e,n,i,r){var o=i.style,a=i.__hostTarget,s=a.textConfig||{},l=i.getComputedTransform(),u=i.getBoundingRect().plain();C_.applyTransform(u,u,l),l?hC.setLocalTransform(l):(hC.x=hC.y=hC.rotation=hC.originX=hC.originY=0,hC.scaleX=hC.scaleY=1);var h,c=i.__hostTarget;if(c){h=c.getBoundingRect().plain();var p=c.getComputedTransform();C_.applyTransform(h,h,p)}var f=h&&c.getTextGuideLine();this._labelList.push({label:i,labelLine:f,seriesModel:n,dataIndex:t,dataType:e,layoutOption:r,computedLayoutOption:null,rect:u,hostRect:h,priority:h?h.width*h.height:0,defaultAttr:{ignore:i.ignore,labelGuideIgnore:f&&f.ignore,x:hC.x,y:hC.y,scaleX:hC.scaleX,scaleY:hC.scaleY,rotation:hC.rotation,style:{x:o.x,y:o.y,align:o.align,verticalAlign:o.verticalAlign,width:o.width,height:o.height,fontSize:o.fontSize},cursor:i.cursor,attachedPos:s.position,attachedRot:s.rotation}})},t.prototype.addLabelsOfSeries=function(t){var e=this;this._chartViewList.push(t);var n=t.__model,i=n.get("labelLayout");(T(i)||b(i).length)&&t.group.traverse(function(t){if(t.ignore)return!0;var r=t.getTextContent(),o=Kb(t);r&&!r.disableLabelLayout&&e._addLabel(o.dataIndex,o.dataType,n,r,i)})},t.prototype.updateLayoutConfig=function(t){function e(t,e){return function(){Wh(t,e)}}for(var n=t.getWidth(),i=t.getHeight(),r=0;r=0&&n.attr(r.oldLayoutSelect),p(h,"emphasis")>=0&&n.attr(r.oldLayoutEmphasis)),is(n,l,e,s)}else if(n.attr(l),!TS(n).valueAnimation){var c=z(n.style.opacity,1);n.style.opacity=0,rs(n,{style:{opacity:c}},e,s)}if(r.oldLayout=l,n.states.select){var f=r.oldLayoutSelect={};ic(f,l,fC),ic(f,n.states.select,fC)}if(n.states.emphasis){var d=r.oldLayoutEmphasis={};ic(d,l,fC),ic(d,n.states.emphasis,fC)}Rs(n,s,u,e,e)}if(i&&!i.ignore&&!i.invisible){var r=pC(i),o=r.oldLayout,g={points:i.shape.points};o?(i.attr({shape:o}),is(i,{shape:g},e)):(i.setShape(g),i.style.strokePercent=0,rs(i,{style:{strokePercent:1}},e)),r.oldLayout=g}},t}(),gC=Math.round(9*Math.random()),yC=function(){function t(){this._id="__ec_inner_"+gC++}return t.prototype.get=function(t){return this._guard(t)[this._id]},t.prototype.set=function(t,e){var n=this._guard(t);return"function"==typeof Object.defineProperty?Object.defineProperty(n,this._id,{value:e,enumerable:!1,configurable:!0}):n[this._id]=e,this},t.prototype["delete"]=function(t){return this.has(t)?(delete this._guard(t)[this._id],!0):!1},t.prototype.has=function(t){return!!this._guard(t)[this._id]},t.prototype._guard=function(t){if(t!==Object(t))throw TypeError("Value of WeakMap is not a non-null object.");return t},t}(),vC=Rb.extend({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var n=e.cx,i=e.cy,r=e.width/2,o=e.height/2;t.moveTo(n,i-o),t.lineTo(n+r,i+o),t.lineTo(n-r,i+o),t.closePath()}}),mC=Rb.extend({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var n=e.cx,i=e.cy,r=e.width/2,o=e.height/2;t.moveTo(n,i-o),t.lineTo(n+r,i),t.lineTo(n,i+o),t.lineTo(n-r,i),t.closePath()}}),_C=Rb.extend({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var n=e.x,i=e.y,r=e.width/5*3,o=Math.max(r,e.height),a=r/2,s=a*a/(o-a),l=i-o+a+s,u=Math.asin(s/a),h=Math.cos(u)*a,c=Math.sin(u),p=Math.cos(u),f=.6*a,d=.7*a;t.moveTo(n-h,l+s),t.arc(n,l,a,Math.PI-u,2*Math.PI+u),t.bezierCurveTo(n+h-c*f,l+s+p*f,n,i-d,n,i),t.bezierCurveTo(n,i-d,n-h+c*f,l+s+p*f,n-h,l+s),t.closePath()}}),xC=Rb.extend({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var n=e.height,i=e.width,r=e.x,o=e.y,a=i/3*2;t.moveTo(r,o),t.lineTo(r+a,o+n),t.lineTo(r,o+n/4*3),t.lineTo(r-a,o+n),t.lineTo(r,o),t.closePath()}}),bC={line:$w,rect:Wb,roundRect:Wb,square:Wb,circle:Iw,diamond:mC,pin:_C,arrow:xC,triangle:vC},wC={line:function(t,e,n,i,r){r.x1=t,r.y1=e+i/2,r.x2=t+n,r.y2=e+i/2},rect:function(t,e,n,i,r){r.x=t,r.y=e,r.width=n,r.height=i},roundRect:function(t,e,n,i,r){r.x=t,r.y=e,r.width=n,r.height=i,r.r=Math.min(n,i)/4},square:function(t,e,n,i,r){var o=Math.min(n,i);r.x=t,r.y=e,r.width=o,r.height=o},circle:function(t,e,n,i,r){r.cx=t+n/2,r.cy=e+i/2,r.r=Math.min(n,i)/2},diamond:function(t,e,n,i,r){r.cx=t+n/2,r.cy=e+i/2,r.width=n,r.height=i},pin:function(t,e,n,i,r){r.x=t+n/2,r.y=e+i/2,r.width=n,r.height=i},arrow:function(t,e,n,i,r){r.x=t+n/2,r.y=e+i/2,r.width=n,r.height=i},triangle:function(t,e,n,i,r){r.cx=t+n/2,r.cy=e+i/2,r.width=n,r.height=i}},SC={};y(bC,function(t,e){SC[e]=new t});for(var MC,TC=Rb.extend({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},calculateTextPosition:function(t,e,n){var i=Fn(t,e,n),r=this.shape;return r&&"pin"===r.symbolType&&"inside"===e.position&&(i.y=n.y+.4*n.height),i},buildPath:function(t,e,n){var i=e.symbolType;if("none"!==i){var r=SC[i];r||(i="rect",r=SC[i]),wC[i](e.x,e.y,e.width,e.height,r.shape),r.buildPath(t,r.shape,n)}}}),CC=new Sb(!0),IC=["shadowBlur","shadowOffsetX","shadowOffsetY"],AC=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]],DC=1,kC=2,LC=3,PC=4,OC=new yC,RC=new a_(100),EC=["symbol","symbolSize","symbolKeepAspect","color","backgroundColor","dashArrayX","dashArrayY","maxTileWidth","maxTileHeight"],NC={fill:"fill",stroke:"stroke","stroke-width":"lineWidth",opacity:"opacity","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-miterlimit":"miterLimit","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-anchor":"textAlign",visibility:"visibility",display:"display"},BC=b(NC),zC={"alignment-baseline":"textBaseline","stop-color":"stopColor"},FC=b(zC),VC=function(){function t(){this._defs={},this._root=null}return t.prototype.parse=function(t,e){e=e||{};var n=Gc(t);if(!n)throw new Error("Illegal svg");this._defsUsePending=[];var i=new ox;this._root=i;var r=[],o=n.getAttribute("viewBox")||"",a=parseFloat(n.getAttribute("width")||e.width),s=parseFloat(n.getAttribute("height")||e.height);isNaN(a)&&(a=null),isNaN(s)&&(s=null),jc(n,i,null,!0,!1);for(var l=n.firstChild;l;)this._parseNode(l,i,r,null,!1,!1),l=l.nextSibling;Kc(this._defs,this._defsUsePending),this._defsUsePending=[];var u,h;if(o){var c=$c(o);c.length>=4&&(u={x:parseFloat(c[0]||0),y:parseFloat(c[1]||0),width:parseFloat(c[2]),height:parseFloat(c[3])})}if(u&&null!=a&&null!=s&&(h=ep(u,{x:0,y:0,width:a,height:s}),!e.ignoreViewBox)){var p=i;i=new ox,i.add(p),p.scaleX=p.scaleY=h.scale,p.x=h.x,p.y=h.y}return e.ignoreRootClip||null==a||null==s||i.setClipPath(new Wb({shape:{x:0,y:0,width:a,height:s}})),{root:i,width:a,height:s,viewBoxRect:u,viewBoxTransform:h,named:r}},t.prototype._parseNode=function(t,e,n,i,r,o){var a,s=t.nodeName.toLowerCase(),l=i;if("defs"===s&&(r=!0),"text"===s&&(o=!0),"defs"===s||"switch"===s)a=e;else{if(!r){var u=MC[s];if(u&&Z(MC,s)){a=u.call(this,t,e);var h=t.getAttribute("name");if(h){var c={name:h,namedFrom:null,svgNodeTagLower:s,el:a};n.push(c),"g"===s&&(l=c)}else i&&n.push({name:i.name,namedFrom:i,svgNodeTagLower:s,el:a});e.add(a)}}var p=HC[s];if(p&&Z(HC,s)){var f=p.call(this,t),d=t.getAttribute("id");d&&(this._defs[d]=f)}}if(a&&a.isGroup)for(var g=t.firstChild;g;)1===g.nodeType?this._parseNode(g,a,n,l,r,o):3===g.nodeType&&o&&this._parseText(g,a),g=g.nextSibling},t.prototype._parseText=function(t,e){var n=new Nb({style:{text:t.textContent},silent:!0,x:this._textX||0,y:this._textY||0});Xc(e,n),jc(t,n,this._defsUsePending,!1,!1),qc(n,e);var i=n.style,r=i.fontSize;r&&9>r&&(i.fontSize=9,n.scaleX*=r/9,n.scaleY*=r/9);var o=(i.fontSize||i.fontFamily)&&[i.fontStyle,i.fontWeight,(i.fontSize||12)+"px",i.fontFamily||"sans-serif"].join(" ");i.font=o;var a=n.getBoundingRect();return this._textX+=a.width,e.add(n),n},t.internalField=function(){MC={g:function(t,e){var n=new ox;return Xc(e,n),jc(t,n,this._defsUsePending,!1,!1),n},rect:function(t,e){var n=new Wb;return Xc(e,n),jc(t,n,this._defsUsePending,!1,!1),n.setShape({x:parseFloat(t.getAttribute("x")||"0"),y:parseFloat(t.getAttribute("y")||"0"),width:parseFloat(t.getAttribute("width")||"0"),height:parseFloat(t.getAttribute("height")||"0")}),n.silent=!0,n},circle:function(t,e){var n=new Iw;return Xc(e,n),jc(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),r:parseFloat(t.getAttribute("r")||"0")}),n.silent=!0,n},line:function(t,e){var n=new $w;return Xc(e,n),jc(t,n,this._defsUsePending,!1,!1),n.setShape({x1:parseFloat(t.getAttribute("x1")||"0"),y1:parseFloat(t.getAttribute("y1")||"0"),x2:parseFloat(t.getAttribute("x2")||"0"),y2:parseFloat(t.getAttribute("y2")||"0")}),n.silent=!0,n},ellipse:function(t,e){var n=new Dw;return Xc(e,n),jc(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),rx:parseFloat(t.getAttribute("rx")||"0"),ry:parseFloat(t.getAttribute("ry")||"0")}),n.silent=!0,n},polygon:function(t,e){var n,i=t.getAttribute("points");i&&(n=Yc(i));var r=new Yw({shape:{points:n||[]},silent:!0});return Xc(e,r),jc(t,r,this._defsUsePending,!1,!1),r},polyline:function(t,e){var n,i=t.getAttribute("points");i&&(n=Yc(i));var r=new qw({shape:{points:n||[]},silent:!0});return Xc(e,r),jc(t,r,this._defsUsePending,!1,!1),r},image:function(t,e){var n=new Fb;return Xc(e,n),jc(t,n,this._defsUsePending,!1,!1),n.setStyle({image:t.getAttribute("xlink:href"),x:+t.getAttribute("x"),y:+t.getAttribute("y"),width:+t.getAttribute("width"),height:+t.getAttribute("height")}),n.silent=!0,n},text:function(t,e){var n=t.getAttribute("x")||"0",i=t.getAttribute("y")||"0",r=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0";this._textX=parseFloat(n)+parseFloat(r),this._textY=parseFloat(i)+parseFloat(o);var a=new ox;return Xc(e,a),jc(t,a,this._defsUsePending,!1,!0),a},tspan:function(t,e){var n=t.getAttribute("x"),i=t.getAttribute("y");null!=n&&(this._textX=parseFloat(n)),null!=i&&(this._textY=parseFloat(i));var r=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0",a=new ox;return Xc(e,a),jc(t,a,this._defsUsePending,!1,!0),this._textX+=parseFloat(r),this._textY+=parseFloat(o),a},path:function(t,e){var n=t.getAttribute("d")||"",i=Ea(n);return Xc(e,i),jc(t,i,this._defsUsePending,!1,!1),i.silent=!0,i}}}(),t}(),HC={lineargradient:function(t){var e=parseInt(t.getAttribute("x1")||"0",10),n=parseInt(t.getAttribute("y1")||"0",10),i=parseInt(t.getAttribute("x2")||"10",10),r=parseInt(t.getAttribute("y2")||"0",10),o=new oS(e,n,i,r);return Wc(t,o),Uc(t,o),o},radialgradient:function(t){var e=parseInt(t.getAttribute("cx")||"0",10),n=parseInt(t.getAttribute("cy")||"0",10),i=parseInt(t.getAttribute("r")||"0",10),r=new aS(e,n,i);return Wc(t,r),Uc(t,r),r}},GC=/^url\(\s*#(.*?)\)/,WC=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g,UC=/(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.eE,]*)\)/g,XC=/([^\s:;]+)\s*:\s*([^:;]+)/g,YC=1e-8,jC=[],qC=function(){function t(t){this.name=t}return t.prototype.getCenter=function(){},t}(),ZC=function(t){function n(e,n,i){var r=t.call(this,e)||this;if(r.type="geoJSON",r.geometries=n,i)i=[i[0],i[1]];else{var o=r.getBoundingRect();i=[o.x+o.width/2,o.y+o.height/2]}return r._center=i,r}return e(n,t),n.prototype.getBoundingRect=function(){var t=this._rect;if(t)return t;for(var e=Number.MAX_VALUE,n=[e,e],i=[-e,-e],r=[],o=[],a=this.geometries,s=0;si;i++)if("polygon"===n[i].type){var o=n[i].exterior,a=n[i].interiors;if(rp(o,t[0],t[1])){for(var s=0;s<(a?a.length:0);s++)if(rp(a[s],t[0],t[1]))continue t;return!0}}return!1},n.prototype.transformTo=function(t,e,n,i){var r=this.getBoundingRect(),o=r.width/r.height;n?i||(i=n/o):n=o*i;for(var a=new C_(t,e,n,i),s=r.calculateTransform(a),l=this.geometries,u=0;u0&&t.unfinished);t.unfinished||this._zr.flush()}}},n.prototype.getDom=function(){return this._dom},n.prototype.getId=function(){return this.id},n.prototype.getZr=function(){return this._zr},n.prototype.setOption=function(t,e,n){if(!this._disposed){var i,r,o;if(fI(e)&&(n=e.lazyUpdate,i=e.silent,r=e.replaceMerge,o=e.transition,e=e.notMerge),this[EI]=!0,!this._model||e){var a=new UM(this._api),s=this._theme,l=this._model=new OM;l.scheduler=this._scheduler,l.init(null,null,null,s,this._locale,a)}this._model.setOption(t,{replaceMerge:r},mA),uA(this,o),n?(this[NI]={silent:i},this[EI]=!1,this.getZr().wakeUp()):(XI(this),qI.update.call(this),this._zr.flush(),this[NI]=!1,this[EI]=!1,JI.call(this,i),QI.call(this,i))}},n.prototype.setTheme=function(){console.error("ECharts#setTheme() is DEPRECATED in ECharts 3.0")},n.prototype.getModel=function(){return this._model},n.prototype.getOption=function(){return this._model&&this._model.getOption()},n.prototype.getWidth=function(){return this._zr.getWidth()},n.prototype.getHeight=function(){return this._zr.getHeight()},n.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||gI&&window.devicePixelRatio||1},n.prototype.getRenderedCanvas=function(t){if(am.canvasSupported){t=h({},t||{}),t.pixelRatio=t.pixelRatio||this.getDevicePixelRatio(),t.backgroundColor=t.backgroundColor||this._model.get("backgroundColor");var e=this._zr;return e.painter.getRenderedCanvas(t)}},n.prototype.getSvgDataURL=function(){if(am.svgSupported){var t=this._zr,e=t.storage.getDisplayList();return y(e,function(t){t.stopAnimation(null,!0)}),t.painter.toDataURL()}},n.prototype.getDataURL=function(t){if(!this._disposed){t=t||{};var e=t.excludeComponents,n=this._model,i=[],r=this;cI(e,function(t){n.eachComponent({mainType:t},function(t){var e=r._componentsMap[t.__viewId];e.group.ignore||(i.push(e),e.group.ignore=!0)})});var o="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.getRenderedCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return cI(i,function(t){t.group.ignore=!1}),o}},n.prototype.getConnectedDataURL=function(t){if(!this._disposed&&am.canvasSupported){var e="svg"===t.type,n=this.group,i=Math.min,r=Math.max,o=1/0;if(TA[n]){var a=o,l=o,u=-o,h=-o,c=[],p=t&&t.pixelRatio||this.getDevicePixelRatio();y(MA,function(o){if(o.group===n){var p=e?o.getZr().painter.getSvgDom().innerHTML:o.getRenderedCanvas(s(t)),f=o.getDom().getBoundingClientRect();a=i(f.left,a),l=i(f.top,l),u=r(f.right,u),h=r(f.bottom,h),c.push({dom:p,left:f.left,top:f.top})}}),a*=p,l*=p,u*=p,h*=p;var f=u-a,d=h-l,g=_m(),v=pi(g,{renderer:e?"svg":"canvas"});if(v.resize({width:f,height:d}),e){var m="";return cI(c,function(t){var e=t.left-a,n=t.top-l;m+=''+t.dom+""}),v.painter.getSvgRoot().innerHTML=m,t.connectedBackgroundColor&&v.painter.setBackgroundColor(t.connectedBackgroundColor),v.refreshImmediately(),v.painter.toDataURL()}return t.connectedBackgroundColor&&v.add(new Wb({shape:{x:0,y:0,width:f,height:d},style:{fill:t.connectedBackgroundColor}})),cI(c,function(t){var e=new Fb({style:{x:t.left*p-a,y:t.top*p-l,image:t.dom}});v.add(e)}),v.refreshImmediately(),g.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}},n.prototype.convertToPixel=function(t,e){return ZI(this,"convertToPixel",t,e)},n.prototype.convertFromPixel=function(t,e){return ZI(this,"convertFromPixel",t,e)},n.prototype.containPixel=function(t,e){if(!this._disposed){var n,i=this._model,r=ar(i,t);return y(r,function(t,i){i.indexOf("Models")>=0&&y(t,function(t){var r=t.coordinateSystem;if(r&&r.containPoint)n=n||!!r.containPoint(e);else if("seriesModels"===i){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(n=n||o.containPoint(e,t))}},this)},this),!!n}},n.prototype.getVisual=function(t,e){var n=this._model,i=ar(n,t,{defaultMainType:"series"}),r=i.seriesModel,o=r.getData(),a=i.hasOwnProperty("dataIndexInside")?i.dataIndexInside:i.hasOwnProperty("dataIndex")?o.indexOfRawIndex(i.dataIndex):null; -return null!=a?Eh(o,a,e):Nh(o,e)},n.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},n.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},n.prototype._initEvents=function(){var t=this;cI(dA,function(e){var n=function(n){var i,r=t.getModel(),o=n.target,a="globalout"===e;if(a?i={}:o&&sc(o,function(t){var e=Kb(t);if(e&&null!=e.dataIndex){var n=e.dataModel||r.getSeriesByIndex(e.seriesIndex);return i=n&&n.getDataParams(e.dataIndex,e.dataType)||{},!0}return e.eventData?(i=h({},e.eventData),!0):void 0},!0),i){var s=i.componentType,l=i.componentIndex;("markLine"===s||"markPoint"===s||"markArea"===s)&&(s="series",l=i.seriesIndex);var u=s&&null!=l&&r.getComponent(s,l),c=u&&t["series"===u.mainType?"_chartsMap":"_componentsMap"][u.__viewId];i.event=n,i.type=e,t._$eventProcessor.eventInfo={targetEl:o,packedEvent:i,model:u,view:c},t.trigger(e,i)}};n.zrEventfulCallAtLast=!0,t._zr.on(e,n,t)}),cI(yA,function(e,n){t._messageCenter.on(n,function(t){this.trigger(n,t)},t)}),cI(["selectchanged"],function(e){t._messageCenter.on(e,function(t){this.trigger(e,t)},t)}),ac(this._messageCenter,this,this._api)},n.prototype.isDisposed=function(){return this._disposed},n.prototype.clear=function(){this._disposed||this.setOption({series:[]},!0)},n.prototype.dispose=function(){if(!this._disposed){this._disposed=!0,ur(this.getDom(),AA,"");var t=this._api,e=this._model;cI(this._componentsViews,function(n){n.dispose(e,t)}),cI(this._chartsViews,function(n){n.dispose(e,t)}),this._zr.dispose(),delete MA[this.id]}},n.prototype.resize=function(t){if(!this._disposed){this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var n=e.resetOption("media"),i=t&&t.silent;this[EI]=!0,n&&XI(this),qI.update.call(this,{type:"resize",animation:h({duration:0},t&&t.animation)}),this[EI]=!1,JI.call(this,i),QI.call(this,i)}}},n.prototype.showLoading=function(t,e){if(!this._disposed&&(fI(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),SA[t])){var n=SA[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}},n.prototype.hideLoading=function(){this._disposed||(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},n.prototype.makeActionFromEvent=function(t){var e=h({},t);return e.type=yA[t.type],e},n.prototype.dispatchAction=function(t,e){if(!this._disposed&&(fI(e)||(e={silent:!!e}),gA[t.type]&&this._model)){if(this[EI])return void this._pendingActions.push(t);var n=e.silent;$I.call(this,t,n);var i=e.flush;i?this._zr.flush():i!==!1&&am.browser.weChat&&this._throttledZrFlush(),JI.call(this,n),QI.call(this,n)}},n.prototype.updateLabelLayout=function(){var t=this._labelManager;t.updateLayoutConfig(this._api),t.layout(this._api),t.processLabelsOverall()},n.prototype.appendData=function(t){if(!this._disposed){var e=t.seriesIndex,n=this.getModel(),i=n.getSeriesByIndex(e);i.appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},n.internalField=function(){function t(t){for(var e=[],n=t.currentStates,i=0;ie.get("hoverLayerThreshold")&&!am.node&&!am.worker&&e.eachSeries(function(e){if(!e.preventUsingHoverLayer){var n=t._chartsMap[e.__viewId];n.__alive&&n.group.traverse(function(t){t.states.emphasis&&(t.states.emphasis.hoverLayer=!0)})}})}function i(t,e){var n=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||(t.style.blend=n),t.eachPendingDisplayable&&t.eachPendingDisplayable(function(t){t.style.blend=n})})}function r(t,e){t.preventAutoZ||o(e.group,t.get("z")||0,t.get("zlevel")||0,-1/0)}function o(t,e,n,i){var r=t.getTextContent(),a=t.getTextGuideLine(),s=t.isGroup;if(s)for(var l=t.childrenRef(),u=0;u0?{duration:o,delay:i.get("delay"),easing:i.get("easing")}:null;n.group.traverse(function(e){if(e.states&&e.states.emphasis){if(ls(e))return;if(e instanceof Rb&&Ca(e),e.__dirty){var n=e.prevStates;n&&e.useStates(n)}if(r){e.stateTransition=a;var i=e.getTextContent(),o=e.getTextGuideLine();i&&(i.stateTransition=a),o&&(o.stateTransition=a)}e.__dirty&&t(e)}})}XI=function(t){var e=t._scheduler;e.restorePipelines(t._model),e.prepareStageTasks(),YI(t,!0),YI(t,!1),e.plan()},YI=function(t,e){function n(t){var n=t.__requireNewView;t.__requireNewView=!1;var u="_ec_"+t.id+"_"+t.type,h=!n&&a[u];if(!h){var c=fr(t.type),p=e?bT.getClass(c.main,c.sub):MT.getClass(c.sub);h=new p,h.init(i,l),a[u]=h,o.push(h),s.add(h.group)}t.__viewId=h.__id=u,h.__alive=!0,h.__model=t,h.group.__ecComponentInfo={mainType:t.mainType,index:t.componentIndex},!e&&r.prepareView(h,t,i,l)}for(var i=t._model,r=t._scheduler,o=e?t._componentsViews:t._chartsViews,a=e?t._componentsMap:t._chartsMap,s=t._zr,l=t._api,u=0;u1){var u=s.shift();1===s.length&&(n[a]=s[0]),this._update&&this._update(u,o)}else 1===l?(n[a]=null,this._update&&this._update(s,o)):this._remove&&this._remove(o)}this._performRestAdd(r,n)},t.prototype._executeMultiple=function(){var t=this._old,e=this._new,n={},i={},r=[],o=[];this._initIndexMap(t,n,r,"_oldKeyGetter"),this._initIndexMap(e,i,o,"_newKeyGetter");for(var a=0;a1&&1===c)this._updateManyToOne&&this._updateManyToOne(u,l),i[s]=null;else if(1===h&&c>1)this._updateOneToMany&&this._updateOneToMany(u,l),i[s]=null;else if(1===h&&1===c)this._update&&this._update(u,l),i[s]=null;else if(h>1)for(var p=0;h>p;p++)this._remove&&this._remove(l[p]);else this._remove&&this._remove(l)}this._performRestAdd(o,i)},t.prototype._performRestAdd=function(t,e){for(var n=0;n1)for(var a=0;o>a;a++)this._add&&this._add(r[a]);else 1===o&&this._add&&this._add(r);e[i]=null}},t.prototype._initIndexMap=function(t,e,n,i){for(var r=this._diffModeMultiple,o=0;ol;l++){var u=i[l];o[u]||(o[u]=WA()),EA(n,this._dimensionInfos[u],s,!0)}for(var h=$A(i,function(t){return o[t]}),c=this._storageArr=$A(i,function(t){return n[t]}),p=[],f=a;s>f;f++){for(var d=f-a,g=0;r>g;g++){var u=i[g],y=this._dimValueGetterArrayRows(t[d]||p,u,d,g);c[g][f]=y;var v=h[g];yv[1]&&(v[1]=y)}e&&(this._nameList[f]=e[d],this._dontMakeIdFromName||VA(this,f))}this._rawCount=this._count=s,this._extent={},OA(this)},t.prototype._initDataFromProvider=function(t,e,n){if(!(t>=e)){for(var i=this._rawData,r=this._storage,o=this.dimensions,a=o.length,s=this._dimensionInfos,l=this._nameList,u=this._idList,h=this._rawExtent,c=i.getSource().sourceFormat,p=c===mM,f=0;a>f;f++){var d=o[f];h[d]||(h[d]=WA()),EA(r,s[d],e,n)}var g=this._storageArr=$A(o,function(t){return r[t]}),y=$A(o,function(t){return h[t]});if(i.fillStorage)i.fillStorage(t,e,g,y);else for(var v=[],m=t;e>m;m++){v=i.getItem(m,v);for(var _=0;a>_;_++){var d=o[_],x=g[_],b=this._dimValueGetter(v,d,m,_);x[m]=b;var w=y[_];bw[1]&&(w[1]=b)}if(p&&!i.pure&&v){var S=v.name;null==l[m]&&null!=S&&(l[m]=Qi(S,null));var M=v.id;null==u[m]&&null!=M&&(u[m]=Qi(M,null))}this._dontMakeIdFromName||VA(this,m)}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=e,this._extent={},OA(this)}},t.prototype.count=function(){return this._count},t.prototype.getIndices=function(){var t,e=this._indices;if(e){var n=e.constructor,i=this._count;if(n===Array){t=new n(i);for(var r=0;i>r;r++)t[r]=e[r]}else t=new n(e.buffer,0,i)}else{var n=RA(this);t=new n(this.count());for(var r=0;r=0&&e=0&&e=0&&ei;i++)n.push(this.get(t[i],e));return n},t.prototype.hasValue=function(t){for(var e=this._dimensionsSummary.dataDimsOnCoord,n=0,i=e.length;i>n;n++)if(isNaN(this.get(e[n],t)))return!1;return!0},t.prototype.getDataExtent=function(t){t=this.getDimension(t);var e=this._storage[t],n=WA();if(!e)return n;var i,r=this.count(),o=!this._indices;if(o)return this._rawExtent[t].slice();if(i=this._extent[t])return i.slice();i=n;for(var a=i[0],s=i[1],l=0;r>l;l++){var u=this.getRawIndex(l),h=e[u];a>h&&(a=h),h>s&&(s=h)}return i=[a,s],this._extent[t]=i,i},t.prototype.getApproximateExtent=function(t){return t=this.getDimension(t),this._approximateExtent[t]||this.getDataExtent(t)},t.prototype.setApproximateExtent=function(t,e){e=this.getDimension(e),this._approximateExtent[e]=t.slice()},t.prototype.getCalculationInfo=function(t){return this._calculationInfo[t]},t.prototype.setCalculationInfo=function(t,e){KA(t)?h(this._calculationInfo,t):this._calculationInfo[t]=e},t.prototype.getSum=function(t){var e=this._storage[t],n=0;if(e)for(var i=0,r=this.count();r>i;i++){var o=this.get(t,i);isNaN(o)||(n+=o)}return n},t.prototype.getMedian=function(t){var e=[];this.each(t,function(t){isNaN(t)||e.push(t)});var n=e.sort(function(t,e){return t-e}),i=this.count();return 0===i?0:i%2===1?n[(i-1)/2]:(n[i/2]+n[i/2-1])/2},t.prototype.rawIndexOf=function(t,e){var n=t&&this._invertedIndicesMap[t],i=n[e];return null==i||isNaN(i)?QA:i},t.prototype.indexOfName=function(t){for(var e=0,n=this.count();n>e;e++)if(this.getName(e)===t)return e;return-1},t.prototype.indexOfRawIndex=function(t){if(t>=this._rawCount||0>t)return-1;if(!this._indices)return t;var e=this._indices,n=e[t];if(null!=n&&n=i;){var o=(i+r)/2|0;if(e[o]t))return o;r=o-1}}return-1},t.prototype.indicesOfNearest=function(t,e,n){var i=this._storage,r=i[t],o=[];if(!r)return o;null==n&&(n=1/0);for(var a=1/0,s=-1,l=0,u=0,h=this.count();h>u;u++){var c=this.getRawIndex(u),p=e-r[c],f=Math.abs(p);n>=f&&((a>f||f===a&&p>=0&&0>s)&&(a=f,s=p,l=0),p===s&&(o[l++]=u))}return o.length=l,o},t.prototype.getRawDataItem=function(t){if(this._rawData.persistent)return this._rawData.getItem(this.getRawIndex(t));for(var e=[],n=0;nh;h++){var p=this.getRawIndex(h);switch(s){case 0:e.call(o,h);break;case 1:e.call(o,u[l[0]][p],h);break;case 2:e.call(o,u[l[0]][p],u[l[1]][p],h);break;default:for(var f=0,d=[];s>f;f++)d[f]=u[l[f]][p];d[f]=h,e.apply(o,d)}}}},t.prototype.filterSelf=function(t,e,n,i){var r=this;if(this._count){"function"==typeof t&&(i=n,n=e,e=t,t=[]);for(var o=n||i||this,a=$A(HA(t),this.getDimension,this),s=this.count(),l=RA(this),u=new l(s),h=[],c=a.length,p=0,f=$A(a,function(t){return r._dimensionInfos[t].index}),d=f[0],g=this._storageArr,y=0;s>y;y++){var v=void 0,m=this.getRawIndex(y);if(0===c)v=e.call(o,y);else if(1===c){var _=g[d][m];v=e.call(o,_,y)}else{for(var x=0;c>x;x++)h[x]=g[f[x]][m];h[x]=y,v=e.apply(o,h)}v&&(u[p++]=m)}return s>p&&(this._indices=u),this._count=p,this._extent={},this.getRawIndex=this._indices?BA:NA,this}},t.prototype.selectRange=function(t){var e=this,n=this._count;if(n){var i=[];for(var r in t)t.hasOwnProperty(r)&&i.push(r);var o=i.length;if(o){var a=this.count(),s=RA(this),l=new s(a),u=0,h=i[0],c=$A(i,function(t){return e._dimensionInfos[t].index}),p=t[h][0],f=t[h][1],d=this._storageArr,g=!1;if(!this._indices){var y=0;if(1===o){for(var v=d[c[0]],m=0;n>m;m++){var _=v[m];(_>=p&&f>=_||isNaN(_))&&(l[u++]=y),y++}g=!0}else if(2===o){for(var v=d[c[0]],x=d[c[1]],b=t[i[1]][0],w=t[i[1]][1],m=0;n>m;m++){var _=v[m],S=x[m];(_>=p&&f>=_||isNaN(_))&&(S>=b&&w>=S||isNaN(S))&&(l[u++]=y),y++}g=!0}}if(!g)if(1===o)for(var m=0;a>m;m++){var M=this.getRawIndex(m),_=d[c[0]][M];(_>=p&&f>=_||isNaN(_))&&(l[u++]=M)}else for(var m=0;a>m;m++){for(var T=!0,M=this.getRawIndex(m),C=0;o>C;C++){var I=i[C],_=d[c[C]][M];(_t[I][1])&&(T=!1)}T&&(l[u++]=this.getRawIndex(m))}return a>u&&(this._indices=l),this._count=u,this._extent={},this.getRawIndex=this._indices?BA:NA,this}}},t.prototype.mapArray=function(t,e,n,i){"function"==typeof t&&(i=n,n=e,e=t,t=[]),n=n||i||this;var r=[];return this.each(t,function(){r.push(e&&e.apply(this,arguments))},n),r},t.prototype.map=function(t,e,n,i){var r=n||i||this,o=$A(HA(t),this.getDimension,this),a=GA(this,o),s=a._storage;a._indices=this._indices,a.getRawIndex=a._indices?BA:NA;for(var l=[],u=o.length,h=this.count(),c=[],p=a._rawExtent,f=0;h>f;f++){for(var d=0;u>d;d++)c[d]=this.get(o[d],f);c[u]=f;var g=e&&e.apply(r,c);if(null!=g){"object"!=typeof g&&(l[0]=g,g=l);for(var y=this.getRawIndex(f),v=0;vx[1]&&(x[1]=_)}}}return a},t.prototype.downSample=function(t,e,n,i){for(var r=GA(this,[t]),o=r._storage,a=[],s=ZA(1/e),l=o[t],u=this.count(),h=r._rawExtent[t],c=new(RA(this))(u),p=0,f=0;u>f;f+=s){s>u-f&&(s=u-f,a.length=s);for(var d=0;s>d;d++){var g=this.getRawIndex(f+d);a[d]=l[g]}var y=n(a),v=this.getRawIndex(Math.min(f+i(a,y)||0,u-1));l[v]=y,yh[1]&&(h[1]=y),c[p++]=v}return r._count=p,r._indices=c,r.getRawIndex=BA,r},t.prototype.lttbDownSample=function(t,e){var n,i,r,o=GA(this,[]),a=o._storage,s=a[t],l=this.count(),u=new(RA(this))(l),h=0,c=ZA(1/e),p=this.getRawIndex(0);u[h++]=p;for(var f=1;l-1>f;f+=c){for(var d=Math.min(f+c,l-1),g=Math.min(f+2*c,l),y=(g+d)/2,v=0,m=d;g>m;m++){var _=this.getRawIndex(m),x=s[_];isNaN(x)||(v+=x)}v/=g-d;var b=f,w=Math.min(f+c,l),S=f-1,M=s[p];n=-1,r=b;for(var m=b;w>m;m++){var _=this.getRawIndex(m),x=s[_];isNaN(x)||(i=Math.abs((S-y)*(x-M)-(S-m)*(v-M)),i>n&&(n=i,r=_))}u[h++]=r,p=r}return u[h++]=this.getRawIndex(l-1),o._count=h,o._indices=u,o.getRawIndex=BA,o},t.prototype.getItemModel=function(t){var e=this.hostModel,n=this.getRawDataItem(t);return new ES(n,e,e&&e.ecModel)},t.prototype.diff=function(t){var e=this;return new jA(t?t.getIndices():[],this.getIndices(),function(e){return zA(t,e)},function(t){return zA(e,t)})},t.prototype.getVisual=function(t){var e=this._visual;return e&&e[t]},t.prototype.setVisual=function(t,e){this._visual=this._visual||{},KA(t)?h(this._visual,t):this._visual[t]=e},t.prototype.getItemVisual=function(t,e){var n=this._itemVisuals[t],i=n&&n[e];return null==i?this.getVisual(e):i},t.prototype.hasItemVisual=function(){return this._itemVisuals.length>0},t.prototype.ensureUniqueItemVisual=function(t,e){var n=this._itemVisuals,i=n[t];i||(i=n[t]={});var r=i[e];return null==r&&(r=this.getVisual(e),M(r)?r=r.slice():KA(r)&&(r=h({},r)),i[e]=r),r},t.prototype.setItemVisual=function(t,e,n){var i=this._itemVisuals[t]||{};this._itemVisuals[t]=i,KA(e)?h(i,e):i[e]=n},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(t,e){if(KA(t))for(var n in t)t.hasOwnProperty(n)&&this.setLayout(n,t[n]);else this._layout[t]=e},t.prototype.getLayout=function(t){return this._layout[t]},t.prototype.getItemLayout=function(t){return this._itemLayouts[t]},t.prototype.setItemLayout=function(t,e,n){this._itemLayouts[t]=n?h(this._itemLayouts[t]||{},e):e},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(t,e){var n=this.hostModel;if(e){var i=Kb(e);i.dataIndex=t,i.dataType=this.dataType,i.seriesIndex=n&&n.seriesIndex,"group"===e.type&&e.traverse(UA,e)}this._graphicEls[t]=e},t.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},t.prototype.eachItemGraphicEl=function(t,e){y(this._graphicEls,function(n,i){n&&t&&t.call(e,n,i)})},t.prototype.cloneShallow=function(e){if(!e){var n=$A(this.dimensions,this.getDimensionInfo,this);e=new t(n,this.hostModel)}if(e._storage=this._storage,e._storageArr=this._storageArr,XA(e,this),this._indices){var i=this._indices.constructor;if(i===Array){var r=this._indices.length;e._indices=new i(r);for(var o=0;r>o;o++)e._indices[o]=this._indices[o]}else e._indices=new i(this._indices)}else e._indices=null;return e.getRawIndex=e._indices?BA:NA,e},t.prototype.wrapMethod=function(t,e){var n=this[t];"function"==typeof n&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=n.apply(this,arguments);return e.apply(this,[t].concat(V(arguments)))})},t.internalField=function(){function e(t,e,n,i){return Pu(t[i],this._dimensionInfos[e])}function n(t){var e=t.constructor;return e===Array?t.slice():new e(t)}PA={arrayRows:e,objectRows:function(t,e){return Pu(t[e],this._dimensionInfos[e])},keyedColumns:e,original:function(t,e,n,i){var r=t&&(null==t.value?t:t.value);return!this._rawData.pure&&Wi(t)&&(this.hasItemOption=!0),Pu(r instanceof Array?r[i]:r,this._dimensionInfos[e])},typedArray:function(t,e,n,i){return t[i]}},OA=function(t){var e=t._invertedIndicesMap;y(e,function(n,i){var r=t._dimensionInfos[i],o=r.ordinalMeta;if(o){n=e[i]=new iD(o.categories.length);for(var a=0;a65535?nD:rD},EA=function(t,e,n,i){var r=eD[e.type],o=e.name;if(i){var a=t[o],s=a&&a.length;if(s!==n){for(var l=new r(n),u=0;s>u;u++)l[u]=a[u];t[o]=l}}else t[o]=new r(n)},NA=function(t){return t},BA=function(t){return t=0?this._indices[t]:-1},zA=function(t,e){var n=t._idList[e];return null==n&&null!=t._idDimIdx&&(n=FA(t,t._idDimIdx,t._idOrdinalMeta,e)),null==n&&(n=tD+e),n},HA=function(t){return M(t)||(t=null!=t?[t]:[]),t},GA=function(e,i){var r=e.dimensions,o=new t($A(r,e.getDimensionInfo,e),e.hostModel);XA(o,e);for(var a=o._storage={},s=e._storage,l=o._storageArr=[],u=0;u=0?(a[h]=n(s[h]),o._rawExtent[h]=WA(),o._extent[h]=null):a[h]=s[h],l.push(a[h])) -}return o},WA=function(){return[1/0,-1/0]},UA=function(t){var e=Kb(t),n=Kb(this);e.seriesIndex=n.seriesIndex,e.dataIndex=n.dataIndex,e.dataType=n.dataType},XA=function(t,e){y(oD.concat(e.__wrappedMethods||[]),function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t.__wrappedMethods=e.__wrappedMethods,y(aD,function(n){t[n]=s(e[n])}),t._calculationInfo=h({},e._calculationInfo)},VA=function(t,e){var n=t._nameList,i=t._idList,r=t._nameDimIdx,o=t._idDimIdx,a=n[e],s=i[e];if(null==a&&null!=r&&(n[e]=a=FA(t,r,t._nameOrdinalMeta,e)),null==s&&null!=o&&(i[e]=s=FA(t,o,t._idOrdinalMeta,e)),null==s&&null!=a){var l=t._nameRepeatCount,u=l[a]=(l[a]||0)+1;s=a,u>1&&(s+="__ec__"+u),i[e]=s}}}(),t}(),lD=function(){function t(t){this.coordSysDims=[],this.axisMap=Y(),this.categoryAxisMap=Y(),this.coordSysName=t}return t}(),uD={cartesian2d:function(t,e,n,i){var r=t.getReferringComponents("xAxis",_x).models[0],o=t.getReferringComponents("yAxis",_x).models[0];e.coordSysDims=["x","y"],n.set("x",r),n.set("y",o),$p(r)&&(i.set("x",r),e.firstCategoryDimIndex=0),$p(o)&&(i.set("y",o),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,n,i){var r=t.getReferringComponents("singleAxis",_x).models[0];e.coordSysDims=["single"],n.set("single",r),$p(r)&&(i.set("single",r),e.firstCategoryDimIndex=0)},polar:function(t,e,n,i){var r=t.getReferringComponents("polar",_x).models[0],o=r.findAxisModel("radiusAxis"),a=r.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],n.set("radius",o),n.set("angle",a),$p(o)&&(i.set("radius",o),e.firstCategoryDimIndex=0),$p(a)&&(i.set("angle",a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},geo:function(t,e){e.coordSysDims=["lng","lat"]},parallel:function(t,e,n,i){var r=t.ecModel,o=r.getComponent("parallel",t.get("parallelIndex")),a=e.coordSysDims=o.dimensions.slice();y(o.parallelAxisIndex,function(t,o){var s=r.getComponent("parallelAxis",t),l=a[o];n.set(l,s),$p(s)&&(i.set(l,s),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=o))})}},hD=function(){function t(t){this._setting=t||{},this._extent=[1/0,-1/0]}return t.prototype.getSetting=function(t){return this._setting[t]},t.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},t.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)},t.prototype.isInExtentRange=function(t){return this._extent[0]<=t&&this._extent[1]>=t},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(t){this._isBlank=t},t}();wr(hD);var cD=function(){function t(t){this.categories=t.categories||[],this._needCollect=t.needCollect,this._deduplication=t.deduplication}return t.createByAxisModel=function(e){var n=e.option,i=n.data,r=i&&v(i,of);return new t({categories:r,needCollect:!r,deduplication:n.dedplication!==!1})},t.prototype.getOrdinal=function(t){return this._getOrCreateMap().get(t)},t.prototype.parseAndCollect=function(t){var e,n=this._needCollect;if("string"!=typeof t&&!n)return t;if(n&&!this._deduplication)return e=this.categories.length,this.categories[e]=t,e;var i=this._getOrCreateMap();return e=i.get(t),null==e&&(n?(e=this.categories.length,this.categories[e]=t,i.set(t,e)):e=0/0),e},t.prototype._getOrCreateMap=function(){return this._map||(this._map=Y(this.categories))},t}(),pD=xi,fD=function(t){function n(e){var n=t.call(this,e)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new cD({})),M(i)&&(i=new cD({categories:v(i,function(t){return D(t)?t.value:t})})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return e(n,t),n.prototype.parse=function(t){return"string"==typeof t?this._ordinalMeta.getOrdinal(t):Math.round(t)},n.prototype.contain=function(t){return t=this.parse(t),hf(t,this._extent)&&null!=this._ordinalMeta.categories[t]},n.prototype.normalize=function(t){return t=this._getTickNumber(this.parse(t)),cf(t,this._extent)},n.prototype.scale=function(t){return t=Math.round(pf(t,this._extent)),this.getRawOrdinalNumber(t)},n.prototype.getTicks=function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push({value:n}),n++;return t},n.prototype.getMinorTicks=function(){},n.prototype.setSortInfo=function(t){if(null==t)return void(this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null);for(var e=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],r=0,o=this._ordinalMeta.categories.length,a=Math.min(o,e.length);a>r;++r){var s=e[r];n[r]=s,i[s]=r}for(var l=0;o>r;++r){for(;null!=i[l];)l++;n.push(l),i[l]=r}},n.prototype._getTickNumber=function(t){var e=this._ticksByOrdinalNumber;return e&&t>=0&&t=0&&t=t},n.prototype.getOrdinalMeta=function(){return this._ordinalMeta},n.prototype.niceTicks=function(){},n.prototype.niceExtent=function(){},n.type="ordinal",n}(hD);hD.registerClass(fD);var dD=xi,gD=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="interval",e._interval=0,e._intervalPrecision=2,e}return e(n,t),n.prototype.parse=function(t){return t},n.prototype.contain=function(t){return hf(t,this._extent)},n.prototype.normalize=function(t){return cf(t,this._extent)},n.prototype.scale=function(t){return pf(t,this._extent)},n.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(e)||(n[1]=parseFloat(e))},n.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),this.setExtent(e[0],e[1])},n.prototype.getInterval=function(){return this._interval},n.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=sf(t)},n.prototype.getTicks=function(t){var e=this._interval,n=this._extent,i=this._niceExtent,r=this._intervalPrecision,o=[];if(!e)return o;var a=1e4;n[0]a)return[];var l=o.length?o[o.length-1].value:i[1];return n[1]>l&&o.push(t?{value:dD(l+e,r)}:{value:n[1]}),o},n.prototype.getMinorTicks=function(t){for(var e=this.getTicks(!0),n=[],i=this.getExtent(),r=1;rs;){var c=dD(a.value+(s+1)*h);c>i[0]&&cr&&(r=-r,i.reverse());var o=af(i,t,e,n);this._intervalPrecision=o.intervalPrecision,this._interval=o.interval,this._niceExtent=o.niceTickExtent}},n.prototype.niceExtent=function(t){var e=this._extent;if(e[0]===e[1])if(0!==e[0]){var n=e[0];t.fixMax?e[0]-=n/2:(e[1]+=n/2,e[0]-=n/2)}else e[1]=1;var i=e[1]-e[0];isFinite(i)||(e[0]=0,e[1]=1),this.niceTicks(t.splitNumber,t.minInterval,t.maxInterval);var r=this._interval;t.fixMin||(e[0]=dD(Math.floor(e[0]/r)*r)),t.fixMax||(e[1]=dD(Math.ceil(e[1]/r)*r))},n.type="interval",n}(hD);hD.registerClass(gD);var yD="__ec_stack_",vD=.5,mD="undefined"!=typeof Float32Array?Float32Array:Array,_D={seriesType:"bar",plan:gh(),reset:function(t){if(bf(t)&&wf(t)){var e=t.getData(),n=t.coordinateSystem,i=n.master.getRect(),r=n.getBaseAxis(),o=n.getOtherAxis(r),a=e.mapDimension(o.dim),s=e.mapDimension(r.dim),l=o.isHorizontal(),u=l?0:1,h=_f(vf([t]),r,t).width;return h>vD||(h=vD),{progress:function(t,e){for(var c,p=t.count,f=new mD(2*p),d=new mD(2*p),g=new mD(p),y=[],v=[],m=0,_=0;null!=(c=t.next());)v[u]=e.get(a,c),v[1-u]=e.get(s,c),y=n.dataToPoint(v,null,y),d[m]=l?i.x+i.width:y[0],f[m++]=y[0],d[m]=l?y[1]:i.y+i.height,f[m++]=y[1],g[_++]=c;e.setLayout({largePoints:f,largeDataIndices:g,largeBackgroundPoints:d,barWidth:h,valueAxisStart:Sf(r,o,!1),backgroundStart:l?i.x:i.y,valueAxisHorizontal:l})}}}}},xD=function(t,e,n,i){for(;i>n;){var r=n+i>>>1;t[r][1]n&&(this._approxInterval=n);var o=wD.length,a=Math.min(xD(wD,this._approxInterval,0,o),o-1);this._interval=wD[a][1],this._minLevelUnit=wD[Math.max(a-1,0)][0]},n.prototype.parse=function(t){return"number"==typeof t?t:+Ai(t)},n.prototype.contain=function(t){return hf(this.parse(t),this._extent)},n.prototype.normalize=function(t){return cf(this.parse(t),this._extent)},n.prototype.scale=function(t){return pf(t,this._extent)},n.type="time",n}(gD),wD=[["second",XS],["minute",YS],["hour",jS],["quarter-day",6*jS],["half-day",12*jS],["day",1.2*qS],["half-week",3.5*qS],["week",7*qS],["month",31*qS],["quarter",95*qS],["half-year",ZS/2],["year",ZS]];hD.registerClass(bD);var SD=hD.prototype,MD=gD.prototype,TD=Si,CD=xi,ID=Math.floor,AD=Math.ceil,DD=Math.pow,kD=Math.log,LD=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e.base=10,e._originalScale=new gD,e._interval=0,e}return e(n,t),n.prototype.getTicks=function(t){var e=this._originalScale,n=this._extent,i=e.getExtent(),r=MD.getTicks.call(this,t);return v(r,function(t){var e=t.value,r=xi(DD(this.base,e));return r=e===n[0]&&this._fixMin?Pf(r,i[0]):r,r=e===n[1]&&this._fixMax?Pf(r,i[1]):r,{value:r}},this)},n.prototype.setExtent=function(t,e){var n=this.base;t=kD(t)/kD(n),e=kD(e)/kD(n),MD.setExtent.call(this,t,e)},n.prototype.getExtent=function(){var t=this.base,e=SD.getExtent.call(this);e[0]=DD(t,e[0]),e[1]=DD(t,e[1]);var n=this._originalScale,i=n.getExtent();return this._fixMin&&(e[0]=Pf(e[0],i[0])),this._fixMax&&(e[1]=Pf(e[1],i[1])),e},n.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=kD(t[0])/kD(e),t[1]=kD(t[1])/kD(e),SD.unionExtent.call(this,t)},n.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},n.prototype.niceTicks=function(t){t=t||10;var e=this._extent,n=e[1]-e[0];if(!(1/0===n||0>=n)){var i=Di(n),r=t/n*i;for(.5>=r&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var o=[xi(AD(e[0]/i)*i),xi(ID(e[1]/i)*i)];this._interval=i,this._niceExtent=o}},n.prototype.niceExtent=function(t){MD.niceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},n.prototype.parse=function(t){return t},n.prototype.contain=function(t){return t=kD(t)/kD(this.base),hf(t,this._extent)},n.prototype.normalize=function(t){return t=kD(t)/kD(this.base),cf(t,this._extent)},n.prototype.scale=function(t){return t=pf(t,this._extent),DD(this.base,t)},n.type="log",n}(hD),PD=LD.prototype;PD.getMinorTicks=MD.getMinorTicks,PD.getLabel=MD.getLabel,hD.registerClass(LD);var OD=function(){function t(t,e,n){this._prepareParams(t,e,n)}return t.prototype._prepareParams=function(t,e,n){n[1]s&&(a=0/0,s=0/0);var h=N(a)||N(s)||t&&!i;this._needCrossZero&&(a>0&&s>0&&!l&&(a=0),0>a&&0>s&&!u&&(s=0));var c=this._determinedMin,p=this._determinedMax;return null!=c&&(a=c,l=!0),null!=p&&(s=p,u=!0),{min:a,max:s,minFixed:l,maxFixed:u,isBlank:h}},t.prototype.modifyDataMinMax=function(t,e){this[ED[t]]=e},t.prototype.setDeterminedMinMax=function(t,e){var n=RD[t];this[n]=e},t.prototype.freeze=function(){this.frozen=!0},t}(),RD={min:"_determinedMin",max:"_determinedMax"},ED={min:"_dataMin",max:"_dataMax"},ND=function(){function t(){}return t.prototype.getNeedCrossZero=function(){var t=this.option;return!t.scale},t.prototype.getCoordSysModel=function(){},t}(),BD={isDimensionStacked:Qp,enableDataStack:Jp,getStackedDimension:tf},zD=(Object.freeze||Object)({createList:jf,getLayoutRect:Sl,dataStack:BD,createScale:qf,mixinAxisModelCommonMethods:Zf,getECData:Kb,createTextStyle:Kf,createDimensions:Zp,createSymbol:uc,enableHoverEmphasis:ma}),FD=[],VD={registerPreprocessor:Cp,registerProcessor:Ip,registerPostInit:Ap,registerPostUpdate:Dp,registerAction:kp,registerCoordinateSystem:Lp,registerLayout:Op,registerVisual:Rp,registerTransform:LA,registerLoading:Np,registerMap:zp,PRIORITY:RI,ComponentModel:cM,ComponentView:bT,SeriesModel:xT,ChartView:MT,registerComponentModel:function(t){cM.registerClass(t)},registerComponentView:function(t){bT.registerClass(t)},registerSeriesModel:function(t){xT.registerClass(t)},registerChartView:function(t){MT.registerClass(t)},registerSubTypeDefaulter:function(t,e){cM.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){yi(t,e)}},HD=(Object.freeze||Object)({linearMap:mi,round:xi,asc:bi,getPrecision:wi,getPrecisionSafe:Si,getPixelPrecision:Mi,getPercentWithPrecision:Ti,MAX_SAFE_INTEGER:fx,remRadian:Ci,isRadianAroundZero:Ii,parseDate:Ai,quantity:Di,quantityExponent:ki,nice:Li,quantile:Pi,reformIntervals:Oi,isNumeric:Ei,numericToNumber:Ri}),GD=(Object.freeze||Object)({parse:Ai,format:js}),WD=(Object.freeze||Object)({extendShape:Ya,extendPath:ja,makePath:Ka,makeImage:$a,mergePath:mS,resizePath:Qa,createIcon:vs,updateProps:is,initProps:rs,getTransform:us,clipPointsByRect:gs,clipRectByRect:ys,registerShape:qa,getShapeClass:Za,Group:ox,Image:Fb,Text:jb,Circle:Iw,Ellipse:Dw,Sector:Gw,Ring:Uw,Polygon:Yw,Polyline:qw,Rect:Wb,Line:$w,BezierCurve:tS,Arc:nS,IncrementalDisplayable:fS,CompoundPath:iS,LinearGradient:oS,RadialGradient:aS,BoundingRect:C_}),UD=(Object.freeze||Object)({addCommas:pl,toCamelCase:fl,normalizeCssArray:eM,encodeHTML:dl,formatTpl:yl,getTooltipMarker:vl,formatTime:ml,capitalFirst:_l,truncateText:Ar,getTextRect:cl}),XD=(Object.freeze||Object)({map:v,each:y,indexOf:p,inherits:f,reduce:m,filter:_,bind:xm,curry:S,isArray:M,isString:C,isObject:D,isFunction:T,extend:h,defaults:c,clone:s,merge:l}),YD=or(),jD=[0,1],qD=function(){function t(t,e,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=e,this._extent=n||[0,0]}return t.prototype.contain=function(t){var e=this._extent,n=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return t>=n&&i>=t},t.prototype.containData=function(t){return this.scale.contain(t)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(t){return Mi(t||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(t,e){var n=this._extent;n[0]=t,n[1]=e},t.prototype.dataToCoord=function(t,e){var n=this._extent,i=this.scale;return t=i.normalize(t),this.onBand&&"ordinal"===i.type&&(n=n.slice(),pd(n,i.count())),mi(t,jD,n,e)},t.prototype.coordToData=function(t,e){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&(n=n.slice(),pd(n,i.count()));var r=mi(t,n,jD,e);return this.scale.scale(r)},t.prototype.pointToData=function(){},t.prototype.getTicksCoords=function(t){t=t||{};var e=t.tickModel||this.getTickModel(),n=Qf(this,e),i=n.ticks,r=v(i,function(t){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(t):t),tickValue:t}},this),o=e.get("alignWithLabel");return fd(this,r,o,t.clamp),r},t.prototype.getMinorTicksCoords=function(){if("ordinal"===this.scale.type)return[];var t=this.model.getModel("minorTick"),e=t.get("splitNumber");e>0&&100>e||(e=5);var n=this.scale.getMinorTicks(e),i=v(n,function(t){return v(t,function(t){return{coord:this.dataToCoord(t),tickValue:t}},this)},this);return i},t.prototype.getViewLabels=function(){return Jf(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var t=this._extent,e=this.scale.getExtent(),n=e[1]-e[0]+(this.onBand?1:0);0===n&&(n=1);var i=Math.abs(t[1]-t[0]);return Math.abs(i)/n},t.prototype.calculateCategoryInterval=function(){return ld(this)},t}(),ZD=function(t){function n(e,n,i){var r=t.call(this)||this;r.motionBlur=!1,r.lastFrameAlpha=.7,r.dpr=1,r.virtual=!1,r.config={},r.incremental=!1,r.zlevel=0,r.maxRepaintRectCount=5,r.__dirty=!0,r.__firstTimePaint=!0,r.__used=!1,r.__drawIndex=0,r.__startIndex=0,r.__endIndex=0,r.__prevStartIndex=null,r.__prevEndIndex=null;var o;i=i||L_,"string"==typeof e?o=_d(e,n,i):D(e)&&(o=e,e=o.id),r.id=e,r.dom=o;var a=o.style;return a&&(o.onselectstart=md,a.webkitUserSelect="none",a.userSelect="none",a.webkitTapHighlightColor="rgba(0,0,0,0)",a["-webkit-touch-callout"]="none",a.padding="0",a.margin="0",a.borderWidth="0"),r.domBack=null,r.ctxBack=null,r.painter=n,r.config=null,r.dpr=i,r}return e(n,t),n.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},n.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},n.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},n.prototype.setUnpainted=function(){this.__firstTimePaint=!0},n.prototype.createBackBuffer=function(){var t=this.dpr;this.domBack=_d("back-"+this.id,this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!==t&&this.ctxBack.scale(t,t)},n.prototype.createRepaintRects=function(t,e,n,i){function r(t){if(t.isFinite()&&!t.isZero())if(0===o.length){var e=new C_(0,0,0,0);e.copy(t),o.push(e)}else{for(var n=!1,i=1/0,r=0,u=0;ug&&(i=g,r=u)}}if(s&&(o[r].union(t),n=!0),!n){var e=new C_(0,0,0,0);e.copy(t),o.push(e)}s||(s=o.length>=a)}}if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;for(var o=[],a=this.maxRepaintRectCount,s=!1,l=new C_(0,0,0,0),u=this.__startIndex;uo;o++){var a=t[o];a.__inHover&&(n||(n=this._hoverlayer=this.getLayer(KD)),i||(i=n.ctx,i.save()),Oc(i,a,r,o===e-1))}i&&i.restore()}},t.prototype.getHoverLayer=function(){return this.getLayer(KD)},t.prototype.paintOne=function(t,e){Pc(t,e)},t.prototype._paintList=function(t,e,n,i){if(this._redrawId===i){n=n||!1,this._updateLayerStatus(t);var r=this._doPaintList(t,e,n),o=r.finished,a=r.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),a&&this._paintHoverList(t),o)this.eachLayer(function(t){t.afterBrush&&t.afterBrush()});else{var s=this;j_(function(){s._paintList(t,e,n,i)})}}},t.prototype._compositeManually=function(){var t=this.getLayer($D).ctx,e=this._domRoot.width,n=this._domRoot.height;t.clearRect(0,0,e,n),this.eachBuiltinLayer(function(i){i.virtual&&t.drawImage(i.dom,0,0,e,n)})},t.prototype._doPaintList=function(t,e,n){for(var i=this,r=[],o=this._opts.useDirtyRect,a=0;a15)break}}n.prevElClipPaths&&l.restore()};if(c)if(0===c.length)m=s.__endIndex;else for(var x=p.dpr,b=0;b0&&t>i[0]){for(l=0;r-1>l&&!(i[l]t);l++);s=n[i[l]]}if(i.splice(l+1,0,t),n[t]=e,!e.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(e.dom,u.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.__painter=this},t.prototype.eachLayer=function(t,e){for(var n=this._zlevelList,i=0;i0?JD:0),this._needsManuallyCompositing),h.__builtin__||a("ZLevel "+u+" has been used by unkown layer "+h.id),h!==s&&(h.__used=!0,h.__startIndex!==o&&(h.__dirty=!0),h.__startIndex=o,h.__drawIndex=h.incremental?-1:o,e(o),s=h),i.__dirty&H_.REDARAW_BIT&&!i.__inHover&&(h.__dirty=!0,h.incremental&&h.__drawIndex<0&&(h.__drawIndex=o))}e(o),this.eachBuiltinLayer(function(t){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)})},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,y(this._layers,function(t){t.setUnpainted()})},t.prototype.configLayer=function(t,e){if(e){var n=this._layerConfig;n[t]?l(n[t],e,!0):n[t]=e;for(var i=0;is;s++){var u=a[s];Oc(n,u,o,s===l-1)}return e.dom},t.prototype.getWidth=function(){return this._width},t.prototype.getHeight=function(){return this._height},t.prototype._getSize=function(t){var e=this._opts,n=["width","height"][t],i=["clientWidth","clientHeight"][t],r=["paddingLeft","paddingTop"][t],o=["paddingRight","paddingBottom"][t];if(null!=e[n]&&"auto"!==e[n])return parseFloat(e[n]);var a=this.root,s=document.defaultView.getComputedStyle(a);return(a[i]||xd(s[n])||xd(a.style[n]))-(xd(s[r])||0)-(xd(s[o])||0)|0},t.prototype.pathToImage=function(t,e){e=e||this.dpr;var n=document.createElement("canvas"),i=n.getContext("2d"),r=t.getBoundingRect(),o=t.style,a=o.shadowBlur*e,s=o.shadowOffsetX*e,l=o.shadowOffsetY*e,u=t.hasStroke()?o.lineWidth:0,c=Math.max(u/2,-s+a),p=Math.max(u/2,s+a),f=Math.max(u/2,-l+a),d=Math.max(u/2,l+a),g=r.width+c+p,y=r.height+f+d;n.width=g*e,n.height=y*e,i.scale(e,e),i.clearRect(0,0,g,y),i.dpr=e;var v={x:t.x,y:t.y,scaleX:t.scaleX,scaleY:t.scaleY,rotation:t.rotation,originX:t.originX,originY:t.originY};t.x=c-r.x,t.y=f-r.y,t.rotation=0,t.scaleX=1,t.scaleY=1,t.updateTransform(),t&&Oc(i,t,{inHover:!1,viewWidth:this._width,viewHeight:this._height},!0);var m=new Fb({style:{x:0,y:0,image:n}});return h(t,v),m},t}(),ek=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="dataset",e}return e(n,t),n.prototype.init=function(e,n,i){t.prototype.init.call(this,e,n,i),this._sourceManager=new fT(this),Gu(this)},n.prototype.mergeOption=function(e,n){t.prototype.mergeOption.call(this,e,n),Gu(this)},n.prototype.optionUpdated=function(){this._sourceManager.dirty() -},n.prototype.getSourceManager=function(){return this._sourceManager},n.type="dataset",n.defaultOption={seriesLayoutBy:MM},n}(cM),nk=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="dataset",e}return e(n,t),n.type="dataset",n}(bT);$f([Sd,Md]);var ik={average:function(t){for(var e=0,n=0,i=0;ie&&(e=t[n]);return isFinite(e)?e:0/0},min:function(t){for(var e=1/0,n=0;nt&&(t=e),t},n.prototype.brushSelector=function(t,e,n){return n.rect(e.getItemLayout(t))},n.type="series.bar",n.dependencies=["grid","polar"],n.defaultOption=zs(ok.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:"#212121"}},realtimeSort:!1}),n}(ok),sk=function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0}return t}(),lk=function(t){function n(e){var n=t.call(this,e)||this;return n.type="sausage",n}return e(n,t),n.prototype.getDefaultShape=function(){return new sk},n.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=Math.max(e.r0||0,0),o=Math.max(e.r,0),a=.5*(o-r),s=r+a,l=e.startAngle,u=e.endAngle,h=e.clockwise,c=Math.cos(l),p=Math.sin(l),f=Math.cos(u),d=Math.sin(u),g=h?u-l<2*Math.PI:l-u<2*Math.PI;g&&(t.moveTo(c*r+n,p*r+i),t.arc(c*s+n,p*s+i,a,-Math.PI+l,l,!h)),t.arc(n,i,o,l,u,!h),t.moveTo(f*o+n,d*o+i),t.arc(f*s+n,d*s+i,a,u-2*Math.PI,u-Math.PI,!h),0!==r&&(t.arc(n,i,r,u,l,h),t.moveTo(c*r+n,d*r+i)),t.closePath()},n}(Rb),uk=[0,0],hk=Math.max,ck=Math.min,pk=function(t){function n(){var e=t.call(this)||this;return e.type=n.type,e._isFirstFrame=!0,e}return e(n,t),n.prototype.render=function(t,e,n,i){this._model=t,this._removeOnRenderedListener(n),this._updateDrawMode(t);var r=t.get("coordinateSystem");("cartesian2d"===r||"polar"===r)&&(this._isLargeDraw?this._renderLarge(t,e,n):this._renderNormal(t,e,n,i))},n.prototype.incrementalPrepareRender=function(t){this._clear(),this._updateDrawMode(t),this._updateLargeClip(t)},n.prototype.incrementalRender=function(t,e){this._incrementalRenderLarge(t,e)},n.prototype._updateDrawMode=function(t){var e=t.pipelineContext.large;(null==this._isLargeDraw||e!==this._isLargeDraw)&&(this._isLargeDraw=e,this._clear())},n.prototype._renderNormal=function(t,e,n,i){function r(t){var e=gk[u.type](s,t),n=Wd(u,o,e);return n.useStyle(v.getItemStyle()),"cartesian2d"===u.type&&n.setShape("r",m),_[t]=n,n}var o,a=this.group,s=t.getData(),l=this._data,u=t.coordinateSystem,h=u.getBaseAxis();"cartesian2d"===u.type?o=h.isHorizontal():"polar"===u.type&&(o="angle"===h.dim);var c=t.isAnimationEnabled()?t:null,p=Od(t,u);p&&this._enableRealtimeSort(p,s,n);var f=t.get("clip",!0)||p,d=Pd(u,s);a.removeClipPath();var g=t.get("roundCap",!0),y=t.get("showBackground",!0),v=t.getModel("backgroundStyle"),m=v.get("borderRadius")||0,_=[],x=this._backgroundEls,b=i&&i.isInitSort,w=i&&"changeAxisOrder"===i.type;s.diff(l).add(function(e){var n=s.getItemModel(e),i=gk[u.type](s,e,n);if(y&&r(e),s.hasValue(e)){var l=!1;f&&(l=fk[u.type](d,i));var v=dk[u.type](t,s,e,i,o,c,h.model,!1,g);Nd(v,s,e,n,i,t,o,"polar"===u.type),b?v.attr({shape:i}):p?Rd(p,c,v,i,e,o,!1,!1):rs(v,{shape:i},t,e),s.setItemGraphicEl(e,v),a.add(v),v.ignore=l}}).update(function(e,n){var i=s.getItemModel(e),S=gk[u.type](s,e,i);if(y){var M=void 0;0===x.length?M=r(n):(M=x[n],M.useStyle(v.getItemStyle()),"cartesian2d"===u.type&&M.setShape("r",m),_[e]=M);var T=gk[u.type](s,e),C=Gd(o,T,u);is(M,{shape:C},c,e)}var I=l.getItemGraphicEl(n);if(!s.hasValue(e))return a.remove(I),void(I=null);var A=!1;f&&(A=fk[u.type](d,S),A&&a.remove(I)),I||(I=dk[u.type](t,s,e,S,o,c,h.model,!!I,g)),w||Nd(I,s,e,i,S,t,o,"polar"===u.type),b?I.attr({shape:S}):p?Rd(p,c,I,S,e,o,!0,w):is(I,{shape:S},t,e,null),s.setItemGraphicEl(e,I),I.ignore=A,a.add(I)}).remove(function(e){var n=l.getItemGraphicEl(e);n&&ss(n,t,e)}).execute();var S=this._backgroundGroup||(this._backgroundGroup=new ox);S.removeAll();for(var M=0;M<_.length;++M)S.add(_[M]);a.add(S),this._backgroundEls=_,this._data=s},n.prototype._renderLarge=function(t){this._clear(),zd(t,this.group),this._updateLargeClip(t)},n.prototype._incrementalRenderLarge=function(t,e){this._removeBackground(),zd(e,this.group,!0)},n.prototype._updateLargeClip=function(t){var e=t.get("clip",!0)?Ad(t.coordinateSystem,!1,t):null;e?this.group.setClipPath(e):this.group.removeClipPath()},n.prototype._enableRealtimeSort=function(t,e,n){var i=this;if(e.count()){var r=t.baseAxis;if(this._isFirstFrame)this._dispatchInitSort(e,t,n),this._isFirstFrame=!1;else{var o=function(t){var n=e.getItemGraphicEl(t);if(n){var i=n.shape;return Math.abs(r.isHorizontal()?i.height:i.width)||0}return 0};this._onRendered=function(){i._updateSortWithinSameData(e,o,r,n)},n.getZr().on("rendered",this._onRendered)}}},n.prototype._dataSort=function(t,e,n){var i=[];return t.each(t.mapDimension(e.dim),function(t,e){var r=n(e);r=null==r?0/0:r,i.push({dataIndex:e,mappedValue:r,ordinalNumber:t})}),i.sort(function(t,e){return e.mappedValue-t.mappedValue}),{ordinalNumbers:v(i,function(t){return t.ordinalNumber})}},n.prototype._isOrderChangedWithinSameData=function(t,e,n){for(var i=n.scale,r=t.mapDimension(n.dim),o=Number.MAX_VALUE,a=0,s=i.getOrdinalMeta().categories.length;s>a;++a){var l=t.rawIndexOf(r,i.getRawOrdinalNumber(a)),u=0>l?Number.MIN_VALUE:e(t.indexOfRawIndex(l));if(u>o)return!0;o=u}return!1},n.prototype._isOrderDifferentInView=function(t,e){for(var n=e.scale,i=n.getExtent(),r=Math.max(0,i[0]),o=Math.min(i[1],n.getOrdinalMeta().categories.length-1);o>=r;++r)if(t.ordinalNumbers[r]!==n.getRawOrdinalNumber(r))return!0},n.prototype._updateSortWithinSameData=function(t,e,n,i){if(this._isOrderChangedWithinSameData(t,e,n)){var r=this._dataSort(t,n,e);this._isOrderDifferentInView(r,n)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:n.dim+"Axis",axisId:n.index,sortInfo:r}))}},n.prototype._dispatchInitSort=function(t,e,n){var i=e.baseAxis,r=this._dataSort(t,i,function(n){return t.get(t.mapDimension(e.otherAxis.dim),n)});n.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.index,sortInfo:r,animation:{duration:0}})},n.prototype.remove=function(t,e){this._clear(this._model),this._removeOnRenderedListener(e)},n.prototype.dispose=function(t,e){this._removeOnRenderedListener(e)},n.prototype._removeOnRenderedListener=function(t){this._onRendered&&(t.getZr().off("rendered",this._onRendered),this._onRendered=null)},n.prototype._clear=function(t){var e=this.group,n=this._data;t&&t.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(e){ss(e,t,Kb(e).dataIndex)})):e.removeAll(),this._data=null,this._isFirstFrame=!0},n.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},n.type="bar",n}(MT),fk={cartesian2d:function(t,e){var n=e.width<0?-1:1,i=e.height<0?-1:1;0>n&&(e.x+=e.width,e.width=-e.width),0>i&&(e.y+=e.height,e.height=-e.height);var r=t.x+t.width,o=t.y+t.height,a=hk(e.x,t.x),s=ck(e.x+e.width,r),l=hk(e.y,t.y),u=ck(e.y+e.height,o),h=a>s,c=l>u;return e.x=h&&a>r?s:a,e.y=c&&l>o?u:l,e.width=h?0:s-a,e.height=c?0:u-l,0>n&&(e.x+=e.width,e.width=-e.width),0>i&&(e.y+=e.height,e.height=-e.height),h||c},polar:function(t,e){var n=e.r0<=e.r?1:-1;if(0>n){var i=e.r;e.r=e.r0,e.r0=i}var r=ck(e.r,t.r),o=hk(e.r0,t.r0);e.r=r,e.r0=o;var a=0>r-o;if(0>n){var i=e.r;e.r=e.r0,e.r0=i}return a}},dk={cartesian2d:function(t,e,n,i,r,o){var a=new Wb({shape:h({},i),z2:1});if(a.__dataIndex=n,a.name="item",o){var s=a.shape,l=r?"height":"width";s[l]=0}return a},polar:function(t,e,n,i,r,o,a,s,l){var u=i.startAngle0?1:-1,a=i.height>0?1:-1;return{x:i.x+o*r/2,y:i.y+a*r/2,width:i.width-o*r,height:i.height-a*r}},polar:function(t,e){var n=t.getItemLayout(e);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle}}},yk=function(){function t(){}return t}(),vk=function(t){function n(e){var n=t.call(this,e)||this;return n.type="largeBar",n}return e(n,t),n.prototype.getDefaultShape=function(){return new yk},n.prototype.buildPath=function(t,e){for(var n=e.points,i=this.__startPoint,r=this.__baseDimIdx,o=0;o=0?n:null},30,!1);$f(Ud);var _k=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.hasSymbolVisual=!0,e}return e(n,t),n.prototype.getInitialData=function(){return ef(this.getSource(),this,{useEncodeDefaulter:!0})},n.prototype.getLegendIcon=function(t){var e=new ox,n=uc("line",0,t.itemHeight/2,t.itemWidth,0,t.lineStyle.stroke,!1);e.add(n),n.setStyle(t.lineStyle);var i=this.getData().getVisual("symbol"),r="none"===i?"circle":i,o=.8*t.itemHeight,a=uc(r,(t.itemWidth-o)/2,(t.itemHeight-o)/2,o,o,t.itemStyle.fill,t.symbolKeepAspect);return e.add(a),a.setStyle(t.itemStyle),r.indexOf("empty")>-1&&(a.style.stroke=a.style.fill,a.style.fill="#fff",a.style.lineWidth=2),e},n.type="series.line",n.dependencies=["grid","polar"],n.defaultOption={zlevel:0,z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0,lineStyle:{width:"bolder"}},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0},n}(xT),xk=function(t){function n(e,n,i,r){var o=t.call(this)||this;return o.updateData(e,n,i,r),o}return e(n,t),n.prototype._createSymbol=function(t,e,n,i,r){this.removeAll();var o=uc(t,-1,-1,2,2,null,r);o.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),o.drift=Xd,this._symbolType=t,this.add(o)},n.prototype.stopSymbolAnimation=function(t){this.childAt(0).stopAnimation(null,t)},n.prototype.getSymbolPath=function(){return this.childAt(0)},n.prototype.highlight=function(){ea(this.childAt(0))},n.prototype.downplay=function(){na(this.childAt(0))},n.prototype.setZ=function(t,e){var n=this.childAt(0);n.zlevel=t,n.z=e},n.prototype.setDraggable=function(t){var e=this.childAt(0);e.draggable=t,e.cursor=t?"move":e.cursor},n.prototype.updateData=function(t,e,i,r){this.silent=!1;var o=t.getItemVisual(e,"symbol")||"circle",a=t.hostModel,s=n.getSymbolSize(t,e),l=o!==this._symbolType,u=r&&r.disableAnimation;if(l){var h=t.getItemVisual(e,"symbolKeepAspect");this._createSymbol(o,t,e,s,h)}else{var c=this.childAt(0);c.silent=!1;var p={scaleX:s[0]/2,scaleY:s[1]/2};u?c.attr(p):is(c,p,a,e)}if(this._updateCommon(t,e,s,i,r),l){var c=this.childAt(0);if(!u){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:c.style.opacity}};c.scaleX=c.scaleY=0,c.style.opacity=0,rs(c,p,a,e)}}u&&this.childAt(0).stopAnimation("remove"),this._seriesModel=a},n.prototype._updateCommon=function(t,e,n,i,r){function o(e){return I?t.getName(e):kd(t,e)}var a,s,l,u,c,p,f,d,g=this.childAt(0),y=t.hostModel;if(i&&(a=i.emphasisItemStyle,s=i.blurItemStyle,l=i.selectItemStyle,u=i.focus,c=i.blurScope,p=i.labelStatesModels,f=i.hoverScale,d=i.cursorStyle),!i||t.hasItemOption){var v=i&&i.itemModel?i.itemModel:t.getItemModel(e),m=v.getModel("emphasis");a=m.getModel("itemStyle").getItemStyle(),l=v.getModel(["select","itemStyle"]).getItemStyle(),s=v.getModel(["blur","itemStyle"]).getItemStyle(),u=m.get("focus"),c=m.get("blurScope"),p=Cs(v),f=m.getShallow("scale"),d=v.getShallow("cursor")}var _=t.getItemVisual(e,"symbolRotate");g.attr("rotation",(_||0)*Math.PI/180||0);var x=t.getItemVisual(e,"symbolOffset")||0;x&&(M(x)||(x=[x,x]),g.x=_i(x[0],n[0]),g.y=_i(z(x[1],x[0])||0,n[1])),d&&g.attr("cursor",d);var b=t.getItemVisual(e,"style"),w=b.fill;if(g instanceof Fb){var S=g.style;g.useStyle(h({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else g.useStyle(g.__isEmptyBrush?h({},b):b),g.style.decal=null,g.setColor(w,r&&r.symbolInnerColor),g.style.strokeNoScale=!0;var T=t.getItemVisual(e,"liftZ"),C=this._z2;null!=T?null==C&&(this._z2=g.z2,g.z2+=T):null!=C&&(g.z2=C,this._z2=null);var I=r&&r.useNameLabel;Ts(g,p,{labelFetcher:y,labelDataIndex:e,defaultText:o,inheritColor:w,defaultOpacity:b.opacity}),this._sizeX=n[0]/2,this._sizeY=n[1]/2;var A=g.ensureState("emphasis");if(A.style=a,g.ensureState("select").style=l,g.ensureState("blur").style=s,f){var D=Math.max(1.1,3/this._sizeY);A.scaleX=this._sizeX*D,A.scaleY=this._sizeY*D}this.setSymbolScale(1),ma(this,u,c)},n.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},n.prototype.fadeOut=function(t,e){var n=this.childAt(0),i=this._seriesModel,r=Kb(this).dataIndex,o=e&&e.animation;if(this.silent=n.silent=!0,e&&e.fadeLabel){var a=n.getTextContent();a&&os(a,{style:{opacity:0}},i,{dataIndex:r,removeOpt:o,cb:function(){n.removeTextContent()}})}else n.removeTextContent();os(n,{style:{opacity:0},scaleX:0,scaleY:0},i,{dataIndex:r,cb:t,removeOpt:o})},n.getSymbolSize=function(t,e){var n=t.getItemVisual(e,"symbolSize");return M(n)?n.slice():[+n,+n]},n}(ox),bk=function(){function t(t){this.group=new ox,this._SymbolCtor=t||xk}return t.prototype.updateData=function(t,e){e=jd(e);var n=this.group,i=t.hostModel,r=this._data,o=this._SymbolCtor,a=e.disableAnimation,s=qd(t),l={disableAnimation:a},u=e.getSymbolPoint||function(e){return t.getItemLayout(e)};r||n.removeAll(),t.diff(r).add(function(i){var r=u(i);if(Yd(t,r,i,e)){var a=new o(t,i,s,l);a.setPosition(r),t.setItemGraphicEl(i,a),n.add(a)}}).update(function(h,c){var p=r.getItemGraphicEl(c),f=u(h);if(!Yd(t,f,h,e))return void n.remove(p);if(p){p.updateData(t,h,s,l);var d={x:f[0],y:f[1]};a?p.attr(d):is(p,d,i)}else p=new o(t,h),p.setPosition(f);n.add(p),t.setItemGraphicEl(h,p)}).remove(function(t){var e=r.getItemGraphicEl(t);e&&e.fadeOut(function(){n.remove(e)})}).execute(),this._getSymbolPoint=u,this._data=t},t.prototype.isPersistent=function(){return!0},t.prototype.updateLayout=function(){var t=this,e=this._data;e&&e.eachItemGraphicEl(function(e,n){var i=t._getSymbolPoint(n);e.setPosition(i),e.markRedraw()})},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=qd(t),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e,n){function i(t){t.isGroup||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}n=jd(n);for(var r=t.start;r0&&eg(n[2*r-2],n[2*r-1]);r--);for(;r>i&&eg(n[2*i],n[2*i+1]);i++);}for(;r>i;)i+=ng(t,n,i,r,r,1,e.smooth,e.smoothMonotone,e.connectNulls)+1},n.prototype.getPointOn=function(t,e){this.path||(this.createPathProxy(),this.buildPath(this.path,this.shape));for(var n,i,r=this.path,o=r.data,a=Sb.CMD,s="x"===e,l=[],u=0;u=v&&v>=0){var m=s?(p-i)*v+i:(c-n)*v+n;return s?[t,m]:[m,t]}n=c,i=p;break;case a.C:c=o[u++],p=o[u++],f=o[u++],d=o[u++],g=o[u++],y=o[u++];var _=s?Wr(n,c,f,g,t,l):Wr(i,p,d,y,t,l);if(_>0)for(var x=0;_>x;x++){var b=l[x];if(1>=b&&b>=0){var m=s?Hr(i,p,d,y,b):Hr(n,c,f,g,b);return s?[t,m]:[m,t]}}n=g,i=y}}},n}(Rb),Ak=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n}(Ck),Dk=function(t){function n(e){var n=t.call(this,e)||this;return n.type="ec-polygon",n}return e(n,t),n.prototype.getDefaultShape=function(){return new Ak},n.prototype.buildPath=function(t,e){var n=e.points,i=e.stackedOnPoints,r=0,o=n.length/2,a=e.smoothMonotone;if(e.connectNulls){for(;o>0&&eg(n[2*o-2],n[2*o-1]);o--);for(;o>r&&eg(n[2*r],n[2*r+1]);r++);}for(;o>r;){var s=ng(t,n,r,o,o,1,e.smooth,a,e.connectNulls);ng(t,i,r+s-1,s,o,-1,e.stackedOnSmooth,a,e.connectNulls),r+=s+1,t.closePath()}},n}(Rb),kk=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.init=function(){var t=new ox,e=new bk;this.group.add(e.group),this._symbolDraw=e,this._lineGroup=t},n.prototype.render=function(t,e,n){var i=this,r=t.coordinateSystem,o=this.group,a=t.getData(),s=t.getModel("lineStyle"),l=t.getModel("areaStyle"),u=a.getLayout("points")||[],h="polar"===r.type,p=this._coordSys,f=this._symbolDraw,d=this._polyline,g=this._polygon,y=this._lineGroup,v=t.get("animation"),m=!l.isEmpty(),_=l.get("origin"),x=Zd(r,a,_),b=m&&sg(r,a,x),w=t.get("showSymbol"),S=w&&!h&&hg(t,a,r),M=this._data;M&&M.eachItemGraphicEl(function(t,e){t.__temp&&(o.remove(t),M.setItemGraphicEl(e,null))}),w||f.remove(),o.add(y);var T,C=h?!1:t.get("step");r&&r.getArea&&t.get("clip",!0)&&(T=r.getArea(),null!=T.width?(T.x-=.1,T.y-=.1,T.width+=.2,T.height+=.2):T.r0&&(T.r0-=.5,T.r+=.5)),this._clipShapeForSymbol=T;var I=ug(a,r)||a.getVisual("style")[a.getVisual("drawType")];d&&p.type===r.type&&C===this._step?(m&&!g?g=this._newPolygon(u,b):g&&!m&&(y.remove(g),g=this._polygon=null),h||this._initOrUpdateEndLabel(t,r,xl(I)),y.setClipPath(yg(this,r,!1,t)),w&&f.updateData(a,{isIgnore:S,clipShape:T,disableAnimation:!0,getSymbolPoint:function(t){return[u[2*t],u[2*t+1]]}}),ig(this._stackedOnPoints,b)&&ig(this._points,u)||(v?this._doUpdateAnimation(a,b,r,n,C,_):(C&&(u=lg(u,r,C),b&&(b=lg(b,r,C))),d.setShape({points:u}),g&&g.setShape({points:u,stackedOnPoints:b})))):(w&&f.updateData(a,{isIgnore:S,clipShape:T,disableAnimation:!0,getSymbolPoint:function(t){return[u[2*t],u[2*t+1]]}}),v&&this._initSymbolLabelAnimation(a,r,T),C&&(u=lg(u,r,C),b&&(b=lg(b,r,C))),d=this._newPolyline(u),m&&(g=this._newPolygon(u,b)),h||this._initOrUpdateEndLabel(t,r,xl(I)),y.setClipPath(yg(this,r,!0,t)));var A=t.get(["emphasis","focus"]),D=t.get(["emphasis","blurScope"]);if(d.useStyle(c(s.getLineStyle(),{fill:"none",stroke:I,lineJoin:"bevel"})),xa(d,t,"lineStyle"),d.style.lineWidth>0&&"bolder"===t.get(["emphasis","lineStyle","width"])){var k=d.getState("emphasis").style;k.lineWidth=+d.style.lineWidth+1}Kb(d).seriesIndex=t.seriesIndex,ma(d,A,D);var L=ag(t.get("smooth")),P=t.get("smoothMonotone"),O=t.get("connectNulls");if(d.setShape({smooth:L,smoothMonotone:P,connectNulls:O}),g){var R=a.getCalculationInfo("stackedOnSeries"),E=0;g.useStyle(c(l.getAreaStyle(),{fill:I,opacity:.7,lineJoin:"bevel",decal:a.getVisual("style").decal})),R&&(E=ag(R.get("smooth"))),g.setShape({smooth:L,stackedOnSmooth:E,smoothMonotone:P,connectNulls:O}),xa(g,t,"areaStyle"),Kb(g).seriesIndex=t.seriesIndex,ma(g,A,D)}var N=function(t){i._changePolyState(t)};a.eachItemGraphicEl(function(t){t&&(t.onHoverStateChange=N)}),this._polyline.onHoverStateChange=N,this._data=a,this._coordSys=r,this._stackedOnPoints=b,this._points=u,this._step=C,this._valueOrigin=_},n.prototype.dispose=function(){},n.prototype.highlight=function(t,e,n,i){var r=t.getData(),o=rr(r,i);if(this._changePolyState("emphasis"),!(o instanceof Array)&&null!=o&&o>=0){var a=r.getLayout("points"),s=r.getItemGraphicEl(o);if(!s){var l=a[2*o],u=a[2*o+1];if(isNaN(l)||isNaN(u))return;if(this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(l,u))return;s=new xk(r,o),s.x=l,s.y=u,s.setZ(t.get("zlevel"),t.get("z"));var h=s.getSymbolPath().getTextContent();h&&(h.z2=this._polyline.z2+1),s.__temp=!0,r.setItemGraphicEl(o,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else MT.prototype.highlight.call(this,t,e,n,i)},n.prototype.downplay=function(t,e,n,i){var r=t.getData(),o=rr(r,i);if(this._changePolyState("normal"),null!=o&&o>=0){var a=r.getItemGraphicEl(o);a&&(a.__temp?(r.setItemGraphicEl(o,null),this.group.remove(a)):a.downplay())}else MT.prototype.downplay.call(this,t,e,n,i)},n.prototype._changePolyState=function(t){var e=this._polygon;Yo(this._polyline,t),e&&Yo(e,t)},n.prototype._newPolyline=function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new Ik({shape:{points:t},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(e),this._polyline=e,e},n.prototype._newPolygon=function(t,e){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new Dk({shape:{points:t,stackedOnPoints:e},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},n.prototype._initSymbolLabelAnimation=function(t,e,n){var i,r,o=e.getBaseAxis(),a=o.inverse;"cartesian2d"===e.type?(i=o.isHorizontal(),r=!1):"polar"===e.type&&(i="angle"===o.dim,r=!0);var s=t.hostModel,l=s.get("animationDuration");"function"==typeof l&&(l=l(null));var u=s.get("animationDelay")||0,h="function"==typeof u?u(null):u;t.eachItemGraphicEl(function(t,o){var s=t;if(s){var c=[t.x,t.y],p=void 0,f=void 0,d=void 0;if(r){var g=n,y=e.pointToCoord(c);i?(p=g.startAngle,f=g.endAngle,d=-y[1]/180*Math.PI):(p=g.r0,f=g.r,d=y[0])}else{var v=n;i?(p=v.x,f=v.x+v.width,d=t.x):(p=v.y+v.height,f=v.y,d=t.y)}var m=f===p?0:(d-p)/(f-p);a&&(m=1-m);var _="function"==typeof u?u(o):l*m+h,x=s.getSymbolPath(),b=x.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,delay:_}),b&&b.animateFrom({style:{opacity:0}},{duration:300,delay:_}),x.disableLabelAnimation=!0}})},n.prototype._initOrUpdateEndLabel=function(t,e,n){var i=t.getModel("endLabel");if(i.get("show")){var r=t.getData(),o=this._polyline,a=this._endLabel;a||(a=this._endLabel=new jb({z2:200}),a.ignoreClip=!0,o.setTextContent(this._endLabel),o.disableLabelAnimation=!0);var s=fg(r.getLayout("points"));s>=0&&(Ts(o,Cs(t,"endLabel"),{inheritColor:n,labelFetcher:t,labelDataIndex:s,defaultText:function(t,e,n){return null!=n?Ld(r,n):kd(r,t)},enableTextSetter:!0},vg(i,e)),o.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},n.prototype._endLabelOnDuring=function(t,e,n,i,r,o,a){var s=this._endLabel,l=this._polyline;if(s){1>t&&null==i.originalX&&(i.originalX=s.x,i.originalY=s.y);var u=n.getLayout("points"),h=n.hostModel,c=h.get("connectNulls"),p=o.get("precision"),f=o.get("distance")||0,d=a.getBaseAxis(),g=d.isHorizontal(),y=d.inverse,v=e.shape,m=y?g?v.x:v.y+v.height:g?v.x+v.width:v.y,_=(g?f:0)*(y?-1:1),x=(g?0:-f)*(y?-1:1),b=g?"x":"y",w=gg(u,m,b),S=w.range,M=S[1]-S[0],T=void 0;if(M>=1){if(M>1&&!c){var C=dg(u,S[0]);s.attr({x:C[0]+_,y:C[1]+x}),r&&(T=h.getRawValue(S[0]))}else{var C=l.getPointOn(m,b);C&&s.attr({x:C[0]+_,y:C[1]+x});var I=h.getRawValue(S[0]),A=h.getRawValue(S[1]);r&&(T=pr(n,p,I,A,w.t))}i.lastFrameIndex=S[0]}else{var D=1===t||i.lastFrameIndex>0?S[0]:0,C=dg(u,D);r&&(T=h.getRawValue(D)),s.attr({x:C[0]+_,y:C[1]+x})}r&&TS(s).setLabelText(T)}},n.prototype._doUpdateAnimation=function(t,e,n,i,r,o){var a=this._polyline,s=this._polygon,l=t.hostModel,u=tg(this._data,t,this._stackedOnPoints,e,this._coordSys,n,this._valueOrigin,o),h=u.current,c=u.stackedOnCurrent,p=u.next,f=u.stackedOnNext;if(r&&(h=lg(u.current,n,r),c=lg(u.stackedOnCurrent,n,r),p=lg(u.next,n,r),f=lg(u.stackedOnNext,n,r)),og(h,p)>3e3||s&&og(c,f)>3e3)return a.setShape({points:p}),void(s&&s.setShape({points:p,stackedOnPoints:f}));a.shape.__points=u.current,a.shape.points=h;var d={shape:{points:p}};u.current!==h&&(d.shape.__points=u.next),a.stopAnimation(),is(a,d,l),s&&(s.setShape({points:h,stackedOnPoints:c}),s.stopAnimation(),is(s,{shape:{stackedOnPoints:f}},l),a.shape.points!==s.shape.points&&(s.shape.points=a.shape.points));for(var g=[],y=u.status,v=0;v0){for(var o=n.getItemLayout(0),a=1;isNaN(o&&o.startAngle)&&a=i.r0}},n.type="pie",n}(MT),Nk=function(){function t(t,e){this._getDataWithEncodedVisual=t,this._getRawData=e}return t.prototype.getAllNames=function(){var t=this._getRawData();return t.mapArray(t.getName)},t.prototype.containName=function(t){var e=this._getRawData();return e.indexOfName(t)>=0},t.prototype.indexOfName=function(t){var e=this._getDataWithEncodedVisual();return e.indexOfName(t)},t.prototype.getItemVisual=function(t,e){var n=this._getDataWithEncodedVisual();return n.getItemVisual(t,e)},t}(),Bk=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.useColorPaletteOnData=!0,e}return e(n,t),n.prototype.init=function(e){t.prototype.init.apply(this,arguments),this.legendVisualProvider=new Nk(xm(this.getData,this),xm(this.getRawData,this)),this._defaultLabelLine(e)},n.prototype.mergeOption=function(){t.prototype.mergeOption.apply(this,arguments)},n.prototype.getInitialData=function(){return Ag(this,{coordDimensions:["value"],encodeDefaulter:S(Ll,this)})},n.prototype.getDataParams=function(e){var n=this.getData(),i=t.prototype.getDataParams.call(this,e),r=[];return n.each(n.mapDimension("value"),function(t){r.push(t)}),i.percent=Ti(r,e,n.hostModel.get("percentPrecision")),i.$vars.push("percent"),i},n.prototype._defaultLabelLine=function(t){Hi(t,"labelLine",["show"]);var e=t.labelLine,n=t.emphasis.labelLine;e.show=e.show&&t.label.show,n.show=n.show&&t.emphasis.label.show},n.type="series.pie",n.defaultOption={zlevel:0,z:2,legendHoverLink:!0,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",bleedMargin:10,distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:15,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},n}(xT);$f(Dg);var zk=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.type="grid",n.dependencies=["xAxis","yAxis"],n.layoutMode="box",n.defaultOption={show:!1,zlevel:0,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},n}(cM),Fk=function(t){function n(){return null!==t&&t.apply(this,arguments)||this -}return e(n,t),n.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",_x).models[0]},n.type="cartesian2dAxis",n}(cM);d(Fk,ND);var Vk={show:!0,zlevel:0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},Hk=l({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},Vk),Gk=l({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},Vk),Wk=l({scale:!0,splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},Gk),Uk=c({scale:!0,logBase:10},Gk),Xk={category:Hk,value:Gk,time:Wk,log:Uk},Yk={value:1,category:1,time:1,log:1},jk=function(){function t(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return t.prototype.getAxis=function(t){return this._axes[t]},t.prototype.getAxes=function(){return v(this._dimList,function(t){return this._axes[t]},this)},t.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),_(this.getAxes(),function(e){return e.scale.type===t})},t.prototype.addAxis=function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},t}(),qk=["x","y"],Zk=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cartesian2d",e.dimensions=qk,e}return e(n,t),n.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,e=this.getAxis("y").scale;if(Pg(t)&&Pg(e)){var n=t.getExtent(),i=e.getExtent(),r=this.dataToPoint([n[0],i[0]]),o=this.dataToPoint([n[1],i[1]]),a=n[1]-n[0],s=i[1]-i[0];if(a&&s){var l=(o[0]-r[0])/a,u=(o[1]-r[1])/s,h=r[0]-n[0]*l,c=r[1]-i[0]*u,p=this._transform=[l,0,0,u,h,c];this._invTransform=Xe([],p)}}},n.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},n.prototype.containPoint=function(t){var e=this.getAxis("x"),n=this.getAxis("y");return e.contain(e.toLocalCoord(t[0]))&&n.contain(n.toLocalCoord(t[1]))},n.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},n.prototype.dataToPoint=function(t,e,n){n=n||[];var i=t[0],r=t[1];if(this._transform&&null!=i&&isFinite(i)&&null!=r&&isFinite(r))return ge(n,t,this._transform);var o=this.getAxis("x"),a=this.getAxis("y");return n[0]=o.toGlobalCoord(o.dataToCoord(i)),n[1]=a.toGlobalCoord(a.dataToCoord(r)),n},n.prototype.clampData=function(t,e){var n=this.getAxis("x").scale,i=this.getAxis("y").scale,r=n.getExtent(),o=i.getExtent(),a=n.parse(t[0]),s=i.parse(t[1]);return e=e||[],e[0]=Math.min(Math.max(Math.min(r[0],r[1]),a),Math.max(r[0],r[1])),e[1]=Math.min(Math.max(Math.min(o[0],o[1]),s),Math.max(o[0],o[1])),e},n.prototype.pointToData=function(t,e){if(e=e||[],this._invTransform)return ge(e,t,this._invTransform);var n=this.getAxis("x"),i=this.getAxis("y");return e[0]=n.coordToData(n.toLocalCoord(t[0])),e[1]=i.coordToData(i.toLocalCoord(t[1])),e},n.prototype.getOtherAxis=function(t){return this.getAxis("x"===t.dim?"y":"x")},n.prototype.getArea=function(){var t=this.getAxis("x").getGlobalExtent(),e=this.getAxis("y").getGlobalExtent(),n=Math.min(t[0],t[1]),i=Math.min(e[0],e[1]),r=Math.max(t[0],t[1])-n,o=Math.max(e[0],e[1])-i;return new C_(n,i,r,o)},n}(jk),Kk=function(t){function n(e,n,i,r,o){var a=t.call(this,e,n,i)||this;return a.index=0,a.type=r||"value",a.position=o||"bottom",a}return e(n,t),n.prototype.isHorizontal=function(){var t=this.position;return"top"===t||"bottom"===t},n.prototype.getGlobalExtent=function(t){var e=this.getExtent();return e[0]=this.toGlobalCoord(e[0]),e[1]=this.toGlobalCoord(e[1]),t&&e[0]>e[1]&&e.reverse(),e},n.prototype.pointToData=function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},n.prototype.setCategorySortInfo=function(t){return"category"!==this.type?!1:(this.model.option.categorySortInfo=t,void this.scale.setSortInfo(t))},n}(qD),$k=function(){function t(t,e,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=qk,this._initCartesian(t,e,n),this.model=t}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(t,e){var n=this._axesMap;this._updateScale(t,this.model),y(n.x,function(t){Bf(t.scale,t.model)}),y(n.y,function(t){Bf(t.scale,t.model)});var i={};y(n.x,function(t){Bg(n,"y",t,i)}),y(n.y,function(t){Bg(n,"x",t,i)}),this.resize(this.model,e)},t.prototype.resize=function(t,e,n){function i(){y(s,function(t){var e=t.isHorizontal(),n=e?[0,a.width]:[0,a.height],i=t.inverse?1:0;t.setExtent(n[i],n[1-i]),Fg(t,e?a.x:a.y)})}var r=t.getBoxLayoutParams(),o=!n&&t.get("containLabel"),a=Sl(r,{width:e.getWidth(),height:e.getHeight()});this._rect=a;var s=this._axesList;i(),o&&(y(s,function(t){if(!t.model.get(["axisLabel","inside"])){var e=Gf(t);if(e){var n=t.isHorizontal()?"height":"width",i=t.model.get(["axisLabel","margin"]);a[n]-=e[n]+i,"top"===t.position?a.y+=e.height+i:"left"===t.position&&(a.x+=e.width+i)}}}),i()),y(this._coordsList,function(t){t.calcAffineTransform()})},t.prototype.getAxis=function(t,e){var n=this._axesMap[t];return null!=n?n[e||0]:void 0},t.prototype.getAxes=function(){return this._axesList.slice()},t.prototype.getCartesian=function(t,e){if(null!=t&&null!=e){var n="x"+t+"y"+e;return this._coordsMap[n]}D(t)&&(e=t.yAxisIndex,t=t.xAxisIndex);for(var i=0,r=this._coordsList;i0?"top":"bottom",i="center"):Ii(o-Jk)?(r=n>0?"bottom":"top",i="center"):(r="middle",i=o>0&&Jk>o?n>0?"right":"left":n>0?"left":"right"),{rotation:o,textAlign:i,textVerticalAlign:r}},t.makeAxisEventDataBase=function(t){var e={componentType:t.mainType,componentIndex:t.componentIndex};return e[t.mainType+"Index"]=t.componentIndex,e},t.isLabelSilent=function(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)},t}(),tL={axisLine:function(t,e,n,i){var r=e.get(["axisLine","show"]);if("auto"===r&&t.handleAutoShown&&(r=t.handleAutoShown("axisLine")),r){var o=e.axis.getExtent(),a=i.transform,s=[o[0],0],l=[o[1],0];a&&(ge(s,s,a),ge(l,l,a));var u=h({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),c=new $w({subPixelOptimize:!0,shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:u,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});c.anid="line",n.add(c);var p=e.get(["axisLine","symbol"]),f=e.get(["axisLine","symbolSize"]),d=e.get(["axisLine","symbolOffset"])||0;if("number"==typeof d&&(d=[d,d]),null!=p){"string"==typeof p&&(p=[p,p]),("string"==typeof f||"number"==typeof f)&&(f=[f,f]);var g=f[0],v=f[1];y([{rotate:t.rotation+Math.PI/2,offset:d[0],r:0},{rotate:t.rotation-Math.PI/2,offset:d[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],function(e,i){if("none"!==p[i]&&null!=p[i]){var r=uc(p[i],-g/2,-v/2,g,v,u.stroke,!0),o=e.r+e.offset;r.attr({rotation:e.rotate,x:s[0]+o*Math.cos(t.rotation),y:s[1]-o*Math.sin(t.rotation),silent:!0,z2:11}),n.add(r)}})}}},axisTickLabel:function(t,e,n,i){var r=Yg(n,i,e,t),o=qg(n,i,e,t);Hg(e,o,r),jg(n,i,e,t.tickDirection)},axisName:function(t,e,n,i){var r=B(t.axisName,e.get("name"));if(r){var o,a=e.get("nameLocation"),s=t.nameDirection,l=e.getModel("nameTextStyle"),u=e.get("nameGap")||0,h=e.axis.getExtent(),c=h[0]>h[1]?-1:1,p=["start"===a?h[0]-c*u:"end"===a?h[1]+c*u:(h[0]+h[1])/2,Ug(a)?t.labelOffset+s*u:0],f=e.get("nameRotate");null!=f&&(f=f*Jk/180);var d;Ug(a)?o=Qk.innerTextLayout(t.rotation,null!=f?f:t.rotation,s):(o=Vg(t.rotation,a,f||0,h),d=t.axisNameAvailableWidth,null!=d&&(d=Math.abs(d/Math.sin(o.rotation)),!isFinite(d)&&(d=null)));var g=l.getFont(),y=e.get("nameTruncate",!0)||{},v=y.ellipsis,m=B(t.nameTruncateMaxWidth,y.maxWidth,d),_=new jb({x:p[0],y:p[1],rotation:o.rotation,silent:Qk.isLabelSilent(e),style:Is(l,{text:r,font:g,overflow:"truncate",width:m,ellipsis:v,fill:l.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:l.get("align")||o.textAlign,verticalAlign:l.get("verticalAlign")||o.textVerticalAlign}),z2:1});if(ws({el:_,componentModel:e,itemName:r}),_.__fullText=r,_.anid="name",e.get("triggerEvent")){var x=Qk.makeAxisEventDataBase(e);x.targetType="axisName",x.name=r,Kb(_).eventData=x}i.add(_),_.updateTransform(),n.add(_),_.decomposeTransform()}}},eL={},nL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.render=function(e,n,i){this.axisPointerClass&&ey(e),t.prototype.render.apply(this,arguments),this._doUpdateAxisPointerClass(e,i,!0)},n.prototype.updateAxisPointer=function(t,e,n){this._doUpdateAxisPointerClass(t,n,!1)},n.prototype.remove=function(t,e){var n=this._axisPointer;n&&n.remove(e)},n.prototype.dispose=function(e,n){this._disposeAxisPointer(n),t.prototype.dispose.apply(this,arguments)},n.prototype._doUpdateAxisPointerClass=function(t,e,i){var r=n.getAxisPointerClass(this.axisPointerClass);if(r){var o=iy(t);o?(this._axisPointer||(this._axisPointer=new r)).render(t,o,e,i):this._disposeAxisPointer(e)}},n.prototype._disposeAxisPointer=function(t){this._axisPointer&&this._axisPointer.dispose(t),this._axisPointer=null},n.registerAxisPointerClass=function(t,e){eL[t]=e},n.getAxisPointerClass=function(t){return t&&eL[t]},n.type="axis",n}(bT),iL=or(),rL=["axisLine","axisTickLabel","axisName"],oL=["splitArea","splitLine","minorSplitLine"],aL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.axisPointerClass="CartesianAxisPointer",e}return e(n,t),n.prototype.render=function(e,n,i,r){this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new ox,this.group.add(this._axisGroup),e.get("show")){var a=e.getCoordSysModel(),s=Og(a,e),l=new Qk(e,h({handleAutoShown:function(){for(var t=a.coordinateSystem.getCartesians(),n=0;n=0},n.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},n.type="legend.plain",n.dependencies=["series"],n.defaultOption={zlevel:0,z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolSize:"auto",inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",decal:"inherit",shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit",shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:" sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},n}(cM),yL=S,vL=y,mL=ox,_L=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.newlineDisabled=!1,e}return e(n,t),n.prototype.init=function(){this.group.add(this._contentGroup=new mL),this.group.add(this._selectorGroup=new mL),this._isFirstRender=!0},n.prototype.getContentGroup=function(){return this._contentGroup},n.prototype.getSelectorGroup=function(){return this._selectorGroup},n.prototype.render=function(t,e,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var r=t.get("align"),o=t.get("orient");r&&"auto"!==r||(r="right"===t.get("left")&&"vertical"===o?"right":"left");var a=t.get("selector",!0),s=t.get("selectorPosition",!0);!a||s&&"auto"!==s||(s="horizontal"===o?"end":"start"),this.renderInner(r,t,e,n,a,o,s);var l=t.getBoxLayoutParams(),u={width:n.getWidth(),height:n.getHeight()},h=t.get("padding"),p=Sl(l,u,h),f=this.layoutInner(t,r,p,i,a,s),d=Sl(c({width:f.width,height:f.height},l),u,h);this.group.x=d.x-f.x,this.group.y=d.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=hy(f,t))}},n.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},n.prototype.renderInner=function(t,e,n,i,r,o,a){var s=this.getContentGroup(),l=Y(),u=e.get("selectedMode"),h=[];n.eachRawSeries(function(t){!t.get("legendHoverLink")&&h.push(t.id)}),vL(e.getData(),function(r,o){var a=r.get("name");if(!this.newlineDisabled&&(""===a||"\n"===a)){var c=new mL;return c.newline=!0,void s.add(c)}var p=n.getSeriesByName(a)[0];if(!l.get(a))if(p){var f=p.getData(),d=f.getVisual("legendLineStyle")||{},g=f.getVisual("legendSymbol"),y=f.getVisual("style");f.getVisual("symbolSize");var v=this._createItem(p,a,o,r,e,t,d,y,g,u);v.on("click",yL(fy,a,null,i,h)).on("mouseover",yL(gy,p.name,null,i,h)).on("mouseout",yL(yy,p.name,null,i,h)),l.set(a,!0)}else n.eachRawSeries(function(n){if(!l.get(a)&&n.legendVisualProvider){var s=n.legendVisualProvider;if(!s.containName(a))return;var c=s.indexOfName(a),p=s.getItemVisual(c,"style"),f=s.getItemVisual(c,"legendSymbol"),d=on(p.fill);d&&0===d[3]&&(d[3]=.2,p.fill=dn(d,"rgba"));var g=this._createItem(n,a,o,r,e,t,{},p,f,u);g.on("click",yL(fy,null,a,i,h)).on("mouseover",yL(gy,null,a,i,h)).on("mouseout",yL(yy,null,a,i,h)),l.set(a,!0)}},this)},this),r&&this._createSelector(r,e,i,o,a)},n.prototype._createSelector=function(t,e,n){var i=this.getSelectorGroup();vL(t,function(t){var r=t.type,o=new jb({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===r?"legendAllSelect":"legendInverseSelect"})}});i.add(o);var a=e.getModel("selectorLabel"),s=e.getModel(["emphasis","selectorLabel"]);Ts(o,{normal:a,emphasis:s},{defaultText:t.title}),ma(o)})},n.prototype._createItem=function(t,e,n,i,r,o,a,s,l,u){var h=t.visualDrawType,c=r.get("itemWidth"),p=r.get("itemHeight"),f=r.isSelected(e),d=i.get("symbolKeepAspect"),g=i.get("icon");l=g||l||"roundRect";var y=r.getModel("lineStyle"),v=cy(l,i,y,a,s,h,f),m=new mL,_=i.getModel("textStyle");m.add("function"!=typeof t.getLegendIcon||g?py({itemWidth:c,itemHeight:p,symbolType:l,symbolKeepAspect:d,itemStyle:v.itemStyle,lineStyle:v.lineStyle}):t.getLegendIcon({itemWidth:c,itemHeight:p,symbolType:l,symbolKeepAspect:d,itemStyle:v.itemStyle,lineStyle:v.lineStyle}));var x="left"===o?c+5:-5,b=o,w=r.get("formatter"),S=e;"string"==typeof w&&w?S=w.replace("{name}",null!=e?e:""):"function"==typeof w&&(S=w(e));var M=i.get("inactiveColor");m.add(new jb({style:Is(_,{text:S,x:x,y:p/2,fill:f?_.getTextColor():M,align:b,verticalAlign:"middle"})}));var T=new Wb({shape:m.getBoundingRect(),invisible:!0}),C=i.getModel("tooltip");return C.get("show")&&ws({el:T,componentModel:r,itemName:e,itemTooltipOption:C.option}),m.add(T),m.eachChild(function(t){t.silent=!0}),T.silent=!u,this.getContentGroup().add(m),ma(m),m.__legendDataIndex=n,m},n.prototype.layoutInner=function(t,e,n,i,r,o){var a=this.getContentGroup(),s=this.getSelectorGroup();uM(t.get("orient"),a,t.get("itemGap"),n.width,n.height);var l=a.getBoundingRect(),u=[-l.x,-l.y];if(s.markRedraw(),a.markRedraw(),r){uM("horizontal",s,t.get("selectorItemGap",!0));var h=s.getBoundingRect(),c=[-h.x,-h.y],p=t.get("selectorButtonGap",!0),f=t.getOrient().index,d=0===f?"width":"height",g=0===f?"height":"width",y=0===f?"y":"x";"end"===o?c[f]+=l[d]+p:u[f]+=h[d]+p,c[1-f]+=l[g]/2-h[g]/2,s.x=c[0],s.y=c[1],a.x=u[0],a.y=u[1];var v={x:0,y:0};return v[d]=l[d]+p+h[d],v[g]=Math.max(l[g],h[g]),v[y]=Math.min(0,h[y]+c[1-f]),v}return a.x=u[0],a.y=u[1],this.group.getBoundingRect()},n.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},n.type="legend.plain",n}(bT),xL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.setScrollDataIndex=function(t){this.option.scrollDataIndex=t},n.prototype.init=function(e,n,i){var r=Cl(e);t.prototype.init.call(this,e,n,i),by(this,e,r)},n.prototype.mergeOption=function(e,n){t.prototype.mergeOption.call(this,e,n),by(this,this.option,e)},n.type="legend.scroll",n.defaultOption=zs(gL.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),n}(gL),bL=ox,wL=["width","height"],SL=["x","y"],ML=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.newlineDisabled=!0,e._currentIndex=0,e}return e(n,t),n.prototype.init=function(){t.prototype.init.call(this),this.group.add(this._containerGroup=new bL),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new bL)},n.prototype.resetInner=function(){t.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},n.prototype.renderInner=function(e,n,i,r,o,a,s){function l(t,e){var i=t+"DataIndex",o=vs(n.get("pageIcons",!0)[n.getOrient().name][e],{onclick:xm(u._pageGo,u,i,n,r)},{x:-p[0]/2,y:-p[1]/2,width:p[0],height:p[1]});o.name=t,h.add(o)}var u=this;t.prototype.renderInner.call(this,e,n,i,r,o,a,s);var h=this._controllerGroup,c=n.get("pageIconSize",!0),p=M(c)?c:[c,c];l("pagePrev",0);var f=n.getModel("pageTextStyle");h.add(new jb({name:"pageText",style:{text:"xx/xx",fill:f.getTextColor(),font:f.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),l("pageNext",1)},n.prototype.layoutInner=function(t,e,n,i,r,o){var a=this.getSelectorGroup(),l=t.getOrient().index,u=wL[l],h=SL[l],c=wL[1-l],p=SL[1-l];r&&uM("horizontal",a,t.get("selectorItemGap",!0));var f=t.get("selectorButtonGap",!0),d=a.getBoundingRect(),g=[-d.x,-d.y],y=s(n);r&&(y[u]=n[u]-d[u]-f);var v=this._layoutContentAndController(t,i,y,l,u,c,p,h);if(r){if("end"===o)g[l]+=v[u]+f;else{var m=d[u]+f;g[l]-=m,v[h]-=m}v[u]+=d[u]+f,g[1-l]+=v[p]+v[c]/2-d[c]/2,v[c]=Math.max(v[c],d[c]),v[p]=Math.min(v[p],d[p]+g[1-l]),a.x=g[0],a.y=g[1],a.markRedraw()}return v},n.prototype._layoutContentAndController=function(t,e,n,i,r,o,a,s){var l=this.getContentGroup(),u=this._containerGroup,h=this._controllerGroup;uM(t.get("orient"),l,t.get("itemGap"),i?n.width:null,i?null:n.height),uM("horizontal",h,t.get("pageButtonItemGap",!0));var c=l.getBoundingRect(),p=h.getBoundingRect(),f=this._showController=c[r]>n[r],d=[-c.x,-c.y];e||(d[i]=l[s]);var g=[0,0],y=[-p.x,-p.y],v=z(t.get("pageButtonGap",!0),t.get("itemGap",!0));if(f){var m=t.get("pageButtonPosition",!0);"end"===m?y[i]+=n[r]-p[r]:g[i]+=p[r]+v}y[1-i]+=c[o]/2-p[o]/2,l.setPosition(d),u.setPosition(g),h.setPosition(y);var _={x:0,y:0};if(_[r]=f?n[r]:c[r],_[o]=Math.max(c[o],p[o]),_[a]=Math.min(0,p[a]+y[1-i]),u.__rectSize=n[r],f){var x={x:0,y:0};x[r]=Math.max(n[r]-p[r]-v,0),x[o]=_[o],u.setClipPath(new Wb({shape:x})),u.__rectSize=x[r]}else h.eachChild(function(t){t.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(t);return null!=b.pageIndex&&is(l,{x:b.contentPosition[0],y:b.contentPosition[1]},f?t:null),this._updatePageInfoView(t,b),_},n.prototype._pageGo=function(t,e,n){var i=this._getPageInfo(e)[t];null!=i&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:e.id})},n.prototype._updatePageInfoView=function(t,e){var n=this._controllerGroup;y(["pagePrev","pageNext"],function(i){var r=i+"DataIndex",o=null!=e[r],a=n.childOfName(i);a&&(a.setStyle("fill",o?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),a.cursor=o?"pointer":"default")});var i=n.childOfName("pageText"),r=t.get("pageFormatter"),o=e.pageIndex,a=null!=o?o+1:0,s=e.pageCount;i&&r&&i.setStyle("text",C(r)?r.replace("{current}",null==a?"":a+"").replace("{total}",null==s?"":s+""):r({current:a,total:s}))},n.prototype._getPageInfo=function(t){function e(t){if(t){var e=t.getBoundingRect(),n=e[l]+t[l];return{s:n,e:n+e[s],i:t.__legendDataIndex}}}function n(t,e){return t.e>=e&&t.s<=e+o}var i=t.get("scrollDataIndex",!0),r=this.getContentGroup(),o=this._containerGroup.__rectSize,a=t.getOrient().index,s=wL[a],l=SL[a],u=this._findTargetItemIndex(i),h=r.children(),c=h[u],p=h.length,f=p?1:0,d={contentPosition:[r.x,r.y],pageCount:f,pageIndex:f-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!c)return d;var g=e(c);d.contentPosition[a]=-g.s;for(var y=u+1,v=g,m=g,_=null;p>=y;++y)_=e(h[y]),(!_&&m.e>v.s+o||_&&!n(_,v.s))&&(v=m.i>v.i?m:_,v&&(null==d.pageNextDataIndex&&(d.pageNextDataIndex=v.i),++d.pageCount)),m=_;for(var y=u-1,v=g,m=g,_=null;y>=-1;--y)_=e(h[y]),_&&n(m,_.s)||!(v.ia)return!0;if(o){var s=ny(t).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>a}return!1}return n===!0},t.prototype.makeElOption=function(){},t.prototype.createPointerEl=function(t,e){var n=e.pointer;if(n){var i=TL(t).pointerEl=new xS[n.type](CL(e.pointer));t.add(i)}},t.prototype.createLabelEl=function(t,e,n,i){if(e.label){var r=TL(t).labelEl=new jb(CL(e.label));t.add(r),Cy(r,i)}},t.prototype.updatePointerEl=function(t,e,n){var i=TL(t).pointerEl;i&&e.pointer&&(i.setStyle(e.pointer.style),n(i,{shape:e.pointer.shape}))},t.prototype.updateLabelEl=function(t,e,n,i){var r=TL(t).labelEl;r&&(r.setStyle(e.label.style),n(r,{x:e.label.x,y:e.label.y}),Cy(r,i))},t.prototype._renderHandle=function(t){if(!this._dragging&&this.updateHandleTransform){var e=this._axisPointerModel,n=this._api.getZr(),i=this._handle,r=e.getModel("handle"),o=e.get("status");if(!r.get("show")||!o||"hide"===o)return i&&n.remove(i),void(this._handle=null);var a;this._handle||(a=!0,i=this._handle=vs(r.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){zm(t.event)},onmousedown:IL(this._onHandleDragMove,this,0,0),drift:IL(this._onHandleDragMove,this),ondragend:IL(this._onHandleDragEnd,this)}),n.add(i)),Ay(i,e,!1),i.setStyle(r.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=r.get("size");M(s)||(s=[s,s]),i.scaleX=s[0]/2,i.scaleY=s[1]/2,bh(this,"_doDispatchAxisPointer",r.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,a)}},t.prototype._moveHandleToValue=function(t,e){My(this._axisPointerModel,!e&&this._moveAnimation,this._handle,Iy(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(t,e){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(Iy(n),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(Iy(i)),TL(n).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){var t=this._handle;if(t){var e=this._payloadInfo,n=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:n.axis.dim,axisIndex:n.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){this._dragging=!1;var t=this._handle;if(t){var e=this._axisPointerModel.get("value");this._moveHandleToValue(e),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),n=this._group,i=this._handle;e&&n&&(this._lastGraphicKey=null,n&&e.remove(n),i&&e.remove(i),this._group=null,this._handle=null,this._payloadInfo=null)},t.prototype.doClear=function(){},t.prototype.buildLabel=function(t,e,n){return n=n||0,{x:t[n],y:t[1-n],width:e[n],height:e[1-n]}},t}(),DL=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.makeElOption=function(t,e,n,i,r){var o=n.axis,a=o.grid,s=i.get("type"),l=By(a,o).getOtherAxis(o).getGlobalExtent(),u=o.toGlobalCoord(o.dataToCoord(e,!0));if(s&&"none"!==s){var h=Dy(i),c=kL[s](o,u,l);c.style=h,t.graphicKey=c.type,t.pointer=c}var p=Og(a.model,n);Ry(e,t,p,n,i,r)},n.prototype.getHandleTransform=function(t,e,n){var i=Og(e.axis.grid.model,e,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var r=Oy(e.axis,t,i);return{x:r[0],y:r[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},n.prototype.updateHandleTransform=function(t,e,n){var i=n.axis,r=i.grid,o=i.getGlobalExtent(!0),a=By(r,i).getOtherAxis(i).getGlobalExtent(),s="x"===i.dim?0:1,l=[t.x,t.y];l[s]+=e[s],l[s]=Math.min(o[1],l[s]),l[s]=Math.max(o[0],l[s]);var u=(a[1]+a[0])/2,h=[u,u];h[s]=l[s];var c=[{verticalAlign:"middle"},{align:"center"}];return{x:l[0],y:l[1],rotation:t.rotation,cursorPoint:h,tooltipOption:c[s]}},n}(AL),kL={line:function(t,e,n){var i=Ey([e,n[0]],[e,n[1]],zy(t));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(t,e,n){var i=Math.max(1,t.getBandWidth()),r=n[1]-n[0];return{type:"Rect",shape:Ny([e-i/2,n[0]],[i,r],zy(t))}}},LL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.type="axisPointer",n.defaultOption={show:"auto",zlevel:0,z:50,type:"line",snap:!1,triggerTooltip:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},n}(cM),PL=or(),OL=y,RL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.render=function(t,e,n){var i=e.getComponent("tooltip"),r=t.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";Fy("axisPointer",n,function(t,e,n){"none"!==r&&("leave"===t||r.indexOf(t)>=0)&&n({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})})},n.prototype.remove=function(t,e){Xy("axisPointer",e)},n.prototype.dispose=function(t,e){Xy("axisPointer",e)},n.type="axisPointer",n}(bT),EL=or(),NL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.type="tooltip",n.dependencies=["axisPointer"],n.defaultOption={zlevel:0,z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},n}(cM),BL=av(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),zL=av(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),FL=sv(zL,"transition"),VL=sv(BL,"transform"),HL="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+(am.transform3dSupported?"will-change:transform;":""),GL=function(){function t(t,e,n){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._firstShow=!0,this._longHide=!0,am.wxa)return null;var i=document.createElement("div");i.domBelongToZr=!0,this.el=i;var r=this._zr=e.getZr(),o=this._appendToBody=n&&n.appendToBody;gv(this._styleCoord,r,o,e.getWidth()/2,e.getHeight()/2),o?document.body.appendChild(i):t.appendChild(i),this._container=t;var a=this;i.onmouseenter=function(){a._enterable&&(clearTimeout(a._hideTimeout),a._show=!0),a._inContent=!0},i.onmousemove=function(t){if(t=t||window.event,!a._enterable){var e=r.handler,n=r.painter.getViewportRoot();Ae(n,t,!0),e.dispatch("mousemove",t)}},i.onmouseleave=function(){a._inContent=!1,a._enterable&&a._show&&a.hideLater(a._hideDelay)}}return t.prototype.update=function(t){var e=this._container,n=lv(e,"position"),i=e.style;"absolute"!==i.position&&"absolute"!==n&&(i.position="relative");var r=t.get("alwaysShowContent");r&&this._moveIfResized(),this.el.className=t.get("className")||""},t.prototype.show=function(t,e){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,i=n.style,r=this._styleCoord;n.innerHTML?i.cssText=HL+dv(t,!this._firstShow,this._longHide)+pv(r[0],r[1],!0)+("border-color:"+xl(e)+";")+(t.get("extraCssText")||"")+(";pointer-event:"+(this._enterable?"auto":"none")):i.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},t.prototype.setContent=function(t,e,n,i,r){if(null!=t){var o=this.el;if(C(r)&&"item"===n.get("trigger")&&!ov(n)&&(t+=hv(n.get("backgroundColor"),i,r)),C(t))o.innerHTML=t;else if(t){o.innerHTML="",M(t)||(t=[t]);for(var a=0;a=0?this._tryShow(n,i):"leave"===t&&this._hide(i))},this))},n.prototype._keepShow=function(){var t=this._tooltipModel,e=this._ecModel,n=this._api;if(null!=this._lastX&&null!=this._lastY&&"none"!==t.get("triggerOn")){var i=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&i.manuallyShowTip(t,e,n,{x:i._lastX,y:i._lastY,dataByCoordSys:i._lastDataByCoordSys})})}},n.prototype.manuallyShowTip=function(t,e,n,i){if(i.from!==this.uid&&!am.node){var r=xv(i,n);this._ticket="";var o=i.dataByCoordSys,a=Tv(i,e,n);if(a){var s=a.el.getBoundingRect().clone();s.applyTransform(a.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:a.el,position:i.position,positionDefault:"bottom"},r)}else if(i.tooltip&&null!=i.x&&null!=i.y){var l=jL;l.x=i.x,l.y=i.y,l.update(),Kb(l).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:l},r)}else if(o)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:o,tooltipOption:i.tooltipOption},r);else if(null!=i.seriesIndex){if(this._manuallyAxisShowTip(t,e,n,i))return;var u=Yy(i,e),h=u.point[0],c=u.point[1];null!=h&&null!=c&&this._tryShow({offsetX:h,offsetY:c,target:u.el,position:i.position,positionDefault:"bottom"},r)}else null!=i.x&&null!=i.y&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},r))}},n.prototype.manuallyHideTip=function(t,e,n,i){var r=this._tooltipContent;!this._alwaysShowContent&&this._tooltipModel&&r.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(xv(i,n))},n.prototype._manuallyAxisShowTip=function(t,e,n,i){var r=i.seriesIndex,o=i.dataIndex,a=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=r&&null!=o&&null!=a){var s=e.getSeriesByIndex(r);if(s){var l=s.getData(),u=_v([l.getItemModel(o),s,(s.coordinateSystem||{}).model],this._tooltipModel);if("axis"===u.get("trigger"))return n.dispatchAction({type:"updateAxisPointer",seriesIndex:r,dataIndex:o,position:i.position}),!0}}},n.prototype._tryShow=function(t,e){var n=t.target,i=this._tooltipModel;if(i){this._lastX=t.offsetX,this._lastY=t.offsetY;var r=t.dataByCoordSys;if(r&&r.length)this._showAxisTooltip(r,t);else if(n){this._lastDataByCoordSys=null;var o,a;sc(n,function(t){return null!=Kb(t).dataIndex?(o=t,!0):null!=Kb(t).tooltipConfig?(a=t,!0):void 0},!0),o?this._showSeriesItemTooltip(t,o,e):a?this._showComponentItemTooltip(t,a,e):this._hide(e)}else this._lastDataByCoordSys=null,this._hide(e)}},n.prototype._showOrMove=function(t,e){var n=t.get("showDelay");e=xm(e,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(e,n):e()},n.prototype._showAxisTooltip=function(t,e){var n=this._ecModel,i=this._tooltipModel,r=[e.offsetX,e.offsetY],o=_v([e.tooltipOption],i),a=this._renderMode,s=[],l=Yu("section",{blocks:[],noHeader:!0}),u=[],h=new mT;XL(t,function(t){XL(t.dataByAxis,function(t){var e=n.getComponent(t.axisDim+"Axis",t.axisIndex),i=t.value;if(e&&null!=i){var r=Py(i,e.axis,n,t.seriesDataIndices,t.valueLabelOpt),o=Yu("section",{header:r,noHeader:!W(r),sortBlocks:!0,blocks:[]});l.blocks.push(o),y(t.seriesDataIndices,function(l){var c=n.getSeriesByIndex(l.seriesIndex),p=l.dataIndexInside,f=c.getDataParams(p);f.axisDim=t.axisDim,f.axisIndex=t.axisIndex,f.axisType=t.axisType,f.axisId=t.axisId,f.axisValue=Hf(e.axis,{value:i}),f.axisValueLabel=r,f.marker=h.makeTooltipMarker("item",xl(f.color),a);var d=ku(c.formatTooltip(p,!0,null));d.markupFragment&&o.blocks.push(d.markupFragment),d.markupText&&u.push(d.markupText),s.push(f)})}})}),l.blocks.reverse(),u.reverse();var c=e.position,p=o.get("order"),f=Zu(l,h,a,p,n.get("useUTC"),o.get("textStyle"));f&&u.unshift(f);var d="richText"===a?"\n\n":"
            ",g=u.join(d);this._showOrMove(o,function(){this._updateContentNotChangedOnAxis(t)?this._updatePosition(o,c,r[0],r[1],this._tooltipContent,s):this._showTooltipContent(o,g,s,Math.random()+"",r[0],r[1],c,null,h)})},n.prototype._showSeriesItemTooltip=function(t,e,n){var i=this._ecModel,r=Kb(e),o=r.seriesIndex,a=i.getSeriesByIndex(o),s=r.dataModel||a,l=r.dataIndex,u=r.dataType,h=s.getData(u),c=this._renderMode,p=t.positionDefault,f=_v([h.getItemModel(l),s,a&&(a.coordinateSystem||{}).model],this._tooltipModel,p?{position:p}:null),d=f.get("trigger");if(null==d||"item"===d){var g=s.getDataParams(l,u),y=new mT;g.marker=y.makeTooltipMarker("item",xl(g.color),c);var v=ku(s.formatTooltip(l,!1,u)),m=f.get("order"),_=v.markupFragment?Zu(v.markupFragment,y,c,m,i.get("useUTC"),f.get("textStyle")):v.markupText,x="item_"+s.name+"_"+l;this._showOrMove(f,function(){this._showTooltipContent(f,_,g,x,t.offsetX,t.offsetY,t.position,t.target,y)}),n({type:"showTip",dataIndexInside:l,dataIndex:h.getRawIndex(l),seriesIndex:o,from:this.uid})}},n.prototype._showComponentItemTooltip=function(t,e,n){var i=Kb(e),r=i.tooltipConfig,o=r.option;if(C(o)){var a=o;o={content:a,formatter:a}}var l=[o],u=this._ecModel.getComponent(i.componentMainType,i.componentIndex);u&&l.push(u);var h=t.positionDefault,c=_v(l,this._tooltipModel,h?{position:h}:null),p=c.get("content"),f=Math.random()+"",d=new mT;this._showOrMove(c,function(){var n=s(c.get("formatterParams")||{});this._showTooltipContent(c,p,n,f,t.offsetX,t.offsetY,t.position,e,d)}),n({type:"showTip",from:this.uid})},n.prototype._showTooltipContent=function(t,e,n,i,r,o,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent,h=t.get("formatter");a=a||t.get("position");var c=e,p=this._getNearestPoint([r,o],n,t.get("trigger"),t.get("borderColor")),f=p.color;if(h&&C(h)){var d=t.ecModel.get("useUTC"),g=M(n)?n[0]:n,y=g&&g.axisType&&g.axisType.indexOf("time")>=0;c=h,y&&(c=js(g.axisValue,c,d)),c=yl(c,n,!0)}else if(T(h)){var v=UL(function(e,i){e===this._ticket&&(u.setContent(i,l,t,f,a),this._updatePosition(t,a,r,o,u,n,s))},this);this._ticket=i,c=h(n,i,v)}u.setContent(c,l,t,f,a),u.show(t,f),this._updatePosition(t,a,r,o,u,n,s)}},n.prototype._getNearestPoint=function(t,e,n,i){return"axis"===n||M(e)?{color:i||("html"===this._renderMode?"#fff":"none")}:M(e)?void 0:{color:i||e.color||e.borderColor}},n.prototype._updatePosition=function(t,e,n,i,r,o,a){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=r.getSize(),h=t.get("align"),c=t.get("verticalAlign"),p=a&&a.getBoundingRect().clone();if(a&&p.applyTransform(a.transform),T(e)&&(e=e([n,i],o,r.el,p,{viewSize:[s,l],contentSize:u.slice()})),M(e))n=YL(e[0],s),i=YL(e[1],l);else if(D(e)){var f=e;f.width=u[0],f.height=u[1];var d=Sl(f,{width:s,height:l});n=d.x,i=d.y,h=null,c=null}else if(C(e)&&a){var g=Sv(e,p,u);n=g[0],i=g[1]}else{var g=bv(n,i,r,s,l,h?null:20,c?null:20);n=g[0],i=g[1]}if(h&&(n-=Mv(h)?u[0]/2:"right"===h?u[0]:0),c&&(i-=Mv(c)?u[1]/2:"bottom"===c?u[1]:0),ov(t)){var g=wv(n,i,r,s,l);n=g[0],i=g[1]}r.moveTo(n,i)},n.prototype._updateContentNotChangedOnAxis=function(t){var e=this._lastDataByCoordSys,n=!!e&&e.length===t.length;return n&&XL(e,function(e,i){var r=e.dataByAxis||[],o=t[i]||{},a=o.dataByAxis||[];n=n&&r.length===a.length,n&&XL(r,function(t,e){var i=a[e]||{},r=t.seriesDataIndices||[],o=i.seriesDataIndices||[];n=n&&t.value===i.value&&t.axisType===i.axisType&&t.axisId===i.axisId&&r.length===o.length,n&&XL(r,function(t,e){var i=o[e];n=n&&t.seriesIndex===i.seriesIndex&&t.dataIndex===i.dataIndex})})}),this._lastDataByCoordSys=t,!!n},n.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},n.prototype.dispose=function(t,e){am.node||(this._tooltipContent.dispose(),Xy("itemTooltip",e))},n.type="tooltip",n}(bT);$f(Cv);var ZL=or(),KL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.createdBySelf=!1,e}return e(n,t),n.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n),this._mergeOption(t,n,!1,!0)},n.prototype.isAnimationEnabled=function(){if(am.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},n.prototype.mergeOption=function(t,e){this._mergeOption(t,e,!1,!1)},n.prototype._mergeOption=function(t,e,n,i){var r=this.mainType;n||e.eachSeries(function(t){var n=t.get(this.mainType,!0),o=ZL(t)[r];return n&&n.data?(o?o._mergeOption(n,e,!0):(i&&Av(n),y(n.data,function(t){t instanceof Array?(Av(t[0]),Av(t[1])):Av(t)}),o=this.createMarkerModelFromSeries(n,this,e),h(o,{mainType:this.mainType,seriesIndex:t.seriesIndex,name:t.name,createdBySelf:!0}),o.__hostSeries=t),void(ZL(t)[r]=o)):void(ZL(t)[r]=null)},this)},n.prototype.formatTooltip=function(t){var e=this.getData(),n=this.getRawValue(t),i=e.getName(t);return Yu("section",{header:this.name,blocks:[Yu("nameValue",{name:i,value:n,noName:!i,noValue:null==n})]})},n.prototype.getData=function(){return this._data},n.prototype.setData=function(t){this._data=t},n.getMarkerModelFromSeries=function(t,e){return ZL(t)[e]},n.type="marker",n.dependencies=["series","grid","polar","geo"],n}(cM);d(KL,aT.prototype);var $L=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.createMarkerModelFromSeries=function(t,e,i){return new n(t,e,i)},n.type="markPoint",n.defaultOption={zlevel:0,z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{show:!0,position:"inside"},itemStyle:{borderWidth:2},emphasis:{label:{show:!0}}},n}(KL),JL={min:S(Lv,"min"),max:S(Lv,"max"),average:S(Lv,"average"),median:S(Lv,"median")},QL=or(),tP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.init=function(){this.markerGroupMap=Y()},n.prototype.render=function(t,e,n){var i=this,r=this.markerGroupMap;r.each(function(t){QL(t).keep=!1}),e.eachSeries(function(t){var r=KL.getMarkerModelFromSeries(t,i.type);r&&i.renderSeries(t,r,e,n)}),r.each(function(t){!QL(t).keep&&i.group.remove(t.group)})},n.prototype.markKeep=function(t){QL(t).keep=!0},n.prototype.blurSeries=function(t){var e=this;y(t,function(t){var n=KL.getMarkerModelFromSeries(t,e.type);if(n){var i=n.getData();i.eachItemGraphicEl(function(t){t&&ia(t)})}})},n.type="marker",n}(bT),eP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.updateTransform=function(t,e,n){e.eachSeries(function(t){var e=KL.getMarkerModelFromSeries(t,"markPoint");e&&(zv(e.getData(),t,n),this.markerGroupMap.get(t.id).updateLayout())},this)},n.prototype.renderSeries=function(t,e,n,i){var r=t.coordinateSystem,o=t.id,a=t.getData(),s=this.markerGroupMap,l=s.get(o)||s.set(o,new bk),u=Fv(r,t,e);e.setData(u),zv(e.getData(),t,i),u.each(function(t){var n=u.getItemModel(t),i=n.getShallow("symbol"),r=n.getShallow("symbolSize"),o=n.getShallow("symbolRotate");if(T(i)||T(r)||T(o)){var s=e.getRawValue(t),l=e.getDataParams(t);T(i)&&(i=i(s,l)),T(r)&&(r=r(s,l)),T(o)&&(o=o(s,l))}var h=n.getModel("itemStyle").getItemStyle(),c=Nh(a,"color");h.fill||(h.fill=c),u.setItemVisual(t,{symbol:i,symbolSize:r,symbolRotate:o,style:h})}),l.updateData(u),this.group.add(l.group),u.eachItemGraphicEl(function(t){t.traverse(function(t){Kb(t).dataModel=e})}),this.markKeep(l),l.group.silent=e.get("silent")||t.get("silent")},n.type="markPoint",n}(tP);$f(Vv);var nP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.createMarkerModelFromSeries=function(t,e,i){return new n(t,e,i)},n.type="markLine",n.defaultOption={zlevel:0,z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},n}(KL),iP=$w.prototype,rP=tS.prototype,oP=function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return t}(),aP=(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n}(oP),function(t){function n(e){var n=t.call(this,e)||this;return n.type="ec-line",n}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new oP},n.prototype.buildPath=function(t,e){Hv(e)?iP.buildPath.call(this,t,e):rP.buildPath.call(this,t,e)},n.prototype.pointAt=function(t){return Hv(this.shape)?iP.pointAt.call(this,t):rP.pointAt.call(this,t)},n.prototype.tangentAt=function(t){var e=this.shape,n=Hv(e)?[e.x2-e.x1,e.y2-e.y1]:rP.tangentAt.call(this,t);return he(n,n)},n}(Rb)),sP=["fromSymbol","toSymbol"],lP=function(t){function n(e,n,i){var r=t.call(this)||this;return r._createLine(e,n,i),r}return e(n,t),n.prototype._createLine=function(t,e,n){var i=t.hostModel,r=t.getItemLayout(e),o=Uv(r);o.shape.percent=0,rs(o,{shape:{percent:1}},i,e),this.add(o),y(sP,function(n){var i=Wv(n,t,e);this.add(i),this[Gv(n)]=t.getItemVisual(e,n)},this),this._updateCommonStl(t,e,n)},n.prototype.updateData=function(t,e,n){var i=t.hostModel,r=this.childOfName("line"),o=t.getItemLayout(e),a={shape:{}};Xv(a.shape,o),is(r,a,i,e),y(sP,function(n){var i=t.getItemVisual(e,n),r=Gv(n);if(this[r]!==i){this.remove(this.childOfName(n));var o=Wv(n,t,e);this.add(o)}this[r]=i},this),this._updateCommonStl(t,e,n)},n.prototype.getLinePath=function(){return this.childAt(0)},n.prototype._updateCommonStl=function(t,e,n){var i=t.hostModel,r=this.childOfName("line"),o=n&&n.emphasisLineStyle,a=n&&n.blurLineStyle,s=n&&n.selectLineStyle,l=n&&n.labelStatesModels;if(!n||t.hasItemOption){var u=t.getItemModel(e);o=u.getModel(["emphasis","lineStyle"]).getLineStyle(),a=u.getModel(["blur","lineStyle"]).getLineStyle(),s=u.getModel(["select","lineStyle"]).getLineStyle(),l=Cs(u)}var h=t.getItemVisual(e,"style"),c=h.stroke;r.useStyle(h),r.style.fill=null,r.style.strokeNoScale=!0,r.ensureState("emphasis").style=o,r.ensureState("blur").style=a,r.ensureState("select").style=s,y(sP,function(t){var e=this.childOfName(t);if(e){e.setColor(c),e.style.opacity=h.opacity;for(var n=0;n0&&(_[0]=-_[0],_[1]=-_[1]);var b=m[0]<0?-1:1;if("start"!==r.__position&&"end"!==r.__position){var w=-Math.atan2(m[1],m[0]);h[0].8?"left":c[0]<-.8?"right":"center",f=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";break;case"start":r.x=-c[0]*g+u[0],r.y=-c[1]*y+u[1],p=c[0]>.8?"right":c[0]<-.8?"left":"center",f=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":r.x=g*b+u[0],r.y=u[1]+S,p=m[0]<0?"right":"left",r.originX=-g*b,r.originY=-S;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":r.x=x[0],r.y=x[1]+S,p="center",r.originY=-S;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":r.x=-g*b+h[0],r.y=h[1]+S,p=m[0]>=0?"right":"left",r.originX=g*b,r.originY=-S}r.scaleX=r.scaleY=o,r.setStyle({verticalAlign:r.__verticalAlign||f,align:r.__align||p})}}}},n}(ox),uP=function(){function t(t){this.group=new ox,this._LineCtor=t||lP}return t.prototype.isPersistent=function(){return!0},t.prototype.updateData=function(t){var e=this,n=this,i=n.group,r=n._lineData;n._lineData=t,r||i.removeAll();var o=jv(t);t.diff(r).add(function(n){e._doAdd(t,n,o)}).update(function(n,i){e._doUpdate(r,t,i,n,o)}).remove(function(t){i.remove(r.getItemGraphicEl(t))}).execute()},t.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(e,n){e.updateLayout(t,n)},this)},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=jv(t),this._lineData=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e){function n(t){t.isGroup||Yv(t)||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0) -}for(var i=t.start;i=0&&"number"==typeof c&&(c=+c.toFixed(Math.min(m,20))),y.coord[d]=v.coord[d]=c,r=[y,v,{type:a,valueIndex:i.valueIndex,value:c}]}else r=[]}var _=[Pv(t,r[0]),Pv(t,r[1]),h({},r[2])];return _[2].type=_[2].type||null,l(_[2],_[0]),l(_[2],_[1]),_},pP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.updateTransform=function(t,e,n){e.eachSeries(function(t){var e=KL.getMarkerModelFromSeries(t,"markLine");if(e){var i=e.getData(),r=hP(e).from,o=hP(e).to;r.each(function(e){Qv(r,e,!0,t,n),Qv(o,e,!1,t,n)}),i.each(function(t){i.setItemLayout(t,[r.getItemLayout(t),o.getItemLayout(t)])}),this.markerGroupMap.get(t.id).updateLayout()}},this)},n.prototype.renderSeries=function(t,e,n,i){function r(e,n,r){var o=e.getItemModel(n);Qv(e,n,r,t,i);var a=o.getModel("itemStyle").getItemStyle();null==a.fill&&(a.fill=Nh(s,"color")),e.setItemVisual(n,{symbolKeepAspect:o.get("symbolKeepAspect"),symbolOffset:z(o.get("symbolOffset"),v[r?0:1]),symbolRotate:z(o.get("symbolRotate",!0),y[r?0:1]),symbolSize:z(o.get("symbolSize"),g[r?0:1]),symbol:z(o.get("symbol",!0),d[r?0:1]),style:a})}var o=t.coordinateSystem,a=t.id,s=t.getData(),l=this.markerGroupMap,u=l.get(a)||l.set(a,new uP);this.group.add(u.group);var h=tm(o,t,e),c=h.from,p=h.to,f=h.line;hP(e).from=c,hP(e).to=p,e.setData(f);var d=e.get("symbol"),g=e.get("symbolSize"),y=e.get("symbolRotate"),v=e.get("symbolOffset");M(d)||(d=[d,d]),M(g)||(g=[g,g]),M(y)||(y=[y,y]),M(v)||(v=[v,v]),h.from.each(function(t){r(c,t,!0),r(p,t,!1)}),f.each(function(t){var e=f.getItemModel(t).getModel("lineStyle").getLineStyle();f.setItemLayout(t,[c.getItemLayout(t),p.getItemLayout(t)]),null==e.stroke&&(e.stroke=c.getItemVisual(t,"style").fill),f.setItemVisual(t,{fromSymbolKeepAspect:c.getItemVisual(t,"symbolKeepAspect"),fromSymbolOffset:c.getItemVisual(t,"symbolOffset"),fromSymbolRotate:c.getItemVisual(t,"symbolRotate"),fromSymbolSize:c.getItemVisual(t,"symbolSize"),fromSymbol:c.getItemVisual(t,"symbol"),toSymbolKeepAspect:p.getItemVisual(t,"symbolKeepAspect"),toSymbolOffset:p.getItemVisual(t,"symbolOffset"),toSymbolRotate:p.getItemVisual(t,"symbolRotate"),toSymbolSize:p.getItemVisual(t,"symbolSize"),toSymbol:p.getItemVisual(t,"symbol"),style:e})}),u.updateData(f),h.line.eachItemGraphicEl(function(t){t.traverse(function(t){Kb(t).dataModel=e})}),this.markKeep(u),u.group.silent=e.get("silent")||t.get("silent")},n.type="markLine",n}(tP);$f(em),t.version=yI,t.dependencies=vI,t.PRIORITY=RI,t.init=_p,t.connect=xp,t.disConnect=bp,t.disconnect=DA,t.dispose=wp,t.getInstanceByDom=Sp,t.getInstanceById=Mp,t.registerTheme=Tp,t.registerPreprocessor=Cp,t.registerProcessor=Ip,t.registerPostInit=Ap,t.registerPostUpdate=Dp,t.registerAction=kp,t.registerCoordinateSystem=Lp,t.getCoordinateSystemDimensions=Pp,t.registerLayout=Op,t.registerVisual=Rp,t.registerLoading=Np,t.setCanvasCreator=Bp,t.registerMap=zp,t.getMap=Fp,t.registerTransform=LA,t.dataTool=YA,t.registerLocale=Fs,t.zrender=cx,t.matrix=qm,t.vector=Am,t.zrUtil=Sm,t.color=p_,t.helper=zD,t.number=HD,t.time=GD,t.graphic=WD,t.format=UD,t.util=XD,t.ComponentModel=cM,t.ComponentView=bT,t.SeriesModel=xT,t.ChartView=MT,t.extendComponentModel=dd,t.extendComponentView=gd,t.extendSeriesModel=yd,t.extendChartView=vd,t.throttle=xh,t.use=$f,t.parseGeoJSON=up,t.parseGeoJson=up,t.env=am,t.List=sD,t.Model=ES,t.Axis=qD,t.innerDrawElementOnCanvas=Pc}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){function n(){this.constructor=t}if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");bm(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function n(t,e){var n=e.browser,i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(n.firefox=!0,n.version=i[1]),r&&(n.ie=!0,n.version=r[1]),o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18),a&&(n.weChat=!0),e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}function i(t){var e={};if("undefined"==typeof JSON)return e;for(var n=0;ni;i++)e[i]=s(t[i])}}else if(Rm[n]){if(!X(t)){var o=t.constructor;if(o.from)e=o.from(t);else{e=new o(t.length);for(var i=0,r=t.length;r>i;i++)e[i]=t[i]}}}else if(!Om[n]&&!X(t)&&!L(t)){e={};for(var a in t)t.hasOwnProperty(a)&&a!==Wm&&(e[a]=s(t[a]))}return e}function l(t,e,n){if(!D(e)||!D(t))return n?s(e):t;for(var i in e)if(e.hasOwnProperty(i)&&i!==Wm){var r=t[i],o=e[i];!D(o)||!D(r)||M(o)||M(r)||L(o)||L(r)||A(o)||A(r)||X(o)||X(r)?!n&&i in t||(t[i]=s(e[i])):l(r,o,n)}return t}function u(t,e){for(var n=t[0],i=1,r=t.length;r>i;i++)n=l(n,t[i],e);return n}function h(t,e){if(Object.assign)Object.assign(t,e);else for(var n in e)e.hasOwnProperty(n)&&n!==Wm&&(t[n]=e[n]);return t}function c(t,e,n){for(var i=b(e),r=0;rn;n++)if(t[n]===e)return n}return-1}function d(t,e){function n(){}var i=t.prototype;n.prototype=e.prototype,t.prototype=new n;for(var r in i)i.hasOwnProperty(r)&&(t.prototype[r]=i[r]);t.prototype.constructor=t,t.superClass=e}function f(t,e,n){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var i=Object.getOwnPropertyNames(e),r=0;ri;i++)e.call(n,t[i],i,t);else for(var o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}function v(t,e,n){if(!t)return[];if(!e)return V(t);if(t.map&&t.map===Vm)return t.map(e,n);for(var i=[],r=0,o=t.length;o>r;r++)i.push(e.call(n,t[r],r,t));return i}function m(t,e,n,i){if(t&&e){for(var r=0,o=t.length;o>r;r++)n=e.call(i,n,t[r],r,t);return n}}function _(t,e,n){if(!t)return[];if(!e)return V(t);if(t.filter&&t.filter===Bm)return t.filter(e,n);for(var i=[],r=0,o=t.length;o>r;r++)e.call(n,t[r],r,t)&&i.push(t[r]);return i}function x(t,e,n){if(t&&e)for(var i=0,r=t.length;r>i;i++)if(e.call(n,t[i],i,t))return t[i]}function b(t){if(!t)return[];if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}function w(t,e){for(var n=[],i=2;in;n++)if(null!=t[n])return t[n]}function B(t,e){return null!=t?t:e}function F(t,e,n){return null!=t?t:null!=e?e:n}function V(t){for(var e=[],n=1;np;p++){var f=1<a;a++)for(var s=0;8>s;s++)null==o[s]&&(o[s]=0),o[s]+=((a+s)%2?-1:1)*_e(n,7,0===a?1:0,1<o;o++){var a=document.createElement("div"),s=a.style,l=o%2,u=(o>>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[l]+":0",r[u]+":0",i[1-l]+":auto",r[1-u]+":auto",""].join("!important;"),t.appendChild(a),n.push(a)}return n}function Me(t,e,n){for(var i=n?"invTrans":"trans",r=e[i],o=e.srcCoords,a=[],s=[],l=!0,u=0;4>u;u++){var h=t[u].getBoundingClientRect(),c=2*u,p=h.left,d=h.top;a.push(p,d),l=l&&o&&p===o[c]&&d===o[c+1],s.push(t[u].offsetLeft,t[u].offsetTop)}return l&&r?r:(e.srcCoords=a,e[i]=n?xe(s,a):xe(a,s))}function Te(t){return"CANVAS"===t.nodeName.toUpperCase()}function Ie(t){return null==t?"":(t+"").replace(l_,function(t,e){return u_[e]})}function Ce(t,e,n,i){return n=n||{},i?ke(t,e,n):p_&&null!=e.layerX&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):null!=e.offsetX?(n.zrX=e.offsetX,n.zrY=e.offsetY):ke(t,e,n),n}function ke(t,e,n){if(Mm.domSupported&&t.getBoundingClientRect){var i=e.clientX,r=e.clientY;if(Te(t)){var o=t.getBoundingClientRect();return n.zrX=i-o.left,void(n.zrY=r-o.top)}if(we(c_,t,i,r))return n.zrX=c_[0],void(n.zrY=c_[1])}n.zrX=n.zrY=0}function De(t){return t||window.event}function Ae(t,e,n){if(e=De(e),null!=e.zrX)return e;var i=e.type,r=i&&i.indexOf("touch")>=0;if(r){var o="touchend"!==i?e.targetTouches[0]:e.changedTouches[0];o&&Ce(t,o,e,n)}else{Ce(t,e,e,n);var a=Pe(e);e.zrDelta=a?a/120:-(e.detail||0)/3}var s=e.button;return null==e.which&&void 0!==s&&h_.test(e.type)&&(e.which=1&s?1:2&s?3:4&s?2:0),e}function Pe(t){var e=t.wheelDelta;if(e)return e;var n=t.deltaX,i=t.deltaY;if(null==n||null==i)return e;var r=Math.abs(0!==i?i:n),o=i>0?-1:0>i?1:n>0?-1:1;return 3*r*o}function Le(t,e,n,i){t.addEventListener(e,n,i)}function Oe(t,e,n,i){t.removeEventListener(e,n,i)}function Re(t){var e=t[1][0]-t[0][0],n=t[1][1]-t[0][1];return Math.sqrt(e*e+n*n)}function Ee(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}function Ne(){return[1,0,0,1,0,0]}function ze(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Be(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function Fe(t,e,n){var i=e[0]*n[0]+e[2]*n[1],r=e[1]*n[0]+e[3]*n[1],o=e[0]*n[2]+e[2]*n[3],a=e[1]*n[2]+e[3]*n[3],s=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t}function Ve(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t}function He(t,e,n){var i=e[0],r=e[2],o=e[4],a=e[1],s=e[3],l=e[5],u=Math.sin(n),h=Math.cos(n);return t[0]=i*h+a*u,t[1]=-i*u+a*h,t[2]=r*h+s*u,t[3]=-r*u+h*s,t[4]=h*o+u*l,t[5]=h*l-u*o,t}function Ge(t,e,n){var i=n[0],r=n[1];return t[0]=e[0]*i,t[1]=e[1]*r,t[2]=e[2]*i,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*r,t}function We(t,e){var n=e[0],i=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=n*a-o*i;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-i*l,t[3]=n*l,t[4]=(i*s-a*r)*l,t[5]=(o*r-n*s)*l,t):null}function Ue(t){var e=Ne();return Be(e,t),e}function Xe(t,e,n){return{type:t,event:n,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:Ye}}function Ye(){d_(this.event)}function qe(t,e,n){if(t[t.rectHover?"rectContain":"contain"](e,n)){for(var i=t,r=void 0,o=!1;i;){if(i.ignoreClip&&(o=!0),!o){var a=i.getClipPath();if(a&&!a.contain(e,n))return!1;i.silent&&(r=!0)}var s=i.__hostTarget;i=s?s:i.parent}return r?C_:!0}return!1}function je(t,e,n,i,r){for(var o=t.length-1;o>=0;o--){var a=t[o],s=void 0;if(a!==r&&!a.ignore&&(s=qe(a,n,i))&&(!e.topTarget&&(e.topTarget=a),s!==C_)){e.target=a;break}}}function Ze(t,e,n){var i=t.painter;return 0>e||e>i.getWidth()||0>n||n>i.getHeight()}function Ke(t){for(var e=0;t>=R_;)e|=1&t,t>>=1;return t+e}function $e(t,e,n,i){var r=e+1;if(r===n)return 1;if(i(t[r++],t[e])<0){for(;n>r&&i(t[r],t[r-1])<0;)r++;Qe(t,e,r)}else for(;n>r&&i(t[r],t[r-1])>=0;)r++;return r-e}function Qe(t,e,n){for(n--;n>e;){var i=t[e];t[e++]=t[n],t[n--]=i}}function Je(t,e,n,i,r){for(i===e&&i++;n>i;i++){for(var o,a=t[i],s=e,l=i;l>s;)o=s+l>>>1,r(a,t[o])<0?l=o:s=o+1;var u=i-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function tn(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])>0){for(s=i-r;s>l&&o(t,e[n+r+l])>0;)a=l,l=(l<<1)+1,0>=l&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;s>l&&o(t,e[n+r-l])<=0;)a=l,l=(l<<1)+1,0>=l&&(l=s);l>s&&(l=s);var u=a;a=r-l,l=r-u}for(a++;l>a;){var h=a+(l-a>>>1);o(t,e[n+h])>0?a=h+1:l=h}return l}function en(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])<0){for(s=r+1;s>l&&o(t,e[n+r-l])<0;)a=l,l=(l<<1)+1,0>=l&&(l=s);l>s&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=i-r;s>l&&o(t,e[n+r+l])>=0;)a=l,l=(l<<1)+1,0>=l&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;l>a;){var h=a+(l-a>>>1);o(t,e[n+h])<0?l=h:a=h+1}return l}function nn(t,e){function n(t,e){l[c]=t,u[c]=e,c+=1}function i(){for(;c>1;){var t=c-2;if(t>=1&&u[t-1]<=u[t]+u[t+1]||t>=2&&u[t-2]<=u[t]+u[t-1])u[t-1]u[t+1])break;o(t)}}function r(){for(;c>1;){var t=c-2;t>0&&u[t-1]=r?a(i,r,o,h):s(i,r,o,h)))}function a(n,i,r,o){var a=0;for(a=0;i>a;a++)p[a]=t[n+a];var s=0,l=r,u=n;if(t[u++]=t[l++],0!==--o){if(1===i){for(a=0;o>a;a++)t[u+a]=t[l+a];return void(t[u+o]=p[s])}for(var c,d,f,g=h;;){c=0,d=0,f=!1;do if(e(t[l],p[s])<0){if(t[u++]=t[l++],d++,c=0,0===--o){f=!0;break}}else if(t[u++]=p[s++],c++,d=0,1===--i){f=!0;break}while(g>(c|d));if(f)break;do{if(c=en(t[l],p,s,i,0,e),0!==c){for(a=0;c>a;a++)t[u+a]=p[s+a];if(u+=c,s+=c,i-=c,1>=i){f=!0;break}}if(t[u++]=t[l++],0===--o){f=!0;break}if(d=tn(p[s],t,l,o,0,e),0!==d){for(a=0;d>a;a++)t[u+a]=t[l+a];if(u+=d,l+=d,o-=d,0===o){f=!0;break}}if(t[u++]=p[s++],1===--i){f=!0;break}g--}while(c>=E_||d>=E_);if(f)break;0>g&&(g=0),g+=2}if(h=g,1>h&&(h=1),1===i){for(a=0;o>a;a++)t[u+a]=t[l+a];t[u+o]=p[s]}else{if(0===i)throw new Error;for(a=0;i>a;a++)t[u+a]=p[s+a]}}else for(a=0;i>a;a++)t[u+a]=p[s+a]}function s(n,i,r,o){var a=0;for(a=0;o>a;a++)p[a]=t[r+a];var s=n+i-1,l=o-1,u=r+o-1,c=0,d=0;if(t[u--]=t[s--],0!==--i){if(1===o){for(u-=i,s-=i,d=u+1,c=s+1,a=i-1;a>=0;a--)t[d+a]=t[c+a];return void(t[u]=p[l])}for(var f=h;;){var g=0,y=0,v=!1;do if(e(p[l],t[s])<0){if(t[u--]=t[s--],g++,y=0,0===--i){v=!0;break}}else if(t[u--]=p[l--],y++,g=0,1===--o){v=!0;break}while(f>(g|y));if(v)break;do{if(g=i-en(p[l],t,n,i,i-1,e),0!==g){for(u-=g,s-=g,i-=g,d=u+1,c=s+1,a=g-1;a>=0;a--)t[d+a]=t[c+a];if(0===i){v=!0;break}}if(t[u--]=p[l--],1===--o){v=!0;break}if(y=o-tn(t[s],p,0,o,o-1,e),0!==y){for(u-=y,l-=y,o-=y,d=u+1,c=l+1,a=0;y>a;a++)t[d+a]=p[c+a];if(1>=o){v=!0;break}}if(t[u--]=t[s--],0===--i){v=!0;break}f--}while(g>=E_||y>=E_);if(v)break;0>f&&(f=0),f+=2}if(h=f,1>h&&(h=1),1===o){for(u-=i,s-=i,d=u+1,c=s+1,a=i-1;a>=0;a--)t[d+a]=t[c+a];t[u]=p[l]}else{if(0===o)throw new Error;for(c=u-(o-1),a=0;o>a;a++)t[c+a]=p[a]}}else for(c=u-(o-1),a=0;o>a;a++)t[c+a]=p[a]}var l,u,h=E_,c=0,p=[];return l=[],u=[],{mergeRuns:i,forceMergeRuns:r,pushRun:n}}function rn(t,e,n,i){n||(n=0),i||(i=t.length);var r=i-n;if(!(2>r)){var o=0;if(R_>r)return o=$e(t,n,i,e),void Je(t,n,i,n+o,e);var a=nn(t,e),s=Ke(r);do{if(o=$e(t,n,i,e),s>o){var l=r;l>s&&(l=s),Je(t,n,n+l,n+o,e),o=l}a.pushRun(n,o),a.mergeRuns(),r-=o,n+=o}while(0!==r);a.forceMergeRuns()}}function on(){F_||(F_=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function an(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}function sn(t){return t>-X_&&X_>t}function ln(t){return t>X_||-X_>t}function un(t,e,n,i,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*i+3*o*n)}function hn(t,e,n,i,r){var o=1-r;return 3*(((e-t)*o+2*(n-e)*r)*o+(i-n)*r*r)}function cn(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,p=l*l-3*s*u,d=0;if(sn(h)&&sn(c))if(sn(s))o[0]=0;else{var f=-l/s;f>=0&&1>=f&&(o[d++]=f)}else{var g=c*c-4*h*p;if(sn(g)){var y=c/h,f=-s/a+y,v=-y/2;f>=0&&1>=f&&(o[d++]=f),v>=0&&1>=v&&(o[d++]=v)}else if(g>0){var m=U_(g),_=h*s+1.5*a*(-c+m),x=h*s+1.5*a*(-c-m);_=0>_?-W_(-_,j_):W_(_,j_),x=0>x?-W_(-x,j_):W_(x,j_);var f=(-s-(_+x))/(3*a);f>=0&&1>=f&&(o[d++]=f)}else{var b=(2*h*s-3*a*c)/(2*U_(h*h*h)),w=Math.acos(b)/3,S=U_(h),M=Math.cos(w),f=(-s-2*S*M)/(3*a),v=(-s+S*(M+q_*Math.sin(w)))/(3*a),T=(-s+S*(M-q_*Math.sin(w)))/(3*a);f>=0&&1>=f&&(o[d++]=f),v>=0&&1>=v&&(o[d++]=v),T>=0&&1>=T&&(o[d++]=T)}}return d}function pn(t,e,n,i,r){var o=6*n-12*e+6*t,a=9*e+3*i-3*t-9*n,s=3*e-3*t,l=0;if(sn(a)){if(ln(o)){var u=-s/o;u>=0&&1>=u&&(r[l++]=u)}}else{var h=o*o-4*a*s;if(sn(h))r[0]=-o/(2*a);else if(h>0){var c=U_(h),u=(-o+c)/(2*a),p=(-o-c)/(2*a);u>=0&&1>=u&&(r[l++]=u),p>=0&&1>=p&&(r[l++]=p)}}return l}function dn(t,e,n,i,r,o){var a=(e-t)*r+t,s=(n-e)*r+e,l=(i-n)*r+n,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=i}function fn(t,e,n,i,r,o,a,s,l,u,h){var c,p,d,f,g,y=.005,v=1/0;Z_[0]=l,Z_[1]=u;for(var m=0;1>m;m+=.05)K_[0]=un(t,n,r,a,m),K_[1]=un(e,i,o,s,m),f=t_(Z_,K_),v>f&&(c=m,v=f);v=1/0;for(var _=0;32>_&&!(Y_>y);_++)p=c-y,d=c+y,K_[0]=un(t,n,r,a,p),K_[1]=un(e,i,o,s,p),f=t_(K_,Z_),p>=0&&v>f?(c=p,v=f):($_[0]=un(t,n,r,a,d),$_[1]=un(e,i,o,s,d),g=t_($_,Z_),1>=d&&v>g?(c=d,v=g):y*=.5);return h&&(h[0]=un(t,n,r,a,c),h[1]=un(e,i,o,s,c)),U_(v)}function gn(t,e,n,i,r,o,a,s,l){for(var u=t,h=e,c=0,p=1/l,d=1;l>=d;d++){var f=d*p,g=un(t,n,r,a,f),y=un(e,i,o,s,f),v=g-u,m=y-h;c+=Math.sqrt(v*v+m*m),u=g,h=y}return c}function yn(t,e,n,i){var r=1-i;return r*(r*t+2*i*e)+i*i*n}function vn(t,e,n,i){return 2*((1-i)*(e-t)+i*(n-e))}function mn(t,e,n,i,r){var o=t-2*e+n,a=2*(e-t),s=t-i,l=0;if(sn(o)){if(ln(a)){var u=-s/a;u>=0&&1>=u&&(r[l++]=u)}}else{var h=a*a-4*o*s;if(sn(h)){var u=-a/(2*o);u>=0&&1>=u&&(r[l++]=u)}else if(h>0){var c=U_(h),u=(-a+c)/(2*o),p=(-a-c)/(2*o);u>=0&&1>=u&&(r[l++]=u),p>=0&&1>=p&&(r[l++]=p)}}return l}function _n(t,e,n){var i=t+n-2*e;return 0===i?.5:(t-e)/i}function xn(t,e,n,i,r){var o=(e-t)*i+t,a=(n-e)*i+e,s=(a-o)*i+o;r[0]=t,r[1]=o,r[2]=s,r[3]=s,r[4]=a,r[5]=n}function bn(t,e,n,i,r,o,a,s,l){var u,h=.005,c=1/0;Z_[0]=a,Z_[1]=s;for(var p=0;1>p;p+=.05){K_[0]=yn(t,n,r,p),K_[1]=yn(e,i,o,p);var d=t_(Z_,K_);c>d&&(u=p,c=d)}c=1/0;for(var f=0;32>f&&!(Y_>h);f++){var g=u-h,y=u+h;K_[0]=yn(t,n,r,g),K_[1]=yn(e,i,o,g);var d=t_(K_,Z_);if(g>=0&&c>d)u=g,c=d;else{$_[0]=yn(t,n,r,y),$_[1]=yn(e,i,o,y);var v=t_($_,Z_);1>=y&&c>v?(u=y,c=v):h*=.5}}return l&&(l[0]=yn(t,n,r,u),l[1]=yn(e,i,o,u)),U_(c)}function wn(t,e,n,i,r,o,a){for(var s=t,l=e,u=0,h=1/a,c=1;a>=c;c++){var p=c*h,d=yn(t,n,r,p),f=yn(e,i,o,p),g=d-s,y=f-l;u+=Math.sqrt(g*g+y*y),s=d,l=f}return u}function Sn(t){var e=t&&Q_.exec(t);if(e){var n=e[1].split(","),i=+W(n[0]),r=+W(n[1]),o=+W(n[2]),a=+W(n[3]);if(isNaN(i+r+o+a))return;var s=[];return function(t){return 0>=t?0:t>=1?1:cn(0,i,o,1,t,s)&&un(0,r,a,1,s[0])}}}function Mn(t){return t=Math.round(t),0>t?0:t>255?255:t}function Tn(t){return t=Math.round(t),0>t?0:t>360?360:t}function In(t){return 0>t?0:t>1?1:t}function Cn(t){var e=t;return Mn(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100*255:parseInt(e,10))}function kn(t){var e=t;return In(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100:parseFloat(e))}function Dn(t,e,n){return 0>n?n+=1:n>1&&(n-=1),1>6*n?t+(e-t)*n*6:1>2*n?e:2>3*n?t+(e-t)*(2/3-n)*6:t}function An(t,e,n){return t+(e-t)*n}function Pn(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function Ln(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function On(t,e){ox&&Ln(ox,e),ox=rx.put(t,ox||e.slice())}function Rn(t,e){if(t){e=e||[];var n=rx.get(t);if(n)return Ln(e,n);t+="";var i=t.replace(/ /g,"").toLowerCase();if(i in ix)return Ln(e,ix[i]),On(t,e),e;var r=i.length;if("#"!==i.charAt(0)){var o=i.indexOf("("),a=i.indexOf(")");if(-1!==o&&a+1===r){var s=i.substr(0,o),l=i.substr(o+1,a-(o+1)).split(","),u=1;switch(s){case"rgba":if(4!==l.length)return 3===l.length?Pn(e,+l[0],+l[1],+l[2],1):Pn(e,0,0,0,1);u=kn(l.pop());case"rgb":return l.length>=3?(Pn(e,Cn(l[0]),Cn(l[1]),Cn(l[2]),3===l.length?u:kn(l[3])),On(t,e),e):void Pn(e,0,0,0,1);case"hsla":return 4!==l.length?void Pn(e,0,0,0,1):(l[3]=kn(l[3]),En(l,e),On(t,e),e);case"hsl":return 3!==l.length?void Pn(e,0,0,0,1):(En(l,e),On(t,e),e);default:return}}Pn(e,0,0,0,1)}else{if(4===r||5===r){var h=parseInt(i.slice(1,4),16);return h>=0&&4095>=h?(Pn(e,(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,5===r?parseInt(i.slice(4),16)/15:1),On(t,e),e):void Pn(e,0,0,0,1)}if(7===r||9===r){var h=parseInt(i.slice(1,7),16);return h>=0&&16777215>=h?(Pn(e,(16711680&h)>>16,(65280&h)>>8,255&h,9===r?parseInt(i.slice(7),16)/255:1),On(t,e),e):void Pn(e,0,0,0,1)}}}}function En(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=kn(t[1]),r=kn(t[2]),o=.5>=r?r*(i+1):r+i-r*i,a=2*r-o;return e=e||[],Pn(e,Mn(255*Dn(a,o,n+1/3)),Mn(255*Dn(a,o,n)),Mn(255*Dn(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function Nn(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=.5>u?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,p=((s-o)/6+l/2)/l;i===s?e=p-c:r===s?e=1/3+h-p:o===s&&(e=2/3+c-h),0>e&&(e+=1),e>1&&(e-=1)}var d=[360*e,n,u];return null!=t[3]&&d.push(t[3]),d}}function zn(t,e){var n=Rn(t);if(n){for(var i=0;3>i;i++)n[i]=0>e?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return Wn(n,4===n.length?"rgba":"rgb")}}function Bn(t){var e=Rn(t);return e?((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1):void 0}function Fn(t,e,n){if(e&&e.length&&t>=0&&1>=t){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],l=i-r;return n[0]=Mn(An(a[0],s[0],l)),n[1]=Mn(An(a[1],s[1],l)),n[2]=Mn(An(a[2],s[2],l)),n[3]=In(An(a[3],s[3],l)),n}}function Vn(t,e,n){if(e&&e.length&&t>=0&&1>=t){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=Rn(e[r]),s=Rn(e[o]),l=i-r,u=Wn([Mn(An(a[0],s[0],l)),Mn(An(a[1],s[1],l)),Mn(An(a[2],s[2],l)),In(An(a[3],s[3],l))],"rgba");return n?{color:u,leftIndex:r,rightIndex:o,value:i}:u}}function Hn(t,e,n,i){var r=Rn(t);return t?(r=Nn(r),null!=e&&(r[0]=Tn(e)),null!=n&&(r[1]=kn(n)),null!=i&&(r[2]=kn(i)),Wn(En(r),"rgba")):void 0}function Gn(t,e){var n=Rn(t);return n&&null!=e?(n[3]=In(e),Wn(n,"rgba")):void 0}function Wn(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return("rgba"===e||"hsva"===e||"hsla"===e)&&(n+=","+t[3]),e+"("+n+")"}}function Un(t,e){var n=Rn(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function Xn(){return Wn([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}function Yn(t){return"linear"===t.type}function qn(t){return"radial"===t.type}function jn(t,e,n){return(e-t)*n+t}function Zn(t,e,n,i){for(var r=e.length,o=0;r>o;o++)t[o]=jn(e[o],n[o],i);return t}function Kn(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;r>a;a++){t[a]||(t[a]=[]);for(var s=0;o>s;s++)t[a][s]=jn(e[a][s],n[a][s],i)}return t}function $n(t,e,n,i){for(var r=e.length,o=0;r>o;o++)t[o]=e[o]+n[o]*i;return t}function Qn(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;r>a;a++){t[a]||(t[a]=[]);for(var s=0;o>s;s++)t[a][s]=e[a][s]+n[a][s]*i}return t}function Jn(t,e){for(var n=t.length,i=e.length,r=n>i?e:t,o=Math.min(n,i),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa;if(s)i.length=a;else for(var l=o;a>l;l++)i.push(1===n?r[l]:ux.call(r[l]))}for(var u=i[0]&&i[0].length,l=0;lh;h++)isNaN(i[l][h])&&(i[l][h]=r[l][h])}}function ei(t){if(g(t)){var e=t.length;if(g(t[0])){for(var n=[],i=0;e>i;i++)n.push(ux.call(t[i]));return n}return ux.call(t)}return t}function ni(t){return t[0]=Math.floor(t[0])||0,t[1]=Math.floor(t[1])||0,t[2]=Math.floor(t[2])||0,t[3]=null==t[3]?1:t[3],"rgba("+t.join(",")+")"}function ii(t){return g(t&&t[0])?2:1}function ri(t){return t===fx||t===gx}function oi(t){return t===cx||t===px}function ai(){return(new Date).getTime()}function si(t){var e=t.pointerType;return"pen"===e||"touch"===e}function li(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout(function(){t.touching=!1,t.touchTimer=null},700)}function ui(t){t&&(t.zrByTouch=!0)}function hi(t,e){return Ae(t.dom,new Cx(t,e),!0)}function ci(t,e){for(var n=e,i=!1;n&&9!==n.nodeType&&!(i=n.domBelongToZr||n!==e&&n===t.painterRoot);)n=n.parentNode;return i}function pi(t,e){var n=e.domHandlers;Mm.pointerEventsSupported?y(Mx.pointer,function(i){fi(e,i,function(e){n[i].call(t,e)})}):(Mm.touchEventsSupported&&y(Mx.touch,function(i){fi(e,i,function(r){n[i].call(t,r),li(e)})}),y(Mx.mouse,function(i){fi(e,i,function(r){r=De(r),e.touching||n[i].call(t,r)})}))}function di(t,e){function n(n){function i(i){i=De(i),ci(t,i.target)||(i=hi(t,i),e.domHandlers[n].call(t,i))}fi(e,n,i,{capture:!0})}Mm.pointerEventsSupported?y(Tx.pointer,n):Mm.touchEventsSupported||y(Tx.mouse,n)}function fi(t,e,n,i){t.mounted[e]=n,t.listenerOpts[e]=i,Le(t.domTarget,e,n,i)}function gi(t){var e=t.mounted;for(var n in e)e.hasOwnProperty(n)&&Oe(t.domTarget,n,e[n],t.listenerOpts[n]);t.mounted={}}function yi(t){return t>Fx||-Fx>t}function vi(t,e){for(var n=0;n=0?parseFloat(t)/100*e:parseFloat(t):t}function Ti(t,e,n){var i=e.position||"inside",r=null!=e.distance?e.distance:5,o=n.height,a=n.width,s=o/2,l=n.x,u=n.y,h="left",c="top";if(i instanceof Array)l+=Mi(i[0],n.width),u+=Mi(i[1],n.height),h=null,c=null;else switch(i){case"left":l-=r,u+=s,h="right",c="middle";break;case"right":l+=r+a,u+=s,c="middle";break;case"top":l+=a/2,u-=r,h="center",c="bottom";break;case"bottom":l+=a/2,u+=o+r,h="center";break;case"inside":l+=a/2,u+=s,h="center",c="middle";break;case"insideLeft":l+=r,u+=s,c="middle";break;case"insideRight":l+=a-r,u+=s,h="right",c="middle";break;case"insideTop":l+=a/2,u+=r,h="center";break;case"insideBottom":l+=a/2,u+=o-r,h="center",c="bottom";break;case"insideTopLeft":l+=r,u+=r;break;case"insideTopRight":l+=a-r,u+=r,h="right";break;case"insideBottomLeft":l+=r,u+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,u+=o-r,h="right",c="bottom"}return t=t||{},t.x=l,t.y=u,t.align=h,t.verticalAlign=c,t}function Ii(t,e,n,i,r){n=n||{};var o=[];Li(t,"",t,e,n,i,o,r);var a=o.length,s=!1,l=n.done,u=n.aborted,h=function(){s=!0,a--,0>=a&&(s?l&&l():u&&u())},c=function(){a--,0>=a&&(s?l&&l():u&&u())};a||l&&l(),o.length>0&&n.during&&o[0].during(function(t,e){n.during(e)});for(var p=0;pi;i++)t[i]=e[i]}function ki(t){return g(t[0])}function Di(t,e,n){if(g(e[n]))if(g(t[n])||(t[n]=[]),P(e[n])){var i=e[n].length;t[n].length!==i&&(t[n]=new e[n].constructor(i),Ci(t[n],e[n],i))}else{var r=e[n],o=t[n],a=r.length;if(ki(r))for(var s=r[0].length,l=0;a>l;l++)o[l]?Ci(o[l],r[l],s):o[l]=Array.prototype.slice.call(r[l]);else Ci(o,r,a);o.length=r.length}else t[n]=e[n]}function Ai(t,e){return t===e||g(t)&&g(e)&&Pi(t,e)}function Pi(t,e){var n=t.length;if(n!==e.length)return!1;for(var i=0;n>i;i++)if(t[i]!==e[i])return!1;return!0}function Li(t,e,n,i,r,o,a,s){for(var l=b(i),u=r.duration,h=r.delay,c=r.additive,d=r.setToFinal,f=!D(o),y=t.animators,v=[],m=0;m0||r.force&&!a.length){var k=void 0,A=void 0,P=void 0;if(s){A={},d&&(k={});for(var M=0;S>M;M++){var x=v[M];A[x]=n[x],d?k[x]=i[x]:n[x]=i[x]}}else if(d){P={};for(var M=0;S>M;M++){var x=v[M];P[x]=ei(n[x]),Di(n,i,x)}}var T=new _x(n,!1,!1,c?_(y,function(t){return t.targetName===e}):null);T.targetName=e,r.scope&&(T.scope=r.scope),d&&k&&T.whenWithKeys(0,k,v),P&&T.whenWithKeys(0,P,v),T.whenWithKeys(null==u?500:u,s?A:i,v).delay(h||0),t.addAnimator(T,e),a.push(T)}}function Oi(t){delete eb[t]}function Ri(t){if(!t)return!1;if("string"==typeof t)return Un(t,1)r;r++)n+=Un(e[r].color,1);return n/=i,Rx>n}return!1}function Ei(t,e){var n=new nb(o(),t,e);return eb[n.id]=n,n}function Ni(t){t.dispose()}function zi(){for(var t in eb)eb.hasOwnProperty(t)&&eb[t].dispose();eb={}}function Bi(t){return eb[t]}function Fi(t,e){tb[t]=e}function Vi(t){return t.replace(/^\s+|\s+$/g,"")}function Hi(t,e,n,i){var r=e[0],o=e[1],a=n[0],s=n[1],l=o-r,u=s-a;if(0===l)return 0===u?a:(a+s)/2;if(i)if(l>0){if(r>=t)return a;if(t>=o)return s}else{if(t>=r)return a;if(o>=t)return s}else{if(t===r)return a;if(t===o)return s}return(t-r)/l*u+a}function Gi(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return I(t)?Vi(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?0/0:+t}function Wi(t,e,n){return null==e&&(e=10),e=Math.min(Math.max(0,e),ab),t=(+t).toFixed(e),n?t:+t}function Ui(t){return t.sort(function(t,e){return t-e}),t}function Xi(t){if(t=+t,isNaN(t))return 0;if(t>1e-14)for(var e=1,n=0;15>n;n++,e*=10)if(Math.round(t*e)/e===t)return n;return Yi(t)}function Yi(t){var e=t.toString().toLowerCase(),n=e.indexOf("e"),i=n>0?+e.slice(n+1):0,r=n>0?n:e.length,o=e.indexOf("."),a=0>o?0:r-1-o;return Math.max(0,a-i)}function qi(t,e){var n=Math.log,i=Math.LN10,r=Math.floor(n(t[1]-t[0])/i),o=Math.round(n(Math.abs(e[1]-e[0]))/i),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20}function ji(t,e,n){if(!t[e])return 0;var i=Zi(t,n);return i[e]||0}function Zi(t,e){var n=m(t,function(t,e){return t+(isNaN(e)?0:e)},0);if(0===n)return[];for(var i=Math.pow(10,e),r=v(t,function(t){return(isNaN(t)?0:t)/n*i*100}),o=100*i,a=v(r,function(t){return Math.floor(t)}),s=m(a,function(t,e){return t+e},0),l=v(r,function(t,e){return t-a[e]});o>s;){for(var u=Number.NEGATIVE_INFINITY,h=null,c=0,p=l.length;p>c;++c)l[c]>u&&(u=l[c],h=c);++a[h],l[h]=0,++s}return v(a,function(t){return t/i})}function Ki(t,e){var n=Math.max(Xi(t),Xi(e)),i=t+e;return n>ab?i:Wi(i,n)}function $i(t){var e=2*Math.PI;return(t%e+e)%e}function Qi(t){return t>-ob&&ob>t}function Ji(t){if(t instanceof Date)return t;if(I(t)){var e=lb.exec(t);if(!e)return new Date(0/0);if(e[8]){var n=+e[4]||0; +return"Z"!==e[8].toUpperCase()&&(n-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,n,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0)}return new Date(null==t?0/0:Math.round(t))}function tr(t){return Math.pow(10,er(t))}function er(t){if(0===t)return 0;var e=Math.floor(Math.log(t)/Math.LN10);return t/Math.pow(10,e)>=10&&e++,e}function nr(t,e){var n,i=er(t),r=Math.pow(10,i),o=t/r;return n=e?1.5>o?1:2.5>o?2:4>o?3:7>o?5:10:1>o?1:2>o?2:3>o?3:5>o?5:10,t=n*r,i>=-20?+t.toFixed(0>i?-i:0):t}function ir(t,e){var n=(t.length-1)*e+1,i=Math.floor(n),r=+t[i-1],o=n-i;return o?r+o*(t[i]-r):r}function rr(t){function e(t,n,i){return t.interval[i]s;s++)o[s]<=n&&(o[s]=n,a[s]=s?1:1-i),n=o[s],i=a[s];o[0]===o[1]&&a[0]*a[1]!==1?t.splice(r,1):r++}return t}function or(t){var e=parseFloat(t);return e==t&&(0!==e||!I(t)||t.indexOf("x")<=0)?e:0/0}function ar(t){return!isNaN(or(t))}function sr(){return Math.round(9*Math.random())}function lr(t,e){return 0===e?t:lr(e,t%e)}function ur(t,e){return null==t?e:null==e?t:t*e/lr(t,e)}function hr(t){throw new Error(t)}function cr(t,e,n){return(e-t)*n+t}function pr(t){return t instanceof Array?t:null==t?[]:[t]}function dr(t,e,n){if(t){t[e]=t[e]||{},t.emphasis=t.emphasis||{},t.emphasis[e]=t.emphasis[e]||{};for(var i=0,r=n.length;r>i;i++){var o=n[i];!t.emphasis[e].hasOwnProperty(o)&&t[e].hasOwnProperty(o)&&(t.emphasis[e][o]=t[e][o])}}}function fr(t){return!D(t)||M(t)||t instanceof Date?t:t.value}function gr(t){return D(t)&&!(t instanceof Array)}function yr(t,e,n){var i="normalMerge"===n,r="replaceMerge"===n,o="replaceAll"===n;t=t||[],e=(e||[]).slice();var a=Y();y(e,function(t,n){return D(t)?void 0:void(e[n]=null)});var s=vr(t,a,n);return(i||r)&&mr(s,t,a,e),i&&_r(s,e),i||r?xr(s,e,r):o&&br(s,e),wr(s),s}function vr(t,e,n){var i=[];if("replaceAll"===n)return i;for(var r=0;rr?n:i;for(var s=[],l=n,u=i,h=Math.max(l?l.length:0,u.length),c=0;h>c;++c){var p=t.getDimensionInfo(c);if(p&&"ordinal"===p.type)s[c]=(1>r&&l?l:u)[c];else{var d=l&&l[c]?l[c]:0,f=u[c],a=cr(d,f,r);s[c]=Wi(a,o?Math.max(Xi(d),Xi(f)):e)}}return s}function Fr(t){var e={main:"",sub:""};if(t){var n=t.split(fb);e.main=n[0]||"",e.sub=n[1]||""}return e}function Vr(t){G(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(t),'componentType "'+t+'" illegal')}function Hr(t){return!(!t||!t[yb])}function Gr(t){t.$constructor=t,t.extend=function(t){var n,i=this;return Wr(i)?n=function(t){function n(){return t.apply(this,arguments)||this}return e(n,t),n}(i):(n=function(){(t.$constructor||i).apply(this,arguments)},d(n,this)),h(n.prototype,t),n[yb]=!0,n.extend=this.extend,n.superCall=Yr,n.superApply=qr,n.superClass=i,n}}function Wr(t){return T(t)&&/^class\s/.test(Function.prototype.toString.call(t))}function Ur(t,e){t.extend=e.extend}function Xr(t){var e=["__\x00is_clz",vb++].join("_");t.prototype[e]=!0,t.isInstance=function(t){return!(!t||!t[e])}}function Yr(t,e){for(var n=[],i=2;i=0||r&&p(r,s)<0)){var l=n.getShallow(s,e);null!=l&&(o[t[a][0]]=l)}}return o}}function Kr(t){if("string"==typeof t){var e=bb.get(t);return e&&e.image}return t}function $r(t,e,n,i,r){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!n)return e;var o=bb.get(t),a={hostEl:n,cb:i,cbPayload:r};return o?(e=o.image,!Jr(e)&&o.pending.push(a)):(e=Lm.loadImage(t,Qr,Qr),e.__zrImageSrc=t,bb.put(t,e.__cachedImgObj={image:e,pending:[a]})),e}return t}return e}function Qr(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;ea;a++)o[a]=no(o[a],r);return o.join("\n")}function eo(t,e,n,i){i=i||{};var r=h({},i);r.font=e,n=B(n,"..."),r.maxIterations=B(i.maxIterations,2);var o=r.minChar=B(i.minChar,0);r.cnCharWidth=mi("国",e);var a=r.ascCharWidth=mi("a",e);r.placeholder=B(i.placeholder,"");for(var s=t=Math.max(0,t-1),l=0;o>l&&s>=a;l++)s-=a;var u=mi(n,e);return u>s&&(n="",u=0),s=t-u,r.ellipsis=n,r.ellipsisWidth=u,r.contentWidth=s,r.containerWidth=t,r}function no(t,e){var n=e.containerWidth,i=e.font,r=e.contentWidth;if(!n)return"";var o=mi(t,i);if(n>=o)return t;for(var a=0;;a++){if(r>=o||a>=e.maxIterations){t+=e.ellipsis;break}var s=0===a?io(t,r,e.ascCharWidth,e.cnCharWidth):o>0?Math.floor(t.length*r/o):0;t=t.substr(0,s),o=mi(t,i)}return""===t&&(t=e.placeholder),t}function io(t,e,n,i){for(var r=0,o=0,a=t.length;a>o&&e>r;o++){var s=t.charCodeAt(o);r+=s>=0&&127>=s?n:i}return o}function ro(t,e){null!=t&&(t+="");var n,i=e.overflow,r=e.padding,o=e.font,a="truncate"===i,s=Si(o),l=B(e.lineHeight,s),u=!!e.backgroundColor,h="truncate"===e.lineOverflow,c=e.width;n=null==c||"break"!==i&&"breakAll"!==i?t?t.split("\n"):[]:t?uo(t,e.font,c,"breakAll"===i,0).lines:[];var p=n.length*l,d=B(e.height,p);if(p>d&&h){var f=Math.floor(d/l);n=n.slice(0,f)}if(t&&a&&null!=c)for(var g=eo(c,o,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),y=0;yu&&ao(i,t.substring(u,h),e,l),ao(i,r[2],e,l,r[1]),u=wb.lastIndex}ua){b>0?(m.tokens=m.tokens.slice(0,b),n(m,x,_),i.lines=i.lines.slice(0,v+1)):i.lines=i.lines.slice(0,v);break t}var k=S.width,D=null==k||"auto"===k;if("string"==typeof k&&"%"===k.charAt(k.length-1))w.percentWidth=k,c.push(w),w.contentWidth=mi(w.text,I);else{if(D){var A=S.backgroundColor,P=A&&A.image;P&&(P=Kr(P),Jr(P)&&(w.width=Math.max(w.width,P.width*C/P.height)))}var L=g&&null!=o?o-x:null;null!=L&&LL?(w.text="",w.width=w.contentWidth=0):(w.text=to(w.text,L-T,I,e.ellipsis,{minChar:e.truncateMinChar}),w.width=w.contentWidth=mi(w.text,I)):w.contentWidth=mi(w.text,I)}w.width+=T,x+=w.width,S&&(_=Math.max(_,w.lineHeight))}n(m,x,_)}i.outerWidth=i.width=B(o,d),i.outerHeight=i.height=B(a,p),i.contentHeight=p,i.contentWidth=d,f&&(i.outerWidth+=f[1]+f[3],i.outerHeight+=f[0]+f[2]);for(var v=0;v0&&f+i.accumWidth>i.width&&(o=e.split("\n"),c=!0),i.accumWidth=f}else{var g=uo(e,h,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+d,a=g.linesWidths,o=g.lines}}else o=e.split("\n");for(var y=0;y=33&&383>=e}function lo(t){return so(t)?Ib[t]?!0:!1:!0}function uo(t,e,n,i,r){for(var o=[],a=[],s="",l="",u=0,h=0,c=0;cn:r+h+d>n)?h?(s||l)&&(f?(s||(s=l,l="",u=0,h=u),o.push(s),a.push(h-u),l+=p,u+=d,s="",h=u):(l&&(s+=l,l="",u=0),o.push(s),a.push(h),s=p,h=d)):f?(o.push(l),a.push(u),l=p,u=d):(o.push(p),a.push(d)):(h+=d,f?(l+=p,u+=d):(l&&(s+=l,l="",u=0),s+=p))}else l&&(s+=l,h+=u),o.push(s),a.push(h),s="",l="",u=0,h=0}return o.length||s||(s=t,l="",u=0),l&&(s+=l),s&&(o.push(s),a.push(h)),1===o.length&&(h+=r),{accumWidth:h,lines:o,linesWidths:a}}function ho(t,e,n){return Ob.copy(t.getBoundingRect()),t.transform&&Ob.applyTransform(t.transform),Rb.width=e,Rb.height=n,!Ob.intersect(Rb)}function co(t,e,n,i,r,o){r[0]=Eb(t,n),r[1]=Eb(e,i),o[0]=Nb(t,n),o[1]=Nb(e,i)}function po(t,e,n,i,r,o,a,s,l,u){var h=pn,c=un,p=h(t,n,r,a,Wb);l[0]=1/0,l[1]=1/0,u[0]=-1/0,u[1]=-1/0;for(var d=0;p>d;d++){var f=c(t,n,r,a,Wb[d]);l[0]=Eb(f,l[0]),u[0]=Nb(f,u[0])}p=h(e,i,o,s,Ub);for(var d=0;p>d;d++){var g=c(e,i,o,s,Ub[d]);l[1]=Eb(g,l[1]),u[1]=Nb(g,u[1])}l[0]=Eb(t,l[0]),u[0]=Nb(t,u[0]),l[0]=Eb(a,l[0]),u[0]=Nb(a,u[0]),l[1]=Eb(e,l[1]),u[1]=Nb(e,u[1]),l[1]=Eb(s,l[1]),u[1]=Nb(s,u[1])}function fo(t,e,n,i,r,o,a,s){var l=_n,u=yn,h=Nb(Eb(l(t,n,r),1),0),c=Nb(Eb(l(e,i,o),1),0),p=u(t,n,r,h),d=u(e,i,o,c);a[0]=Eb(t,r,p),a[1]=Eb(e,o,d),s[0]=Nb(t,r,p),s[1]=Nb(e,o,d)}function go(t,e,n,i,r,o,a,s,l){var u=ve,h=me,c=Math.abs(r-o);if(1e-4>c%Fb&&c>1e-4)return s[0]=t-n,s[1]=e-i,l[0]=t+n,void(l[1]=e+i);if(Vb[0]=Bb(r)*n+t,Vb[1]=zb(r)*i+e,Hb[0]=Bb(o)*n+t,Hb[1]=zb(o)*i+e,u(s,Vb,Hb),h(l,Vb,Hb),r%=Fb,0>r&&(r+=Fb),o%=Fb,0>o&&(o+=Fb),r>o&&!a?o+=Fb:o>r&&a&&(r+=Fb),a){var p=o;o=r,r=p}for(var d=0;o>d;d+=Math.PI/2)d>r&&(Gb[0]=Bb(d)*n+t,Gb[1]=zb(d)*i+e,u(s,Gb,s),h(l,Gb,l))}function yo(t){var e=Math.round(t/iw*1e8)/1e8;return e%2*iw}function vo(t,e){var n=yo(t[0]);0>n&&(n+=rw);var i=n-t[0],r=t[1];r+=i,!e&&r-n>=rw?r=n+rw:e&&n-r>=rw?r=n-rw:!e&&n>r?r=n+(rw-yo(n-r)):e&&r>n&&(r=n-(rw-yo(r-n))),t[0]=n,t[1]=r}function mo(t,e,n,i,r,o,a){if(0===r)return!1;var s=r,l=0,u=t;if(a>e+s&&a>i+s||e-s>a&&i-s>a||o>t+s&&o>n+s||t-s>o&&n-s>o)return!1;if(t===n)return Math.abs(o-t)<=s/2;l=(e-i)/(t-n),u=(t*i-n*e)/(t-n);var h=l*o-a+u,c=h*h/(l*l+1);return s/2*s/2>=c}function _o(t,e,n,i,r,o,a,s,l,u,h){if(0===l)return!1;var c=l;if(h>e+c&&h>i+c&&h>o+c&&h>s+c||e-c>h&&i-c>h&&o-c>h&&s-c>h||u>t+c&&u>n+c&&u>r+c&&u>a+c||t-c>u&&n-c>u&&r-c>u&&a-c>u)return!1;var p=fn(t,e,n,i,r,o,a,s,u,h,null);return c/2>=p}function xo(t,e,n,i,r,o,a,s,l){if(0===a)return!1;var u=a;if(l>e+u&&l>i+u&&l>o+u||e-u>l&&i-u>l&&o-u>l||s>t+u&&s>n+u&&s>r+u||t-u>s&&n-u>s&&r-u>s)return!1;var h=bn(t,e,n,i,r,o,s,l,null);return u/2>=h}function bo(t){return t%=lw,0>t&&(t+=lw),t}function wo(t,e,n,i,r,o,a,s,l){if(0===a)return!1;var u=a;s-=t,l-=e;var h=Math.sqrt(s*s+l*l);if(h-u>n||n>h+u)return!1;if(Math.abs(i-r)%uw<1e-4)return!0;if(o){var c=i;i=bo(r),r=bo(c)}else i=bo(i),r=bo(r);i>r&&(r+=uw);var p=Math.atan2(l,s);return 0>p&&(p+=uw),p>=i&&r>=p||p+uw>=i&&r>=p+uw}function So(t,e,n,i,r,o){if(o>e&&o>i||e>o&&i>o)return 0;if(i===e)return 0;var a=(o-e)/(i-e),s=e>i?1:-1;(1===a||0===a)&&(s=e>i?.5:-.5);var l=a*(n-t)+t;return l===r?1/0:l>r?s:0}function Mo(t,e){return Math.abs(t-e)e&&u>i&&u>o&&u>s||e>u&&i>u&&o>u&&s>u)return 0;var h=cn(e,i,o,s,u,dw);if(0===h)return 0;for(var c=0,p=-1,d=void 0,f=void 0,g=0;h>g;g++){var y=dw[g],v=0===y||1===y?.5:1,m=un(t,n,r,a,y);l>m||(0>p&&(p=pn(e,i,o,s,fw),fw[1]1&&To(),d=un(e,i,o,s,fw[0]),p>1&&(f=un(e,i,o,s,fw[1]))),c+=2===p?yd?v:-v:yf?v:-v:f>s?v:-v:yd?v:-v:d>s?v:-v)}return c}function Co(t,e,n,i,r,o,a,s){if(s>e&&s>i&&s>o||e>s&&i>s&&o>s)return 0;var l=mn(e,i,o,s,dw);if(0===l)return 0;var u=_n(e,i,o);if(u>=0&&1>=u){for(var h=0,c=yn(e,i,o,u),p=0;l>p;p++){var d=0===dw[p]||1===dw[p]?.5:1,f=yn(t,n,r,dw[p]);a>f||(h+=dw[p]c?d:-d:c>o?d:-d)}return h}var d=0===dw[0]||1===dw[0]?.5:1,f=yn(t,n,r,dw[0]);return a>f?0:e>o?d:-d}function ko(t,e,n,i,r,o,a,s){if(s-=e,s>n||-n>s)return 0;var l=Math.sqrt(n*n-s*s);dw[0]=-l,dw[1]=l;var u=Math.abs(i-r);if(1e-4>u)return 0;if(u>=cw-1e-4){i=0,r=cw;var h=o?1:-1;return a>=dw[0]+t&&a<=dw[1]+t?h:0}if(i>r){var c=i;i=r,r=c}0>i&&(i+=cw,r+=cw);for(var p=0,d=0;2>d;d++){var f=dw[d];if(f+t>a){var g=Math.atan2(s,f),h=o?1:-1;0>g&&(g=cw+g),(g>=i&&r>=g||g+cw>=i&&r>=g+cw)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),p+=h)}}return p}function Do(t,e,n,i,r){for(var o,a,s=t.data,l=t.len(),u=0,h=0,c=0,p=0,d=0,f=0;l>f;){var g=s[f++],y=1===f;switch(g===hw.M&&f>1&&(n||(u+=So(h,c,p,d,i,r))),y&&(h=s[f],c=s[f+1],p=h,d=c),g){case hw.M:p=s[f++],d=s[f++],h=p,c=d;break;case hw.L:if(n){if(mo(h,c,s[f],s[f+1],e,i,r))return!0}else u+=So(h,c,s[f],s[f+1],i,r)||0;h=s[f++],c=s[f++];break;case hw.C:if(n){if(_o(h,c,s[f++],s[f++],s[f++],s[f++],s[f],s[f+1],e,i,r))return!0}else u+=Io(h,c,s[f++],s[f++],s[f++],s[f++],s[f],s[f+1],i,r)||0;h=s[f++],c=s[f++];break;case hw.Q:if(n){if(xo(h,c,s[f++],s[f++],s[f],s[f+1],e,i,r))return!0}else u+=Co(h,c,s[f++],s[f++],s[f],s[f+1],i,r)||0;h=s[f++],c=s[f++];break;case hw.A:var v=s[f++],m=s[f++],_=s[f++],x=s[f++],b=s[f++],w=s[f++];f+=1;var S=!!(1-s[f++]);o=Math.cos(b)*_+v,a=Math.sin(b)*x+m,y?(p=o,d=a):u+=So(h,c,o,a,i,r);var M=(i-v)*x/_+v;if(n){if(wo(v,m,x,b,b+w,S,e,M,r))return!0}else u+=ko(v,m,x,b,b+w,S,M,r);h=Math.cos(b+w)*_+v,c=Math.sin(b+w)*x+m;break;case hw.R:p=h=s[f++],d=c=s[f++];var T=s[f++],I=s[f++];if(o=p+T,a=d+I,n){if(mo(p,d,o,d,e,i,r)||mo(o,d,o,a,e,i,r)||mo(o,a,p,a,e,i,r)||mo(p,a,p,d,e,i,r))return!0}else u+=So(o,d,o,a,i,r),u+=So(p,a,p,d,i,r);break;case hw.Z:if(n){if(mo(h,c,p,d,e,i,r))return!0}else u+=So(h,c,p,d,i,r);h=p,c=d}}return n||Mo(c,d)||(u+=So(h,c,p,d,i,r)||0),0!==u}function Ao(t,e,n){return Do(t,0,!1,e,n)}function Po(t,e,n,i){return Do(t,e,!0,n,i)}function Lo(t){return!!(t&&"string"!=typeof t&&t.width&&t.height)}function Oo(t,e){var n,i,r,o,a=e.x,s=e.y,l=e.width,u=e.height,h=e.r;0>l&&(a+=l,l=-l),0>u&&(s+=u,u=-u),"number"==typeof h?n=i=r=o=h:h instanceof Array?1===h.length?n=i=r=o=h[0]:2===h.length?(n=r=h[0],i=o=h[1]):3===h.length?(n=h[0],i=o=h[1],r=h[2]):(n=h[0],i=h[1],r=h[2],o=h[3]):n=i=r=o=0;var c;n+i>l&&(c=n+i,n*=l/c,i*=l/c),r+o>l&&(c=r+o,r*=l/c,o*=l/c),i+r>u&&(c=i+r,i*=u/c,r*=u/c),n+o>u&&(c=n+o,n*=u/c,o*=u/c),t.moveTo(a+n,s),t.lineTo(a+l-i,s),0!==i&&t.arc(a+l-i,s+i,i,-Math.PI/2,0),t.lineTo(a+l,s+u-r),0!==r&&t.arc(a+l-r,s+u-r,r,0,Math.PI/2),t.lineTo(a+o,s+u),0!==o&&t.arc(a+o,s+u-o,o,Math.PI/2,Math.PI),t.lineTo(a,s+n),0!==n&&t.arc(a+n,s+n,n,Math.PI,1.5*Math.PI)}function Ro(t,e,n){if(e){var i=e.x1,r=e.x2,o=e.y1,a=e.y2;t.x1=i,t.x2=r,t.y1=o,t.y2=a;var s=n&&n.lineWidth;return s?(Mw(2*i)===Mw(2*r)&&(t.x1=t.x2=No(i,s,!0)),Mw(2*o)===Mw(2*a)&&(t.y1=t.y2=No(o,s,!0)),t):t}}function Eo(t,e,n){if(e){var i=e.x,r=e.y,o=e.width,a=e.height;t.x=i,t.y=r,t.width=o,t.height=a;var s=n&&n.lineWidth;return s?(t.x=No(i,s,!0),t.y=No(r,s,!0),t.width=Math.max(No(i+o,s,!1)-t.x,0===o?0:1),t.height=Math.max(No(r+a,s,!1)-t.y,0===a?0:1),t):t}}function No(t,e,n){if(!e)return t;var i=Mw(2*t);return(i+Mw(e))%2===0?i/2:(i+(n?1:-1))/2}function zo(t){return"string"!=typeof t||-1===t.indexOf("px")&&-1===t.indexOf("rem")&&-1===t.indexOf("em")?isNaN(+t)?Tm+"px":t+"px":t}function Bo(t,e){for(var n=0;n=e||"transparent"===t||"none"===t?null:t.image||t.colorStops?"#000":t}function Wo(t){return null==t||"none"===t?null:t.image||t.colorStops?"#000":t}function Uo(t,e,n){return"right"===e?t-n[1]:"center"===e?t+n[3]/2-n[1]/2:t+n[3]}function Xo(t){var e=t.text;return null!=e&&(e+=""),e}function Yo(t){return!!(t.backgroundColor||t.lineHeight||t.borderWidth&&t.borderColor)}function qo(t){return null!=t&&"none"!==t}function jo(t){if(I(t)){var e=Jw.get(t);return e||(e=zn(t,-.1),Jw.put(t,e)),e}if(O(t)){var n=h({},t);return n.colorStops=v(t.colorStops,function(t){return{offset:t.offset,color:zn(t.color,-.1)}}),n}return t}function Zo(t,e,n){t.onHoverStateChange&&(t.hoverState||0)!==n&&t.onHoverStateChange(e),t.hoverState=n}function Ko(t){Zo(t,"emphasis",Ww)}function $o(t){t.hoverState===Ww&&Zo(t,"normal",Hw)}function Qo(t){Zo(t,"blur",Gw)}function Jo(t){t.hoverState===Gw&&Zo(t,"normal",Hw)}function ta(t){t.selected=!0}function ea(t){t.selected=!1}function na(t,e,n){e(t,n)}function ia(t,e,n){na(t,e,n),t.isGroup&&t.traverse(function(t){na(t,e,n)})}function ra(t,e){switch(e){case"emphasis":t.hoverState=Ww;break;case"normal":t.hoverState=Hw;break;case"blur":t.hoverState=Gw;break;case"select":t.selected=!0}}function oa(t,e,n,i){for(var r=t.style,o={},a=0;a=0,o=!1;if(t instanceof mw){var a=Fw(t),s=r?a.selectFill||a.normalFill:a.normalFill,l=r?a.selectStroke||a.normalStroke:a.normalStroke;if(qo(s)||qo(l)){i=i||{};var u=i.style||{};"inherit"===u.fill?(o=!0,i=h({},i),u=h({},u),u.fill=s):!qo(u.fill)&&qo(s)?(o=!0,i=h({},i),u=h({},u),u.fill=jo(s)):!qo(u.stroke)&&qo(l)&&(o||(i=h({},i),u=h({},u)),u.stroke=jo(l)),i.style=u}}if(i&&null==i.z2){o||(i=h({},i));var c=t.z2EmphasisLift;i.z2=t.z2+(null!=c?c:Yw)}return i}function sa(t,e,n){if(n&&null==n.z2){n=h({},n);var i=t.z2SelectLift;n.z2=t.z2+(null!=i?i:qw)}return n}function la(t,e,n){var i=p(t.currentStates,e)>=0,r=t.style.opacity,o=i?null:oa(t,["opacity"],e,{opacity:1});n=n||{};var a=n.style||{};return null==a.opacity&&(n=h({},n),a=h({opacity:i?r:.1*o.opacity},a),n.style=a),n}function ua(t,e){var n=this.states[t];if(this.style){if("emphasis"===t)return aa(this,t,e,n);if("blur"===t)return la(this,t,n);if("select"===t)return sa(this,t,n)}return n}function ha(t){t.stateProxy=ua;var e=t.getTextContent(),n=t.getTextGuideLine();e&&(e.stateProxy=ua),n&&(n.stateProxy=ua)}function ca(t,e){!_a(t,e)&&!t.__highByOuter&&ia(t,Ko)}function pa(t,e){!_a(t,e)&&!t.__highByOuter&&ia(t,$o)}function da(t,e){t.__highByOuter|=1<<(e||0),ia(t,Ko)}function fa(t,e){!(t.__highByOuter&=~(1<<(e||0)))&&ia(t,$o)}function ga(t){ia(t,Qo)}function ya(t){ia(t,Jo)}function va(t){ia(t,ta)}function ma(t){ia(t,ea)}function _a(t,e){return t.__highDownSilentOnTouch&&e.zrByTouch}function xa(t){var e=t.getModel(),n=[],i=[];e.eachComponent(function(e,r){var o=Vw(r),a="series"===e,s=a?t.getViewOfSeriesModel(r):t.getViewOfComponentModel(r);!a&&i.push(s),o.isBlured&&(s.group.traverse(function(t){Jo(t)}),a&&n.push(r)),o.isBlured=!1}),y(i,function(t){t&&t.toggleBlurSeries&&t.toggleBlurSeries(n,!1,e)})}function ba(t,e,n,i){function r(t,e){for(var n=0;nl;)a=r.getItemGraphicEl(l++);if(a){var u=Ew(a);ba(i,u.focus,u.blurScope,n)}else{var h=t.get(["emphasis","focus"]),c=t.get(["emphasis","blurScope"]);null!=h&&ba(i,h,c,n)}}}function Ma(t,e,n,i){var r={focusSelf:!1,dispatchers:null};if(null==t||"series"===t||null==e||null==n)return r;var o=i.getModel().getComponent(t,e);if(!o)return r;var a=i.getViewOfComponentModel(o);if(!a||!a.findHighDownDispatchers)return r;for(var s,l=a.findHighDownDispatchers(n),u=0;u0){var o={dataIndex:r,seriesIndex:t.seriesIndex};null!=i&&(o.dataType=i),e.push(o)}})}),e}function Aa(t,e,n){Ea(t,!0),ia(t,ha),Oa(t,e,n)}function Pa(t){Ea(t,!1)}function La(t,e,n,i){i?Pa(t):Aa(t,e,n)}function Oa(t,e,n){var i=Ew(t);null!=e?(i.focus=e,i.blurScope=n):i.focus&&(i.focus=null)}function Ra(t,e,n,i){n=n||"itemStyle";for(var r=0;r=zw&&(e=Bw[t]=zw++),e}function Ba(t){var e=t.type;return e===Kw||e===$w||e===Qw}function Fa(t){var e=t.type;return e===jw||e===Zw}function Va(t){var e=Fw(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var n=t.states.select||{};e.selectFill=n.style&&n.style.fill||null,e.selectStroke=n.style&&n.style.stroke||null}function Ha(t,e){if(e){var n,i,r,o,a,s,l=t.data,u=t.len(),h=nS.M,c=nS.C,p=nS.L,d=nS.R,f=nS.A,g=nS.Q;for(r=0,o=0;u>r;){switch(n=l[r++],o=r,i=0,n){case h:i=1;break;case p:i=1;break;case c:i=3;break;case g:i=2;break;case f:var y=e[4],v=e[5],m=rS(e[0]*e[0]+e[1]*e[1]),_=rS(e[2]*e[2]+e[3]*e[3]),x=oS(-e[1]/_,e[0]/m);l[r]*=m,l[r++]+=y,l[r]*=_,l[r++]+=v,l[r++]*=m,l[r++]*=_,l[r++]+=x,l[r++]+=x,r+=2,o=r;break;case d:s[0]=l[r++],s[1]=l[r++],ye(s,s,e),l[o++]=s[0],l[o++]=s[1],s[0]+=l[r++],s[1]+=l[r++],ye(s,s,e),l[o++]=s[0],l[o++]=s[1]}for(a=0;i>a;a++){var b=iS[a];b[0]=l[r++],b[1]=l[r++],ye(b,b,e),l[o++]=b[0],l[o++]=b[1]}}t.increaseVersion()}}function Ga(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Wa(t,e){return(t[0]*e[0]+t[1]*e[1])/(Ga(t)*Ga(e))}function Ua(t,e){return(t[0]*e[1]1&&(a*=aS(f),s*=aS(f));var g=(r===o?-1:1)*aS((a*a*s*s-a*a*d*d-s*s*p*p)/(a*a*d*d+s*s*p*p))||0,y=g*a*d/s,v=g*-s*p/a,m=(t+n)/2+lS(c)*y-sS(c)*v,_=(e+i)/2+sS(c)*y+lS(c)*v,x=Ua([1,0],[(p-y)/a,(d-v)/s]),b=[(p-y)/a,(d-v)/s],w=[(-1*p-y)/a,(-1*d-v)/s],S=Ua(b,w);if(Wa(b,w)<=-1&&(S=uS),Wa(b,w)>=1&&(S=0),0>S){var M=Math.round(S/uS*1e6)/1e6;S=2*uS+M%2*uS}h.addData(u,m,_,a,s,x,S,c,o)}function Ya(t){var e=new sw;if(!t)return e;var n,i=0,r=0,o=i,a=r,s=sw.CMD,l=t.match(hS);if(!l)return e;for(var u=0;ug;g++)d[g]=parseFloat(d[g]);for(var y=0;f>y;){var v=void 0,m=void 0,_=void 0,x=void 0,b=void 0,w=void 0,S=void 0,M=i,T=r,I=void 0,C=void 0;switch(c){case"l":i+=d[y++],r+=d[y++],p=s.L,e.addData(p,i,r);break;case"L":i=d[y++],r=d[y++],p=s.L,e.addData(p,i,r);break;case"m":i+=d[y++],r+=d[y++],p=s.M,e.addData(p,i,r),o=i,a=r,c="l";break;case"M":i=d[y++],r=d[y++],p=s.M,e.addData(p,i,r),o=i,a=r,c="L";break;case"h":i+=d[y++],p=s.L,e.addData(p,i,r);break;case"H":i=d[y++],p=s.L,e.addData(p,i,r);break;case"v":r+=d[y++],p=s.L,e.addData(p,i,r);break;case"V":r=d[y++],p=s.L,e.addData(p,i,r);break;case"C":p=s.C,e.addData(p,d[y++],d[y++],d[y++],d[y++],d[y++],d[y++]),i=d[y-2],r=d[y-1];break;case"c":p=s.C,e.addData(p,d[y++]+i,d[y++]+r,d[y++]+i,d[y++]+r,d[y++]+i,d[y++]+r),i+=d[y-2],r+=d[y-1];break;case"S":v=i,m=r,I=e.len(),C=e.data,n===s.C&&(v+=i-C[I-4],m+=r-C[I-3]),p=s.C,M=d[y++],T=d[y++],i=d[y++],r=d[y++],e.addData(p,v,m,M,T,i,r);break;case"s":v=i,m=r,I=e.len(),C=e.data,n===s.C&&(v+=i-C[I-4],m+=r-C[I-3]),p=s.C,M=i+d[y++],T=r+d[y++],i+=d[y++],r+=d[y++],e.addData(p,v,m,M,T,i,r);break;case"Q":M=d[y++],T=d[y++],i=d[y++],r=d[y++],p=s.Q,e.addData(p,M,T,i,r);break;case"q":M=d[y++]+i,T=d[y++]+r,i+=d[y++],r+=d[y++],p=s.Q,e.addData(p,M,T,i,r);break;case"T":v=i,m=r,I=e.len(),C=e.data,n===s.Q&&(v+=i-C[I-4],m+=r-C[I-3]),i=d[y++],r=d[y++],p=s.Q,e.addData(p,v,m,i,r);break;case"t":v=i,m=r,I=e.len(),C=e.data,n===s.Q&&(v+=i-C[I-4],m+=r-C[I-3]),i+=d[y++],r+=d[y++],p=s.Q,e.addData(p,v,m,i,r);break;case"A":_=d[y++],x=d[y++],b=d[y++],w=d[y++],S=d[y++],M=i,T=r,i=d[y++],r=d[y++],p=s.A,Xa(M,T,i,r,w,S,_,x,b,p,e);break;case"a":_=d[y++],x=d[y++],b=d[y++],w=d[y++],S=d[y++],M=i,T=r,i+=d[y++],r+=d[y++],p=s.A,Xa(M,T,i,r,w,S,_,x,b,p,e)}}("z"===c||"Z"===c)&&(p=s.Z,e.addData(p),i=o,r=a),n=p}return e.toStatic(),e}function qa(t){return null!=t.setData}function ja(t,e){var n=Ya(t),i=h({},e);return i.buildPath=function(t){if(qa(t)){t.setData(n.data);var e=t.getContext();e&&t.rebuildPath(e,1)}else{var e=t;n.rebuildPath(e,1)}},i.applyTransform=function(t){Ha(n,t),this.dirtyShape()},i}function Za(t,e){return new pS(ja(t,e))}function Ka(t,n){var i=ja(t,n),r=function(t){function n(e){var n=t.call(this,e)||this;return n.applyTransform=i.applyTransform,n.buildPath=i.buildPath,n}return e(n,t),n}(pS);return r}function $a(t,e){for(var n=[],i=t.length,r=0;i>r;r++){var o=t[r];n.push(o.getUpdatedPathProxy(!0))}var a=new mw(e);return a.createPathProxy(),a.buildPath=function(t){if(qa(t)){t.appendPath(n);var e=t.getContext();e&&t.rebuildPath(e,1)}},a}function Qa(t,e,n,i,r,o,a,s){var l=n-t,u=i-e,h=a-r,c=s-o,p=c*l-h*u; +return CS>p*p?void 0:(p=(h*(e-o)-c*(t-r))/p,[t+p*l,e+p*u])}function Ja(t,e,n,i,r,o,a){var s=t-n,l=e-i,u=(a?o:-o)/MS(s*s+l*l),h=u*l,c=-u*s,p=t+h,d=e+c,f=n+h,g=i+c,y=(p+f)/2,v=(d+g)/2,m=f-p,_=g-d,x=m*m+_*_,b=r-o,w=p*g-f*d,S=(0>_?-1:1)*MS(TS(0,b*b*x-w*w)),M=(w*_-m*S)/x,T=(-w*m-_*S)/x,I=(w*_+m*S)/x,C=(-w*m+_*S)/x,k=M-y,D=T-v,A=I-y,P=C-v;return k*k+D*D>A*A+P*P&&(M=I,T=C),{cx:M,cy:T,x0:-h,y0:-c,x1:M*(r/b-1),y1:T*(r/b-1)}}function ts(t){var e;if(M(t)){var n=t.length;if(!n)return t;e=1===n?[t[0],t[0],0,0]:2===n?[t[0],t[0],t[1],t[1]]:3===n?t.concat(t[2]):t}else e=[t,t,t,t];return e}function es(t,e){var n,i=TS(e.r,0),r=TS(e.r0||0,0),o=i>0,a=r>0;if(o||a){if(o||(i=r,r=0),r>i){var s=i;i=r,r=s}var l=e.startAngle,u=e.endAngle;if(!isNaN(l)&&!isNaN(u)){var h=e.cx,c=e.cy,p=!!e.clockwise,d=SS(u-l),f=d>mS&&d%mS;if(f>CS&&(d=f),i>CS)if(d>mS-CS)t.moveTo(h+i*xS(l),c+i*_S(l)),t.arc(h,c,i,l,u,!p),r>CS&&(t.moveTo(h+r*xS(u),c+r*_S(u)),t.arc(h,c,r,u,l,p));else{var g=void 0,y=void 0,v=void 0,m=void 0,_=void 0,x=void 0,b=void 0,w=void 0,S=void 0,M=void 0,T=void 0,I=void 0,C=void 0,k=void 0,D=void 0,A=void 0,P=i*xS(l),L=i*_S(l),O=r*xS(u),R=r*_S(u),E=d>CS;if(E){var N=e.cornerRadius;N&&(n=ts(N),g=n[0],y=n[1],v=n[2],m=n[3]);var z=SS(i-r)/2;if(_=IS(z,v),x=IS(z,m),b=IS(z,g),w=IS(z,y),T=S=TS(_,x),I=M=TS(b,w),(S>CS||M>CS)&&(C=i*xS(u),k=i*_S(u),D=r*xS(l),A=r*_S(l),vS>d)){var B=Qa(P,L,D,A,C,k,O,R);if(B){var F=P-B[0],V=L-B[1],H=C-B[0],G=k-B[1],W=1/_S(bS((F*H+V*G)/(MS(F*F+V*V)*MS(H*H+G*G)))/2),U=MS(B[0]*B[0]+B[1]*B[1]);T=IS(S,(i-U)/(W+1)),I=IS(M,(r-U)/(W-1))}}}if(E)if(T>CS){var X=IS(v,T),Y=IS(m,T),q=Ja(D,A,P,L,i,X,p),j=Ja(C,k,O,R,i,Y,p);t.moveTo(h+q.cx+q.x0,c+q.cy+q.y0),S>T&&X===Y?t.arc(h+q.cx,c+q.cy,T,wS(q.y0,q.x0),wS(j.y0,j.x0),!p):(X>0&&t.arc(h+q.cx,c+q.cy,X,wS(q.y0,q.x0),wS(q.y1,q.x1),!p),t.arc(h,c,i,wS(q.cy+q.y1,q.cx+q.x1),wS(j.cy+j.y1,j.cx+j.x1),!p),Y>0&&t.arc(h+j.cx,c+j.cy,Y,wS(j.y1,j.x1),wS(j.y0,j.x0),!p))}else t.moveTo(h+P,c+L),t.arc(h,c,i,l,u,!p);else t.moveTo(h+P,c+L);if(r>CS&&E)if(I>CS){var X=IS(g,I),Y=IS(y,I),q=Ja(O,R,C,k,r,-Y,p),j=Ja(P,L,D,A,r,-X,p);t.lineTo(h+q.cx+q.x0,c+q.cy+q.y0),M>I&&X===Y?t.arc(h+q.cx,c+q.cy,I,wS(q.y0,q.x0),wS(j.y0,j.x0),!p):(Y>0&&t.arc(h+q.cx,c+q.cy,Y,wS(q.y0,q.x0),wS(q.y1,q.x1),!p),t.arc(h,c,r,wS(q.cy+q.y1,q.cx+q.x1),wS(j.cy+j.y1,j.cx+j.x1),p),X>0&&t.arc(h+j.cx,c+j.cy,X,wS(j.y1,j.x1),wS(j.y0,j.x0),!p))}else t.lineTo(h+O,c+R),t.arc(h,c,r,u,l,p);else t.lineTo(h+O,c+R)}else t.moveTo(h,c);t.closePath()}}}function ns(t,e,n,i){var r,o,a,s,l=[],u=[],h=[],c=[];if(i){a=[1/0,1/0],s=[-1/0,-1/0];for(var p=0,d=t.length;d>p;p++)ve(a,a,t[p]),me(s,s,t[p]);ve(a,a,i[0]),me(s,s,i[1])}for(var p=0,d=t.length;d>p;p++){var f=t[p];if(n)r=t[p?p-1:d-1],o=t[(p+1)%d];else{if(0===p||p===d-1){l.push(te(t[p]));continue}r=t[p-1],o=t[p+1]}re(u,o,r),he(u,u,e);var g=pe(f,r),y=pe(f,o),v=g+y;0!==v&&(g/=v,y/=v),he(h,u,-g),he(c,u,y);var m=ne([],f,h),_=ne([],f,c);i&&(me(m,m,a),ve(m,m,s),me(_,_,a),ve(_,_,s)),l.push(m),l.push(_)}return n&&l.push(l.shift()),l}function is(t,e,n){var i=e.smooth,r=e.points;if(r&&r.length>=2){if(i){var o=ns(r,i,n,e.smoothConstraint);t.moveTo(r[0][0],r[0][1]);for(var a=r.length,s=0;(n?a:a-1)>s;s++){var l=o[2*s],u=o[2*s+1],h=r[(s+1)%a];t.bezierCurveTo(l[0],l[1],u[0],u[1],h[0],h[1])}}else{t.moveTo(r[0][0],r[0][1]);for(var s=1,c=r.length;c>s;s++)t.lineTo(r[s][0],r[s][1])}n&&t.closePath()}}function rs(t,e,n){var i=t.cpx2,r=t.cpy2;return null!=i||null!=r?[(n?hn:un)(t.x1,t.cpx1,t.cpx2,t.x2,e),(n?hn:un)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(n?vn:yn)(t.x1,t.cpx1,t.x2,e),(n?vn:yn)(t.y1,t.cpy1,t.y2,e)]}function os(t,e,n,i,r){var o;if(e&&e.ecModel){var a=e.ecModel.getUpdatePayload();o=a&&a.animation}var s=e&&e.isAnimationEnabled(),l="update"===t;if(s){var u=void 0,h=void 0,c=void 0;i?(u=B(i.duration,200),h=B(i.easing,"cubicOut"),c=0):(u=e.getShallow(l?"animationDurationUpdate":"animationDuration"),h=e.getShallow(l?"animationEasingUpdate":"animationEasing"),c=e.getShallow(l?"animationDelayUpdate":"animationDelay")),o&&(null!=o.duration&&(u=o.duration),null!=o.easing&&(h=o.easing),null!=o.delay&&(c=o.delay)),T(c)&&(c=c(n,r)),T(u)&&(u=u(n));var p={duration:u||0,delay:c,easing:h};return p}return null}function as(t,e,n,i,r,o,a){var s,l=!1;T(r)?(a=o,o=r,r=null):D(r)&&(o=r.cb,a=r.during,l=r.isFrom,s=r.removeOpt,r=r.dataIndex);var u="leave"===t;u||e.stopAnimation("leave");var h=os(t,i,r,u?s||{}:null,i&&i.getAnimationDelayParams?i.getAnimationDelayParams(e,r):null);if(h&&h.duration>0){var c=h.duration,p=h.delay,d=h.easing,f={duration:c,delay:p||0,easing:d,done:o,force:!!o||!!a,setToFinal:!u,scope:t,during:a};l?e.animateFrom(n,f):e.animateTo(n,f)}else e.stopAnimation(),!l&&e.attr(n),a&&a(1),o&&o()}function ss(t,e,n,i,r,o){as("update",t,e,n,i,r,o)}function ls(t,e,n,i,r,o){as("enter",t,e,n,i,r,o)}function us(t){if(!t.__zr)return!0;for(var e=0;eMath.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"}function Cs(t){return!t.isGroup}function ks(t){return null!=t.shape}function Ds(t,e,n){function i(t){var e={};return t.traverse(function(t){Cs(t)&&t.anid&&(e[t.anid]=t)}),e}function r(t){var e={x:t.x,y:t.y,rotation:t.rotation};return ks(t)&&(e.shape=h({},t.shape)),e}if(t&&e){var o=i(t);e.traverse(function(t){if(Cs(t)&&t.anid){var e=o[t.anid];if(e){var i=r(t);t.attr(r(e)),ss(t,i,n,Ew(t).dataIndex)}}})}}function As(t,e){return v(t,function(t){var n=t[0];n=nM(n,e.x),n=iM(n,e.x+e.width);var i=t[1];return i=nM(i,e.y),i=iM(i,e.y+e.height),[n,i]})}function Ps(t,e){var n=nM(t.x,e.x),i=iM(t.x+t.width,e.x+e.width),r=nM(t.y,e.y),o=iM(t.y+t.height,e.y+e.height);return i>=n&&o>=r?{x:n,y:r,width:i-n,height:o-r}:void 0}function Ls(t,e,n){var i=h({rectHover:!0},e),r=i.style={strokeNoScale:!0};return n=n||{x:-1,y:-1,width:2,height:2},t?0===t.indexOf("image://")?(r.image=t.slice(8),c(r,n),new Sw(i)):ms(t.replace("path://",""),i,n,"center"):void 0}function Os(t,e,n,i,r){for(var o=0,a=r[r.length-1];og||g>1)return!1;var y=Es(d,f,h,c)/p;return 0>y||y>1?!1:!0}function Es(t,e,n,i){return t*i-n*e}function Ns(t){return 1e-6>=t&&t>=-1e-6}function zs(t){var e=t.itemTooltipOption,n=t.componentModel,i=t.itemName,r=I(e)?{formatter:e}:e,o=n.mainType,a=n.componentIndex,s={componentType:o,name:i,$vars:["name"]};s[o+"Index"]=a;var l=t.formatterParamsExtra;l&&y(b(l),function(t){K(s,t)||(s[t]=l[t],s.$vars.push(t))});var u=Ew(t.el);u.componentMainType=o,u.componentIndex=a,u.tooltipConfig={name:i,option:c({content:i,formatterParams:s},r)}}function Bs(t,e){var n;t.isGroup&&(n=e(t)),n||t.traverse(e)}function Fs(t,e){if(t)if(M(t))for(var n=0;n=0&&n.push(t)}),n}t.topologicalTravel=function(t,e,i,r){function o(t){l[t].entryCount--,0===l[t].entryCount&&u.push(t)}function a(t){h[t]=!0,o(t)}if(t.length){var s=n(e),l=s.graph,u=s.noEntryList,h={};for(y(t,function(t){h[t]=!0});u.length;){var c=u.pop(),p=l[c],d=!!h[c];d&&(i.call(r,c,p.originalDeps.slice()),delete h[c]),y(p.successor,d?a:o)}y(h,function(){var t="";throw new Error(t)})}}}function el(t,e){return l(l({},t,!0),e,!0)}function nl(t,e){t=t.toUpperCase(),LM[t]=new MM(e),PM[t]=e}function il(t){if(I(t)){var e=PM[t.toUpperCase()]||{};return t===kM||t===DM?s(e):l(s(e),s(PM[AM]),!1)}return l(s(t),s(PM[AM]),!1)}function rl(t){return LM[t]}function ol(){return LM[AM]}function al(t,e){return t+="","0000".substr(0,e-t.length)+t}function sl(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function ll(t){return t===sl(t)}function ul(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function hl(t,e,n,i){var r=Ji(t),o=r[fl(n)](),a=r[gl(n)]()+1,s=Math.floor((a-1)/3)+1,l=r[yl(n)](),u=r["get"+(n?"UTC":"")+"Day"](),h=r[vl(n)](),c=(h-1)%12+1,p=r[ml(n)](),d=r[_l(n)](),f=r[xl(n)](),g=i instanceof MM?i:rl(i||OM)||ol(),y=g.getModel("time"),v=y.get("month"),m=y.get("monthAbbr"),_=y.get("dayOfWeek"),x=y.get("dayOfWeekAbbr");return(e||"").replace(/{yyyy}/g,o+"").replace(/{yy}/g,o%100+"").replace(/{Q}/g,s+"").replace(/{MMMM}/g,v[a-1]).replace(/{MMM}/g,m[a-1]).replace(/{MM}/g,al(a,2)).replace(/{M}/g,a+"").replace(/{dd}/g,al(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,_[u]).replace(/{ee}/g,x[u]).replace(/{e}/g,u+"").replace(/{HH}/g,al(h,2)).replace(/{H}/g,h+"").replace(/{hh}/g,al(c+"",2)).replace(/{h}/g,c+"").replace(/{mm}/g,al(p,2)).replace(/{m}/g,p+"").replace(/{ss}/g,al(d,2)).replace(/{s}/g,d+"").replace(/{SSS}/g,al(f,3)).replace(/{S}/g,f+"")}function cl(t,e,n,i,r){var o=null;if(I(n))o=n;else if(T(n))o=n(t.value,e,{level:t.level});else{var a=h({},FM);if(t.level>0)for(var s=0;s=0;--s)if(l[u]){o=l[u];break}o=o||a.none}if(M(o)){var d=null==t.level?0:t.level>=0?t.level:o.length+t.level;d=Math.min(d,o.length-1),o=o[d]}}return hl(new Date(t.value),o,r,i)}function pl(t,e){var n=Ji(t),i=n[gl(e)]()+1,r=n[yl(e)](),o=n[vl(e)](),a=n[ml(e)](),s=n[_l(e)](),l=n[xl(e)](),u=0===l,h=u&&0===s,c=h&&0===a,p=c&&0===o,d=p&&1===r,f=d&&1===i;return f?"year":d?"month":p?"day":c?"hour":h?"minute":u?"second":"millisecond"}function dl(t,e,n){var i=k(t)?Ji(t):t;switch(e=e||pl(t,n)){case"year":return i[fl(n)]();case"half-year":return i[gl(n)]()>=6?1:0;case"quarter":return Math.floor((i[gl(n)]()+1)/4);case"month":return i[gl(n)]();case"day":return i[yl(n)]();case"half-day":return i[vl(n)]()/24;case"hour":return i[vl(n)]();case"minute":return i[ml(n)]();case"second":return i[_l(n)]();case"millisecond":return i[xl(n)]()}}function fl(t){return t?"getUTCFullYear":"getFullYear"}function gl(t){return t?"getUTCMonth":"getMonth"}function yl(t){return t?"getUTCDate":"getDate"}function vl(t){return t?"getUTCHours":"getHours"}function ml(t){return t?"getUTCMinutes":"getMinutes"}function _l(t){return t?"getUTCSeconds":"getSeconds"}function xl(t){return t?"getUTCMilliseconds":"getMilliseconds"}function bl(t){return t?"setUTCFullYear":"setFullYear"}function wl(t){return t?"setUTCMonth":"setMonth"}function Sl(t){return t?"setUTCDate":"setDate"}function Ml(t){return t?"setUTCHours":"setHours"}function Tl(t){return t?"setUTCMinutes":"setMinutes"}function Il(t){return t?"setUTCSeconds":"setSeconds"}function Cl(t){return t?"setUTCMilliseconds":"setMilliseconds"}function kl(t,e,n,i,r,o,a,s){var l=new Pw({style:{text:t,font:e,align:n,verticalAlign:i,padding:r,rich:o,overflow:a?"truncate":null,lineHeight:s}});return l.getBoundingRect()}function Dl(t){if(!ar(t))return I(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function Al(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}function Pl(t,e,n){function i(t){return t&&W(t)?t:"-"}function r(t){return!(null==t||isNaN(t)||!isFinite(t))}var o="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",a="time"===e,s=t instanceof Date;if(a||s){var l=a?Ji(t):t;if(!isNaN(+l))return hl(l,o,n);if(s)return"-"}if("ordinal"===e)return C(t)?i(t):k(t)&&r(t)?t+"":"-";var u=or(t);return r(u)?Dl(u):C(t)?i(t):"boolean"==typeof t?t+"":"-"}function Ll(t,e,n){M(e)||(e=[e]);var i=e.length;if(!i)return"";for(var r=e[0].$vars||[],o=0;os;s++)for(var l=0;l':'';var a=n.markerId||"markerX";return{renderMode:o,content:"{"+a+"|} ",style:"subItem"===r?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}}function Rl(t,e,n){("week"===t||"month"===t||"quarter"===t||"half-year"===t||"year"===t)&&(t="MM-dd\nyyyy");var i=Ji(e),r=n?"getUTC":"get",o=i[r+"FullYear"](),a=i[r+"Month"]()+1,s=i[r+"Date"](),l=i[r+"Hours"](),u=i[r+"Minutes"](),h=i[r+"Seconds"](),c=i[r+"Milliseconds"]();return t=t.replace("MM",al(a,2)).replace("M",a).replace("yyyy",o).replace("yy",al(o%100+"",2)).replace("dd",al(s,2)).replace("d",s).replace("hh",al(l,2)).replace("h",l).replace("mm",al(u,2)).replace("m",u).replace("ss",al(h,2)).replace("s",h).replace("SSS",al(c,3))}function El(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function Nl(t,e){return e=e||"transparent",I(t)?t:D(t)?t.colorStops&&(t.colorStops[0]||{}).color||e:e}function zl(t,e){if("_blank"===e||"blank"===e){var n=window.open();n.opener=null,n.location.href=t}else window.open(t,e)}function Bl(t,e,n,i,r){var o=0,a=0;null==i&&(i=1/0),null==r&&(r=1/0);var s=0;e.eachChild(function(l,u){var h,c,p=l.getBoundingRect(),d=e.childAt(u+1),f=d&&d.getBoundingRect();if("horizontal"===t){var g=p.width+(f?-f.x+p.x:0);h=o+g,h>i||l.newline?(o=0,h=g,a+=s+n,s=p.height):s=Math.max(s,p.height)}else{var y=p.height+(f?-f.y+p.y:0);c=a+y,c>r||l.newline?(o+=s+n,a=0,c=y,s=p.width):s=Math.max(s,p.width)}l.newline||(l.x=o,l.y=a,l.markRedraw(),"horizontal"===t?o=h+n:a=c+n)})}function Fl(t,e,n){n=UM(n||0);var i=e.width,r=e.height,o=Gi(t.left,i),a=Gi(t.top,r),s=Gi(t.right,i),l=Gi(t.bottom,r),u=Gi(t.width,i),h=Gi(t.height,r),c=n[2]+n[0],p=n[1]+n[3],d=t.aspect;switch(isNaN(u)&&(u=i-s-p-o),isNaN(h)&&(h=r-l-c-a),null!=d&&(isNaN(u)&&isNaN(h)&&(d>i/r?u=.8*i:h=.8*r),isNaN(u)&&(u=d*h),isNaN(h)&&(h=u/d)),isNaN(o)&&(o=i-s-u-p),isNaN(a)&&(a=r-l-h-c),t.left||t.right){case"center":o=i/2-u/2-n[3];break;case"right":o=i-u-p}switch(t.top||t.bottom){case"middle":case"center":a=r/2-h/2-n[0];break;case"bottom":a=r-h-c}o=o||0,a=a||0,isNaN(u)&&(u=i-p-o-(s||0)),isNaN(h)&&(h=r-c-a-(l||0));var f=new I_(o+n[3],a+n[0],u,h);return f.margin=n,f}function Vl(t){var e=t.layoutMode||t.constructor.layoutMode;return D(e)?e:e?{type:e}:null}function Hl(t,e,n){function i(n,i){var a={},l=0,u={},h=0,c=2;if(qM(n,function(e){u[e]=t[e]}),qM(n,function(t){r(e,t)&&(a[t]=u[t]=e[t]),o(a,t)&&l++,o(u,t)&&h++}),s[i])return o(e,n[1])?u[n[2]]=null:o(e,n[2])&&(u[n[1]]=null),u;if(h!==c&&l){if(l>=c)return a;for(var p=0;pi;i++)t.push(e+i)}function r(t){var e=t.dimsDef;return e?e.length:1}var o={},a=ql(e);if(!a||!t)return o;var s,l,u=[],h=[],c=e.ecModel,p=fT(c).datasetMap,d=a.uid+"_"+n.seriesLayoutBy;t=t.slice(),y(t,function(e,n){var i=D(e)?e:t[n]={name:e};"ordinal"===i.type&&null==s&&(s=n,l=r(i)),o[i.name]=[]});var f=p.get(d)||p.set(d,{categoryWayDim:l,valueWayDim:0});return y(t,function(t,e){var n=t.name,a=r(t);if(null==s){var l=f.valueWayDim;i(o[n],l,a),i(h,l,a),f.valueWayDim+=a}else if(s===e)i(o[n],0,a),i(u,0,a);else{var l=f.categoryWayDim;i(o[n],l,a),i(h,l,a),f.categoryWayDim+=a}}),u.length&&(o.itemName=u),h.length&&(o.seriesName=h),o}function ql(t){var e=t.get("data",!0);return e?void 0:Rr(t.ecModel,"dataset",{index:t.get("datasetIndex",!0),id:t.get("datasetId",!0)},db).models[0]}function jl(t){return t.get("transform",!0)||t.get("fromTransformResult",!0)?Rr(t.ecModel,"dataset",{index:t.get("fromDatasetIndex",!0),id:t.get("fromDatasetId",!0)},db).models:[]}function Zl(t,e){return Kl(t.data,t.sourceFormat,t.seriesLayoutBy,t.dimensionsDefine,t.startIndex,e)}function Kl(t,e,n,i,r,o){function a(t){var e=I(t);return null!=t&&isFinite(t)&&""!==t?e?dT.Might:dT.Not:e&&"-"!==t?dT.Must:void 0}var s,l=5;if(P(t))return dT.Not;var u,h;if(i){var c=i[o];D(c)?(u=c.name,h=c.type):I(c)&&(u=c)}if(null!=h)return"ordinal"===h?dT.Must:dT.Not;if(e===aT){var p=t;if(n===pT){for(var d=p[o],f=0;f<(d||[]).length&&l>f;f++)if(null!=(s=a(d[r+f])))return s}else for(var f=0;ff;f++){var g=p[r+f];if(g&&null!=(s=a(g[o])))return s}}else if(e===sT){var y=t;if(!u)return dT.Not;for(var f=0;ff;f++){var v=y[f];if(v&&null!=(s=a(v[u])))return s}}else if(e===lT){var m=t;if(!u)return dT.Not;var d=m[u];if(!d||P(d))return dT.Not;for(var f=0;ff;f++)if(null!=(s=a(d[f])))return s}else if(e===oT)for(var _=t,f=0;f<_.length&&l>f;f++){var v=_[f],x=fr(v);if(!M(x))return dT.Not;if(null!=(s=a(x[o])))return s}return dT.Not}function $l(t,e,n){var i=gT.get(e);if(!i)return n;var r=i(t);return r?n.concat(r):n}function Ql(t,e){for(var n=t.length,i=0;n>i;i++)if(t[i].length>e)return t[i];return t[n-1]}function Jl(t,e,n,i,r,o,a){o=o||t;var s=e(o),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(r))return u[r];var h=null!=a&&i?Ql(i,a):n;if(h=h||n,h&&h.length){var c=h[l];return r&&(u[r]=c),s.paletteIdx=(l+1)%h.length,c}}function tu(t,e){e(t).paletteIdx=0,e(t).paletteNameMap={}}function eu(t,e){if(e){var n=e.seriesIndex,i=e.seriesId,r=e.seriesName;return null!=n&&t.componentIndex!==n||null!=i&&t.id!==i||null!=r&&t.name!==r}}function nu(t,e){var n=t.color&&!t.colorLayer;y(e,function(e,i){"colorLayer"===i&&n||QM.hasClass(i)||("object"==typeof e?t[i]=t[i]?l(t[i],e,!1):s(e):null==t[i]&&(t[i]=e))})}function iu(t,e,n){if(M(e)){var i=Y();return y(e,function(t){if(null!=t){var e=Tr(t,null);null!=e&&i.set(t,!0)}}),_(n,function(e){return e&&i.get(e[t])})}var r=Tr(e,null);return _(n,function(e){return e&&null!=r&&e[t]===r})}function ru(t,e){return e.hasOwnProperty("subType")?_(t,function(t){return t&&t.subType===e.subType}):t}function ou(t){var e=Y();return t&&y(pr(t.replaceMerge),function(t){e.set(t,!0)}),{replaceMergeMainTypeMap:e}}function au(t,e,n){function i(t){y(e,function(e){e(t,n)})}var r,o,a=[],s=t.baseOption,l=t.timeline,u=t.options,h=t.media,c=!!t.media,p=!!(u||l||s&&s.timeline);return s?(o=s,o.timeline||(o.timeline=l)):((p||c)&&(t.options=t.media=null),o=t),c&&M(h)&&y(h,function(t){t&&t.option&&(t.query?a.push(t):r||(r=t))}),i(o),y(u,function(t){return i(t)}),y(a,function(t){return i(t.option)}),{baseOption:o,timelineOptions:u||[],mediaDefault:r,mediaList:a}}function su(t,e,n){var i={width:e,height:n,aspectratio:e/n},r=!0;return y(t,function(t,e){var n=e.match(PT);if(n&&n[1]&&n[2]){var o=n[1],a=n[2].toLowerCase();lu(i[a],t,o)||(r=!1)}}),r}function lu(t,e,n){return"min"===n?t>=e:"max"===n?e>=t:t===e}function uu(t,e){return t.join(",")===e.join(",")}function hu(t){var e=t&&t.itemStyle;if(e)for(var n=0,i=ET.length;i>n;n++){var r=ET[n],o=e.normal,a=e.emphasis;o&&o[r]&&(t[r]=t[r]||{},t[r].normal?l(t[r].normal,o[r]):t[r].normal=o[r],o[r]=null),a&&a[r]&&(t[r]=t[r]||{},t[r].emphasis?l(t[r].emphasis,a[r]):t[r].emphasis=a[r],a[r]=null)}}function cu(t,e,n){if(t&&t[e]&&(t[e].normal||t[e].emphasis)){var i=t[e].normal,r=t[e].emphasis;i&&(n?(t[e].normal=t[e].emphasis=null,c(t[e],i)):t[e]=i),r&&(t.emphasis=t.emphasis||{},t.emphasis[e]=r,r.focus&&(t.emphasis.focus=r.focus),r.blurScope&&(t.emphasis.blurScope=r.blurScope))}}function pu(t){cu(t,"itemStyle"),cu(t,"lineStyle"),cu(t,"areaStyle"),cu(t,"label"),cu(t,"labelLine"),cu(t,"upperLabel"),cu(t,"edgeLabel")}function du(t,e){var n=RT(t)&&t[e],i=RT(n)&&n.textStyle;if(i)for(var r=0,o=cb.length;o>r;r++){var a=cb[r];i.hasOwnProperty(a)&&(n[a]=i[a])}}function fu(t){t&&(pu(t),du(t,"label"),t.emphasis&&du(t.emphasis,"label"))}function gu(t){if(RT(t)){hu(t),pu(t),du(t,"label"),du(t,"upperLabel"),du(t,"edgeLabel"),t.emphasis&&(du(t.emphasis,"label"),du(t.emphasis,"upperLabel"),du(t.emphasis,"edgeLabel"));var e=t.markPoint;e&&(hu(e),fu(e));var n=t.markLine;n&&(hu(n),fu(n));var i=t.markArea;i&&fu(i);var r=t.data;if("graph"===t.type){r=r||t.nodes;var o=t.links||t.edges;if(o&&!P(o))for(var a=0;a=0;g--){var y=t[g];if(s||(d=y.data.rawIndexOf(y.stackedByDimension,p)),d>=0){var v=y.data.getByRawIndex(y.stackResultDimension,d);if("all"===l||"positive"===l&&v>0||"negative"===l&&0>v||"samesign"===l&&c>=0&&v>0||"samesign"===l&&0>=c&&0>v){c=Ki(c,v),f=v;break}}}return i[0]=c,i[1]=f,i})})}function Au(t){return t instanceof FT}function Pu(t,e,n){n=n||Ru(t);var i=e.seriesLayoutBy,r=Eu(t,n,i,e.sourceHeader,e.dimensions),o=new FT({data:t,sourceFormat:n,seriesLayoutBy:i,dimensionsDefine:r.dimensionsDefine,startIndex:r.startIndex,dimensionsDetectedCount:r.dimensionsDetectedCount,metaRawOption:s(e)});return o}function Lu(t){return new FT({data:t,sourceFormat:P(t)?uT:oT})}function Ou(t){return new FT({data:t.data,sourceFormat:t.sourceFormat,seriesLayoutBy:t.seriesLayoutBy,dimensionsDefine:s(t.dimensionsDefine),startIndex:t.startIndex,dimensionsDetectedCount:t.dimensionsDetectedCount})}function Ru(t){var e=hT;if(P(t))e=uT;else if(M(t)){0===t.length&&(e=aT);for(var n=0,i=t.length;i>n;n++){var r=t[n];if(null!=r){if(M(r)){e=aT;break}if(D(r)){e=sT;break}}}}else if(D(t))for(var o in t)if(K(t,o)&&g(t[o])){e=lT;break}return e}function Eu(t,e,n,i,r){var o,a;if(!t)return{dimensionsDefine:zu(r),startIndex:a,dimensionsDetectedCount:o};if(e===aT){var s=t;"auto"===i||null==i?Bu(function(t){null!=t&&"-"!==t&&(I(t)?null==a&&(a=1):a=0)},n,s,10):a=k(i)?i:i?1:0,r||1!==a||(r=[],Bu(function(t,e){r[e]=null!=t?t+"":""},n,s,1/0)),o=r?r.length:n===pT?s.length:s[0]?s[0].length:null}else if(e===sT)r||(r=Nu(t));else if(e===lT)r||(r=[],y(t,function(t,e){r.push(e)}));else if(e===oT){var l=fr(t[0]);o=M(l)&&l.length||1}return{startIndex:a,dimensionsDefine:zu(r),dimensionsDetectedCount:o}}function Nu(t){for(var e,n=0;nr;r++)t(n[r]?n[r][0]:null,r);else for(var o=n[0]||[],r=0;rr;r++)t(o[r],r)}function Fu(t){var e=t.sourceFormat;return e===sT||e===lT}function Vu(t,e){var n=GT[Wu(t,e)];return n}function Hu(t,e){var n=UT[Wu(t,e)];return n}function Gu(t){var e=YT[t];return e}function Wu(t,e){return t===aT?t+"_"+e:t}function Uu(t,e,n){if(t){var i=t.getRawDataItem(e);if(null!=i){var r=t.getStore(),o=r.getSource().sourceFormat;if(null!=n){var a=t.getDimensionIndex(n),s=r.getDimensionProperty(a);return Gu(o)(i,a,s)}var l=i;return o===oT&&(l=fr(i)),l}}}function Xu(t){var e,n;return D(t)?t.type&&(n=t):e=t,{text:e,frag:n}}function Yu(t){return new ZT(t)}function qu(t,e){var n=e&&e.type;return"ordinal"===n?t:("time"!==n||k(t)||null==t||"-"===t||(t=+Ji(t)),null==t||""===t?0/0:+t)}function ju(t,e){var n=new JT,i=t.data,r=n.sourceFormat=t.sourceFormat,o=t.startIndex,a="";t.seriesLayoutBy!==cT&&hr(a);var s=[],l={},u=t.dimensionsDefine;if(u)y(u,function(t,e){var n=t.name,i={index:e,name:n,displayName:t.displayName};if(s.push(i),null!=n){var r="";K(l,n)&&hr(r),l[n]=i}});else for(var h=0;ho;o++)r.push(n[o].slice());return r}if(e===sT){for(var r=[],o=0,a=n.length;a>o;o++)r.push(h({},n[o]));return r}}function $u(t,e,n){return null!=n?k(n)||!isNaN(n)&&!K(e,n)?t[n]:K(e,n)?e[n]:void 0:void 0}function Qu(t){return s(t)}function Ju(t){t=s(t);var e=t.type,n="";e||hr(n);var i=e.split(":");2!==i.length&&hr(n);var r=!1;"echarts"===i[0]&&(e=i[1],r=!0),t.__isBuiltIn=r,tI.set(e,t)}function th(t,e,n){var i=pr(t),r=i.length,o="";r||hr(o);for(var a=0,s=r;s>a;a++){var l=i[a];e=eh(l,e,n,1===r?null:a),a!==s-1&&(e.length=Math.max(e.length,1))}return e}function eh(t,e){var n="";e.length||hr(n),D(t)||hr(n);var i=t.type,r=tI.get(i);r||hr(n);var o=v(e,function(t){return ju(t,r)}),a=pr(r.transform({upstream:o[0],upstreamList:o,config:s(t.config)}));return v(a,function(t,n){var i="";D(t)||hr(i),t.data||hr(i);var r=Ru(t.data);nh(r)||hr(i);var o,a=e[0];if(a&&0===n&&!t.dimensions){var s=a.startIndex;s&&(t.data=a.data.slice(0,s).concat(t.data)),o={seriesLayoutBy:cT,sourceHeader:s,dimensions:a.metaRawOption.dimensions}}else o={seriesLayoutBy:cT,sourceHeader:0,dimensions:t.dimensions};return Pu(t.data,o,null)})}function nh(t){return t===aT||t===sT}function ih(t){return t>65535?nI:iI}function rh(){return[1/0,-1/0]}function oh(t){var e=t.constructor;return e===Array?t.slice():new e(t)}function ah(t,e,n,i,r){var o=aI[n||"float"];if(r){var a=t[e],s=a&&a.length;if(s!==i){for(var l=new o(i),u=0;s>u;u++)l[u]=a[u];t[e]=l}}else t[e]=new o(i)}function sh(t){var e=t.option.transform;e&&U(t.option.transform)}function lh(t){return"series"===t.mainType}function uh(t){throw new Error(t)}function hh(t,e){var n=t.color||"#6e7079",i=t.fontSize||12,r=t.fontWeight||"400",o=t.color||"#464646",a=t.fontSize||14,s=t.fontWeight||"900";return"html"===e?{nameStyle:"font-size:"+Ie(i+"")+"px;color:"+Ie(n)+";font-weight:"+Ie(r+""),valueStyle:"font-size:"+Ie(a+"")+"px;color:"+Ie(o)+";font-weight:"+Ie(s+"")}:{nameStyle:{fontSize:i,fill:n,fontWeight:r},valueStyle:{fontSize:a,fill:o,fontWeight:s}}}function ch(t,e){return e.type=t,e}function ph(t){return"section"===t.type}function dh(t){return ph(t)?gh:yh}function fh(t){if(ph(t)){var e=0,n=t.blocks.length,i=n>1||n>0&&!t.noHeader;return y(t.blocks,function(t){var n=fh(t);n>=e&&(e=n+ +(i&&(!n||ph(t)&&!t.noHeader)))}),e}return 0}function gh(t,e,n,i){var r=e.noHeader,o=mh(fh(e)),a=[],s=e.blocks||[];G(!s||M(s)),s=s||[];var l=t.orderMode;if(e.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(K(u,l)){var c=new QT(u[l],null);s.sort(function(t,e){return c.evaluate(t.sortParam,e.sortParam)})}else"seriesDesc"===l&&s.reverse()}y(s,function(n,r){var s=e.valueFormatter,l=dh(n)(s?h(h({},t),{valueFormatter:s}):t,n,r>0?o.html:0,i);null!=l&&a.push(l)});var p="richText"===t.renderMode?a.join(o.richText):_h(a.join(""),r?n:o.html);if(r)return p;var d=Pl(e.header,"ordinal",t.useUTC),f=hh(i,t.renderMode).nameStyle;return"richText"===t.renderMode?wh(t,d,f)+o.richText+p:_h('
            '+Ie(d)+"
            "+p,n)}function yh(t,e,n,i){var r=t.renderMode,o=e.noName,a=e.noValue,s=!e.markerType,l=e.name,u=t.useUTC,h=e.valueFormatter||t.valueFormatter||function(t){return t=M(t)?t:[t],v(t,function(t,e){return Pl(t,M(d)?d[e]:d,u)})};if(!o||!a){var c=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",r),p=o?"":Pl(l,"ordinal",u),d=e.valueType,f=a?[]:h(e.value),g=!s||!o,y=!s&&o,m=hh(i,r),_=m.nameStyle,x=m.valueStyle;return"richText"===r?(s?"":c)+(o?"":wh(t,p,_))+(a?"":Sh(t,f,g,y,x)):_h((s?"":c)+(o?"":xh(p,!s,_))+(a?"":bh(f,g,y,x)),n)}}function vh(t,e,n,i,r,o){if(t){var a=dh(t),s={useUTC:r,renderMode:n,orderMode:i,markupStyleCreator:e,valueFormatter:t.valueFormatter};return a(s,t,0,o)}}function mh(t){return{html:hI[t],richText:cI[t]}}function _h(t,e){var n='
            ',i="margin: "+e+"px 0 0";return'
            '+t+n+"
            "}function xh(t,e,n){var i=e?"margin-left:2px":"";return''+Ie(t)+""}function bh(t,e,n,i){var r=n?"10px":"20px",o=e?"float:right;margin-left:"+r:"";return t=M(t)?t:[t],''+v(t,function(t){return Ie(t)}).join("  ")+""}function wh(t,e,n){return t.markupStyleCreator.wrapRichTextStyle(e,n)}function Sh(t,e,n,i,r){var o=[r],a=i?10:20;return n&&o.push({padding:[0,0,0,a],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(M(e)?e.join(" "):e,o)}function Mh(t,e){var n=t.getData().getItemVisual(e,"style"),i=n[t.visualDrawType];return Nl(i)}function Th(t,e){var n=t.get("padding");return null!=n?n:"richText"===e?[8,10]:10}function Ih(t){var e,n,i,r,o=t.series,a=t.dataIndex,s=t.multipleSeries,l=o.getData(),u=l.mapDimensionsAll("defaultedTooltip"),h=u.length,c=o.getRawValue(a),p=M(c),d=Mh(o,a);if(h>1||p&&!h){var f=Ch(c,o,a,u,d);e=f.inlineValues,n=f.inlineValueTypes,i=f.blocks,r=f.inlineValues[0]}else if(h){var g=l.getDimensionInfo(u[0]);r=e=Uu(l,a,u[0]),n=g.type}else r=e=p?c[0]:c;var y=Ir(o),v=y&&o.name||"",m=l.getName(a),_=s?v:m;return ch("section",{header:v,noHeader:s||!y,sortParam:r,blocks:[ch("nameValue",{markerType:"item",markerColor:d,name:_,noName:!W(_),value:e,valueType:n})].concat(i||[])})}function Ch(t,e,n,i,r){function o(t,e){var n=a.getDimensionInfo(e);n&&n.otherDims.tooltip!==!1&&(s?h.push(ch("nameValue",{markerType:"subItem",markerColor:r,name:n.displayName,value:t,valueType:n.type})):(l.push(t),u.push(n.type)))}var a=e.getData(),s=m(t,function(t,e,n){var i=a.getDimensionInfo(n);return t=t||i&&i.tooltip!==!1&&null!=i.displayName},!1),l=[],u=[],h=[];return i.length?y(i,function(t){o(Uu(a,n,t),t)}):y(t,o),{inlineValues:l,inlineValueTypes:u,blocks:h}}function kh(t,e){return t.getName(e)||t.getId(e)}function Dh(t){var e=t.name;Ir(t)||(t.name=Ah(t)||e)}function Ah(t){var e=t.getRawData(),n=e.mapDimensionsAll("seriesName"),i=[];return y(n,function(t){var n=e.getDimensionInfo(t);n.displayName&&i.push(n.displayName)}),i.join(" ")}function Ph(t){return t.model.getRawData().count()}function Lh(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),Oh}function Oh(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function Rh(t,e){y(q(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),function(n){t.wrapMethod(n,S(Eh,e))})}function Eh(t,e){var n=Nh(t);return n&&n.setOutputEnd((e||this).count()),e}function Nh(t){var e=(t.ecModel||{}).scheduler,n=e&&e.getPipeline(t.uid);if(n){var i=n.currentTask;if(i){var r=i.agentStubMap;r&&(i=r.get(t.uid))}return i}}function zh(){var t=Pr();return function(e){var n=t(e),i=e.pipelineContext,r=!!n.large,o=!!n.progressiveRender,a=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(r===a&&o===s)&&"reset"}}function Bh(t,e,n){t&&Na(t)&&("emphasis"===e?da:fa)(t,n)}function Fh(t,e,n){var i=Ar(t,e),r=e&&null!=e.highlightKey?za(e.highlightKey):null;null!=i?y(pr(i),function(e){Bh(t.getItemGraphicEl(e),n,r)}):t.eachItemGraphicEl(function(t){Bh(t,n,r)})}function Vh(t){return mI(t.model)}function Hh(t){var e=t.model,n=t.ecModel,i=t.api,r=t.payload,o=e.pipelineContext.progressiveRender,a=t.view,s=r&&vI(r).updateMethod,l=o?"incrementalPrepareRender":s&&a[s]?s:"render";return"render"!==l&&a[l](e,n,i,r),bI[l]}function Gh(t,e,n){function i(){h=(new Date).getTime(),c=null,t.apply(a,s||[])}var r,o,a,s,l,u=0,h=0,c=null;e=e||0;var p=function(){for(var t=[],p=0;p=0?i():c=setTimeout(i,-o),u=r};return p.clear=function(){c&&(clearTimeout(c),c=null)},p.debounceNextCall=function(t){l=t},p}function Wh(t,e,n,i){var r=t[e];if(r){var o=r[wI]||r,a=r[MI],s=r[SI];if(s!==n||a!==i){if(null==n||!i)return t[e]=o;r=t[e]=Gh(o,n,"debounce"===i),r[wI]=o,r[MI]=i,r[SI]=n}return r}}function Uh(t,e){var n=t[e];n&&n[wI]&&(n.clear&&n.clear(),t[e]=n[wI])}function Xh(t,e){var n=t.visualStyleMapper||II[e];return n?n:(console.warn("Unkown style type '"+e+"'."),II.itemStyle)}function Yh(t,e){var n=t.visualDrawType||CI[e];return n?n:(console.warn("Unkown style type '"+e+"'."),"fill")}function qh(t,e){e=e||{},c(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var n=new Jx,i=new Cw({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});n.add(i);var r=new Pw({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),o=new Cw({style:{fill:"none"},textContent:r,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});n.add(o);var a;return e.showSpinner&&(a=new WS({shape:{startAngle:-LI/2,endAngle:-LI/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001}),a.animateShape(!0).when(1e3,{endAngle:3*LI/2}).start("circularInOut"),a.animateShape(!0).when(1e3,{startAngle:3*LI/2}).delay(300).start("circularInOut"),n.add(a)),n.resize=function(){var n=r.getBoundingRect().width,s=e.showSpinner?e.spinnerRadius:0,l=(t.getWidth()-2*s-(e.showSpinner&&n?10:0)-n)/2-(e.showSpinner&&n?0:5+n/2)+(e.showSpinner?0:n/2)+(n?0:s),u=t.getHeight()/2;e.showSpinner&&a.setShape({cx:l,cy:u}),o.setShape({x:l-s,y:u-s,width:2*s,height:2*s}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},n.resize(),n}function jh(t){t.overallReset(t.ecModel,t.api,t.payload)}function Zh(t){return t.overallProgress&&Kh}function Kh(){this.agent.dirty(),this.getDownstream().dirty()}function $h(){this.agent&&this.agent.dirty()}function Qh(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function Jh(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=pr(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?v(e,function(t,e){return tc(e)}):RI}function tc(t){return function(e,n){var i=n.data,r=n.resetDefines[t];if(r&&r.dataEach)for(var o=e.start;o=0&&dc(l)?l:.5;var u=t.createRadialGradient(a,s,0,a,s,l);return u}function yc(t,e,n){for(var i="radial"===e.type?gc(t,e,n):fc(t,e,n),r=e.colorStops,o=0;o0?"dashed"===t?[4*e,2*e]:"dotted"===t?[e]:k(t)?[t]:M(t)?t:null:null}function bc(t){var e=t.style,n=e.lineDash&&e.lineWidth>0&&xc(e.lineDash,e.lineWidth),i=e.lineDashOffset;if(n){var r=e.strokeNoScale&&t.getLineScale?t.getLineScale():1;r&&1!==r&&(n=v(n,function(t){return t/r}),i/=r)}return[n,i]}function wc(t){var e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))}function Sc(t){return"string"==typeof t&&"none"!==t}function Mc(t){var e=t.fill;return null!=e&&"none"!==e}function Tc(t,e){if(null!=e.fillOpacity&&1!==e.fillOpacity){var n=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=n}else t.fill()}function Ic(t,e){if(null!=e.strokeOpacity&&1!==e.strokeOpacity){var n=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=n}else t.stroke()}function Cc(t,e,n){var i=$r(e.image,e.__image,n);if(Jr(i)){var r=t.createPattern(i,e.repeat||"repeat");if("function"==typeof DOMMatrix&&r&&r.setTransform){var o=new DOMMatrix;o.translateSelf(e.x||0,e.y||0),o.rotateSelf(0,0,(e.rotation||0)*Zm),o.scaleSelf(e.scaleX||1,e.scaleY||1),r.setTransform(o)}return r}}function kc(t,e,n,i){var r,o=wc(n),a=Mc(n),s=n.strokePercent,l=1>s,u=!e.path;e.silent&&!l||!u||e.createPathProxy();var h=e.path||aC,c=e.__dirty;if(!i){var p=n.fill,d=n.stroke,f=a&&!!p.colorStops,g=o&&!!d.colorStops,y=a&&!!p.image,v=o&&!!d.image,m=void 0,_=void 0,x=void 0,b=void 0,w=void 0;(f||g)&&(w=e.getBoundingRect()),f&&(m=c?yc(t,p,w):e.__canvasFillGradient,e.__canvasFillGradient=m),g&&(_=c?yc(t,d,w):e.__canvasStrokeGradient,e.__canvasStrokeGradient=_),y&&(x=c||!e.__canvasFillPattern?Cc(t,p,e):e.__canvasFillPattern,e.__canvasFillPattern=x),v&&(b=c||!e.__canvasStrokePattern?Cc(t,d,e):e.__canvasStrokePattern,e.__canvasStrokePattern=x),f?t.fillStyle=m:y&&(x?t.fillStyle=x:a=!1),g?t.strokeStyle=_:v&&(b?t.strokeStyle=b:o=!1)}var S=e.getGlobalScale();h.setScale(S[0],S[1],e.segmentIgnoreThreshold);var M,T;t.setLineDash&&n.lineDash&&(r=bc(e),M=r[0],T=r[1]);var I=!0;(u||c&B_)&&(h.setDPR(t.dpr),l?h.setContext(null):(h.setContext(t),I=!1),h.reset(),e.buildPath(h,e.shape,i),h.toStatic(),e.pathUpdated()),I&&h.rebuildPath(t,l?s:1),M&&(t.setLineDash(M),t.lineDashOffset=T),i||(n.strokeFirst?(o&&Ic(t,n),a&&Tc(t,n)):(a&&Tc(t,n),o&&Ic(t,n))),M&&t.setLineDash([])}function Dc(t,e,n){var i=e.__image=$r(n.image,e.__image,e,e.onload);if(i&&Jr(i)){var r=n.x||0,o=n.y||0,a=e.getWidth(),s=e.getHeight(),l=i.width/i.height;if(null==a&&null!=s?a=s*l:null==s&&null!=a?s=a/l:null==a&&null==s&&(a=i.width,s=i.height),n.sWidth&&n.sHeight){var u=n.sx||0,h=n.sy||0;t.drawImage(i,u,h,n.sWidth,n.sHeight,r,o,a,s)}else if(n.sx&&n.sy){var u=n.sx,h=n.sy,c=a-u,p=s-h;t.drawImage(i,u,h,c,p,r,o,a,s)}else t.drawImage(i,r,o,a,s)}}function Ac(t,e,n){var i,r=n.text;if(null!=r&&(r+=""),r){t.font=n.font||Cm,t.textAlign=n.textAlign,t.textBaseline=n.textBaseline;var o=void 0,a=void 0;t.setLineDash&&n.lineDash&&(i=bc(e),o=i[0],a=i[1]),o&&(t.setLineDash(o),t.lineDashOffset=a),n.strokeFirst?(wc(n)&&t.strokeText(r,n.x,n.y),Mc(n)&&t.fillText(r,n.x,n.y)):(Mc(n)&&t.fillText(r,n.x,n.y),wc(n)&&t.strokeText(r,n.x,n.y)),o&&t.setLineDash([])}}function Pc(t,e,n,i,r){var o=!1;if(!i&&(n=n||{},e===n))return!1;if(i||e.opacity!==n.opacity){Bc(t,r),o=!0;var a=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(a)?kb.opacity:a}(i||e.blend!==n.blend)&&(o||(Bc(t,r),o=!0),t.globalCompositeOperation=e.blend||kb.blend);for(var s=0;so;o++){var l=i[o];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),Hc(t,l,s,o===a-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),s.prevEl=l}for(var u=0,h=r.length;h>u;u++){var l=r[u];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),Hc(t,l,s,u===h-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),s.prevEl=l}e.clearTemporalDisplayables(),e.notClear=!0,t.restore()}function Wc(t,e){function n(t){function e(){for(var t=1,e=0,n=v.length;n>e;++e)t=ur(t,v[e]);for(var i=1,e=0,n=y.length;n>e;++e)i=ur(i,y[e].length);t*=i;var r=m*v.length*y.length;return{width:Math.max(1,Math.min(t,s.maxTileWidth)),height:Math.max(1,Math.min(r,s.maxTileHeight))}}function n(){function t(t,e,n,a,l){var u=o?1:i,h=hc(l,t*u,e*u,n*u,a*u,s.color,s.symbolKeepAspect);if(o){var c=r.painter.renderOneToVNode(h);c&&x.children.push(c)}else Vc(d,h)}d&&(d.clearRect(0,0,_.width,_.height),s.backgroundColor&&(d.fillStyle=s.backgroundColor,d.fillRect(0,0,_.width,_.height)));for(var e=0,n=0;n=e))for(var a=-m,l=0,u=0,h=0;a=S)break;if(v%2===0){var M=.5*(1-s.symbolSize),T=p+f[h][v]*M,I=a+g[l]*M,C=f[h][v]*s.symbolSize,k=g[l]*s.symbolSize,D=w/2%y[c].length;t(T,I,C,k,y[c][D])}p+=f[h][v],++w,++v,v===f[h].length&&(v=0)}++h,h===f.length&&(h=0)}a+=g[l],++u,++l,l===g.length&&(l=0)}}for(var a=[i],l=!0,u=0;u=0)){kk.push(n);var o=OI.wrapStageHandler(n,r);o.__prio=e,o.__raw=n,t.push(o)}}function _p(t,e){bk[t]=e}function xp(t){r({createCanvas:t})}function bp(t,e,n){var i=$c("registerMap");i&&i(t,e,n)}function wp(t){var e=$c("getMap");return e&&e(t)}function Sp(t){return null==t?0:t.length||1}function Mp(t){return t}function Tp(t,e){var n={},i=n.encode={},r=Y(),o=[],a=[],s={};y(t.dimensions,function(e){var n=t.getDimensionInfo(e),l=n.coordDim;if(l){var u=n.coordDimIndex;Ip(i,l)[u]=e,n.isExtraCoord||(r.set(l,1),kp(n.type)&&(o[0]=e),Ip(s,l)[u]=t.getDimensionIndex(n.name)),n.defaultTooltip&&a.push(e)}rT.each(function(t,e){var r=Ip(i,e),o=n.otherDims[e];null!=o&&o!==!1&&(r[o]=n.name)})});var l=[],u={};r.each(function(t,e){var n=i[e];u[e]=n[0],l=l.concat(n)}),n.dataDimsOnCoord=l,n.dataDimIndicesOnCoord=v(l,function(e){return t.getDimensionInfo(e).storeDimIndex}),n.encodeFirstDimNotExtra=u;var h=i.label;h&&h.length&&(o=h.slice());var c=i.tooltip;return c&&c.length?a=c.slice():a.length||(a=o.slice()),i.defaultedLabel=o,i.defaultedTooltip=a,n.userOutput=new Fk(s,e),n}function Ip(t,e){return t.hasOwnProperty(e)||(t[e]=[]),t[e]}function Cp(t){return"category"===t?"ordinal":"time"===t?"time":"float"}function kp(t){return!("ordinal"===t||"time"===t)}function Dp(t){return t instanceof Wk}function Ap(t){for(var e=Y(),n=0;n<(t||[]).length;n++){var i=t[n],r=D(i)?i.name:i;null!=r&&null==e.get(r)&&e.set(r,n)}return e}function Pp(t){var e=Hk(t);return e.dimNameMap||(e.dimNameMap=Ap(t.dimensionsDefine))}function Lp(t){return t>30}function Op(t,e){return Rp(t,e).dimensions}function Rp(t,e){function n(t){var e=m[t];if(0>e){var n=a[t],i=D(n)?n:{name:n},r=new Vk,o=i.name;null!=o&&null!=f.get(o)&&(r.name=r.displayName=o),null!=i.type&&(r.type=i.type),null!=i.displayName&&(r.displayName=i.displayName);var s=l.length;return m[t]=s,r.storeDimIndex=t,l.push(r),r}return l[e]}function i(t,e,n){null!=rT.get(e)?t.otherDims[e]=n:(t.coordDim=e,t.coordDimIndex=n,s.set(e,!0))}function r(t){null==t.name&&(t.name=t.coordDim)}Au(t)||(t=Lu(t)),e=e||{};var o=e.coordDimensions||[],a=e.dimensionsDefine||t.dimensionsDefine||[],s=Y(),l=[],u=Np(t,o,a,e.dimensionsCount),p=e.canOmitUnusedDimensions&&Lp(u),d=a===t.dimensionsDefine,f=d?Pp(t):Ap(a),g=e.encodeDefine;!g&&e.encodeDefaulter&&(g=e.encodeDefaulter(t,u));for(var v=Y(g),m=new rI(u),_=0;__;_++)n(_);v.each(function(t,e){var r=pr(t).slice();if(1===r.length&&!I(r[0])&&r[0]<0)return void v.set(e,!1);var o=v.set(e,[]);y(r,function(t,r){var a=I(t)?f.get(t):t;null!=a&&u>a&&(o[r]=a,i(n(a),e,r))})});var x=0;y(o,function(t){var e,r,o,a;if(I(t))e=t,a={};else{a=t,e=a.name;var s=a.ordinalMeta;a.ordinalMeta=null,a=h({},a),a.ordinalMeta=s,r=a.dimsDef,o=a.otherDims,a.name=a.coordDim=a.coordDimIndex=a.dimsDef=a.otherDims=null}var l=v.get(e);if(l!==!1){if(l=pr(l),!l.length)for(var p=0;p<(r&&r.length||1);p++){for(;u>x&&null!=n(x).coordDim;)x++; +u>x&&l.push(x++)}y(l,function(t,s){var l=n(t);if(d&&null!=a.type&&(l.type=a.type),i(c(l,a),e,s),null==l.name&&r){var u=r[s];!D(u)&&(u={name:u}),l.name=l.displayName=u.name,l.defaultTooltip=u.defaultTooltip}o&&c(l.otherDims,o)})}});var b=e.generateCoord,w=e.generateCoordCount,S=null!=w;w=b?w||1:0;var M=b||"value";if(p)y(l,function(t){r(t)}),l.sort(function(t,e){return t.storeDimIndex-e.storeDimIndex});else for(var T=0;u>T;T++){var C=n(T),k=C.coordDim;null==k&&(C.coordDim=zp(M,s,S),C.coordDimIndex=0,(!b||0>=w)&&(C.isExtraCoord=!0),w--),r(C),null!=C.type||Zl(t,T)!==dT.Must&&(!C.isExtraCoord||null==C.otherDims.itemName&&null==C.otherDims.seriesName)||(C.type="ordinal")}return Ep(l),new Wk({source:t,dimensions:l,fullDimensionCount:u,dimensionOmitted:p})}function Ep(t){for(var e=Y(),n=0;n0&&(i.name=r+(o-1)),o++,e.set(r,o)}}function Np(t,e,n,i){var r=Math.max(t.dimensionsDetectedCount||1,e.length,n.length,i||0);return y(e,function(t){var e;D(t)&&(e=t.dimsDef)&&(r=Math.max(r,e.length))}),r}function zp(t,e,n){var i=e.data;if(n||i.hasOwnProperty(t)){for(var r=0;i.hasOwnProperty(t+r);)r++;t+=r}return e.set(t,!0),t}function Bp(t){var e=t.get("coordinateSystem"),n=new Qk(e),i=Jk[e];return i?(i(t,n,n.axisMap,n.categoryAxisMap),n):void 0}function Fp(t){return"category"===t.get("type")}function Vp(t,e,n){n=n||{};var i,r,o,a=n.byIndex,s=n.stackedCoordDimension;Hp(e)?i=e:(r=e.schema,i=r.dimensions,o=e.store);var l,u,h,c,p=!(!t||!t.get("stack"));if(y(i,function(t,e){I(t)&&(i[e]=t={name:t}),p&&!t.isExtraCoord&&(a||l||!t.ordinalMeta||(l=t),u||"ordinal"===t.type||"time"===t.type||s&&s!==t.coordDim||(u=t))}),!u||a||l||(a=!0),u){h="__\x00ecstackresult_"+t.id,c="__\x00ecstackedover_"+t.id,l&&(l.createInvertedIndices=!0);var d=u.coordDim,f=u.type,g=0;y(i,function(t){t.coordDim===d&&g++});var v={name:h,coordDim:d,coordDimIndex:g,type:f,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},m={name:c,coordDim:c,coordDimIndex:g+1,type:f,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};r?(o&&(v.storeDimIndex=o.ensureCalculationDimension(c,f),m.storeDimIndex=o.ensureCalculationDimension(h,f)),r.appendCalculationDimension(v),r.appendCalculationDimension(m)):(i.push(v),i.push(m))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:a,stackedOverDimension:c,stackResultDimension:h}}function Hp(t){return!Dp(t.schema)}function Gp(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function Wp(t,e){return Gp(t,e)?t.getCalculationInfo("stackResultDimension"):e}function Up(t,e){var n,i=t.get("coordinateSystem"),r=AT.get(i);return e&&e.coordSysDims&&(n=v(e.coordSysDims,function(t){var n={name:t},i=e.axisMap.get(t);if(i){var r=i.get("type");n.type=Cp(r)}return n})),n||(n=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||["x","y"]),n}function Xp(t,e,n){var i,r;return n&&y(t,function(t,o){var a=t.coordDim,s=n.categoryAxisMap.get(a);s&&(null==i&&(i=o),t.ordinalMeta=s.getOrdinalMeta(),e&&(t.createInvertedIndices=!0)),null!=t.otherDims.itemName&&(r=!0)}),r||null==i||(t[i].otherDims.itemName=0),i}function Yp(t,e,n){n=n||{};var i,r=e.getSourceManager(),o=!1;t?(o=!0,i=Lu(t)):(i=r.getSource(),o=i.sourceFormat===oT);var a=Bp(e),s=Up(e,a),l=n.useEncodeDefaulter,u=T(l)?l:l?S(Yl,s,e):null,h={coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!o},c=Rp(i,h),p=Xp(c.dimensions,n.createInvertedIndices,a),d=o?null:r.getSharedDataStore(c),f=Vp(e,{schema:c,store:d}),g=new $k(c,e);g.setCalculationInfo(f);var y=null!=p&&qp(i)?function(t,e,n,i){return i===p?n:this.defaultDimValueGetter(t,e,n,i)}:null;return g.hasItemOption=!1,g.initData(o?i:d,null,y),g}function qp(t){if(t.sourceFormat===oT){var e=jp(t.data||[]);return!M(fr(e))}}function jp(t){for(var e=0;ea&&(a=r.interval=n),null!=i&&a>i&&(a=r.interval=i);var s=r.intervalPrecision=Jp(a),l=r.niceTickExtent=[Wi(Math.ceil(t[0]/a)*a,s),Wi(Math.floor(t[1]/a)*a,s)];return ed(l,t),r}function Qp(t){var e=Math.pow(10,er(t)),n=t/e;return n?2===n?n=3:3===n?n=5:n*=2:n=1,Wi(n*e)}function Jp(t){return Xi(t)+2}function td(t,e,n){t[e]=Math.max(Math.min(t[e],n[1]),n[0])}function ed(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),td(t,0,e),td(t,1,e),t[0]>t[1]&&(t[0]=t[1])}function nd(t,e){return t>=e[0]&&t<=e[1]}function id(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function rd(t,e){return t*(e[1]-e[0])+e[0]}function od(t){return M(t)?aD?new Float32Array(t):t:new sD(t)}function ad(t){return t.get("stack")||lD+t.seriesIndex}function sd(t){return t.dim+t.index}function ld(t,e){var n=[];return e.eachSeriesByType(t,function(t){gd(t)&&n.push(t)}),n}function ud(t){var e={};y(t,function(t){var n=t.coordinateSystem,i=n.getBaseAxis();if("time"===i.type||"value"===i.type)for(var r=t.getData(),o=i.dim+"_"+i.index,a=r.getDimensionIndex(r.mapDimension(i.dim)),s=r.getStore(),l=0,u=s.count();u>l;++l){var h=s.get(a,l);e[o]?e[o].push(h):e[o]=[h]}});var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(r){r.sort(function(t,e){return t-e});for(var o=null,a=1;a0&&(o=null===o?s:Math.min(o,s))}n[i]=o}}return n}function hd(t){var e=ud(t),n=[];return y(t,function(t){var i,r=t.coordinateSystem,o=r.getBaseAxis(),a=o.getExtent();if("category"===o.type)i=o.getBandWidth();else if("value"===o.type||"time"===o.type){var s=o.dim+"_"+o.index,l=e[s],u=Math.abs(a[1]-a[0]),h=o.scale.getExtent(),c=Math.abs(h[1]-h[0]);i=l?u/c*l:u}else{var p=t.getData();i=Math.abs(a[1]-a[0])/p.count()}var d=Gi(t.get("barWidth"),i),f=Gi(t.get("barMaxWidth"),i),g=Gi(t.get("barMinWidth")||(yd(t)?.5:1),i),y=t.get("barGap"),v=t.get("barCategoryGap");n.push({bandWidth:i,barWidth:d,barMaxWidth:f,barMinWidth:g,barGap:y,barCategoryGap:v,axisKey:sd(o),stackId:ad(t)})}),cd(n)}function cd(t){var e={};y(t,function(t){var n=t.axisKey,i=t.bandWidth,r=e[n]||{bandWidth:i,remainedWidth:i,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},o=r.stacks;e[n]=r;var a=t.stackId;o[a]||r.autoWidthCount++,o[a]=o[a]||{width:0,maxWidth:0};var s=t.barWidth;s&&!o[a].width&&(o[a].width=s,s=Math.min(r.remainedWidth,s),r.remainedWidth-=s);var l=t.barMaxWidth;l&&(o[a].maxWidth=l);var u=t.barMinWidth;u&&(o[a].minWidth=u);var h=t.barGap;null!=h&&(r.gap=h);var c=t.barCategoryGap;null!=c&&(r.categoryGap=c)});var n={};return y(e,function(t,e){n[e]={};var i=t.stacks,r=t.bandWidth,o=t.categoryGap;if(null==o){var a=b(i).length;o=Math.max(35-4*a,15)+"%"}var s=Gi(o,r),l=Gi(t.gap,1),u=t.remainedWidth,h=t.autoWidthCount,c=(u-s)/(h+(h-1)*l);c=Math.max(c,0),y(i,function(t){var e=t.maxWidth,n=t.minWidth;if(t.width){var i=t.width;e&&(i=Math.min(i,e)),n&&(i=Math.max(i,n)),t.width=i,u-=i+l*i,h--}else{var i=c;e&&i>e&&(i=Math.min(e,u)),n&&n>i&&(i=n),i!==c&&(t.width=i,u-=i+l*i,h--)}}),c=(u-s)/(h+(h-1)*l),c=Math.max(c,0);var p,d=0;y(i,function(t){t.width||(t.width=c),p=t,d+=t.width*(1+l)}),p&&(d-=p.width*l);var f=-d/2;y(i,function(t,i){n[e][i]=n[e][i]||{bandWidth:r,offset:f,width:t.width},f+=t.width*(1+l)})}),n}function pd(t,e,n){if(t&&e){var i=t[sd(e)];return null!=i&&null!=n?i[ad(n)]:i}}function dd(t,e){var n=ld(t,e),i=hd(n);y(n,function(t){var e=t.getData(),n=t.coordinateSystem,r=n.getBaseAxis(),o=ad(t),a=i[sd(r)][o],s=a.offset,l=a.width;e.setLayout({bandWidth:a.bandWidth,offset:s,size:l})})}function fd(t){return{seriesType:t,plan:zh(),reset:function(t){if(gd(t)){var e=t.getData(),n=t.coordinateSystem,i=n.getBaseAxis(),r=n.getOtherAxis(i),o=e.getDimensionIndex(e.mapDimension(r.dim)),a=e.getDimensionIndex(e.mapDimension(i.dim)),s=t.get("showBackground",!0),l=e.mapDimension(r.dim),u=e.getCalculationInfo("stackResultDimension"),h=Gp(e,l)&&!!e.getCalculationInfo("stackedOnSeries"),c=r.isHorizontal(),p=vd(i,r),d=yd(t),f=t.get("barMinHeight")||0,g=u&&e.getDimensionIndex(u),y=e.getLayout("size"),v=e.getLayout("offset");return{progress:function(t,e){for(var i,r=t.count,l=d&&od(3*r),u=d&&s&&od(3*r),m=d&&od(r),_=n.master.getRect(),x=c?_.width:_.height,b=e.getStore(),w=0;null!=(i=t.next());){var S=b.get(h?g:o,i),M=b.get(a,i),T=p,I=void 0;h&&(I=+S-b.get(o,i));var C=void 0,k=void 0,D=void 0,A=void 0;if(c){var P=n.dataToPoint([S,M]);if(h){var L=n.dataToPoint([I,M]);T=L[0]}C=T,k=P[1]+v,D=P[0]-T,A=y,Math.abs(D)D?-1:1)*f)}else{var P=n.dataToPoint([M,S]);if(h){var L=n.dataToPoint([M,I]);T=L[1]}C=P[0]+v,k=T,D=y,A=P[1]-T,Math.abs(A)=A?-1:1)*f)}d?(l[w]=C,l[w+1]=k,l[w+2]=c?D:A,u&&(u[w]=c?_.x:C,u[w+1]=c?k:_.y,u[w+2]=x),m[i]=i):e.setItemLayout(i,{x:C,y:k,width:D,height:A}),w+=3}d&&e.setLayout({largePoints:l,largeDataIndices:m,largeBackgroundPoints:u,valueAxisHorizontal:c})}}}}}}function gd(t){return t.coordinateSystem&&"cartesian2d"===t.coordinateSystem.type}function yd(t){return t.pipelineContext&&t.pipelineContext.large}function vd(t,e){return e.toGlobalCoord(e.dataToCoord("log"===e.type?1:0))}function md(t,e,n,i){var r=Ji(e),o=Ji(n),a=function(t){return dl(r,t,i)===dl(o,t,i)},s=function(){return a("year")},l=function(){return s()&&a("month")},u=function(){return l()&&a("day")},h=function(){return u()&&a("hour")},c=function(){return h()&&a("minute")},p=function(){return c()&&a("second")},d=function(){return p()&&a("millisecond")};switch(t){case"year":return s();case"month":return l();case"day":return u();case"hour":return h();case"minute":return c();case"second":return p();case"millisecond":return d()}}function _d(t){return t/=zM,t>16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function xd(t){var e=30*zM;return t/=e,t>6?6:t>3?3:t>2?2:1}function bd(t){return t/=NM,t>12?12:t>6?6:t>3.5?4:t>2?2:1}function wd(t,e){return t/=e?EM:RM,t>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function Sd(t){return nr(t,!0)}function Md(t,e,n){var i=new Date(t);switch(sl(e)){case"year":case"month":i[wl(n)](0);case"day":i[Sl(n)](1);case"hour":i[Ml(n)](0);case"minute":i[Tl(n)](0);case"second":i[Il(n)](0),i[Cl(n)](0)}return i.getTime()}function Td(t,e,n,i){function r(t,e,n,r,o,a,s){for(var l=new Date(e),u=e,h=l[r]();n>u&&u<=i[1];)s.push({value:u}),h+=t,l[o](h),u=l.getTime();s.push({value:u,notAdd:!0})}function o(t,o,a){var s=[],l=!o.length;if(!md(sl(t),i[0],i[1],n)){l&&(o=[{value:Md(new Date(i[0]),t,n)},{value:i[1]}]);for(var u=0;u1&&0===u&&a.unshift({value:a[0].value-p})}}for(var u=0;u=i[0]&&x<=i[1]&&c++)}var b=(i[1]-i[0])/e;if(c>1.5*b&&p>b/1.5)break;if(u.push(y),c>b||t===s[d])break}h=[]}}}for(var w=_(v(u,function(t){return _(t,function(t){return t.value>=i[0]&&t.value<=i[1]&&!t.notAdd})}),function(t){return t.length>0}),S=[],M=w.length-1,d=0;d0&&i>0||0>n&&0>i)}function Rd(t){var e=t.getLabelModel().get("formatter"),n="category"===t.type?t.scale.getExtent()[0]:null;return"time"===t.scale.type?function(e){return function(n,i){return t.scale.getFormattedLabel(n,i,e)}}(e):I(e)?function(e){return function(n){var i=t.scale.getLabel(n),r=e.replace("{value}",null!=i?i:"");return r}}(e):T(e)?function(e){return function(i,r){return null!=n&&(r=i.value-n),e(Ed(t,i),r,null!=i.level?{level:i.level}:null)}}(e):function(e){return t.scale.getLabel(e)}}function Ed(t,e){return"category"===t.type?t.scale.getLabel(e):e.value}function Nd(t){var e=t.model,n=t.scale;if(e.get(["axisLabel","show"])&&!n.isBlank()){var i,r,o=n.getExtent();n instanceof iD?r=n.count():(i=n.getTicks(),r=i.length);var a,s=t.getLabelModel(),l=Rd(t),u=1;r>40&&(u=Math.ceil(r/40));for(var h=0;r>h;h+=u){var c=i?i[h]:{value:o[0]+h},p=l(c,h),d=s.getTextRect(p),f=zd(d,s.get("rotate")||0);a?a.union(f):a=f}return a}}function zd(t,e){var n=e*Math.PI/180,i=t.width,r=t.height,o=i*Math.abs(Math.cos(n))+Math.abs(r*Math.sin(n)),a=i*Math.abs(Math.sin(n))+Math.abs(r*Math.cos(n)),s=new I_(t.x,t.y,o,a);return s}function Bd(t){var e=t.get("interval");return null==e?"auto":e}function Fd(t){return"category"===t.type&&0===Bd(t.getLabelModel())}function Vd(t,e){var n={};return y(t.mapDimensionsAll(e),function(e){n[Wp(t,e)]=!0}),b(n)}function Hd(t){return Yp(null,t)}function Gd(t,e){var n=e;e instanceof MM||(n=new MM(e));var i=Ld(n);return i.setExtent(t[0],t[1]),Pd(i,n),i}function Wd(t){f(t,MD)}function Ud(t,e){return e=e||{},Us(t,null,null,"normal"!==e.state)}function Xd(t){return M(t)?void y(t,function(t){Xd(t)}):void(p(CD,t)>=0||(CD.push(t),T(t)&&(t={install:t}),t.install(kD)))}function Yd(t,e){return Math.abs(t-e)s;s++){var l=t[s][0],u=t[s][1],h=o*u-l*a;e+=h,n+=(o+l)*h,i+=(a+u)*h,o=l,a=u}return e?[n/e/3,i/e/3,e]:[t[0][0]||0,t[0][1]||0]}function $d(t){if(!t.UTF8Encoding)return t;var e=t,n=e.UTF8Scale;null==n&&(n=1024);var i=e.features;return y(i,function(t){var e=t.geometry,i=e.encodeOffsets,r=e.coordinates;if(i)switch(e.type){case"LineString":e.coordinates=Jd(r,i,n);break;case"Polygon":Qd(r,i,n);break;case"MultiLineString":Qd(r,i,n);break;case"MultiPolygon":y(r,function(t,e){return Qd(t,i[e],n)})}}),e.UTF8Encoding=!1,e}function Qd(t,e,n){for(var i=0;i>1^-(1&s),l=l>>1^-(1&l),s+=r,l+=o,r=s,o=l,i.push([s/n,l/n])}return i}function tf(t,e){return t=$d(t),v(_(t.features,function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0}),function(t){var n=t.properties,i=t.geometry,r=[];switch(i.type){case"Polygon":var o=i.coordinates;r.push(new LD(o[0],o.slice(1)));break;case"MultiPolygon":y(i.coordinates,function(t){t[0]&&r.push(new LD(t[0],t.slice(1)))});break;case"LineString":r.push(new OD([i.coordinates]));break;case"MultiLineString":r.push(new OD(i.coordinates))}var a=new RD(n[e||"name"],r,n.cp);return a.properties=n,a})}function ef(t){return"category"===t.type?rf(t):sf(t)}function nf(t,e){return"category"===t.type?af(t,e):{ticks:v(t.scale.getTicks(),function(t){return t.value})}}function rf(t){var e=t.getLabelModel(),n=of(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}function of(t,e){var n=lf(t,"labels"),i=Bd(e),r=uf(n,i);if(r)return r;var o,a;return T(i)?o=gf(t,i):(a="auto"===i?cf(t):i,o=ff(t,a)),hf(n,i,{labels:o,labelCategoryInterval:a})}function af(t,e){var n=lf(t,"ticks"),i=Bd(e),r=uf(n,i);if(r)return r;var o,a;if((!e.get("show")||t.scale.isBlank())&&(o=[]),T(i))o=gf(t,i,!0);else if("auto"===i){var s=of(t,t.getLabelModel());a=s.labelCategoryInterval,o=v(s.labels,function(t){return t.tickValue})}else a=i,o=ff(t,a,!0);return hf(n,i,{ticks:o,tickCategoryInterval:a})}function sf(t){var e=t.scale.getTicks(),n=Rd(t);return{labels:v(e,function(e,i){return{level:e.level,formattedLabel:n(e,i),rawLabel:t.scale.getLabel(e),tickValue:e.value}})}}function lf(t,e){return VD(t)[e]||(VD(t)[e]=[])}function uf(t,e){for(var n=0;n40&&(s=Math.max(1,Math.floor(a/40)));for(var l=o[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),h=Math.abs(u*Math.cos(i)),c=Math.abs(u*Math.sin(i)),p=0,d=0;l<=o[1];l+=s){var f=0,g=0,y=xi(n({value:l}),e.font,"center","top");f=1.3*y.width,g=1.3*y.height,p=Math.max(p,f,7),d=Math.max(d,g,7)}var v=p/h,m=d/c;isNaN(v)&&(v=1/0),isNaN(m)&&(m=1/0);var _=Math.max(0,Math.floor(Math.min(v,m))),x=VD(t.model),b=t.getExtent(),w=x.lastAutoInterval,S=x.lastTickCount;return null!=w&&null!=S&&Math.abs(w-_)<=1&&Math.abs(S-a)<=1&&w>_&&x.axisExtent0===b[0]&&x.axisExtent1===b[1]?_=w:(x.lastTickCount=a,x.lastAutoInterval=_,x.axisExtent0=b[0],x.axisExtent1=b[1]),_}function df(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function ff(t,e,n){function i(t){var e={value:t};l.push(n?t:{formattedLabel:r(e),rawLabel:o.getLabel(e),tickValue:t})}var r=Rd(t),o=t.scale,a=o.getExtent(),s=t.getLabelModel(),l=[],u=Math.max((e||0)+1,1),h=a[0],c=o.count();0!==h&&u>1&&c/u>2&&(h=Math.round(Math.ceil(h/u)*u));var p=Fd(t),d=s.get("showMinLabel")||p,f=s.get("showMaxLabel")||p;d&&h!==a[0]&&i(a[0]);for(var g=h;g<=a[1];g+=u)i(g);return f&&g-u!==a[1]&&i(a[1]),l}function gf(t,e,n){var i=t.scale,r=Rd(t),o=[];return y(i.getTicks(),function(t){var a=i.getLabel(t),s=t.value;e(t.value,a)&&o.push(n?s:{formattedLabel:r(t),rawLabel:a,tickValue:s})}),o}function yf(t,e){var n=t[1]-t[0],i=e,r=n/i/2;t[0]+=r,t[1]-=r}function vf(t,e,n,i){function r(t,e){return t=Wi(t),e=Wi(e),p?t>e:e>t}var o=e.length;if(t.onBand&&!n&&o){var a,s,l=t.getExtent();if(1===o)e[0].coord=l[0],a=e[1]={coord:l[0]};else{var u=e[o-1].tickValue-e[0].tickValue,h=(e[o-1].coord-e[0].coord)/u;y(e,function(t){t.coord-=h/2});var c=t.scale.getExtent();s=1+c[1]-e[o-1].tickValue,a={coord:e[o-1].coord+h*s},e.push(a)}var p=l[0]>l[1];r(e[0].coord,l[0])&&(i?e[0].coord=l[0]:e.shift()),i&&r(l[0],e[0].coord)&&e.unshift({coord:l[0]}),r(l[1],a.coord)&&(i?a.coord=l[1]:e.pop()),i&&r(a.coord,l[1])&&e.push({coord:l[1]})}}function mf(t){var e=QM.extend(t);return QM.registerClass(e),e}function _f(t){var e=yI.extend(t);return yI.registerClass(e),e}function xf(t){var e=gI.extend(t);return gI.registerClass(e),e}function bf(t){var e=_I.extend(t);return _I.registerClass(e),e}function wf(t,e,n,i,r){var o=n.width,a=n.height;switch(t){case"top":i.set(n.x+o/2,n.y-e),r.set(0,-1);break;case"bottom":i.set(n.x+o/2,n.y+a+e),r.set(0,1);break;case"left":i.set(n.x-e,n.y+a/2),r.set(-1,0);break;case"right":i.set(n.x+o+e,n.y+a/2),r.set(1,0)}}function Sf(t,e,n,i,r,o,a,s,l){a-=t,s-=e;var u=Math.sqrt(a*a+s*s);a/=u,s/=u;var h=a*n+t,c=s*n+e;if(Math.abs(i-r)%WD<1e-4)return l[0]=h,l[1]=c,u-n;if(o){var p=i;i=bo(r),r=bo(p)}else i=bo(i),r=bo(r);i>r&&(r+=WD);var d=Math.atan2(s,a);if(0>d&&(d+=WD),d>=i&&r>=d||d+WD>=i&&r>=d+WD)return l[0]=h,l[1]=c,u-n;var f=n*Math.cos(i)+t,g=n*Math.sin(i)+e,y=n*Math.cos(r)+t,v=n*Math.sin(r)+e,m=(f-a)*(f-a)+(g-s)*(g-s),_=(y-a)*(y-a)+(v-s)*(v-s);return _>m?(l[0]=f,l[1]=g,Math.sqrt(m)):(l[0]=y,l[1]=v,Math.sqrt(_))}function Mf(t,e,n,i,r,o,a,s){var l=r-t,u=o-e,h=n-t,c=i-e,p=Math.sqrt(h*h+c*c);h/=p,c/=p;var d=l*h+u*c,f=d/p;s&&(f=Math.min(Math.max(f,0),1)),f*=p;var g=a[0]=t+f*h,y=a[1]=e+f*c;return Math.sqrt((g-r)*(g-r)+(y-o)*(y-o))}function Tf(t,e,n,i,r,o,a){0>n&&(t+=n,n=-n),0>i&&(e+=i,i=-i);var s=t+n,l=e+i,u=a[0]=Math.min(Math.max(r,t),s),h=a[1]=Math.min(Math.max(o,e),l);return Math.sqrt((u-r)*(u-r)+(h-o)*(h-o))}function If(t,e,n){var i=Tf(e.x,e.y,e.width,e.height,t.x,t.y,YD);return n.set(YD[0],YD[1]),i}function Cf(t,e,n){for(var i,r,o=0,a=0,s=0,l=0,u=1/0,h=e.data,c=t.x,p=t.y,d=0;d=d&&(s=i,l=r);var S=(c-y)*_/m+y;g=Sf(y,v,_,x,x+b,w,S,p,YD),o=Math.cos(x+b)*m+y,a=Math.sin(x+b)*_+v;break;case UD.R:s=o=h[d++],l=a=h[d++];var M=h[d++],T=h[d++];g=Tf(s,l,M,T,c,p,YD);break;case UD.Z:g=Mf(o,a,s,l,c,p,YD,!0),o=s,a=l}u>g&&(u=g,n.set(YD[0],YD[1]))}return u}function kf(t,e){if(t){var n=t.getTextGuideLine(),i=t.getTextContent();if(i&&n){var r=t.textGuideLineConfig||{},o=[[0,0],[0,0],[0,0]],a=r.candidates||XD,s=i.getBoundingRect().clone();s.applyTransform(i.getComputedTransform());var l=1/0,u=r.anchor,h=t.getComputedTransform(),c=h&&We([],h),p=e.get("length2")||0;u&&ZD.copy(u);for(var d=0;dy&&(l=y,jD.transform(h),ZD.transform(h),ZD.toArray(o[0]),jD.toArray(o[1]),qD.toArray(o[2]))}Df(o,e.get("minTurnAngle")),n.setShape({points:o})}}}function Df(t,e){if(180>=e&&e>0){e=e/180*Math.PI,qD.fromArray(t[0]),jD.fromArray(t[1]),ZD.fromArray(t[2]),v_.sub(KD,qD,jD),v_.sub($D,ZD,jD);var n=KD.len(),i=$D.len();if(!(.001>n||.001>i)){KD.scale(1/n),$D.scale(1/i);var r=KD.dot($D),o=Math.cos(e);if(r>o){var a=Mf(jD.x,jD.y,ZD.x,ZD.y,qD.x,qD.y,QD,!1);JD.fromArray(QD),JD.scaleAndAdd($D,a/Math.tan(Math.PI-e));var s=ZD.x!==jD.x?(JD.x-jD.x)/(ZD.x-jD.x):(JD.y-jD.y)/(ZD.y-jD.y);if(isNaN(s))return;0>s?v_.copy(JD,jD):s>1&&v_.copy(JD,ZD),JD.toArray(t[1])}}}}function Af(t,e,n,i){var r="normal"===n,o=r?t:t.ensureState(n);o.ignore=e;var a=i.get("smooth");a&&a===!0&&(a=.3),o.shape=o.shape||{},a>0&&(o.shape.smooth=a);var s=i.getModel("lineStyle").getLineStyle();r?t.useStyle(s):o.style=s}function Pf(t,e){var n=e.smooth,i=e.points;if(i)if(t.moveTo(i[0][0],i[0][1]),n>0&&i.length>=3){var r=Jm(i[0],i[1]),o=Jm(i[1],i[2]);if(!r||!o)return t.lineTo(i[1][0],i[1][1]),void t.lineTo(i[2][0],i[2][1]);var a=Math.min(r,o)*n,s=ge([],i[1],i[0],a/r),l=ge([],i[1],i[2],a/o),u=ge([],s,l,.5);t.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),t.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var h=1;ht){var i=Math.min(e,-t);if(i>0){l(i*n,0,c);var r=i+t;0>r&&u(-r*n,1)}else u(-t*n,1)}}function l(n,i,r){0!==n&&(f=!0);for(var o=i;r>o;o++){var a=t[o],s=a.rect;s[e]+=n,a.label[e]+=n}}function u(i,r){for(var o=[],a=0,s=1;c>s;s++){var u=t[s-1].rect,h=Math.max(t[s].rect[e]-u[e]-u[n],0);o.push(h),a+=h}if(a){var p=Math.min(Math.abs(i)/a,r);if(i>0)for(var s=0;c-1>s;s++){var d=o[s]*p;l(d,0,s+1)}else for(var s=c-1;s>0;s--){var d=o[s-1]*p;l(-d,s,c)}}}function h(t){var e=0>t?-1:1;t=Math.abs(t);for(var n=Math.ceil(t/(c-1)),i=0;c-1>i;i++)if(e>0?l(n,0,i+1):l(-n,c-i-1,c),t-=n,0>=t)return}var c=t.length;if(!(2>c)){t.sort(function(t,n){return t.rect[e]-n.rect[e]});for(var p,d=0,f=!1,g=[],y=0,v=0;c>v;v++){var m=t[v],_=m.rect;p=_[e]-d,0>p&&(_[e]-=p,m.label[e]-=p,f=!0);var x=Math.max(-p,0);g.push(x),y+=x,d=_[e]+_[n]}y>0&&o&&l(-y/c,0,c);var b,w,S=t[0],M=t[c-1];return a(),0>b&&u(-b,.8),0>w&&u(w,.8),a(),s(b,w,1),s(w,b,-1),a(),0>b&&h(-b),0>w&&h(w),f}}function Nf(t,e,n,i){return Ef(t,"x","width",e,n,i)}function zf(t,e,n,i){return Ef(t,"y","height",e,n,i)}function Bf(t){function e(t){if(!t.ignore){var e=t.ensureState("emphasis");null==e.ignore&&(e.ignore=!1)}t.ignore=!0}var n=[];t.sort(function(t,e){return e.priority-t.priority});for(var i=new I_(0,0,0,0),r=0;r10&&"cartesian2d"===o.type&&r){var s=o.getBaseAxis(),l=o.getOtherAxis(s),u=s.getExtent(),h=n.getDevicePixelRatio(),c=Math.abs(u[1]-u[0])*(h||1),p=Math.round(a/c);if(isFinite(p)&&p>1){"lttb"===r&&t.setData(i.lttbDownSample(i.mapDimension(l.dim),1/p));var d=void 0;I(r)?d=gA[r]:T(r)&&(d=r),d&&t.setData(i.downSample(i.mapDimension(l.dim),1/p,d,yA))}}}}}function Zf(t,e,n,i,r){var o=t.getArea(),a=o.x,s=o.y,l=o.width,u=o.height,h=n.get(["lineStyle","width"])||2;a-=h/2,s-=h/2,l+=h,u+=h,a=Math.floor(a),l=Math.round(l);var c=new Cw({shape:{x:a,y:s,width:l,height:u}});if(e){var p=t.getBaseAxis(),d=p.isHorizontal(),f=p.inverse;d?(f&&(c.shape.x+=l),c.shape.width=0):(f||(c.shape.y+=u),c.shape.height=0);var g=T(r)?function(t){r(t,c)}:null;ls(c,{shape:{width:l,height:u,x:a,y:s}},n,null,i,g)}return c}function Kf(t,e,n){var i=t.getArea(),r=Wi(i.r0,1),o=Wi(i.r,1),a=new DS({shape:{cx:Wi(t.cx,1),cy:Wi(t.cy,1),r0:r,r:o,startAngle:i.startAngle,endAngle:i.endAngle,clockwise:i.clockwise}});if(e){var s="angle"===t.getBaseAxis().dim;s?a.shape.endAngle=i.startAngle:a.shape.r=r,ls(a,{shape:{endAngle:i.endAngle,r:o}},n)}return a}function $f(t,e,n,i,r){return t?"polar"===t.type?Kf(t,e,n):"cartesian2d"===t.type?Zf(t,e,n,i,r):null:null}function Qf(t,e){return t.type===e}function Jf(t,e){var n=t.mapDimensionsAll("defaultedLabel"),i=n.length;if(1===i){var r=Uu(t,e,n[0]);return null!=r?r+"":null}if(i){for(var o=[],a=0;a=0&&i.push(e[o])}return i.join(" ")}function eg(t,e){e=e||{};var n=e.isRoundCap;return function(e,i,r){var o=i.position;if(!o||o instanceof Array)return Ti(e,i,r);var a=t(o),s=null!=i.distance?i.distance:5,l=this.shape,u=l.cx,h=l.cy,c=l.r,p=l.r0,d=(c+p)/2,f=l.startAngle,g=l.endAngle,y=(f+g)/2,v=n?Math.abs(c-p)/2:0,m=Math.cos,_=Math.sin,x=u+c*m(f),b=h+c*_(f),w="left",S="top";switch(a){case"startArc":x=u+(p-s)*m(y),b=h+(p-s)*_(y),w="center",S="top";break;case"insideStartArc":x=u+(p+s)*m(y),b=h+(p+s)*_(y),w="center",S="bottom";break;case"startAngle":x=u+d*m(f)+ig(f,s+v,!1),b=h+d*_(f)+rg(f,s+v,!1),w="right",S="middle";break;case"insideStartAngle":x=u+d*m(f)+ig(f,-s+v,!1),b=h+d*_(f)+rg(f,-s+v,!1),w="left",S="middle";break;case"middle":x=u+d*m(y),b=h+d*_(y),w="center",S="middle";break;case"endArc":x=u+(c+s)*m(y),b=h+(c+s)*_(y),w="center",S="bottom";break;case"insideEndArc":x=u+(c-s)*m(y),b=h+(c-s)*_(y),w="center",S="top";break;case"endAngle":x=u+d*m(g)+ig(g,s+v,!0),b=h+d*_(g)+rg(g,s+v,!0),w="left",S="middle";break;case"insideEndAngle":x=u+d*m(g)+ig(g,-s+v,!0),b=h+d*_(g)+rg(g,-s+v,!0),w="right",S="middle"; +break;default:return Ti(e,i,r)}return e=e||{},e.x=x,e.y=b,e.align=w,e.verticalAlign=S,e}}function ng(t,e,n,i){if(k(i))return void t.setTextConfig({rotation:i});if(M(e))return void t.setTextConfig({rotation:0});var r,o=t.shape,a=o.clockwise?o.startAngle:o.endAngle,s=o.clockwise?o.endAngle:o.startAngle,l=(a+s)/2,u=n(e);switch(u){case"startArc":case"insideStartArc":case"middle":case"insideEndArc":case"endArc":r=l;break;case"startAngle":case"insideStartAngle":r=a;break;case"endAngle":case"insideEndAngle":r=s;break;default:return void t.setTextConfig({rotation:0})}var h=1.5*Math.PI-r;"middle"===u&&h>Math.PI/2&&h<1.5*Math.PI&&(h-=Math.PI),t.setTextConfig({rotation:h})}function ig(t,e,n){return e*Math.sin(t)*(n?-1:1)}function rg(t,e,n){return e*Math.cos(t)*(n?1:-1)}function og(t,e){var n=t.getArea&&t.getArea();if(Qf(t,"cartesian2d")){var i=t.getBaseAxis();if("category"!==i.type||!i.onBand){var r=e.getLayout("bandWidth");i.isHorizontal()?(n.x-=r,n.width+=2*r):(n.y-=r,n.height+=2*r)}}return n}function ag(t,e){var n=t.get("realtimeSort",!0),i=e.getBaseAxis();return n&&"category"===i.type&&"cartesian2d"===e.type?{baseAxis:i,otherAxis:e.getOtherAxis(i)}:void 0}function sg(t,e,n,i,r,o,a,s){var l,u;o?(u={x:i.x,width:i.width},l={y:i.y,height:i.height}):(u={y:i.y,height:i.height},l={x:i.x,width:i.width}),s||(a?ss:ls)(n,{shape:l},e,r,null);var h=e?t.baseAxis.model:null;(a?ss:ls)(n,{shape:u},h,r)}function lg(t,e){for(var n=0;n=r.r0?"endArc":"startArc":r.endAngle>=r.startAngle?"endAngle":"startAngle":a?r.height>=0?"bottom":"top":r.width>=0?"right":"left",c=Ws(i);Gs(t,c,{labelFetcher:o,labelDataIndex:n,defaultText:Jf(o.getData(),n),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:h});var p=t.getTextContent();if(s&&p){var d=i.get(["label","position"]);t.textConfig.inside="middle"===d?!0:null,ng(t,"outside"===d?h:d,hg(a),i.get(["label","rotate"]))}Ks(p,c,o.getRawValue(n),function(t){return tg(e,t)});var f=i.getModel(["emphasis"]);La(t,f.get("focus"),f.get("blurScope"),f.get("disabled")),Ra(t,i),ug(r)&&(t.style.fill="none",t.style.stroke="none",y(t.states,function(t){t.style&&(t.style.fill=t.style.stroke="none")}))}function pg(t,e){var n=t.get(["itemStyle","borderColor"]);if(!n||"none"===n)return 0;var i=t.get(["itemStyle","borderWidth"])||0,r=isNaN(e.width)?Number.MAX_VALUE:Math.abs(e.width),o=isNaN(e.height)?Number.MAX_VALUE:Math.abs(e.height);return Math.min(i,r,o)}function dg(t,e,n,i){var r=t.getData(),o=r.getLayout("valueAxisHorizontal")?1:0,a=r.getLayout("largeDataIndices"),s=r.getLayout("size"),l=t.getModel("backgroundStyle"),u=r.getLayout("largeBackgroundPoints");if(u){var h=new PA({shape:{points:u},incremental:!!i,silent:!0,z2:0});h.baseDimIdx=o,h.largeDataIndices=a,h.barWidth=s,h.useStyle(l.getItemStyle()),e.add(h),n&&n.push(h)}var c=new PA({shape:{points:r.getLayout("largePoints")},incremental:!!i,ignoreCoarsePointer:!0,z2:1});c.baseDimIdx=o,c.largeDataIndices=a,c.barWidth=s,e.add(c),c.useStyle(r.getVisual("style")),Ew(c).seriesIndex=t.seriesIndex,t.get("silent")||(c.on("mousedown",LA),c.on("mousemove",LA)),n&&n.push(c)}function fg(t,e,n){for(var i=t.baseDimIdx,r=1-i,o=t.shape.points,a=t.largeDataIndices,s=[],l=[],u=t.barWidth,h=0,c=o.length/3;c>h;h++){var p=3*h;if(l[i]=u,l[r]=o[p+2],s[i]=o[p+i],s[r]=o[p+r],l[r]<0&&(s[r]+=l[r],l[r]=-l[r]),e>=s[0]&&e<=s[0]+l[0]&&n>=s[1]&&n<=s[1]+l[1])return a[h]}return-1}function gg(t,e,n){if(Qf(n,"cartesian2d")){var i=e,r=n.getArea();return{x:t?i.x:r.x,y:t?r.y:i.y,width:t?i.width:r.width,height:t?r.height:i.height}}var r=n.getArea(),o=e;return{cx:r.cx,cy:r.cy,r0:t?r.r0:o.r0,r:t?r.r:o.r,startAngle:t?o.startAngle:0,endAngle:t?o.endAngle:2*Math.PI}}function yg(t,e,n){var i="polar"===t.type?DS:Cw;return new i({shape:gg(e,n,t),silent:!0,z2:0})}function vg(t){t.registerChartView(SA),t.registerSeriesModel(mA),t.registerLayout(t.PRIORITY.VISUAL.LAYOUT,S(dd,"bar")),t.registerLayout(t.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,fd("bar")),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,jf("bar")),t.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(t,e){var n=t.componentType||"series";e.eachComponent({mainType:n,query:t},function(e){t.sortInfo&&e.axis.setCategorySortInfo(t.sortInfo)})})}function mg(t,e){this.parent.drift(t,e)}function _g(t,e,n,i){return!(!e||isNaN(e[0])||isNaN(e[1])||i.isIgnore&&i.isIgnore(n)||i.clipShape&&!i.clipShape.contain(e[0],e[1])||"none"===t.getItemVisual(n,"symbol"))}function xg(t){return null==t||D(t)||(t={isIgnore:t}),t||{}}function bg(t){var e=t.hostModel,n=e.getModel("emphasis");return{emphasisItemStyle:n.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:n.get("focus"),blurScope:n.get("blurScope"),emphasisDisabled:n.get("disabled"),hoverScale:n.get("scale"),labelStatesModels:Ws(e),cursorStyle:e.get("cursor")}}function wg(t,e,n){var i=t.getBaseAxis(),r=t.getOtherAxis(i),o=Sg(r,n),a=i.dim,s=r.dim,l=e.mapDimension(s),u=e.mapDimension(a),h="x"===s||"radius"===s?1:0,c=v(t.dimensions,function(t){return e.mapDimension(t)}),p=!1,d=e.getCalculationInfo("stackResultDimension");return Gp(e,c[0])&&(p=!0,c[0]=d),Gp(e,c[1])&&(p=!0,c[1]=d),{dataDimsForPoint:c,valueStart:o,valueAxisDim:s,baseAxisDim:a,stacked:!!p,valueDim:l,baseDim:u,baseDataOffset:h,stackedOverDimension:e.getCalculationInfo("stackedOverDimension")}}function Sg(t,e){var n=0,i=t.scale.getExtent();return"start"===e?n=i[0]:"end"===e?n=i[1]:k(e)&&!isNaN(e)?n=e:i[0]>0?n=i[0]:i[1]<0&&(n=i[1]),n}function Mg(t,e,n,i){var r=0/0;t.stacked&&(r=n.get(n.getCalculationInfo("stackedOverDimension"),i)),isNaN(r)&&(r=t.valueStart);var o=t.baseDataOffset,a=[];return a[o]=n.get(t.baseDim,i),a[1-o]=r,e.dataToPoint(a)}function Tg(t,e){var n=[];return e.diff(t).add(function(t){n.push({cmd:"+",idx:t})}).update(function(t,e){n.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){n.push({cmd:"-",idx:t})}).execute(),n}function Ig(t,e,n,i,r,o,a){for(var s=Tg(t,e),l=[],u=[],h=[],c=[],p=[],d=[],f=[],g=wg(r,e,a),y=t.getLayout("points")||[],v=e.getLayout("points")||[],m=0;my;y++){var v=e[2*g],m=e[2*g+1];if(g>=r||0>g)break;if(Cg(v,m)){if(l){g+=o;continue}break}if(g===n)t[o>0?"moveTo":"lineTo"](v,m),c=v,p=m;else{var _=v-u,x=m-h;if(.5>_*_+x*x){g+=o;continue}if(a>0){for(var b=g+o,w=e[2*b],S=e[2*b+1];w===v&&S===m&&i>y;)y++,b+=o,g+=o,w=e[2*b],S=e[2*b+1],v=e[2*g],m=e[2*g+1],_=v-u,x=m-h;var M=y+1;if(l)for(;Cg(w,S)&&i>M;)M++,b+=o,w=e[2*b],S=e[2*b+1];var T=.5,I=0,C=0,k=void 0,D=void 0;if(M>=i||Cg(w,S))d=v,f=m;else{I=w-u,C=S-h;var A=v-u,P=w-v,L=m-h,O=S-m,R=void 0,E=void 0;if("x"===s){R=Math.abs(A),E=Math.abs(P);var N=I>0?1:-1;d=v-N*R*a,f=m,k=v+N*E*a,D=m}else if("y"===s){R=Math.abs(L),E=Math.abs(O);var z=C>0?1:-1;d=v,f=m-z*R*a,k=v,D=m+z*E*a}else R=Math.sqrt(A*A+L*L),E=Math.sqrt(P*P+O*O),T=E/(E+R),d=v-I*a*(1-T),f=m-C*a*(1-T),k=v+I*a*T,D=m+C*a*T,k=NA(k,zA(w,v)),D=NA(D,zA(S,m)),k=zA(k,NA(w,v)),D=zA(D,NA(S,m)),I=k-v,C=D-m,d=v-I*R/E,f=m-C*R/E,d=NA(d,zA(u,v)),f=NA(f,zA(h,m)),d=zA(d,NA(u,v)),f=zA(f,NA(h,m)),I=v-d,C=m-f,k=v+I*E/R,D=m+C*E/R}t.bezierCurveTo(c,p,d,f,v,m),c=k,p=D}else t.lineTo(v,m)}u=v,h=m,g+=o}return y}function Dg(t,e){if(t.length===e.length){for(var n=0;no;o++){var a=Mg(n,t,e,o);r[2*o]=a[0],r[2*o+1]=a[1]}return r}function Rg(t,e,n,i){var r=e.getBaseAxis(),o="x"===r.dim||"radius"===r.dim?0:1,a=[],s=0,l=[],u=[],h=[],c=[];if(i){for(s=0;ss;s++){var l=t[s],u=l.coord;if(0>u)i=l;else{if(u>e){r?o.push(n(r,l,e)):i&&o.push(n(i,l,0),n(i,l,e));break}i&&(o.push(n(i,l,0)),i=null),o.push(l),r=l}}return o}function Ng(t,e,n){var i=t.getVisual("visualMeta");if(i&&i.length&&t.count()&&"cartesian2d"===e.type){for(var r,o,a=i.length-1;a>=0;a--){var s=t.getDimensionInfo(i[a].dimension);if(r=s&&s.coordDim,"x"===r||"y"===r){o=i[a];break}}if(o){var l=e.getAxis(r),u=v(o.stops,function(t){return{coord:l.toGlobalCoord(l.dataToCoord(t.value)),color:t.color}}),h=u.length,c=o.outerColors.slice();h&&u[0].coord>u[h-1].coord&&(u.reverse(),c.reverse());var p=Eg(u,"x"===r?n.getWidth():n.getHeight()),d=p.length;if(!d&&h)return u[0].coord<0?c[1]?c[1]:u[h-1].color:c[0]?c[0]:u[0].color;var f=10,g=p[0].coord-f,m=p[d-1].coord+f,_=m-g;if(.001>_)return"transparent";y(p,function(t){t.offset=(t.coord-g)/_}),p.push({offset:d?p[d-1].offset:.5,color:c[1]||"transparent"}),p.unshift({offset:d?p[0].offset:.5,color:c[0]||"transparent"});var x=new YS(0,0,0,0,p,!0);return x[r]=g,x[r+"2"]=m,x}}}function zg(t,e,n){var i=t.get("showAllSymbol"),r="auto"===i;if(!i||r){var o=n.getAxesByScale("ordinal")[0];if(o&&(!r||!Bg(o,e))){var a=e.mapDimension(o.dim),s={};return y(o.getViewLabels(),function(t){var e=o.scale.getRawOrdinalNumber(t.tickValue);s[e]=1}),function(t){return!s.hasOwnProperty(e.get(a,t))}}}}function Bg(t,e){var n=t.getExtent(),i=Math.abs(n[1]-n[0])/t.scale.count();isNaN(i)&&(i=0);for(var r=e.count(),o=Math.max(1,Math.round(r/5)),a=0;r>a;a+=o)if(1.5*RA.getSymbolSize(e,a)[t.isHorizontal()?1:0]>i)return!1;return!0}function Fg(t,e){return isNaN(t)||isNaN(e)}function Vg(t){for(var e=t.length/2;e>0&&Fg(t[2*e-2],t[2*e-1]);e--);return e-1}function Hg(t,e){return[t[2*e],t[2*e+1]]}function Gg(t,e,n){for(var i,r,o=t.length/2,a="x"===n?0:1,s=0,l=-1,u=0;o>u;u++)if(r=t[2*u+a],!isNaN(r)&&!isNaN(t[2*u+1-a]))if(0!==u){if(e>=i&&r>=e||i>=e&&e>=r){l=u;break}s=u,i=r}else i=r;return{range:[s,l],t:(e-i)/(r-i)}}function Wg(t){if(t.get(["endLabel","show"]))return!0;for(var e=0;eu[0]&&isFinite(g)&&isFinite(u[0]);)f=Qp(f),g=u[1]-f*a;else{var v=t.getTicks().length-1;v>a&&(f=Qp(f));var m=f*a;y=Math.ceil(u[1]/f)*f,g=Wi(y-m),0>g&&u[0]>=0?(g=0,y=Wi(m)):y>0&&u[1]<=0&&(y=0,g=-Wi(m))}var _=(r[0].value-o[0].value)/s,x=(r[a].value-o[a].value)/s;i.setExtent.call(t,g+f*_,y+f*x),i.setInterval.call(t,f),(_||x)&&i.setNiceExtent.call(t,g+f,y-f)}function ey(t,e){return t.getCoordSysModel()===e}function ny(t,e,n,i){function r(t){return t.dim+"_"+t.index}n.getAxesOnZeroOf=function(){return o?[o]:[]};var o,a=t[e],s=n.model,l=s.get(["axisLine","onZero"]),u=s.get(["axisLine","onZeroAxisIndex"]);if(l){if(null!=u)iy(a[u])&&(o=a[u]);else for(var h in a)if(a.hasOwnProperty(h)&&iy(a[h])&&!i[r(a[h])]){o=a[h];break}o&&(i[r(o)]=!0)}}function iy(t){return t&&"category"!==t.type&&"time"!==t.type&&Od(t)}function ry(t,e){var n=t.getExtent(),i=n[0]+n[1];t.toGlobalCoord="x"===t.dim?function(t){return t+e}:function(t){return i-t+e},t.toLocalCoord="x"===t.dim?function(t){return t-e}:function(t){return i-t+e}}function oy(t,e,n,i){var r,o,a=$i(n-t),s=i[0]>i[1],l="start"===e&&!s||"start"!==e&&s;return Qi(a-rP/2)?(o=l?"bottom":"top",r="center"):Qi(a-1.5*rP)?(o=l?"top":"bottom",r="center"):(o="middle",r=1.5*rP>a&&a>rP/2?l?"left":"right":l?"right":"left"),{rotation:a,textAlign:r,textVerticalAlign:o}}function ay(t,e,n){if(!Fd(t.axis)){var i=t.get(["axisLabel","showMinLabel"]),r=t.get(["axisLabel","showMaxLabel"]);e=e||[],n=n||[];var o=e[0],a=e[1],s=e[e.length-1],l=e[e.length-2],u=n[0],h=n[1],c=n[n.length-1],p=n[n.length-2];i===!1?(sy(o),sy(u)):ly(o,a)&&(i?(sy(a),sy(h)):(sy(o),sy(u))),r===!1?(sy(s),sy(c)):ly(l,s)&&(r?(sy(l),sy(p)):(sy(s),sy(c)))}}function sy(t){t&&(t.ignore=!0)}function ly(t,e){var n=t&&t.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(n&&i){var r=ze([]);return He(r,r,-t.rotation),n.applyTransform(Fe([],r,t.getLocalTransform())),i.applyTransform(Fe([],r,e.getLocalTransform())),n.intersect(i)}}function uy(t){return"middle"===t||"center"===t}function hy(t,e,n,i,r){for(var o=[],a=[],s=[],l=0;l=0||t===e}function xy(t){var e=by(t);if(e){var n=e.axisPointerModel,i=e.axis.scale,r=n.option,o=n.get("status"),a=n.get("value");null!=a&&(a=i.parse(a));var s=Sy(n);null==o&&(r.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==a||a>l[1])&&(a=l[1]),a0?2:0),SP(t,function(n,i){"inherit"===t[i]&&(t[i]=e[i])})}var l=e.getModel("itemStyle"),u=l.getItemStyle(),h=0===t.lastIndexOf("empty",0)?"fill":"stroke",c=l.getShallow("decal");u.decal=c&&"inherit"!==c?Wc(c,a):i.decal,"inherit"===u.fill&&(u.fill=i[r]),"inherit"===u.stroke&&(u.stroke=i[h]),"inherit"===u.opacity&&(u.opacity=("fill"===r?i:n).opacity),s(u,i);var p=e.getModel("lineStyle"),d=p.getLineStyle();if(s(d,n),"auto"===u.fill&&(u.fill=i.fill),"auto"===u.stroke&&(u.stroke=i.fill),"auto"===d.stroke&&(d.stroke=i.fill),!o){var f=e.get("inactiveBorderWidth"),g=u[h];u.lineWidth="auto"===f?i.lineWidth>0&&g?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),d.stroke=p.get("inactiveColor"),d.lineWidth=p.get("inactiveWidth")}return{itemStyle:u,lineStyle:d}}function Py(t){var e=t.icon||"roundRect",n=hc(e,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill,t.symbolKeepAspect);return n.setStyle(t.itemStyle),n.rotation=(t.iconRotate||0)*Math.PI/180,n.setOrigin([t.itemWidth/2,t.itemHeight/2]),e.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2),n}function Ly(t,e,n,i){Ey(t,e,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=t?t:e}),Ry(t,e,n,i)}function Oy(t){for(var e,n=t.getZr().storage.getDisplayList(),i=0,r=n.length;r>i&&!(e=n[i].states.emphasis);)i++;return e&&e.hoverLayer}function Ry(t,e,n,i){Oy(n)||n.dispatchAction({type:"highlight",seriesName:t,name:e,excludeSeriesId:i})}function Ey(t,e,n,i){Oy(n)||n.dispatchAction({type:"downplay",seriesName:t,name:e,excludeSeriesId:i})}function Ny(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(t){for(var n=0;na||M(a))return{point:[]};var s=o.getItemGraphicEl(a),l=n.coordinateSystem;if(n.getTooltipPosition)i=n.getTooltipPosition(a)||[];else if(l&&l.dataToPoint)if(t.isStacked){var u=l.getBaseAxis(),h=l.getOtherAxis(u),c=h.dim,p=u.dim,d="x"===c||"radius"===c?1:0,f=o.mapDimension(p),g=[]; +g[d]=o.get(f,a),g[1-d]=o.get(o.getCalculationInfo("stackResultDimension"),a),i=l.dataToPoint(g)||[]}else i=l.dataToPoint(o.getValues(v(l.dimensions,function(t){return o.mapDimension(t)}),a))||[];else if(s){var y=s.getBoundingRect().clone();y.applyTransform(s.transform),i=[y.x+y.width/2,y.y+y.height/2]}return{point:i,el:s}}function pv(t,e,n){var i=t.currTrigger,r=[t.x,t.y],o=t,a=t.dispatchAction||Ym(n.dispatchAction,n),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){wv(r)&&(r=cv({seriesIndex:o.seriesIndex,dataIndex:o.dataIndex},e).point);var l=wv(r),u=o.axesInfo,h=s.axesInfo,c="leave"===i||wv(r),p={},d={},f={list:[],map:{}},g={showPointer:S(gv,d),showTooltip:S(yv,f)};y(s.coordSysMap,function(t,e){var n=l||t.containPoint(r);y(s.coordSysAxesInfo[e],function(t){var e=t.axis,i=xv(u,t);if(!c&&n&&(!u||i)){var o=i&&i.value;null!=o||l||(o=e.pointToData(r)),null!=o&&dv(t,o,g,!1,p)}})});var v={};return y(h,function(t,e){var n=t.linkGroup;n&&!d[e]&&y(n.axesInfo,function(e,i){var r=d[i];if(e!==t&&r){var o=r.value;n.mapper&&(o=t.axis.scale.parse(n.mapper(o,bv(e),bv(t)))),v[t.key]=o}})}),y(v,function(t,e){dv(h[e],t,g,!0,p)}),vv(d,h,p),mv(f,r,t,a),_v(h,a,n),p}}function dv(t,e,n,i,r){var o=t.axis;if(!o.scale.isBlank()&&o.containData(e)){if(!t.involveSeries)return void n.showPointer(t,e);var a=fv(e,t),s=a.payloadBatch,l=a.snapToValue;s[0]&&null==r.seriesIndex&&h(r,s[0]),!i&&t.snap&&o.containData(l)&&null!=l&&(e=l),n.showPointer(t,e,s),n.showTooltip(t,a,l)}}function fv(t,e){var n=e.axis,i=n.dim,r=t,o=[],a=Number.MAX_VALUE,s=-1;return y(e.seriesModels,function(e){var l,u,h=e.getData().mapDimensionsAll(i);if(e.getAxisTooltipData){var c=e.getAxisTooltipData(h,t,n);u=c.dataIndices,l=c.nestestValue}else{if(u=e.getData().indicesOfNearest(h[0],t,"category"===n.type?.5:null),!u.length)return;l=e.getData().get(h[0],u[0])}if(null!=l&&isFinite(l)){var p=t-l,d=Math.abs(p);a>=d&&((a>d||p>=0&&0>s)&&(a=d,s=p,r=l,o.length=0),y(u,function(t){o.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})}))}}),{payloadBatch:o,snapToValue:r}}function gv(t,e,n,i){t[e.key]={value:n,payloadBatch:i}}function yv(t,e,n,i){var r=n.payloadBatch,o=e.axis,a=o.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,u=My(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:o.dim,axisIndex:a.componentIndex,axisType:a.type,axisId:a.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:r.slice()})}}function vv(t,e,n){var i=n.axesInfo=[];y(e,function(e,n){var r=e.axisPointerModel.option,o=t[n];o?(!e.useHandle&&(r.status="show"),r.value=o.value,r.seriesDataIndices=(o.payloadBatch||[]).slice()):!e.useHandle&&(r.status="hide"),"show"===r.status&&i.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:r.value})})}function mv(t,e,n,i){if(wv(e)||!t.list.length)return void i({type:"hideTip"});var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}function _v(t,e,n){var i=n.getZr(),r="axisPointerLastHighlights",o=HP(i)[r]||{},a=HP(i)[r]={};y(t,function(t){var e=t.axisPointerModel.option;"show"===e.status&&y(e.seriesDataIndices,function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t})});var s=[],l=[];y(o,function(t,e){!a[e]&&l.push(t)}),y(a,function(t,e){!o[e]&&s.push(t)}),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function xv(t,e){for(var n=0;n<(t||[]).length;n++){var i=t[n];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}function bv(t){var e=t.axis.model,n={},i=n.axisDim=t.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=e.componentIndex,n.axisName=n[i+"AxisName"]=e.name,n.axisId=n[i+"AxisId"]=e.id,n}function wv(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function Sv(t){lP.registerAxisPointerClass("CartesianAxisPointer",EP),t.registerComponentModel(zP),t.registerComponentView(VP),t.registerPreprocessor(function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!M(e)&&(t.axisPointer.link=[e])}}),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=fy(t,e)}),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},pv)}function Mv(t){var e=t.get("confine");return null!=e?!!e:"richText"===t.get("renderMode")}function Tv(t){if(Mm.domSupported)for(var e=document.documentElement.style,n=0,i=t.length;i>n;n++)if(t[n]in e)return t[n]}function Iv(t,e){if(!t)return e;e=Al(e,!0);var n=t.indexOf(e);return t=-1===n?e:"-"+t.slice(0,n)+"-"+e,t.toLowerCase()}function Cv(t,e){var n=t.currentStyle||document.defaultView&&document.defaultView.getComputedStyle(t);return n?e?n[e]:n:null}function kv(t){return t="left"===t?"right":"right"===t?"left":"top"===t?"bottom":"top"}function Dv(t,e,n){if(!I(n)||"inside"===n)return"";var i=t.get("backgroundColor"),r=t.get("borderWidth");e=Nl(e);var o,a=kv(n),s=Math.max(1.5*Math.round(r),6),l="",u=YP+":";p(["left","right"],a)>-1?(l+="top:50%",u+="translateY(-50%) rotate("+(o="left"===a?-225:-45)+"deg)"):(l+="left:50%",u+="translateX(-50%) rotate("+(o="top"===a?225:45)+"deg)");var h=o*Math.PI/180,c=s+r,d=c*Math.abs(Math.cos(h))+c*Math.abs(Math.sin(h)),f=Math.round(100*((d-Math.SQRT2*r)/2+Math.SQRT2*r-(d-c)/2))/100;l+=";"+a+":-"+f+"px";var g=e+" solid "+r+"px;",y=["position:absolute;width:"+s+"px;height:"+s+"px;",l+";"+u+";","border-bottom:"+g,"border-right:"+g,"background-color:"+i+";"];return'
            '}function Av(t,e){var n="cubic-bezier(0.23,1,0.32,1)",i=" "+t/2+"s "+n,r="opacity"+i+",visibility"+i;return e||(i=" "+t+"s "+n,r+=Mm.transformSupported?","+YP+i:",left"+i+",top"+i),XP+":"+r}function Pv(t,e,n){var i=t.toFixed(0)+"px",r=e.toFixed(0)+"px";if(!Mm.transformSupported)return n?"top:"+r+";left:"+i+";":[["top",r],["left",i]];var o=Mm.transform3dSupported,a="translate"+(o?"3d":"")+"("+i+","+r+(o?",0":"")+")";return n?"top:0;left:0;"+YP+":"+a+";":[["top",0],["left",0],[WP,a]]}function Lv(t){var e=[],n=t.get("fontSize"),i=t.getTextColor();i&&e.push("color:"+i),e.push("font:"+t.getFont()),n&&e.push("line-height:"+Math.round(3*n/2)+"px");var r=t.get("textShadowColor"),o=t.get("textShadowBlur")||0,a=t.get("textShadowOffsetX")||0,s=t.get("textShadowOffsetY")||0;return r&&o&&e.push("text-shadow:"+a+"px "+s+"px "+o+"px "+r),y(["decoration","align"],function(n){var i=t.get(n);i&&e.push("text-"+n+":"+i)}),e.join(";")}function Ov(t,e,n){var i=[],r=t.get("transitionDuration"),o=t.get("backgroundColor"),a=t.get("shadowBlur"),s=t.get("shadowColor"),l=t.get("shadowOffsetX"),u=t.get("shadowOffsetY"),h=t.getModel("textStyle"),c=Th(t,"html"),p=l+"px "+u+"px "+a+"px "+s;return i.push("box-shadow:"+p),e&&r&&i.push(Av(r,n)),o&&i.push("background-color:"+o),y(["width","color","radius"],function(e){var n="border-"+e,r=Al(n),o=t.get(r);null!=o&&i.push(n+":"+o+("color"===e?"":"px"))}),i.push(Lv(h)),null!=c&&i.push("padding:"+UM(c).join("px ")+"px"),i.join(";")+";"}function Rv(t,e,n,i,r){var o=e&&e.painter;if(n){var a=o&&o.getViewportRoot();a&&be(t,a,document.body,i,r)}else{t[0]=i,t[1]=r;var s=o&&o.getViewportRootOffset();s&&(t[0]+=s.offsetLeft,t[1]+=s.offsetTop)}t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}function Ev(t){return Math.max(0,t)}function Nv(t){var e=Ev(t.shadowBlur||0),n=Ev(t.shadowOffsetX||0),i=Ev(t.shadowOffsetY||0);return{left:Ev(e-n),right:Ev(e+n),top:Ev(e-i),bottom:Ev(e+i)}}function zv(t,e,n,i){t[0]=n,t[1]=i,t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}function Bv(t,e,n){var i,r=e.ecModel;n?(i=new MM(n,r,r),i=new MM(e.option,i,r)):i=e;for(var o=t.length-1;o>=0;o--){var a=t[o];a&&(a instanceof MM&&(a=a.get("tooltip",!0)),I(a)&&(a={formatter:a}),a&&(i=new MM(a,i,r)))}return i}function Fv(t,e){return t.dispatchAction||Ym(e.dispatchAction,e)}function Vv(t,e,n,i,r,o,a){var s=n.getSize(),l=s[0],u=s[1];return null!=o&&(t+l+o+2>i?t-=l+o:t+=o),null!=a&&(e+u+a>r?e-=u+a:e+=a),[t,e]}function Hv(t,e,n,i,r){var o=n.getSize(),a=o[0],s=o[1];return t=Math.min(t+a,i)-a,e=Math.min(e+s,r)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function Gv(t,e,n,i){var r=n[0],o=n[1],a=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,h=e.height;switch(t){case"inside":s=e.x+u/2-r/2,l=e.y+h/2-o/2;break;case"top":s=e.x+u/2-r/2,l=e.y-o-a;break;case"bottom":s=e.x+u/2-r/2,l=e.y+h+a;break;case"left":s=e.x-r-a,l=e.y+h/2-o/2;break;case"right":s=e.x+u+a,l=e.y+h/2-o/2}return[s,l]}function Wv(t){return"center"===t||"middle"===t}function Uv(t,e,n){var i=Or(t).queryOptionMap,r=i.keys()[0];if(r&&"series"!==r){var o=Rr(e,r,i.get(r),{useDefault:!1,enableAll:!1,enableNone:!1}),a=o.models[0];if(a){var s,l=n.getViewOfComponentModel(a);return l.group.traverse(function(e){var n=Ew(e).tooltipConfig;return n&&n.name===t.name?(s=e,!0):void 0}),s?{componentMainType:r,componentIndex:a.componentIndex,el:s}:void 0}}}function Xv(t){Xd(Sv),t.registerComponentModel(GP),t.registerComponentView($P),t.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},$),t.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},$)}function Yv(t,e){if(!t)return!1;for(var n=M(t)?t:[t],i=0;i=0&&(a[o]=+a[o].toFixed(p)),[a,c]}function $v(t,e){var n=t.getData(),i=t.coordinateSystem;if(e&&!Zv(e)&&!M(e.coord)&&i){var r=i.dimensions,o=Qv(e,n,i,t);if(e=s(e),e.type&&eL[e.type]&&o.baseAxis&&o.valueAxis){var a=p(r,o.baseAxis.dim),l=p(r,o.valueAxis.dim),u=eL[e.type](n,o.baseDataDim,o.valueDataDim,a,l);e.coord=u[0],e.value=u[1]}else{for(var h=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],c=0;2>c;c++)eL[h[c]]&&(h[c]=nm(n,n.mapDimension(r[c]),h[c]));e.coord=h}}return e}function Qv(t,e,n,i){var r={};return null!=t.valueIndex||null!=t.valueDim?(r.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,r.valueAxis=n.getAxis(Jv(i,r.valueDataDim)),r.baseAxis=n.getOtherAxis(r.valueAxis),r.baseDataDim=e.mapDimension(r.baseAxis.dim)):(r.baseAxis=i.getBaseAxis(),r.valueAxis=n.getOtherAxis(r.baseAxis),r.baseDataDim=e.mapDimension(r.baseAxis.dim),r.valueDataDim=e.mapDimension(r.valueAxis.dim)),r}function Jv(t,e){var n=t.getData().getDimensionInfo(e);return n&&n.coordDim}function tm(t,e){return t&&t.containData&&e.coord&&!jv(e)?t.containData(e.coord):!0}function em(t,e){return t?function(t,n,i,r){var o=2>r?t.coord&&t.coord[r]:t.value;return qu(o,e[r])}:function(t,n,i,r){return qu(t.value,e[r])}}function nm(t,e,n){if("average"===n){var i=0,r=0;return t.each(e,function(t){isNaN(t)||(i+=t,r++)}),i/r}return"median"===n?t.getMedian(e):t.getDataExtent(e)["max"===n?1:0]}function im(t,e,n){var i=e.coordinateSystem;t.each(function(r){var o,a=t.getItemModel(r),s=Gi(a.get("x"),n.getWidth()),l=Gi(a.get("y"),n.getHeight());if(isNaN(s)||isNaN(l)){if(e.getMarkerPosition)o=e.getMarkerPosition(t.getValues(t.dimensions,r));else if(i){var u=t.get(i.dimensions[0],r),h=t.get(i.dimensions[1],r);o=i.dataToPoint([u,h])}}else o=[s,l];isNaN(s)||(o[0]=s),isNaN(l)||(o[1]=l),t.setItemLayout(r,o)})}function rm(t,e,n){var i;i=t?v(t&&t.dimensions,function(t){var n=e.getData().getDimensionInfo(e.getData().mapDimension(t))||{};return h(h({},n),{name:t,ordinalMeta:null})}):[{name:"value",type:"float"}];var r=new $k(i,n),o=v(n.get("data"),S($v,e));t&&(o=_(o,S(tm,t)));var a=em(!!t,i);return r.initData(o,null,a),r}function om(t){t.registerComponentModel(tL),t.registerComponentView(rL),t.registerPreprocessor(function(t){Yv(t.series,"markPoint")&&(t.markPoint=t.markPoint||{})})}function am(t){return isNaN(+t.cpx1)||isNaN(+t.cpy1)}function sm(t){return"_"+t+"Type"}function lm(t,e,n){var i=e.getItemVisual(n,t);if(i&&"none"!==i){var r=e.getItemVisual(n,t+"Size"),o=e.getItemVisual(n,t+"Rotate"),a=e.getItemVisual(n,t+"Offset"),s=e.getItemVisual(n,t+"KeepAspect"),l=cc(r),u=pc(a||0,l),h=hc(i,-l[0]/2+u[0],-l[1]/2+u[1],l[0],l[1],null,s);return h.__specifiedRotation=null==o||isNaN(o)?void 0:+o*Math.PI/180||0,h.name=t,h}}function um(t){var e=new uL({name:"line",subPixelOptimize:!0});return hm(e.shape,t),e}function hm(t,e){t.x1=e[0][0],t.y1=e[0][1],t.x2=e[1][0],t.y2=e[1][1],t.percent=1;var n=e[2];n?(t.cpx1=n[0],t.cpy1=n[1]):(t.cpx1=0/0,t.cpy1=0/0)}function cm(t){return t.animators&&t.animators.length>0}function pm(t){var e=t.hostModel,n=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:n.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:n.get("disabled"),blurScope:n.get("blurScope"),focus:n.get("focus"),labelStatesModels:Ws(e)}}function dm(t){return isNaN(t[0])||isNaN(t[1])}function fm(t){return t&&!dm(t[0])&&!dm(t[1])}function gm(t){return!isNaN(t)&&!isFinite(t)}function ym(t,e,n,i){var r=1-t,o=i.dimensions[t];return gm(e[r])&&gm(n[r])&&e[t]===n[t]&&i.getAxis(o).containData(e[t])}function vm(t,e){if("cartesian2d"===t.type){var n=e[0].coord,i=e[1].coord;if(n&&i&&(ym(1,n,i,t)||ym(0,n,i,t)))return!0}return tm(t,e[0])&&tm(t,e[1])}function mm(t,e,n,i,r){var o,a=i.coordinateSystem,s=t.getItemModel(e),l=Gi(s.get("x"),r.getWidth()),u=Gi(s.get("y"),r.getHeight());if(isNaN(l)||isNaN(u)){if(i.getMarkerPosition)o=i.getMarkerPosition(t.getValues(t.dimensions,e));else{var h=a.dimensions,c=t.get(h[0],e),p=t.get(h[1],e);o=a.dataToPoint([c,p])}if(Qf(a,"cartesian2d")){var d=a.getAxis("x"),f=a.getAxis("y"),h=a.dimensions;gm(t.get(h[0],e))?o[0]=d.toGlobalCoord(d.getExtent()[n?0:1]):gm(t.get(h[1],e))&&(o[1]=f.toGlobalCoord(f.getExtent()[n?0:1]))}isNaN(l)||(o[0]=l),isNaN(u)||(o[1]=u)}else o=[l,u];t.setItemLayout(e,o)}function _m(t,e,n){var i;i=t?v(t&&t.dimensions,function(t){var n=e.getData().getDimensionInfo(e.getData().mapDimension(t))||{};return h(h({},n),{name:t,ordinalMeta:null})}):[{name:"value",type:"float"}];var r=new $k(i,n),o=new $k(i,n),a=new $k([],n),s=v(n.get("data"),S(fL,e,t,n));t&&(s=_(s,S(vm,t)));var l=em(!!t,i);return r.initData(v(s,function(t){return t[0]}),null,l),o.initData(v(s,function(t){return t[1]}),null,l),a.initData(v(s,function(t){return t[2]})),a.hasItemOption=!0,{from:r,to:o,line:a}}function xm(t){t.registerComponentModel(oL),t.registerComponentView(gL),t.registerPreprocessor(function(t){Yv(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var bm=function(t,e){return(bm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},wm=function(){function t(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return t}(),Sm=function(){function t(){this.browser=new wm,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window}return t}(),Mm=new Sm;"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(Mm.wxa=!0,Mm.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?Mm.worker=!0:"undefined"==typeof navigator?(Mm.node=!0,Mm.svgSupported=!0):n(navigator.userAgent,Mm);var Tm=12,Im="sans-serif",Cm=Tm+"px "+Im,km=20,Dm=100,Am="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N",Pm=i(Am),Lm={createCanvas:function(){return"undefined"!=typeof document&&document.createElement("canvas")},measureText:function(){var t,e;return function(n,i){if(!t){var r=Lm.createCanvas();t=r&&r.getContext("2d")}if(t)return e!==i&&(e=t.font=i||Cm),t.measureText(n);n=n||"",i=i||Cm;var o=/^([0-9]*?)px$/.exec(i),a=+(o&&o[1])||Tm,s=0;if(i.indexOf("mono")>=0)s=a*n.length;else for(var l=0;lr;r++)n[t][r].h!==e&&i.push(n[t][r]);n[t]=i}n[t]&&0===n[t].length&&delete n[t]}else delete n[t];return this},t.prototype.trigger=function(t){for(var e=[],n=1;ns;s++){var l=i[s];if(!r||!r.filter||null==l.query||r.filter(t,l.query))switch(o){case 0:l.h.call(l.ctx);break;case 1:l.h.call(l.ctx,e[0]);break;case 2:l.h.call(l.ctx,e[0],e[1]);break;default:l.h.apply(l.ctx,e)}}return r&&r.afterTrigger&&r.afterTrigger(t),this},t.prototype.triggerWithContext=function(t){for(var e=[],n=1;nl;l++){var u=i[l];if(!r||!r.filter||null==u.query||r.filter(t,u.query))switch(o){case 0:u.h.call(a);break;case 1:u.h.call(a,e[0]);break;case 2:u.h.call(a,e[0],e[1]);break;default:u.h.apply(a,e.slice(1,o-1))}}return r&&r.afterTrigger&&r.afterTrigger(t),this},t}(),o_=Math.log(2),a_="___zrEVENTSAVED",s_=[],l_=/([&<>"'])/g,u_={"&":"&","<":"<",">":">",'"':""","'":"'"},h_=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,c_=[],p_=Mm.browser.firefox&&+Mm.browser.version.split(".")[0]<39,d_=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0},f_=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,n){return this._doTrack(t,e,n),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,n){var i=t.touches;if(i){for(var r={points:[],touches:[],target:e,event:t},o=0,a=i.length;a>o;o++){var s=i[o],l=Ce(n,s,{});r.points.push([l.zrX,l.zrY]),r.touches.push(s)}this._track.push(r)}},t.prototype._recognize=function(t){for(var e in g_)if(g_.hasOwnProperty(e)){var n=g_[e](this._track,t);if(n)return n}},t}(),g_={pinch:function(t,e){var n=t.length;if(n){var i=(t[n-1]||{}).points,r=(t[n-2]||{}).points||i;if(r&&r.length>1&&i&&i.length>1){var o=Re(i)/Re(r);!isFinite(o)&&(o=1),e.pinchScale=o;var a=Ee(i);return e.pinchX=a[0],e.pinchY=a[1],{type:"pinch",target:t[0].target,event:e}}}}},y_=(Object.freeze||Object)({create:Ne,identity:ze,copy:Be,mul:Fe,translate:Ve,rotate:He,scale:Ge,invert:We,clone:Ue}),v_=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,n=this.y;return this.x=t[0]*e+t[2]*n+t[4],this.y=t[1]*e+t[3]*n+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,n){t.x=e,t.y=n},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,n){t.x=e.x+n.x,t.y=e.y+n.y},t.sub=function(t,e,n){t.x=e.x-n.x,t.y=e.y-n.y},t.scale=function(t,e,n){t.x=e.x*n,t.y=e.y*n},t.scaleAndAdd=function(t,e,n,i){t.x=e.x+n.x*i,t.y=e.y+n.y*i},t.lerp=function(t,e,n,i){var r=1-i;t.x=r*e.x+i*n.x,t.y=r*e.y+i*n.y},t}(),m_=Math.min,__=Math.max,x_=new v_,b_=new v_,w_=new v_,S_=new v_,M_=new v_,T_=new v_,I_=function(){function t(t,e,n,i){0>n&&(t+=n,n=-n),0>i&&(e+=i,i=-i),this.x=t,this.y=e,this.width=n,this.height=i}return t.prototype.union=function(t){var e=m_(t.x,this.x),n=m_(t.y,this.y);this.width=isFinite(this.x)&&isFinite(this.width)?__(t.x+t.width,this.x+this.width)-e:t.width,this.height=isFinite(this.y)&&isFinite(this.height)?__(t.y+t.height,this.y+this.height)-n:t.height,this.x=e,this.y=n},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,n=t.width/e.width,i=t.height/e.height,r=Ne();return Ve(r,r,[-e.x,-e.y]),Ge(r,r,[n,i]),Ve(r,r,[t.x,t.y]),r},t.prototype.intersect=function(e,n){if(!e)return!1;e instanceof t||(e=t.create(e));var i=this,r=i.x,o=i.x+i.width,a=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,h=e.y,c=e.y+e.height,p=!(l>o||r>u||h>s||a>c);if(n){var d=1/0,f=0,g=Math.abs(o-l),y=Math.abs(u-r),v=Math.abs(s-h),m=Math.abs(c-a),_=Math.min(g,y),x=Math.min(v,m);l>o||r>u?_>f&&(f=_,y>g?v_.set(T_,-g,0):v_.set(T_,y,0)):d>_&&(d=_,y>g?v_.set(M_,g,0):v_.set(M_,-y,0)),h>s||a>c?x>f&&(f=x,m>v?v_.set(T_,0,-v):v_.set(T_,0,m)):d>_&&(d=_,m>v?v_.set(M_,0,v):v_.set(M_,0,-m))}return n&&v_.copy(n,p?M_:T_),p},t.prototype.contain=function(t,e){var n=this;return t>=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,n,i){if(!i)return void(e!==n&&t.copy(e,n));if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var r=i[0],o=i[3],a=i[4],s=i[5];return e.x=n.x*r+a,e.y=n.y*o+s,e.width=n.width*r,e.height=n.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}x_.x=w_.x=n.x,x_.y=S_.y=n.y,b_.x=S_.x=n.x+n.width,b_.y=w_.y=n.y+n.height,x_.transform(i),S_.transform(i),b_.transform(i),w_.transform(i),e.x=m_(x_.x,b_.x,w_.x,S_.x),e.y=m_(x_.y,b_.y,w_.y,S_.y);var l=__(x_.x,b_.x,w_.x,S_.x),u=__(x_.y,b_.y,w_.y,S_.y);e.width=l-e.x,e.height=u-e.y},t}(),C_="silent",k_=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return e(n,t),n.prototype.dispose=function(){},n.prototype.setCursor=function(){},n}(r_),D_=function(){function t(t,e){this.x=t,this.y=e}return t}(),A_=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],P_=new I_(0,0,0,0),L_=function(t){function n(e,n,i,r,o){var a=t.call(this)||this;return a._hovered=new D_(0,0),a.storage=e,a.painter=n,a.painterRoot=r,a._pointerSize=o,i=i||new k_,a.proxy=null,a.setHandlerProxy(i),a._draggingMgr=new i_(a),a}return e(n,t),n.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(y(A_,function(e){t.on&&t.on(e,this[e],this)},this),t.handler=this),this.proxy=t},n.prototype.mousemove=function(t){var e=t.zrX,n=t.zrY,i=Ze(this,e,n),r=this._hovered,o=r.target;o&&!o.__zr&&(r=this.findHover(r.x,r.y),o=r.target);var a=this._hovered=i?new D_(e,n):this.findHover(e,n),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},n.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},n.prototype.resize=function(){this._hovered=new D_(0,0)},n.prototype.dispatch=function(t,e){var n=this[t];n&&n.call(this,e)},n.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},n.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},n.prototype.dispatchToElement=function(t,e,n){t=t||{};var i=t.target;if(!i||!i.silent){for(var r="on"+e,o=Xe(e,t,n);i&&(i[r]&&(o.cancelBubble=!!i[r].call(i,o)),i.trigger(e,o),i=i.__hostTarget?i.__hostTarget:i.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)}))}},n.prototype.findHover=function(t,e,n){var i=this.storage.getDisplayList(),r=new D_(t,e);if(je(i,r,t,e,n),this._pointerSize&&!r.target){for(var o=[],a=this._pointerSize,s=a/2,l=new I_(t-s,e-s,a,a),u=i.length-1;u>=0;u--){var h=i[u];h===n||h.ignore||h.ignoreCoarsePointer||h.parent&&h.parent.ignoreCoarsePointer||(P_.copy(h.getBoundingRect()),h.transform&&P_.applyTransform(h.transform),P_.intersect(l)&&o.push(h))}if(o.length)for(var c=4,p=Math.PI/12,d=2*Math.PI,f=0;s>f;f+=c)for(var g=0;d>g;g+=p){var y=t+f*Math.cos(g),v=e+f*Math.sin(g);if(je(o,r,y,v,n),r.target)return r}}return r},n.prototype.processGesture=function(t,e){this._gestureMgr||(this._gestureMgr=new f_);var n=this._gestureMgr;"start"===e&&n.clear();var i=n.recognize(t,this.findHover(t.zrX,t.zrY,null).target,this.proxy.dom);if("end"===e&&n.clear(),i){var r=i.type;t.gestureEvent=r;var o=new D_;o.target=i.target,this.dispatchToElement(o,r,i.event)}},n}(r_);y(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){L_.prototype[t]=function(e){var n,i,r=e.zrX,o=e.zrY,a=Ze(this,r,o);if("mouseup"===t&&a||(n=this.findHover(r,o),i=n.target),"mousedown"===t)this._downEl=i,this._downPoint=[e.zrX,e.zrY],this._upEl=i;else if("mouseup"===t)this._upEl=i;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||Jm(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,t,e)}});var O_,R_=32,E_=7,N_=1,z_=2,B_=4,F_=!1,V_=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=an}return t.prototype.traverse=function(t,e){for(var n=0;ni;i++)this._updateAndAddDisplayable(e[i],null,t);n.length=this._displayListLen,rn(n,an)},t.prototype._updateAndAddDisplayable=function(t,e,n){if(!t.ignore||n){t.beforeUpdate(),t.update(),t.afterUpdate();var i=t.getClipPath();if(t.ignoreClip)e=null;else if(i){e=e?e.slice():[];for(var r=i,o=t;r;)r.parent=o,r.updateTransform(),e.push(r),o=r,r=r.getClipPath()}if(t.childrenRef){for(var a=t.childrenRef(),s=0;s0&&(u.__clipPaths=[]),isNaN(u.z)&&(on(),u.z=0),isNaN(u.z2)&&(on(),u.z2=0),isNaN(u.zlevel)&&(on(),u.zlevel=0),this._displayList[this._displayListLen++]=u +}var h=t.getDecalElement&&t.getDecalElement();h&&this._updateAndAddDisplayable(h,e,n);var c=t.getTextGuideLine();c&&this._updateAndAddDisplayable(c,e,n);var p=t.getTextContent();p&&this._updateAndAddDisplayable(p,e,n)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,n=t.length;n>e;e++)this.delRoot(t[e]);else{var i=p(this._roots,t);i>=0&&this._roots.splice(i,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}();O_=Mm.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var H_=O_,G_={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||1>n?(n=1,e=i/4):e=i*Math.asin(1/n)/(2*Math.PI),-(n*Math.pow(2,10*(t-=1))*Math.sin(2*(t-e)*Math.PI/i)))},elasticOut:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||1>n?(n=1,e=i/4):e=i*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*t)*Math.sin(2*(t-e)*Math.PI/i)+1)},elasticInOut:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||1>n?(n=1,e=i/4):e=i*Math.asin(1/n)/(2*Math.PI),(t*=2)<1?-.5*n*Math.pow(2,10*(t-=1))*Math.sin(2*(t-e)*Math.PI/i):n*Math.pow(2,-10*(t-=1))*Math.sin(2*(t-e)*Math.PI/i)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?.5*t*t*((e+1)*t-e):.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-G_.bounceOut(1-t)},bounceOut:function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return.5>t?.5*G_.bounceIn(2*t):.5*G_.bounceOut(2*t-1)+.5}},W_=Math.pow,U_=Math.sqrt,X_=1e-8,Y_=1e-4,q_=U_(3),j_=1/3,Z_=Q(),K_=Q(),$_=Q(),Q_=/cubic-bezier\(([0-9,\.e ]+)\)/,J_=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||$,this.ondestroy=t.ondestroy||$,this.onrestart=t.onrestart||$,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),this._paused)return void(this._pausedTime+=e);var n=this._life,i=t-this._startTime-this._pausedTime,r=i/n;0>r&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=i%n;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=T(t)?t:G_[t]||Sn(t)},t}(),tx=function(){function t(t){this.value=t}return t}(),ex=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new tx(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}(),nx=function(){function t(t){this._list=new ex,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,i=this._map,r=null;if(null==i[t]){var o=n.len(),a=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var s=n.head;n.remove(s),delete i[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new tx(e),a.key=t,n.insertEntry(a),i[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],n=this._list;return null!=e?(e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value):void 0},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}(),ix={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},rx=new nx(20),ox=null,ax=Fn,sx=Vn,lx=(Object.freeze||Object)({parse:Rn,lift:zn,toHex:Bn,fastLerp:Fn,fastMapToColor:ax,lerp:Vn,mapToColor:sx,modifyHSL:Hn,modifyAlpha:Gn,stringify:Wn,lum:Un,random:Xn}),ux=(function(){return Mm.hasGlobalWindow&&T(window.btoa)?function(t){return window.btoa(unescape(t))}:"undefined"!=typeof Buffer?function(t){return Buffer.from(t).toString("base64")}:function(){return null}}(),Array.prototype.slice),hx=0,cx=1,px=2,dx=3,fx=4,gx=5,yx=6,vx=[0,0,0,0],mx=function(){function t(t){this.keyframes=[],this.discrete=!1,this._invalid=!1,this._needsSort=!1,this._lastFr=0,this._lastFrP=0,this.propName=t}return t.prototype.isFinished=function(){return this._finished},t.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},t.prototype.needsAnimate=function(){return this.keyframes.length>=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,n){this._needsSort=!0;var i=this.keyframes,r=i.length,o=!1,a=yx,s=e;if(g(e)){var l=ii(e);a=l,(1===l&&!k(e[0])||2===l&&!k(e[0][0]))&&(o=!0)}else if(k(e)&&!N(e))a=hx;else if(I(e))if(isNaN(+e)){var u=Rn(e);u&&(s=u,a=dx)}else a=hx;else if(O(e)){var c=h({},s);c.colorStops=v(e.colorStops,function(t){return{offset:t.offset,color:Rn(t.color)}}),Yn(e)?a=fx:qn(e)&&(a=gx),s=c}0===r?this.valType=a:(a!==this.valType||a===yx)&&(o=!0),this.discrete=this.discrete||o;var p={time:t,value:s,rawValue:e,percent:0};return n&&(p.easing=n,p.easingFunc=T(n)?n:G_[n]||Sn(n)),i.push(p),p},t.prototype.prepare=function(t,e){var n=this.keyframes;this._needsSort&&n.sort(function(t,e){return t.time-e.time});for(var i=this.valType,r=n.length,o=n[r-1],a=this.discrete,s=oi(i),l=ri(i),u=0;r>u;u++){var h=n[u],c=h.value,p=o.value;h.percent=h.time/t,a||(s&&u!==r-1?ti(c,p,i):l&&Jn(c.colorStops,p.colorStops))}if(!a&&i!==gx&&e&&this.needsAnimate()&&e.needsAnimate()&&i===e.valType&&!e._finished){this._additiveTrack=e;for(var d=n[0].value,u=0;r>u;u++)i===hx?n[u].additiveValue=n[u].value-d:i===dx?n[u].additiveValue=$n([],n[u].value,d,-1):oi(i)&&(n[u].additiveValue=i===cx?$n([],n[u].value,d,-1):Qn([],n[u].value,d,-1))}},t.prototype.step=function(t,e){if(!this._finished){this._additiveTrack&&this._additiveTrack._finished&&(this._additiveTrack=null);var n,i,r,o=null!=this._additiveTrack,a=o?"additiveValue":"value",s=this.valType,l=this.keyframes,u=l.length,h=this.propName,c=s===dx,p=this._lastFr,d=Math.min;if(1===u)i=r=l[0];else{if(0>e)n=0;else if(e=0&&!(l[n].percent<=e);n--);n=d(n,u-2)}else{for(n=p;u>n&&!(l[n].percent>e);n++);n=d(n-1,u-2)}r=l[n+1],i=l[n]}if(i&&r){this._lastFr=n,this._lastFrP=e;var g=r.percent-i.percent,y=0===g?1:d((e-i.percent)/g,1);r.easingFunc&&(y=r.easingFunc(y));var m=o?this._additiveValue:c?vx:t[h];if(!oi(s)&&!c||m||(m=this._additiveValue=[]),this.discrete)t[h]=1>y?i.rawValue:r.rawValue;else if(oi(s))s===cx?Zn(m,i[a],r[a],y):Kn(m,i[a],r[a],y);else if(ri(s)){var _=i[a],x=r[a],b=s===fx;t[h]={type:b?"linear":"radial",x:jn(_.x,x.x,y),y:jn(_.y,x.y,y),colorStops:v(_.colorStops,function(t,e){var n=x.colorStops[e];return{offset:jn(t.offset,n.offset,y),color:ni(Zn([],t.color,n.color,y))}}),global:x.global},b?(t[h].x2=jn(_.x2,x.x2,y),t[h].y2=jn(_.y2,x.y2,y)):t[h].r=jn(_.r,x.r,y)}else if(c)Zn(m,i[a],r[a],y),o||(t[h]=ni(m));else{var w=jn(i[a],r[a],y);o?this._additiveValue=w:t[h]=w}o&&this._addToTarget(t)}}},t.prototype._addToTarget=function(t){var e=this.valType,n=this.propName,i=this._additiveValue;e===hx?t[n]=t[n]+i:e===dx?(Rn(t[n],vx),$n(vx,vx,i,1),t[n]=ni(vx)):e===cx?$n(t[n],t[n],i,1):e===px&&Qn(t[n],t[n],i,1)},t}(),_x=function(){function t(t,e,n,i){return this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=t,this._loop=e,e&&i?void a("Can' use additive animation on looped animation."):(this._additiveAnimators=i,void(this._allowDiscrete=n))}return t.prototype.getMaxTime=function(){return this._maxTime},t.prototype.getDelay=function(){return this._delay},t.prototype.getLoop=function(){return this._loop},t.prototype.getTarget=function(){return this._target},t.prototype.changeTarget=function(t){this._target=t},t.prototype.when=function(t,e,n){return this.whenWithKeys(t,e,b(e),n)},t.prototype.whenWithKeys=function(t,e,n,i){for(var r=this._tracks,o=0;o0&&s.addKeyframe(0,ei(l),i),this._trackKeys.push(a)}s.addKeyframe(t,ei(e[a]),i)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,n=0;e>n;n++)t[n].call(this)},t.prototype._abortedCallback=function(){this._setTracksFinished();var t=this.animation,e=this._abortedCbs;if(t&&t.removeClip(this._clip),this._clip=null,e)for(var n=0;n0)){this._started=1;for(var e=this,n=[],i=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}(),xx=function(t){function n(e){var n=t.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,e=e||{},n.stage=e.stage||{},n}return e(n,t),n.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},n.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},n.prototype.removeClip=function(t){if(t.animation){var e=t.prev,n=t.next;e?e.next=n:this._head=n,n?n.prev=e:this._tail=e,t.next=t.prev=t.animation=null}},n.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},n.prototype.update=function(t){for(var e=ai()-this._pausedTime,n=e-this._time,i=this._head;i;){var r=i.next,o=i.step(e,n);o?(i.ondestroy(),this.removeClip(i),i=r):i=r}this._time=e,t||(this.trigger("frame",n),this.stage.update&&this.stage.update())},n.prototype._startLoop=function(){function t(){e._running&&(H_(t),!e._paused&&e.update())}var e=this;this._running=!0,H_(t)},n.prototype.start=function(){this._running||(this._time=ai(),this._pausedTime=0,this._startLoop())},n.prototype.stop=function(){this._running=!1},n.prototype.pause=function(){this._paused||(this._pauseStart=ai(),this._paused=!0)},n.prototype.resume=function(){this._paused&&(this._pausedTime+=ai()-this._pauseStart,this._paused=!1)},n.prototype.clear=function(){for(var t=this._head;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._head=this._tail=null},n.prototype.isFinished=function(){return null==this._head},n.prototype.animate=function(t,e){e=e||{},this.start();var n=new _x(t,e.loop);return this.addAnimator(n),n},n}(r_),bx=300,Sx=Mm.domSupported,Mx=function(){var t=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},i=v(t,function(t){var e=t.replace("mouse","pointer");return n.hasOwnProperty(e)?e:t});return{mouse:t,touch:e,pointer:i}}(),Tx={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},Ix=!1,Cx=function(){function t(t,e){this.stopPropagation=$,this.stopImmediatePropagation=$,this.preventDefault=$,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY}return t}(),kx={mousedown:function(t){t=Ae(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=Ae(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=Ae(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){t=Ae(this.dom,t);var e=t.toElement||t.relatedTarget;ci(this,e)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){Ix=!0,t=Ae(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){Ix||(t=Ae(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){t=Ae(this.dom,t),ui(t),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),kx.mousemove.call(this,t),kx.mousedown.call(this,t)},touchmove:function(t){t=Ae(this.dom,t),ui(t),this.handler.processGesture(t,"change"),kx.mousemove.call(this,t)},touchend:function(t){t=Ae(this.dom,t),ui(t),this.handler.processGesture(t,"end"),kx.mouseup.call(this,t),+new Date-+this.__lastTouchMoment1e-10&&Wx(t[3]-1)>1e-10?Math.sqrt(Wx(t[0]*t[3]-t[2]*t[1])):1},t.prototype.copyTransform=function(t){vi(this,t)},t.getLocalTransform=function(t,e){e=e||[];var n=t.originX||0,i=t.originY||0,r=t.scaleX,o=t.scaleY,a=t.anchorX,s=t.anchorY,l=t.rotation||0,u=t.x,h=t.y,c=t.skewX?Math.tan(t.skewX):0,p=t.skewY?Math.tan(-t.skewY):0;if(n||i||a||s){var d=n+a,f=i+s;e[4]=-d*r-c*f*o,e[5]=-f*o-p*d*r}else e[4]=e[5]=0;return e[0]=r,e[3]=o,e[1]=p*r,e[2]=c*o,l&&He(e,e,l),e[4]+=n+u,e[5]+=i+h,e},t.initDefaultProps=function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),t}(),Xx=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"],Yx={},qx="__zr_normal__",jx=Xx.concat(["ignore"]),Zx=m(Xx,function(t,e){return t[e]=!0,t},{ignore:!1}),Kx={},$x=new I_(0,0,0,0),Qx=function(){function t(t){this.id=o(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var n=this.transform;n||(n=this.transform=[1,0,0,1,0,0]),n[4]+=t,n[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,r=e.innerTransformable,o=void 0,a=void 0,s=!1;r.parent=i?this:null;var l=!1;if(r.copyTransform(e),null!=n.position){var u=$x;u.copy(n.layoutRect?n.layoutRect:this.getBoundingRect()),i||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(Kx,n,u):Ti(Kx,n,u),r.x=Kx.x,r.y=Kx.y,o=Kx.align,a=Kx.verticalAlign;var h=n.origin;if(h&&null!=n.rotation){var c=void 0,p=void 0;"center"===h?(c=.5*u.width,p=.5*u.height):(c=Mi(h[0],u.width),p=Mi(h[1],u.height)),l=!0,r.originX=-r.x+c+(i?0:u.x),r.originY=-r.y+p+(i?0:u.y)}}null!=n.rotation&&(r.rotation=n.rotation);var d=n.offset;d&&(r.x+=d[0],r.y+=d[1],l||(r.originX=-d[0],r.originY=-d[1]));var f=null==n.inside?"string"==typeof n.position&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),y=void 0,v=void 0,m=void 0;f&&this.canBeInsideText()?(y=n.insideFill,v=n.insideStroke,(null==y||"auto"===y)&&(y=this.getInsideTextFill()),(null==v||"auto"===v)&&(v=this.getInsideTextStroke(y),m=!0)):(y=n.outsideFill,v=n.outsideStroke,(null==y||"auto"===y)&&(y=this.getOutsideFill()),(null==v||"auto"===v)&&(v=this.getOutsideStroke(y),m=!0)),y=y||"#000",(y!==g.fill||v!==g.stroke||m!==g.autoStroke||o!==g.align||a!==g.verticalAlign)&&(s=!0,g.fill=y,g.stroke=v,g.autoStroke=m,g.align=o,g.verticalAlign=a,e.setDefaultTextStyle(g)),e.__dirty|=N_,s&&e.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?Nx:Ex},t.prototype.getOutsideStroke=function(){var t=this.__zr&&this.__zr.getBackgroundColor(),e="string"==typeof t&&Rn(t);e||(e=[255,255,255,1]);for(var n=e[3],i=this.__zr.isDarkMode(),r=0;3>r;r++)e[r]=e[r]*n+(i?0:255)*(1-n);return e[3]=1,Wn(e,"rgba")},t.prototype.traverse=function(){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},h(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if(D(t))for(var n=t,i=b(n),r=0;r0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(qx,!1,t)},t.prototype.useState=function(t,e,n,i){var r=t===qx,o=this.hasState();if(o||!r){var s=this.currentStates,l=this.stateTransition;if(!(p(s,t)>=0)||!e&&1!==s.length){var u;if(this.stateProxy&&!r&&(u=this.stateProxy(t)),u||(u=this.states&&this.states[t]),!u&&!r)return void a("State "+t+" not exists.");r||this.saveCurrentToNormalState(u);var h=!!(u&&u.hoverLayer||i);h&&this._toggleHoverLayerFlag(!0),this._applyStateObj(t,u,this._normalState,e,!n&&!this.__inHover&&l&&l.duration>0,l);var c=this._textContent,d=this._textGuide;return c&&c.useState(t,e,n,h),d&&d.useState(t,e,n,h),r?(this.currentStates=[],this._normalState={}):e?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!h&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~N_),u}}},t.prototype.useStates=function(t,e,n){if(t.length){var i=[],r=this.currentStates,o=t.length,a=o===r.length;if(a)for(var s=0;o>s;s++)if(t[s]!==r[s]){a=!1;break}if(a)return;for(var s=0;o>s;s++){var l=t[s],u=void 0;this.stateProxy&&(u=this.stateProxy(l,t)),u||(u=this.states[l]),u&&i.push(u)}var h=i[o-1],c=!!(h&&h.hoverLayer||n);c&&this._toggleHoverLayerFlag(!0);var p=this._mergeStates(i),d=this.stateTransition;this.saveCurrentToNormalState(p),this._applyStateObj(t.join(","),p,this._normalState,!1,!e&&!this.__inHover&&d&&d.duration>0,d);var f=this._textContent,g=this._textGuide;f&&f.useStates(t,e,c),g&&g.useStates(t,e,c),this._updateAnimationTargets(),this.currentStates=t.slice(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~N_)}else this.clearStates()},t.prototype._updateAnimationTargets=function(){for(var t=0;t=0){var n=this.currentStates.slice();n.splice(e,1),this.useStates(n)}},t.prototype.replaceState=function(t,e,n){var i=this.currentStates.slice(),r=p(i,t),o=p(i,e)>=0;r>=0?o?i.splice(r,1):i[r]=e:n&&!o&&i.push(e),this.useStates(i)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,n={},i=0;i=0&&e.splice(n,1)}),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},t.prototype.updateDuringAnimation=function(){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var n=this.animators,i=n.length,r=[],o=0;i>o;o++){var a=n[o];t&&t!==a.scope?r.push(a):a.stop(e)}return this.animators=r,this},t.prototype.animateTo=function(t,e,n){Ii(this,t,e,n)},t.prototype.animateFrom=function(t,e,n){Ii(this,t,e,n,!0)},t.prototype._transitionState=function(t,e,n,i){for(var r=Ii(this,e,n,i),o=0;o=0&&(n.splice(i,0,t),this._doAdd(t))}return this},n.prototype.replace=function(t,e){var n=p(this._children,t);return n>=0&&this.replaceAt(e,n),this},n.prototype.replaceAt=function(t,e){var n=this._children,i=n[e];if(t&&t!==this&&t.parent!==this&&t!==i){n[e]=t,i.parent=null;var r=this.__zr;r&&i.removeSelfFromZr(r),this._doAdd(t)}return this},n.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},n.prototype.remove=function(t){var e=this.__zr,n=this._children,i=p(n,t);return 0>i?this:(n.splice(i,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh(),this)},n.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,n=0;n0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this.animation.start(),this._stillFrameAccum=0},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover()},t.prototype.resize=function(t){t=t||{},this.painter.resize(t.width,t.height),this.handler.resize()},t.prototype.clearAnimation=function(){this.animation.clear()},t.prototype.getWidth=function(){return this.painter.getWidth()},t.prototype.getHeight=function(){return this.painter.getHeight()},t.prototype.setCursorStyle=function(t){this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){return this.handler.findHover(t,e)},t.prototype.on=function(t,e,n){return this.handler.on(t,e,n),this},t.prototype.off=function(t,e){this.handler.off(t,e)},t.prototype.trigger=function(t,e){this.handler.trigger(t,e)},t.prototype.clear=function(){for(var t=this.storage.getRoots(),e=0;e0&&(this._ux=nw(n/Ox/t)||0,this._uy=nw(n/Ox/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this._drawPendingPt(),this.addData(Xb.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var n=nw(t-this._xi),i=nw(e-this._yi),r=n>this._ux||i>this._uy;if(this.addData(Xb.L,t,e),this._ctx&&r&&this._ctx.lineTo(t,e),r)this._xi=t,this._yi=e,this._pendingPtDist=0;else{var o=n*n+i*i;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){return this._drawPendingPt(),this.addData(Xb.C,t,e,n,i,r,o),this._ctx&&this._ctx.bezierCurveTo(t,e,n,i,r,o),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,n,i){return this._drawPendingPt(),this.addData(Xb.Q,t,e,n,i),this._ctx&&this._ctx.quadraticCurveTo(t,e,n,i),this._xi=n,this._yi=i,this},t.prototype.arc=function(t,e,n,i,r,o){this._drawPendingPt(),aw[0]=i,aw[1]=r,vo(aw,o),i=aw[0],r=aw[1];var a=r-i;return this.addData(Xb.A,t,e,n,n,i,a,0,o?0:1),this._ctx&&this._ctx.arc(t,e,n,i,r,o),this._xi=tw(r)*n+t,this._yi=ew(r)*n+e,this},t.prototype.arcTo=function(t,e,n,i,r){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(t,e,n,i,r),this},t.prototype.rect=function(t,e,n,i){return this._drawPendingPt(),this._ctx&&this._ctx.rect(t,e,n,i),this.addData(Xb.R,t,e,n,i),this},t.prototype.closePath=function(){this._drawPendingPt(),this.addData(Xb.Z);var t=this._ctx,e=this._x0,n=this._y0;return t&&t.closePath(),this._xi=e,this._yi=n,this},t.prototype.fill=function(t){t&&t.fill(),this.toStatic()},t.prototype.stroke=function(t){t&&t.stroke(),this.toStatic()},t.prototype.len=function(){return this._len},t.prototype.setData=function(t){var e=t.length;this.data&&this.data.length===e||!ow||(this.data=new Float32Array(e));for(var n=0;e>n;n++)this.data[n]=t[n];this._len=e},t.prototype.appendPath=function(t){t instanceof Array||(t=[t]);for(var e=t.length,n=0,i=this._len,r=0;e>r;r++)n+=t[r].len();ow&&this.data instanceof Float32Array&&(this.data=new Float32Array(i+n));for(var r=0;e>r;r++)for(var o=t[r].data,a=0;at.length&&(this._expandData(),t=this.data);for(var e=0;e0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],e=0;e11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){jb[0]=jb[1]=Kb[0]=Kb[1]=Number.MAX_VALUE,Zb[0]=Zb[1]=$b[0]=$b[1]=-Number.MAX_VALUE;var t,e=this.data,n=0,i=0,r=0,o=0;for(t=0;tc;){var p=t[c++],d=1===c;d&&(r=t[c],o=t[c+1],a=r,s=o);var f=-1;switch(p){case Xb.M:r=a=t[c++],o=s=t[c++];break;case Xb.L:var g=t[c++],y=t[c++],v=g-r,m=y-o;(nw(v)>n||nw(m)>i||c===e-1)&&(f=Math.sqrt(v*v+m*m),r=g,o=y);break;case Xb.C:var _=t[c++],x=t[c++],g=t[c++],y=t[c++],b=t[c++],w=t[c++];f=gn(r,o,_,x,g,y,b,w,10),r=b,o=w;break;case Xb.Q:var _=t[c++],x=t[c++],g=t[c++],y=t[c++];f=wn(r,o,_,x,g,y,10),r=g,o=y;break;case Xb.A:var S=t[c++],M=t[c++],T=t[c++],I=t[c++],C=t[c++],k=t[c++],D=k+C;c+=1;{!t[c++]}d&&(a=tw(C)*T+S,s=ew(C)*I+M),f=Jb(T,I)*Qb(rw,Math.abs(k)),r=tw(D)*T+S,o=ew(D)*I+M;break;case Xb.R:a=r=t[c++],s=o=t[c++];var A=t[c++],P=t[c++];f=2*A+2*P;break;case Xb.Z:var v=a-r,m=s-o;f=Math.sqrt(v*v+m*m),r=a,o=s}f>=0&&(l[h++]=f,u+=f)}return this._pathLen=u,u},t.prototype.rebuildPath=function(t,e){var n,i,r,o,a,s,l,u,h,c,p,d=this.data,f=this._ux,g=this._uy,y=this._len,v=1>e,m=0,_=0,x=0;if(!v||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,u=this._pathLen,h=e*u))t:for(var b=0;y>b;){var w=d[b++],S=1===b;switch(S&&(r=d[b],o=d[b+1],n=r,i=o),w!==Xb.L&&x>0&&(t.lineTo(c,p),x=0),w){case Xb.M:n=r=d[b++],i=o=d[b++],t.moveTo(r,o);break;case Xb.L:a=d[b++],s=d[b++];var M=nw(a-r),T=nw(s-o);if(M>f||T>g){if(v){var I=l[_++];if(m+I>h){var C=(h-m)/I;t.lineTo(r*(1-C)+a*C,o*(1-C)+s*C);break t}m+=I}t.lineTo(a,s),r=a,o=s,x=0}else{var k=M*M+T*T;k>x&&(c=a,p=s,x=k)}break;case Xb.C:var D=d[b++],A=d[b++],P=d[b++],L=d[b++],O=d[b++],R=d[b++];if(v){var I=l[_++];if(m+I>h){var C=(h-m)/I;dn(r,D,P,O,C,Yb),dn(o,A,L,R,C,qb),t.bezierCurveTo(Yb[1],qb[1],Yb[2],qb[2],Yb[3],qb[3]);break t}m+=I}t.bezierCurveTo(D,A,P,L,O,R),r=O,o=R;break;case Xb.Q:var D=d[b++],A=d[b++],P=d[b++],L=d[b++];if(v){var I=l[_++];if(m+I>h){var C=(h-m)/I;xn(r,D,P,C,Yb),xn(o,A,L,C,qb),t.quadraticCurveTo(Yb[1],qb[1],Yb[2],qb[2]);break t}m+=I}t.quadraticCurveTo(D,A,P,L),r=P,o=L;break;case Xb.A:var E=d[b++],N=d[b++],z=d[b++],B=d[b++],F=d[b++],V=d[b++],H=d[b++],G=!d[b++],W=z>B?z:B,U=nw(z-B)>.001,X=F+V,Y=!1;if(v){var I=l[_++];m+I>h&&(X=F+V*(h-m)/I,Y=!0),m+=I}if(U&&t.ellipse?t.ellipse(E,N,z,B,H,F,X,G):t.arc(E,N,W,F,X,G),Y)break t;S&&(n=tw(F)*z+E,i=ew(F)*B+N),r=tw(X)*z+E,o=ew(X)*B+N;break;case Xb.R:n=r=d[b],i=o=d[b+1],a=d[b++],s=d[b++];var q=d[b++],j=d[b++];if(v){var I=l[_++];if(m+I>h){var Z=h-m;t.moveTo(a,s),t.lineTo(a+Qb(Z,q),s),Z-=q,Z>0&&t.lineTo(a+q,s+Qb(Z,j)),Z-=j,Z>0&&t.lineTo(a+Jb(q-Z,0),s+j),Z-=q,Z>0&&t.lineTo(a,s+Jb(j-Z,0));break t}m+=I}t.rect(a,s,q,j);break;case Xb.Z:if(v){var I=l[_++];if(m+I>h){var C=(h-m)/I;t.lineTo(r*(1-C)+n*C,o*(1-C)+i*C);break t}m+=I}t.closePath(),r=n,o=i}}},t.prototype.clone=function(){var e=new t,n=this.data;return e.data=n.slice?n.slice():Array.prototype.slice.call(n),e._len=this._len,e},t.CMD=Xb,t.initDefaultProps=function(){var e=t.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),t}(),lw=2*Math.PI,uw=2*Math.PI,hw=sw.CMD,cw=2*Math.PI,pw=1e-4,dw=[-1,-1,-1],fw=[-1,-1],gw=c({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},kb),yw={style:c({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},Db.style)},vw=Xx.concat(["invisible","culling","z","z2","zlevel","parent"]),mw=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.update=function(){var e=this;t.prototype.update.call(this);var i=this.style;if(i.decal){var r=this._decalEl=this._decalEl||new n;r.buildPath===n.prototype.buildPath&&(r.buildPath=function(t){e.buildPath(t,e.shape)}),r.silent=!0;var o=r.style;for(var a in i)o[a]!==i[a]&&(o[a]=i[a]);o.fill=i.fill?i.decal:null,o.decal=null,o.shadowColor=null,i.strokeFirst&&(o.stroke=null);for(var s=0;s.5?Ex:e>.2?zx:Nx}if(t)return Nx}return Ex},n.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if(I(e)){var n=this.__zr,i=!(!n||!n.isDarkMode()),r=Un(t,0)0))},n.prototype.hasFill=function(){var t=this.style,e=t.fill;return null!=e&&"none"!==e},n.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,n=!t;if(n){var i=!1;this.path||(i=!0,this.createPathProxy());var r=this.path;(i||this.__dirty&B_)&&(r.beginPath(),this.buildPath(r,this.shape,!1),this.pathUpdated()),t=r.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var o=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||n){o.copy(t);var a=e.strokeNoScale?this.getLineScale():1,s=e.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}a>1e-10&&(o.width+=s/a,o.height+=s/a,o.x-=s/a/2,o.y-=s/a/2)}return o}return t},n.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect(),r=this.style;if(t=n[0],e=n[1],i.contain(t,e)){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),Po(o,a/s,t,e)))return!0}if(this.hasFill())return Ao(o,t,e)}return!1},n.prototype.dirtyShape=function(){this.__dirty|=B_,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},n.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},n.prototype.animateShape=function(t){return this.animate("shape",t)},n.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},n.prototype.attrKV=function(e,n){"shape"===e?this.setShape(n):t.prototype.attrKV.call(this,e,n)},n.prototype.setShape=function(t,e){var n=this.shape;return n||(n=this.shape={}),"string"==typeof t?n[t]=e:h(n,t),this.dirtyShape(),this},n.prototype.shapeChanged=function(){return!!(this.__dirty&B_)},n.prototype.createStyle=function(t){return j(gw,t)},n.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var n=this._normalState;e.shape&&!n.shape&&(n.shape=h({},this.shape))},n.prototype._applyStateObj=function(e,n,i,r,o,a){t.prototype._applyStateObj.call(this,e,n,i,r,o,a);var s,l=!(n&&r);if(n&&n.shape?o?r?s=n.shape:(s=h({},i.shape),h(s,n.shape)):(s=h({},r?this.shape:i.shape),h(s,n.shape)):l&&(s=i.shape),s)if(o){this.shape=h({},this.shape);for(var u={},c=b(s),p=0;p0},n.prototype.hasFill=function(){var t=this.style,e=t.fill;return null!=e&&"none"!==e},n.prototype.createStyle=function(t){return j(_w,t)},n.prototype.setBoundingRect=function(t){this._rect=t},n.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var e=t.text;null!=e?e+="":e="";var n=xi(e,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var i=t.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},n.initDefaultProps=function(){var t=n.prototype;t.dirtyRectTolerance=10}(),n}(Lb);xw.prototype.type="tspan";var bw=c({x:0,y:0},kb),ww={style:c({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},Db.style)},Sw=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.createStyle=function(t){return j(bw,t)},n.prototype._getSize=function(t){var e=this.style,n=e[t];if(null!=n)return n;var i=Lo(e.image)?e.image:this.__image;if(!i)return 0;var r="width"===t?"height":"width",o=e[r];return null==o?i[t]:i[t]/i[r]*o},n.prototype.getWidth=function(){return this._getSize("width")},n.prototype.getHeight=function(){return this._getSize("height")},n.prototype.getAnimationStyleProps=function(){return ww},n.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new I_(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},n}(Lb);Sw.prototype.type="image";var Mw=Math.round,Tw=function(){function t(){this.x=0,this.y=0,this.width=0,this.height=0}return t}(),Iw={},Cw=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new Tw},n.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=Eo(Iw,e,this.style);n=a.x,i=a.y,r=a.width,o=a.height,a.r=e.r,e=a}else n=e.x,i=e.y,r=e.width,o=e.height;e.r?Oo(t,e):t.rect(n,i,r,o)},n.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},n}(mw);Cw.prototype.type="rect"; +var kw={fill:"#000"},Dw=2,Aw={style:c({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},Db.style)},Pw=function(t){function n(e){var n=t.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=kw,n.attr(e),n}return e(n,t),n.prototype.childrenRef=function(){return this._children},n.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var e=0;e0,I=null!=t.width&&("truncate"===t.overflow||"break"===t.overflow||"breakAll"===t.overflow),C=r.calculatedLineHeight,k=0;kM&&(k=x[M],!k.align||"left"===k.align);)this._placeToken(k,t,w,g,T,"left",v),S-=k.width,T+=k.width,M++;for(;C>=0&&(k=x[C],"right"===k.align);)this._placeToken(k,t,w,g,I,"right",v),S-=k.width,I-=k.width,C--;for(T+=(i-(T-f)-(y-I)-S)/2;C>=M;)k=x[M],this._placeToken(k,t,w,g,T+k.width/2,"center",v),T+=k.width,M++;g+=w}},n.prototype._placeToken=function(t,e,n,i,r,o,a){var s=e.rich[t.styleName]||{};s.text=t.text;var l=t.verticalAlign,u=i+n/2;"top"===l?u=i+t.height/2:"bottom"===l&&(u=i+n-t.height/2);var h=!t.isLineHolder&&Yo(s);h&&this._renderBackground(s,e,"right"===o?r-t.width:"center"===o?r-t.width/2:r,u-t.height/2,t.width,t.height);var c=!!s.backgroundColor,p=t.textPadding;p&&(r=Uo(r,o,p),u-=t.height/2-p[0]-t.innerHeight/2);var d=this._getOrCreateChild(xw),f=d.createStyle();d.useStyle(f);var g=this._defaultStyle,y=!1,v=0,m=Wo("fill"in s?s.fill:"fill"in e?e.fill:(y=!0,g.fill)),_=Go("stroke"in s?s.stroke:"stroke"in e?e.stroke:c||a||g.autoStroke&&!y?null:(v=Dw,g.stroke)),x=s.textShadowBlur>0||e.textShadowBlur>0;f.text=t.text,f.x=r,f.y=u,x&&(f.shadowBlur=s.textShadowBlur||e.textShadowBlur||0,f.shadowColor=s.textShadowColor||e.textShadowColor||"transparent",f.shadowOffsetX=s.textShadowOffsetX||e.textShadowOffsetX||0,f.shadowOffsetY=s.textShadowOffsetY||e.textShadowOffsetY||0),f.textAlign=o,f.textBaseline="middle",f.font=t.font||Cm,f.opacity=F(s.opacity,e.opacity,1),Bo(f,s),_&&(f.lineWidth=F(s.lineWidth,e.lineWidth,v),f.lineDash=B(s.lineDash,e.lineDash),f.lineDashOffset=e.lineDashOffset||0,f.stroke=_),m&&(f.fill=m);var b=t.contentWidth,w=t.contentHeight;d.setBoundingRect(new I_(bi(f.x,b,f.textAlign),wi(f.y,w,f.textBaseline),b,w))},n.prototype._renderBackground=function(t,e,n,i,r,o){var a,s,l=t.backgroundColor,u=t.borderWidth,h=t.borderColor,c=l&&l.image,p=l&&!c,d=t.borderRadius,f=this;if(p||t.lineHeight||u&&h){a=this._getOrCreateChild(Cw),a.useStyle(a.createStyle()),a.style.fill=null;var g=a.shape;g.x=n,g.y=i,g.width=r,g.height=o,g.r=d,a.dirtyShape()}if(p){var y=a.style;y.fill=l||null,y.fillOpacity=B(t.fillOpacity,1)}else if(c){s=this._getOrCreateChild(Sw),s.onload=function(){f.dirtyStyle()};var v=s.style;v.image=l.image,v.x=n,v.y=i,v.width=r,v.height=o}if(u&&h){var y=a.style;y.lineWidth=u,y.stroke=h,y.strokeOpacity=B(t.strokeOpacity,1),y.lineDash=t.borderDash,y.lineDashOffset=t.borderDashOffset||0,a.strokeContainThreshold=0,a.hasFill()&&a.hasStroke()&&(y.strokeFirst=!0,y.lineWidth*=2)}var m=(a||s).style;m.shadowBlur=t.shadowBlur||0,m.shadowColor=t.shadowColor||"transparent",m.shadowOffsetX=t.shadowOffsetX||0,m.shadowOffsetY=t.shadowOffsetY||0,m.opacity=F(t.opacity,e.opacity,1)},n.makeFont=function(t){var e="";return Fo(t)&&(e=[t.fontStyle,t.fontWeight,zo(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),e&&W(e)||t.textFont||t.font},n}(Lb),Lw={left:!0,right:1,center:1},Ow={top:1,bottom:1,middle:1},Rw=["fontStyle","fontWeight","fontSize","fontFamily"],Ew=Pr(),Nw=function(t,e,n,i){if(i){var r=Ew(i);r.dataIndex=n,r.dataType=e,r.seriesIndex=t,"group"===i.type&&i.traverse(function(i){var r=Ew(i);r.seriesIndex=t,r.dataIndex=n,r.dataType=e})}},zw=1,Bw={},Fw=Pr(),Vw=Pr(),Hw=0,Gw=1,Ww=2,Uw=["emphasis","blur","select"],Xw=["normal","emphasis","blur","select"],Yw=10,qw=9,jw="highlight",Zw="downplay",Kw="select",$w="unselect",Qw="toggleSelect",Jw=new nx(100),tS=["emphasis","blur","select"],eS={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"},nS=sw.CMD,iS=[[],[],[]],rS=Math.sqrt,oS=Math.atan2,aS=Math.sqrt,sS=Math.sin,lS=Math.cos,uS=Math.PI,hS=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,cS=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g,pS=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.applyTransform=function(){},n}(mw),dS=function(){function t(){this.cx=0,this.cy=0,this.r=0}return t}(),fS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new dS},n.prototype.buildPath=function(t,e){t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI)},n}(mw);fS.prototype.type="circle";var gS=function(){function t(){this.cx=0,this.cy=0,this.rx=0,this.ry=0}return t}(),yS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new gS},n.prototype.buildPath=function(t,e){var n=.5522848,i=e.cx,r=e.cy,o=e.rx,a=e.ry,s=o*n,l=a*n;t.moveTo(i-o,r),t.bezierCurveTo(i-o,r-l,i-s,r-a,i,r-a),t.bezierCurveTo(i+s,r-a,i+o,r-l,i+o,r),t.bezierCurveTo(i+o,r+l,i+s,r+a,i,r+a),t.bezierCurveTo(i-s,r+a,i-o,r+l,i-o,r),t.closePath()},n}(mw);yS.prototype.type="ellipse";var vS=Math.PI,mS=2*vS,_S=Math.sin,xS=Math.cos,bS=Math.acos,wS=Math.atan2,SS=Math.abs,MS=Math.sqrt,TS=Math.max,IS=Math.min,CS=1e-4,kS=function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0}return t}(),DS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new kS},n.prototype.buildPath=function(t,e){es(t,e)},n.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},n}(mw);DS.prototype.type="sector";var AS=function(){function t(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return t}(),PS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new AS},n.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=2*Math.PI;t.moveTo(n+e.r,i),t.arc(n,i,e.r,0,r,!1),t.moveTo(n+e.r0,i),t.arc(n,i,e.r0,0,r,!0)},n}(mw);PS.prototype.type="ring";var LS=function(){function t(){this.points=null,this.smooth=0,this.smoothConstraint=null}return t}(),OS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultShape=function(){return new LS},n.prototype.buildPath=function(t,e){is(t,e,!0)},n}(mw);OS.prototype.type="polygon";var RS=function(){function t(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null}return t}(),ES=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new RS},n.prototype.buildPath=function(t,e){is(t,e,!1)},n}(mw);ES.prototype.type="polyline";var NS={},zS=function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return t}(),BS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new zS},n.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=Ro(NS,e,this.style);n=a.x1,i=a.y1,r=a.x2,o=a.y2}else n=e.x1,i=e.y1,r=e.x2,o=e.y2;var s=e.percent;0!==s&&(t.moveTo(n,i),1>s&&(r=n*(1-s)+r*s,o=i*(1-s)+o*s),t.lineTo(r,o))},n.prototype.pointAt=function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]},n}(mw);BS.prototype.type="line";var FS=[],VS=function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.percent=1}return t}(),HS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new VS},n.prototype.buildPath=function(t,e){var n=e.x1,i=e.y1,r=e.x2,o=e.y2,a=e.cpx1,s=e.cpy1,l=e.cpx2,u=e.cpy2,h=e.percent;0!==h&&(t.moveTo(n,i),null==l||null==u?(1>h&&(xn(n,a,r,h,FS),a=FS[1],r=FS[2],xn(i,s,o,h,FS),s=FS[1],o=FS[2]),t.quadraticCurveTo(a,s,r,o)):(1>h&&(dn(n,a,l,r,h,FS),a=FS[1],l=FS[2],r=FS[3],dn(i,s,u,o,h,FS),s=FS[1],u=FS[2],o=FS[3]),t.bezierCurveTo(a,s,l,u,r,o)))},n.prototype.pointAt=function(t){return rs(this.shape,t,!1)},n.prototype.tangentAt=function(t){var e=rs(this.shape,t,!0);return ce(e,e)},n}(mw);HS.prototype.type="bezier-curve";var GS=function(){function t(){this.cx=0,this.cy=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0}return t}(),WS=function(t){function n(e){return t.call(this,e)||this}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new GS},n.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=Math.max(e.r,0),o=e.startAngle,a=e.endAngle,s=e.clockwise,l=Math.cos(o),u=Math.sin(o);t.moveTo(l*r+n,u*r+i),t.arc(n,i,r,o,a,!s)},n}(mw);WS.prototype.type="arc";var US=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="compound",e}return e(n,t),n.prototype._updatePathDirty=function(){for(var t=this.shape.paths,e=this.shapeChanged(),n=0;nn;n++)this._corners[n]=new v_;for(var n=0;2>n;n++)this._axes[n]=new v_;t&&this.fromBoundingRect(t,e)}return t.prototype.fromBoundingRect=function(t,e){var n=this._corners,i=this._axes,r=t.x,o=t.y,a=r+t.width,s=o+t.height;if(n[0].set(r,o),n[1].set(a,o),n[2].set(a,s),n[3].set(r,s),e)for(var l=0;4>l;l++)n[l].transform(e);v_.sub(i[0],n[1],n[0]),v_.sub(i[1],n[3],n[0]),i[0].normalize(),i[1].normalize();for(var l=0;2>l;l++)this._origin[l]=i[l].dot(n[0])},t.prototype.intersect=function(t,e){var n=!0,i=!e;return KS.set(1/0,1/0),$S.set(0,0),!this._intersectCheckOneSide(this,t,KS,$S,i,1)&&(n=!1,i)?n:!this._intersectCheckOneSide(t,this,KS,$S,i,-1)&&(n=!1,i)?n:(i||v_.copy(e,n?KS:$S),n)},t.prototype._intersectCheckOneSide=function(t,e,n,i,r,o){for(var a=!0,s=0;2>s;s++){var l=this._axes[s];if(this._getProjMinMaxOnAxis(s,t._corners,jS),this._getProjMinMaxOnAxis(s,e._corners,ZS),jS[1]ZS[1]){if(a=!1,r)return a;var u=Math.abs(ZS[0]-jS[1]),h=Math.abs(jS[0]-ZS[1]);Math.min(u,h)>i.len()&&(h>u?v_.scale(i,l,-u*o):v_.scale(i,l,h*o))}else if(n){var u=Math.abs(ZS[0]-jS[1]),h=Math.abs(jS[0]-ZS[1]);Math.min(u,h)u?v_.scale(n,l,u*o):v_.scale(n,l,-h*o))}}return a},t.prototype._getProjMinMaxOnAxis=function(t,e,n){for(var i=this._axes[t],r=this._origin,o=e[0].dot(i)+r[t],a=o,s=o,l=1;l-1?kM:AM}():AM;nl(DM,IM),nl(kM,CM);var RM=1e3,EM=60*RM,NM=60*EM,zM=24*NM,BM=365*zM,FM={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},VM="{yyyy}-{MM}-{dd}",HM={year:"{yyyy}",month:"{yyyy}-{MM}",day:VM,hour:VM+" "+FM.hour,minute:VM+" "+FM.minute,second:VM+" "+FM.second,millisecond:FM.none},GM=["year","month","day","hour","minute","second","millisecond"],WM=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"],UM=H,XM=["a","b","c","d","e","f","g"],YM=function(t,e){return"{"+t+(null==e?"":e)+"}"},qM=y,jM=["left","right","top","bottom","width","height"],ZM=[["width","left","right"],["height","top","bottom"]],KM=Bl,$M=(S(Bl,"vertical"),S(Bl,"horizontal"),Pr()),QM=function(t){function n(e,n,i){var r=t.call(this,e,n,i)||this;return r.uid=Qs("ec_cpt_model"),r}return e(n,t),n.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n)},n.prototype.mergeDefaultAndTheme=function(t,e){var n=Vl(this),i=n?Gl(t):{},r=e.getTheme();l(t,r.get(this.mainType)),l(t,this.getDefaultOption()),n&&Hl(t,i,n)},n.prototype.mergeOption=function(t){l(this.option,t,!0);var e=Vl(this);e&&Hl(this.option,t,e)},n.prototype.optionUpdated=function(){},n.prototype.getDefaultOption=function(){var t=this.constructor;if(!Hr(t))return t.defaultOption;var e=$M(this);if(!e.defaultOption){for(var n=[],i=t;i;){var r=i.prototype.defaultOption;r&&n.push(r),i=i.superClass}for(var o={},a=n.length-1;a>=0;a--)o=l(o,n[a],!0);e.defaultOption=o}return e.defaultOption},n.prototype.getReferringComponents=function(t,e){var n=t+"Index",i=t+"Id";return Rr(this.ecModel,t,{index:this.get(n,!0),id:this.get(i,!0)},e)},n.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},n.prototype.getZLevelKey=function(){return""},n.prototype.setZLevel=function(t){this.option.zlevel=t},n.protoInitialize=function(){var t=n.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),n}(MM);Ur(QM,MM),jr(QM),Js(QM),tl(QM,Ul);var JM="";"undefined"!=typeof navigator&&(JM=navigator.platform||"");var tT,eT,nT="rgba(0, 0, 0, 0.2)",iT={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:nT,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:nT,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:nT,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:nT,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:nT,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:nT,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:JM.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1},rT=Y(["tooltip","label","itemName","itemId","itemGroupId","seriesName"]),oT="original",aT="arrayRows",sT="objectRows",lT="keyedColumns",uT="typedArray",hT="unknown",cT="column",pT="row",dT={Must:1,Might:2,Not:3},fT=Pr(),gT=Y(),yT=Pr(),vT=(Pr(),function(){function t(){}return t.prototype.getColorFromPalette=function(t,e,n){var i=pr(this.get("color",!0)),r=this.get("colorLayer",!0);return Jl(this,yT,i,r,t,e,n)},t.prototype.clearColorPalette=function(){tu(this,yT)},t}()),mT="\x00_ec_inner",_T=1,xT=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.init=function(t,e,n,i,r,o){i=i||{},this.option=null,this._theme=new MM(i),this._locale=new MM(r),this._optionManager=o},n.prototype.setOption=function(t,e,n){var i=ou(e);this._optionManager.setOption(t,n,i),this._resetOption(null,i)},n.prototype.resetOption=function(t,e){return this._resetOption(t,ou(e))},n.prototype._resetOption=function(t,e){var n=!1,i=this._optionManager;if(!t||"recreate"===t){var r=i.mountOption("recreate"===t);this.option&&"recreate"!==t?(this.restoreData(),this._mergeOption(r,e)):eT(this,r),n=!0}if(("timeline"===t||"media"===t)&&this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(n=!0,this._mergeOption(o,e))}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this);a.length&&y(a,function(t){n=!0,this._mergeOption(t,e)},this)}return n},n.prototype.mergeOption=function(t){this._mergeOption(t,null)},n.prototype._mergeOption=function(t,e){function n(e){var n=$l(this,e,pr(t[e])),a=r.get(e),s=a?c&&c.get(e)?"replaceMerge":"normalMerge":"replaceAll",l=yr(a,n,s);kr(l,e,QM),i[e]=null,r.set(e,null),o.set(e,0);var u,p=[],d=[],f=0;y(l,function(t,n){var i=t.existing,r=t.newOption;if(r){var o="series"===e,a=QM.getClass(e,t.keyInfo.subType,!o);if(!a)return;if("tooltip"===e){if(u)return;u=!0}if(i&&i.constructor===a)i.name=t.keyInfo.name,i.mergeOption(r,this),i.optionUpdated(r,!1);else{var s=h({componentIndex:n},t.keyInfo);i=new a(r,this,this,s),h(i,s),t.brandNew&&(i.__requireNewView=!0),i.init(r,this,this),i.optionUpdated(null,!0)}}else i&&(i.mergeOption({},this),i.optionUpdated({},!1));i?(p.push(i.option),d.push(i),f++):(p.push(void 0),d.push(void 0))},this),i[e]=p,r.set(e,d),o.set(e,f),"series"===e&&tT(this)}var i=this.option,r=this._componentsMap,o=this._componentsCount,a=[],u=Y(),c=e&&e.replaceMergeMainTypeMap;Xl(this),y(t,function(t,e){null!=t&&(QM.hasClass(e)?e&&(a.push(e),u.set(e,!0)):i[e]=null==i[e]?s(t):l(i[e],t,!0))}),c&&c.each(function(t,e){QM.hasClass(e)&&!u.get(e)&&(a.push(e),u.set(e,!0))}),QM.topologicalTravel(a,QM.getAllClassMainTypes(),n,this),this._seriesIndices||tT(this) +},n.prototype.getOption=function(){var t=s(this.option);return y(t,function(e,n){if(QM.hasClass(n)){for(var i=pr(e),r=i.length,o=!1,a=r-1;a>=0;a--)i[a]&&!Cr(i[a])?o=!0:(i[a]=null,!o&&r--);i.length=r,t[n]=i}}),delete t[mT],t},n.prototype.getTheme=function(){return this._theme},n.prototype.getLocaleModel=function(){return this._locale},n.prototype.setUpdatePayload=function(t){this._payload=t},n.prototype.getUpdatePayload=function(){return this._payload},n.prototype.getComponent=function(t,e){var n=this._componentsMap.get(t);if(n){var i=n[e||0];if(i)return i;if(null==e)for(var r=0;ra;a++)su(n[a].query,t,e)&&r.push(a);return!r.length&&i&&(r=[-1]),r.length&&!uu(r,this._currentMediaIndices)&&(o=v(r,function(t){return s(-1===t?i.option:n[t].option)})),this._currentMediaIndices=r,o},t}(),OT=y,RT=D,ET=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"],NT=[["x","left"],["y","top"],["x2","right"],["y2","bottom"]],zT=["grid","geo","parallel","legend","toolbox","title","visualMap","dataZoom","timeline"],BT=[["borderRadius","barBorderRadius"],["borderColor","barBorderColor"],["borderWidth","barBorderWidth"]],FT=function(){function t(t){this.data=t.data||(t.sourceFormat===lT?{}:[]),this.sourceFormat=t.sourceFormat||hT,this.seriesLayoutBy=t.seriesLayoutBy||cT,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var e=this.dimensionsDefine=t.dimensionsDefine;if(e)for(var n=0;no;o++)e[o]=n[r+o];return e},i=function(t,e,n,i){for(var r=this._data,o=this._dimSize,a=0;o>a;a++){for(var s=i[a],l=null==s[0]?1/0:s[0],u=null==s[1]?-1/0:s[1],h=e-t,c=n[a],p=0;h>p;p++){var d=r[p*o+a];c[t+p]=d,l>d&&(l=d),d>u&&(u=d)}s[0]=l,s[1]=u}},r=function(){return this._data?this._data.length/this._dimSize:0};e={},e[aT+"_"+cT]={pure:!0,appendData:t},e[aT+"_"+pT]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[sT]={pure:!0,appendData:t},e[lT]={pure:!0,appendData:function(t){var e=this._data;y(t,function(t,n){for(var i=e[n]||(e[n]=[]),r=0;r<(t||[]).length;r++)i.push(t[r])})}},e[oT]={appendData:t},e[uT]={persistent:!1,pure:!0,appendData:function(t){this._data=t},clean:function(){this._offset+=this.count(),this._data=null}},MT=e}(),t}(),HT=function(t,e,n,i){return t[i]},GT=(bT={},bT[aT+"_"+cT]=function(t,e,n,i){return t[i+e]},bT[aT+"_"+pT]=function(t,e,n,i,r){i+=e;for(var o=r||[],a=t,s=0;s=0&&(s=o.interpolatedValue[l])}return null!=s?s+"":""})}},t.prototype.getRawValue=function(t,e){return Uu(this.getData(e),t)},t.prototype.formatTooltip=function(){},t}(),ZT=function(){function t(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return t.prototype.perform=function(t){function e(t){return!(t>=1)&&(t=1),t}var n=this._upstream,i=t&&t.skip;if(this._dirty&&n){var r=this.context;r.data=r.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var o;this._plan&&!i&&(o=this._plan(this.context));var a=e(this._modBy),s=this._modDataCount||0,l=e(t&&t.modBy),u=t&&t.modDataCount||0;(a!==l||s!==u)&&(o="reset");var h;(this._dirty||"reset"===o)&&(this._dirty=!1,h=this._doReset(i)),this._modBy=l,this._modDataCount=u;var c=t&&t.step;if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var p=this._dueIndex,d=Math.min(null!=c?this._dueIndex+c:1/0,this._dueEnd);if(!i&&(h||d>p)){var f=this._progress;if(M(f))for(var g=0;gi?i++:null}function e(){var t=i%a*r+Math.ceil(i/a),e=i>=n?null:o>t?t:i;return i++,e}var n,i,r,o,a,s={reset:function(l,u,h,c){i=l,n=u,r=h,o=c,a=Math.ceil(o/r),s.next=r>1&&o>0?e:t}};return s}(),$T=(Y({number:function(t){return parseFloat(t)},time:function(t){return+Ji(t)},trim:function(t){return I(t)?W(t):t}}),{lt:function(t,e){return e>t},lte:function(t,e){return e>=t},gt:function(t,e){return t>e},gte:function(t,e){return t>=e}}),QT=(function(){function t(t,e){if(!k(e)){var n="";hr(n)}this._opFn=$T[t],this._rvalFloat=or(e)}return t.prototype.evaluate=function(t){return k(t)?this._opFn(t,this._rvalFloat):this._opFn(or(t),this._rvalFloat)},t}(),function(){function t(t,e){var n="desc"===t;this._resultLT=n?1:-1,null==e&&(e=n?"min":"max"),this._incomparable="min"===e?-1/0:1/0}return t.prototype.evaluate=function(t,e){var n=k(t)?t:or(t),i=k(e)?e:or(e),r=isNaN(n),o=isNaN(i);if(r&&(n=this._incomparable),o&&(i=this._incomparable),r&&o){var a=I(t),s=I(e);a&&(n=s?t:0),s&&(i=a?e:0)}return i>n?this._resultLT:n>i?-this._resultLT:0},t}()),JT=(function(){function t(t,e){this._rval=e,this._isEQ=t,this._rvalTypeof=typeof e,this._rvalFloat=or(e)}return t.prototype.evaluate=function(t){var e=t===this._rval;if(!e){var n=typeof t;n===this._rvalTypeof||"number"!==n&&"number"!==this._rvalTypeof||(e=or(t)===this._rvalFloat)}return this._isEQ?e:!e},t}(),function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(){},t.prototype.retrieveValueFromItem=function(){},t.prototype.convertValue=function(t,e){return qu(t,e)},t}()),tI=Y(),eI="undefined",nI=typeof Uint32Array===eI?Array:Uint32Array,iI=typeof Uint16Array===eI?Array:Uint16Array,rI=typeof Int32Array===eI?Array:Int32Array,oI=typeof Float64Array===eI?Array:Float64Array,aI={"float":oI,"int":rI,ordinal:Array,number:Array,time:oI},sI=function(){function t(){this._chunks=[],this._rawExtent=[],this._extent=[],this._count=0,this._rawCount=0,this._calcDimNameToIdx=Y()}return t.prototype.initData=function(t,e,n){this._provider=t,this._chunks=[],this._indices=null,this.getRawIndex=this._getRawIdxIdentity;var i=t.getSource(),r=this.defaultDimValueGetter=IT[i.sourceFormat];this._dimValueGetter=n||r,this._rawExtent=[];Fu(i);this._dimensions=v(e,function(t){return{type:t.type,property:t.property}}),this._initDataFromProvider(0,t.count())},t.prototype.getProvider=function(){return this._provider},t.prototype.getSource=function(){return this._provider.getSource()},t.prototype.ensureCalculationDimension=function(t,e){var n=this._calcDimNameToIdx,i=this._dimensions,r=n.get(t);if(null!=r){if(i[r].type===e)return r}else r=i.length;return i[r]={type:e},n.set(t,r),this._chunks[r]=new aI[e||"float"](this._rawCount),this._rawExtent[r]=rh(),r},t.prototype.collectOrdinalMeta=function(t,e){var n=this._chunks[t],i=this._dimensions[t],r=this._rawExtent,o=i.ordinalOffset||0,a=n.length;0===o&&(r[t]=rh());for(var s=r[t],l=o;a>l;l++){var u=n[l]=e.parseAndCollect(n[l]);isNaN(u)||(s[0]=Math.min(u,s[0]),s[1]=Math.max(u,s[1]))}i.ordinalMeta=e,i.ordinalOffset=a,i.type="ordinal"},t.prototype.getOrdinalMeta=function(t){var e=this._dimensions[t],n=e.ordinalMeta;return n},t.prototype.getDimensionProperty=function(t){var e=this._dimensions[t];return e&&e.property},t.prototype.appendData=function(t){var e=this._provider,n=this.count();e.appendData(t);var i=e.count();return e.persistent||(i+=n),i>n&&this._initDataFromProvider(n,i,!0),[n,i]},t.prototype.appendValues=function(t,e){for(var n=this._chunks,i=this._dimensions,r=i.length,o=this._rawExtent,a=this.count(),s=a+Math.max(t.length,e||0),l=0;r>l;l++){var u=i[l];ah(n,l,u.type,s,!0)}for(var h=[],c=a;s>c;c++)for(var p=c-a,d=0;r>d;d++){var u=i[d],f=IT.arrayRows.call(this,t[p]||h,u.property,p,d);n[d][c]=f;var g=o[d];fg[1]&&(g[1]=f)}return this._rawCount=this._count=s,{start:a,end:s}},t.prototype._initDataFromProvider=function(t,e,n){for(var i=this._provider,r=this._chunks,o=this._dimensions,a=o.length,s=this._rawExtent,l=v(o,function(t){return t.property}),u=0;a>u;u++){var h=o[u];s[u]||(s[u]=rh()),ah(r,u,h.type,e,n)}if(i.fillStorage)i.fillStorage(t,e,r,s);else for(var c=[],p=t;e>p;p++){c=i.getItem(p,c);for(var d=0;a>d;d++){var f=r[d],g=this._dimValueGetter(c,l[d],p,d);f[p]=g;var y=s[d];gy[1]&&(y[1]=g)}}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=e,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(t,e){if(!(e>=0&&er;r++)n.push(this.get(i[r],e));return n},t.prototype.getByRawIndex=function(t,e){if(!(e>=0&&ei;i++){var o=this.get(t,i);isNaN(o)||(n+=o)}return n},t.prototype.getMedian=function(t){var e=[];this.each([t],function(t){isNaN(t)||e.push(t)});var n=e.sort(function(t,e){return t-e}),i=this.count();return 0===i?0:i%2===1?n[(i-1)/2]:(n[i/2]+n[i/2-1])/2},t.prototype.indexOfRawIndex=function(t){if(t>=this._rawCount||0>t)return-1;if(!this._indices)return t;var e=this._indices,n=e[t];if(null!=n&&n=i;){var o=(i+r)/2|0;if(e[o]t))return o;r=o-1}}return-1},t.prototype.indicesOfNearest=function(t,e,n){var i=this._chunks,r=i[t],o=[];if(!r)return o;null==n&&(n=1/0);for(var a=1/0,s=-1,l=0,u=0,h=this.count();h>u;u++){var c=this.getRawIndex(u),p=e-r[c],d=Math.abs(p);n>=d&&((a>d||d===a&&p>=0&&0>s)&&(a=d,s=p,l=0),p===s&&(o[l++]=u))}return o.length=l,o},t.prototype.getIndices=function(){var t,e=this._indices;if(e){var n=e.constructor,i=this._count;if(n===Array){t=new n(i);for(var r=0;i>r;r++)t[r]=e[r]}else t=new n(e.buffer,0,i)}else{var n=ih(this._rawCount);t=new n(this.count());for(var r=0;rc;c++){var p=void 0,d=n.getRawIndex(c);if(0===s)p=e(c);else if(1===s){var f=h[u][d];p=e(f,c)}else{for(var g=0;s>g;g++)a[g]=h[t[g]][d];a[g]=c,p=e.apply(null,a)}p&&(o[l++]=d)}return i>l&&(n._indices=o),n._count=l,n._extent=[],n._updateGetRawIdx(),n},t.prototype.selectRange=function(t){var e=this.clone(),n=e._count;if(!n)return this;var i=b(t),r=i.length;if(!r)return this;var o=e.count(),a=ih(e._rawCount),s=new a(o),l=0,u=i[0],h=t[u][0],c=t[u][1],p=e._chunks,d=!1;if(!e._indices){var f=0;if(1===r){for(var g=p[i[0]],y=0;n>y;y++){var v=g[y];(v>=h&&c>=v||isNaN(v))&&(s[l++]=f),f++}d=!0}else if(2===r){for(var g=p[i[0]],m=p[i[1]],_=t[i[1]][0],x=t[i[1]][1],y=0;n>y;y++){var v=g[y],w=m[y];(v>=h&&c>=v||isNaN(v))&&(w>=_&&x>=w||isNaN(w))&&(s[l++]=f),f++}d=!0}}if(!d)if(1===r)for(var y=0;o>y;y++){var S=e.getRawIndex(y),v=p[i[0]][S];(v>=h&&c>=v||isNaN(v))&&(s[l++]=S)}else for(var y=0;o>y;y++){for(var M=!0,S=e.getRawIndex(y),T=0;r>T;T++){var I=i[T],v=p[I][S];(vt[I][1])&&(M=!1)}M&&(s[l++]=e.getRawIndex(y))}return o>l&&(e._indices=s),e._count=l,e._extent=[],e._updateGetRawIdx(),e},t.prototype.map=function(t,e){var n=this.clone(t);return this._updateDims(n,t,e),n},t.prototype.modify=function(t,e){this._updateDims(this,t,e)},t.prototype._updateDims=function(t,e,n){for(var i=t._chunks,r=[],o=e.length,a=t.count(),s=[],l=t._rawExtent,u=0;uh;h++){for(var c=t.getRawIndex(h),p=0;o>p;p++)s[p]=i[e[p]][c];s[o]=h;var d=n&&n.apply(null,s);if(null!=d){"object"!=typeof d&&(r[0]=d,d=r);for(var u=0;uy[1]&&(y[1]=g)}}}},t.prototype.lttbDownSample=function(t,e){var n,i,r,o=this.clone([t],!0),a=o._chunks,s=a[t],l=this.count(),u=0,h=Math.floor(1/e),c=this.getRawIndex(0),p=new(ih(this._rawCount))(Math.min(2*(Math.ceil(l/h)+2),l));p[u++]=c;for(var d=1;l-1>d;d+=h){for(var f=Math.min(d+h,l-1),g=Math.min(d+2*h,l),y=(g+f)/2,v=0,m=f;g>m;m++){var _=this.getRawIndex(m),x=s[_];isNaN(x)||(v+=x)}v/=g-f;var b=d,w=Math.min(d+h,l),S=d-1,M=s[c];n=-1,r=b;for(var T=-1,I=0,m=b;w>m;m++){var _=this.getRawIndex(m),x=s[_];isNaN(x)?(I++,0>T&&(T=_)):(i=Math.abs((S-y)*(x-M)-(S-m)*(v-M)),i>n&&(n=i,r=_))}I>0&&w-b>I&&(p[u++]=Math.min(T,r),r=Math.max(T,r)),p[u++]=r,c=r}return p[u++]=this.getRawIndex(l-1),o._count=u,o._indices=p,o.getRawIndex=this._getRawIdx,o},t.prototype.downSample=function(t,e,n,i){for(var r=this.clone([t],!0),o=r._chunks,a=[],s=Math.floor(1/e),l=o[t],u=this.count(),h=r._rawExtent[t]=rh(),c=new(ih(this._rawCount))(Math.ceil(u/s)),p=0,d=0;u>d;d+=s){s>u-d&&(s=u-d,a.length=s);for(var f=0;s>f;f++){var g=this.getRawIndex(d+f);a[f]=l[g]}var y=n(a),v=this.getRawIndex(Math.min(d+i(a,y)||0,u-1));l[v]=y,yh[1]&&(h[1]=y),c[p++]=v}return r._count=p,r._indices=c,r._updateGetRawIdx(),r},t.prototype.each=function(t,e){if(this._count)for(var n=t.length,i=this._chunks,r=0,o=this.count();o>r;r++){var a=this.getRawIndex(r);switch(n){case 0:e(r);break;case 1:e(i[t[0]][a],r);break;case 2:e(i[t[0]][a],i[t[1]][a],r);break;default:for(var s=0,l=[];n>s;s++)l[s]=i[t[s]][a];l[s]=r,e.apply(null,l)}}},t.prototype.getDataExtent=function(t){var e=this._chunks[t],n=rh();if(!e)return n;var i,r=this.count(),o=!this._indices;if(o)return this._rawExtent[t].slice();if(i=this._extent[t])return i.slice();i=n;for(var a=i[0],s=i[1],l=0;r>l;l++){var u=this.getRawIndex(l),h=e[u];a>h&&(a=h),h>s&&(s=h)}return i=[a,s],this._extent[t]=i,i},t.prototype.getRawDataItem=function(t){var e=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(e);for(var n=[],i=this._chunks,r=0;ri;i++)e[i]=this._indices[i]}else e=new t(this._indices);return e}return null},t.prototype._getRawIdxIdentity=function(t){return t},t.prototype._getRawIdx=function(t){return t=0?this._indices[t]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=function(){function t(t,e,n,i){return qu(t[i],this._dimensions[i])}IT={arrayRows:t,objectRows:function(t,e,n,i){return qu(t[e],this._dimensions[i])},keyedColumns:t,original:function(t,e,n,i){var r=t&&(null==t.value?t:t.value);return qu(r instanceof Array?r[i]:r,this._dimensions[i])},typedArray:function(t,e,n,i){return t[i]}}}(),t}(),lI=function(){function t(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(t,e){this._sourceList=t,this._upstreamSignList=e,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var t,e,n=this._sourceHost,i=this._getUpstreamSourceManagers(),r=!!i.length;if(lh(n)){var o=n,a=void 0,s=void 0,l=void 0;if(r){var u=i[0];u.prepareSource(),l=u.getSource(),a=l.data,s=l.sourceFormat,e=[u._getVersionSign()]}else a=o.get("data",!0),s=P(a)?uT:oT,e=[];var h=this._getSourceMetaRawOption()||{},c=l&&l.metaRawOption||{},p=B(h.seriesLayoutBy,c.seriesLayoutBy)||null,d=B(h.sourceHeader,c.sourceHeader),f=B(h.dimensions,c.dimensions),g=p!==c.seriesLayoutBy||!!d!=!!c.sourceHeader||f;t=g?[Pu(a,{seriesLayoutBy:p,sourceHeader:d,dimensions:f},s)]:[]}else{var y=n;if(r){var v=this._applyTransform(i);t=v.sourceList,e=v.upstreamSignList}else{var m=y.get("source",!0);t=[Pu(m,this._getSourceMetaRawOption(),null)],e=[]}}this._setLocalSource(t,e)},t.prototype._applyTransform=function(t){var e=this._sourceHost,n=e.get("transform",!0),i=e.get("fromTransformResult",!0);if(null!=i){var r="";1!==t.length&&uh(r)}var o,a=[],s=[];return y(t,function(t){t.prepareSource();var e=t.getSource(i||0),n="";null==i||e||uh(n),a.push(e),s.push(t._getVersionSign())}),n?o=th(n,a,{datasetIndex:e.componentIndex}):null!=i&&(o=[Ou(a[0])]),{sourceList:o,upstreamSignList:s}},t.prototype._isDirty=function(){if(this._dirty)return!0;for(var t=this._getUpstreamSourceManagers(),e=0;ethis.getShallow("animationThreshold")&&(e=!1),!!e},n.prototype.restoreData=function(){this.dataTask.dirty()},n.prototype.getColorFromPalette=function(t,e,n){var i=this.ecModel,r=vT.prototype.getColorFromPalette.call(this,t,e,n);return r||(r=i.getColorFromPalette(t,e,n)),r},n.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},n.prototype.getProgressive=function(){return this.get("progressive")},n.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},n.prototype.select=function(t,e){this._innerSelect(this.getData(e),t)},n.prototype.unselect=function(t,e){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,r=this.getData(e);if("series"===i||"all"===n)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var o=0;o=0&&n.push(r)}return n},n.prototype.isSelected=function(t,e){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(e);return("all"===n||n[kh(i,t)])&&!i.getItemModel(t).get(["select","disabled"])},n.prototype.isUniversalTransitionEnabled=function(){if(this[fI])return!0;var t=this.option.universalTransition;return t?t===!0?!0:t&&t.enabled:!1},n.prototype._innerSelect=function(t,e){var n,i,r=this.option,o=r.selectedMode,a=e.length;if(o&&a)if("series"===o)r.selectedMap="all";else if("multiple"===o){D(r.selectedMap)||(r.selectedMap={});for(var s=r.selectedMap,l=0;a>l;l++){var u=e[l],h=kh(t,u);s[h]=!0,this._selectedDataIndicesMap[h]=t.getRawIndex(u)}}else if("single"===o||o===!0){var c=e[a-1],h=kh(t,c);r.selectedMap=(n={},n[h]=!0,n),this._selectedDataIndicesMap=(i={},i[h]=t.getRawIndex(c),i)}},n.prototype._initSelectedMapFromData=function(t){if(!this.option.selectedMap){var e=[];t.hasItemOption&&t.each(function(n){var i=t.getRawDataItem(n);i&&i.selected&&e.push(n)}),e.length>0&&this._innerSelect(t,e)}},n.registerClass=function(t){return QM.registerClass(t)},n.protoInitialize=function(){var t=n.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),n}(QM);f(gI,jT),f(gI,vT),Ur(gI,QM);var yI=function(){function t(){this.group=new Jx,this.uid=Qs("viewComponent")}return t.prototype.init=function(){},t.prototype.render=function(){},t.prototype.dispose=function(){},t.prototype.updateView=function(){},t.prototype.updateLayout=function(){},t.prototype.updateVisual=function(){},t.prototype.toggleBlurSeries=function(){},t.prototype.eachRendered=function(t){var e=this.group;e&&e.traverse(t)},t}();Gr(yI),jr(yI);var vI=Pr(),mI=zh(),_I=function(){function t(){this.group=new Jx,this.uid=Qs("viewChart"),this.renderTask=Yu({plan:Vh,reset:Hh}),this.renderTask.context={view:this}}return t.prototype.init=function(){},t.prototype.render=function(){},t.prototype.highlight=function(t,e,n,i){var r=t.getData(i&&i.dataType);r&&Fh(r,i,"emphasis")},t.prototype.downplay=function(t,e,n,i){var r=t.getData(i&&i.dataType);r&&Fh(r,i,"normal")},t.prototype.remove=function(){this.group.removeAll()},t.prototype.dispose=function(){},t.prototype.updateView=function(t,e,n,i){this.render(t,e,n,i)},t.prototype.updateLayout=function(t,e,n,i){this.render(t,e,n,i)},t.prototype.updateVisual=function(t,e,n,i){this.render(t,e,n,i)},t.prototype.eachRendered=function(t){Fs(this.group,t)},t.markUpdateMethod=function(t,e){vI(t).updateMethod=e},t.protoInitialize=function(){var e=t.prototype;e.type="chart"}(),t}();Gr(_I,["dispose"]),jr(_I);var xI,bI={incrementalPrepareRender:{progress:function(t,e){e.view.incrementalRender(t,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(t,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}},wI="\x00__throttleOriginMethod",SI="\x00__throttleRate",MI="\x00__throttleType",TI=Pr(),II={itemStyle:Zr(bM,!0),lineStyle:Zr(mM,!0)},CI={lineStyle:"stroke",itemStyle:"fill"},kI={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=t.getModel(i),o=Xh(t,i),a=o(r),s=r.getShallow("decal");s&&(n.setVisual("decal",s),s.dirty=!0);var l=Yh(t,i),u=a[l],c=T(u)?u:null,p="auto"===a.fill||"auto"===a.stroke;if(!a[l]||c||p){var d=t.getColorFromPalette(t.name,null,e.getSeriesCount());a[l]||(a[l]=d,n.setVisual("colorFromPalette",!0)),a.fill="auto"===a.fill||T(a.fill)?d:a.fill,a.stroke="auto"===a.stroke||T(a.stroke)?d:a.stroke}return n.setVisual("style",a),n.setVisual("drawType",l),!e.isSeriesFiltered(t)&&c?(n.setVisual("colorFromPalette",!1),{dataEach:function(e,n){var i=t.getDataParams(n),r=h({},a);r[l]=c(i),e.setItemVisual(n,"style",r)}}):void 0}},DI=new MM,AI={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.ignoreStyleOnData&&!e.isSeriesFiltered(t)){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=Xh(t,i),o=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(t,e){var n=t.getRawDataItem(e);if(n&&n[i]){DI.option=n[i];var a=r(DI),s=t.ensureUniqueItemVisual(e,"style");h(s,a),DI.option.decal&&(t.setItemVisual(e,"decal",DI.option.decal),DI.option.decal.dirty=!0),o in a&&t.setItemVisual(e,"colorFromPalette",!1)}}:null}}}},PI={performRawSeries:!0,overallReset:function(t){var e=Y();t.eachSeries(function(t){var n=t.getColorBy();if(!t.isColorBySeries()){var i=t.type+"-"+n,r=e.get(i);r||(r={},e.set(i,r)),TI(t).scope=r}}),t.eachSeries(function(e){if(!e.isColorBySeries()&&!t.isSeriesFiltered(e)){var n=e.getRawData(),i={},r=e.getData(),o=TI(e).scope,a=e.visualStyleAccessPath||"itemStyle",s=Yh(e,a);r.each(function(t){var e=r.getRawIndex(t);i[e]=t}),n.each(function(t){var a=i[t],l=r.getItemVisual(a,"colorFromPalette");if(l){var u=r.ensureUniqueItemVisual(a,"style"),h=n.getName(t)||t+"",c=n.count();u[s]=e.getColorFromPalette(h,o,c)}})}})}},LI=Math.PI,OI=function(){function t(t,e,n,i){this._stageTaskMap=Y(),this.ecInstance=t,this.api=e,n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return t.prototype.restoreData=function(t,e){t.restoreData(e),this._stageTaskMap.each(function(t){var e=t.overallTask;e&&e.dirty()})},t.prototype.getPerformArgs=function(t,e){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),i=n.context,r=!e&&n.progressiveEnabled&&(!i||i.progressiveRender)&&t.__idxInPipeline>n.blockIndex,o=r?n.step:null,a=i&&i.modDataCount,s=null!=a?Math.ceil(a/o):null;return{step:o,modBy:s,modDataCount:a}}},t.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},t.prototype.updateStreamModes=function(t,e){var n=this._pipelineMap.get(t.uid),i=t.getData(),r=i.count(),o=n.progressiveEnabled&&e.incrementalPrepareRender&&r>=n.threshold,a=t.get("large")&&r>=t.get("largeThreshold"),s="mod"===t.get("progressiveChunkMode")?r:null;t.pipelineContext=n.context={progressiveRender:o,modDataCount:s,large:a}},t.prototype.restorePipelines=function(t){var e=this,n=e._pipelineMap=Y();t.eachSeries(function(t){var i=t.getProgressive(),r=t.uid;n.set(r,{id:r,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),e._pipe(t,t.dataTask)})},t.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.api.getModel(),n=this.api;y(this._allHandlers,function(i){var r=t.get(i.uid)||t.set(i.uid,{}),o="";G(!(i.reset&&i.overallReset),o),i.reset&&this._createSeriesStageTask(i,r,e,n),i.overallReset&&this._createOverallStageTask(i,r,e,n)},this)},t.prototype.prepareView=function(t,e,n,i){var r=t.renderTask,o=r.context;o.model=e,o.ecModel=n,o.api=i,r.__block=!t.incrementalPrepareRender,this._pipe(e,r)},t.prototype.performDataProcessorTasks=function(t,e){this._performStageTasks(this._dataProcessorHandlers,t,e,{block:!0})},t.prototype.performVisualTasks=function(t,e,n){this._performStageTasks(this._visualHandlers,t,e,n)},t.prototype._performStageTasks=function(t,e,n,i){function r(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}i=i||{};var o=!1,a=this;y(t,function(t){if(!i.visualType||i.visualType===t.visualType){var s=a._stageTaskMap.get(t.uid),l=s.seriesTaskMap,u=s.overallTask;if(u){var h,c=u.agentStubMap;c.each(function(t){r(i,t)&&(t.dirty(),h=!0)}),h&&u.dirty(),a.updatePayload(u,n);var p=a.getPerformArgs(u,i.block);c.each(function(t){t.perform(p)}),u.perform(p)&&(o=!0)}else l&&l.each(function(s){r(i,s)&&s.dirty();var l=a.getPerformArgs(s,i.block);l.skip=!t.performRawSeries&&e.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(l)&&(o=!0)})}}),this.unfinished=o||this.unfinished},t.prototype.performSeriesTasks=function(t){var e;t.eachSeries(function(t){e=t.dataTask.perform()||e}),this.unfinished=e||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each(function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)})},t.prototype.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},t.prototype._createSeriesStageTask=function(t,e,n,i){function r(e){var r=e.uid,l=s.set(r,a&&a.get(r)||Yu({plan:Qh,reset:Jh,count:ec}));l.context={model:e,ecModel:n,api:i,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:o},o._pipe(e,l)}var o=this,a=e.seriesTaskMap,s=e.seriesTaskMap=Y(),l=t.seriesType,u=t.getTargetSeries;t.createOnAllSeries?n.eachRawSeries(r):l?n.eachRawSeriesByType(l,r):u&&u(n,i).each(r)},t.prototype._createOverallStageTask=function(t,e,n,i){function r(t){var e=t.uid,n=l.set(e,s&&s.get(e)||(p=!0,Yu({reset:Zh,onDirty:$h})));n.context={model:t,overallProgress:c},n.agent=a,n.__block=c,o._pipe(t,n)}var o=this,a=e.overallTask=e.overallTask||Yu({reset:jh});a.context={ecModel:n,api:i,overallReset:t.overallReset,scheduler:o};var s=a.agentStubMap,l=a.agentStubMap=Y(),u=t.seriesType,h=t.getTargetSeries,c=!0,p=!1,d="";G(!t.createOnAllSeries,d),u?n.eachRawSeriesByType(u,r):h?h(n,i).each(r):(c=!1,y(n.getSeries(),r)),p&&a.dirty()},t.prototype._pipe=function(t,e){var n=t.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=e),i.tail&&i.tail.pipe(e),i.tail=e,e.__idxInPipeline=i.count++,e.__pipeline=i},t.wrapStageHandler=function(t,e){return T(t)&&(t={overallReset:t,seriesType:nc(t)}),t.uid=Qs("stageHandler"),e&&(t.visualType=e),t},t}(),RI=tc(0),EI={},NI={};ic(EI,xT),ic(NI,kT),EI.eachSeriesByType=EI.eachRawSeriesByType=function(t){xI=t},EI.eachComponent=function(t){"series"===t.mainType&&t.subType&&(xI=t.subType)};var zI=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"],BI={color:zI,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],zI]},FI="#B9B8CE",VI="#100C2A",HI=function(){return{axisLine:{lineStyle:{color:FI}},splitLine:{lineStyle:{color:"#484753"}},splitArea:{areaStyle:{color:["rgba(255,255,255,0.02)","rgba(255,255,255,0.05)"]}},minorSplitLine:{lineStyle:{color:"#20203B"}}}},GI=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"],WI={darkMode:!0,color:GI,backgroundColor:VI,axisPointer:{lineStyle:{color:"#817f91"},crossStyle:{color:"#817f91"},label:{color:"#fff"}},legend:{textStyle:{color:FI}},textStyle:{color:FI},title:{textStyle:{color:"#EEF1FA"},subtextStyle:{color:"#B9B8CE"}},toolbox:{iconStyle:{borderColor:FI}},dataZoom:{borderColor:"#71708A",textStyle:{color:FI},brushStyle:{color:"rgba(135,163,206,0.3)"},handleStyle:{color:"#353450",borderColor:"#C5CBE3"},moveHandleStyle:{color:"#B0B6C3",opacity:.3},fillerColor:"rgba(135,163,206,0.2)",emphasis:{handleStyle:{borderColor:"#91B7F2",color:"#4D587D"},moveHandleStyle:{color:"#636D9A",opacity:.7}},dataBackground:{lineStyle:{color:"#71708A",width:1},areaStyle:{color:"#71708A"}},selectedDataBackground:{lineStyle:{color:"#87A3CE"},areaStyle:{color:"#87A3CE"}}},visualMap:{textStyle:{color:FI}},timeline:{lineStyle:{color:FI},label:{color:FI},controlStyle:{color:FI,borderColor:FI}},calendar:{itemStyle:{color:VI},dayLabel:{color:FI},monthLabel:{color:FI},yearLabel:{color:FI}},timeAxis:HI(),logAxis:HI(),valueAxis:HI(),categoryAxis:HI(),line:{symbol:"circle"},graph:{color:GI},gauge:{title:{color:FI},axisLine:{lineStyle:{color:[[1,"rgba(207,212,219,0.2)"]]}},axisLabel:{color:FI},detail:{color:"#EEF1FA"}},candlestick:{itemStyle:{color:"#f64e56",color0:"#54ea92",borderColor:"#f64e56",borderColor0:"#54ea92"}}};WI.categoryAxis.splitLine.show=!1;var UI=function(){function t(){}return t.prototype.normalizeQuery=function(t){var e={},n={},i={};if(I(t)){var r=Fr(t);e.mainType=r.main||null,e.subType=r.sub||null}else{var o=["Index","Name","Id"],a={name:1,dataIndex:1,dataType:1};y(t,function(t,r){for(var s=!1,l=0;l0&&h===r.length-u.length){var c=r.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,s=!0)}}a.hasOwnProperty(r)&&(n[r]=t,s=!0),s||(i[r]=t)})}return{cptQuery:e,dataQuery:n,otherQuery:i}},t.prototype.filter=function(t,e){function n(t,e,n,i){return null==t[n]||e[i||n]===t[n]}var i=this.eventInfo;if(!i)return!0;var r=i.targetEl,o=i.packedEvent,a=i.model,s=i.view;if(!a||!s)return!0;var l=e.cptQuery,u=e.dataQuery;return n(l,a,"mainType")&&n(l,a,"subType")&&n(l,a,"index","componentIndex")&&n(l,a,"name")&&n(l,a,"id")&&n(u,o,"name")&&n(u,o,"dataIndex")&&n(u,o,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(t,e.otherQuery,r,o))},t.prototype.afterTrigger=function(){this.eventInfo=null},t}(),XI=["symbol","symbolSize","symbolRotate","symbolOffset"],YI=XI.concat(["symbolKeepAspect"]),qI={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){function n(e,n){for(var i=t.getRawValue(n),r=t.getDataParams(n),a=0;a0&&t.unfinished);t.unfinished||this._zr.flush()}}},n.prototype.getDom=function(){return this._dom},n.prototype.getId=function(){return this.id},n.prototype.getZr=function(){return this._zr},n.prototype.isSSR=function(){return this._ssr},n.prototype.setOption=function(t,e,n){if(!this[BC]&&!this._disposed){var i,r,o;if(D(e)&&(n=e.lazyUpdate,i=e.silent,r=e.replaceMerge,o=e.transition,e=e.notMerge),this[BC]=!0,!this._model||e){var a=new LT(this._api),s=this._theme,l=this._model=new xT;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,a)}this._model.setOption(t,{replaceMerge:r},mk);var u={seriesTransition:o,optionChanged:!0};if(n)this[FC]={silent:i,updateParams:u},this[BC]=!1,this.getZr().wakeUp();else{try{jC(this),$C.update.call(this,null,u)}catch(h){throw this[FC]=null,this[BC]=!1,h}this._ssr||this._zr.flush(),this[FC]=null,this[BC]=!1,ek.call(this,i),nk.call(this,i)}}},n.prototype.setTheme=function(){},n.prototype.getModel=function(){return this._model},n.prototype.getOption=function(){return this._model&&this._model.getOption()},n.prototype.getWidth=function(){return this._zr.getWidth()},n.prototype.getHeight=function(){return this._zr.getHeight()},n.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||mC&&window.devicePixelRatio||1},n.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},n.prototype.renderToCanvas=function(t){t=t||{};var e=this._zr.painter;return e.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},n.prototype.renderToSVGString=function(t){t=t||{};var e=this._zr.painter;return e.renderToString({useViewBox:t.useViewBox})},n.prototype.getSvgDataURL=function(){if(Mm.svgSupported){var t=this._zr,e=t.storage.getDisplayList();return y(e,function(t){t.stopAnimation(null,!0)}),t.painter.toDataURL()}},n.prototype.getDataURL=function(t){if(!this._disposed){t=t||{};var e=t.excludeComponents,n=this._model,i=[],r=this;y(e,function(t){n.eachComponent({mainType:t},function(t){var e=r._componentsMap[t.__viewId];e.group.ignore||(i.push(e),e.group.ignore=!0)})});var o="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return y(i,function(t){t.group.ignore=!1}),o}},n.prototype.getConnectedDataURL=function(t){if(!this._disposed){var e="svg"===t.type,n=this.group,i=Math.min,r=Math.max,o=1/0;if(Sk[n]){var a=o,l=o,u=-o,h=-o,c=[],p=t&&t.pixelRatio||this.getDevicePixelRatio();y(wk,function(o){if(o.group===n){var p=e?o.getZr().painter.getSvgDom().innerHTML:o.renderToCanvas(s(t)),d=o.getDom().getBoundingClientRect();a=i(d.left,a),l=i(d.top,l),u=r(d.right,u),h=r(d.bottom,h),c.push({dom:p,left:d.left,top:d.top})}}),a*=p,l*=p,u*=p,h*=p;var d=u-a,f=h-l,g=Lm.createCanvas(),v=Ei(g,{renderer:e?"svg":"canvas"});if(v.resize({width:d,height:f}),e){var m="";return y(c,function(t){var e=t.left-a,n=t.top-l;m+=''+t.dom+""}),v.painter.getSvgRoot().innerHTML=m,t.connectedBackgroundColor&&v.painter.setBackgroundColor(t.connectedBackgroundColor),v.refreshImmediately(),v.painter.toDataURL()}return t.connectedBackgroundColor&&v.add(new Cw({shape:{x:0,y:0,width:d,height:f},style:{fill:t.connectedBackgroundColor}})),y(c,function(t){var e=new Sw({style:{x:t.left*p-a,y:t.top*p-l,image:t.dom}});v.add(e)}),v.refreshImmediately(),g.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}},n.prototype.convertToPixel=function(t,e){return QC(this,"convertToPixel",t,e)},n.prototype.convertFromPixel=function(t,e){return QC(this,"convertFromPixel",t,e)},n.prototype.containPixel=function(t,e){if(!this._disposed){var n,i=this._model,r=Lr(i,t);return y(r,function(t,i){i.indexOf("Models")>=0&&y(t,function(t){var r=t.coordinateSystem;if(r&&r.containPoint)n=n||!!r.containPoint(e);else if("seriesModels"===i){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(n=n||o.containPoint(e,t))}},this)},this),!!n}},n.prototype.getVisual=function(t,e){var n=this._model,i=Lr(n,t,{defaultMainType:"series"}),r=i.seriesModel,o=r.getData(),a=i.hasOwnProperty("dataIndexInside")?i.dataIndexInside:i.hasOwnProperty("dataIndex")?o.indexOfRawIndex(i.dataIndex):null;return null!=a?rc(o,a,e):oc(o,e)},n.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},n.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},n.prototype._initEvents=function(){var t=this;y(fk,function(e){var n=function(n){var i,r=t.getModel(),o=n.target,a="globalout"===e;if(a?i={}:o&&lc(o,function(t){var e=Ew(t);if(e&&null!=e.dataIndex){var n=e.dataModel||r.getSeriesByIndex(e.seriesIndex);return i=n&&n.getDataParams(e.dataIndex,e.dataType)||{},!0}return e.eventData?(i=h({},e.eventData),!0):void 0},!0),i){var s=i.componentType,l=i.componentIndex;("markLine"===s||"markPoint"===s||"markArea"===s)&&(s="series",l=i.seriesIndex);var u=s&&null!=l&&r.getComponent(s,l),c=u&&t["series"===u.mainType?"_chartsMap":"_componentsMap"][u.__viewId];i.event=n,i.type=e,t._$eventProcessor.eventInfo={targetEl:o,packedEvent:i,model:u,view:c},t.trigger(e,i)}};n.zrEventfulCallAtLast=!0,t._zr.on(e,n,t)}),y(yk,function(e,n){t._messageCenter.on(n,function(t){this.trigger(n,t)},t)}),y(["selectchanged"],function(e){t._messageCenter.on(e,function(t){this.trigger(e,t)},t)}),sc(this._messageCenter,this,this._api)},n.prototype.isDisposed=function(){return this._disposed},n.prototype.clear=function(){this._disposed||this.setOption({series:[]},!0)},n.prototype.dispose=function(){if(!this._disposed){this._disposed=!0;var t=this.getDom();t&&Er(this.getDom(),Ik,"");var e=this,n=e._api,i=e._model;y(e._componentsViews,function(t){t.dispose(i,n)}),y(e._chartsViews,function(t){t.dispose(i,n)}),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete wk[e.id]}},n.prototype.resize=function(t){if(!this[BC]&&!this._disposed){this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var n=e.resetOption("media"),i=t&&t.silent;this[FC]&&(null==i&&(i=this[FC].silent),n=!0,this[FC]=null),this[BC]=!0;try{n&&jC(this),$C.update.call(this,{type:"resize",animation:h({duration:0},t&&t.animation)})}catch(r){throw this[BC]=!1,r}this[BC]=!1,ek.call(this,i),nk.call(this,i)}}},n.prototype.showLoading=function(t,e){if(!this._disposed&&(D(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),bk[t])){var n=bk[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}},n.prototype.hideLoading=function(){this._disposed||(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},n.prototype.makeActionFromEvent=function(t){var e=h({},t);return e.type=yk[t.type],e},n.prototype.dispatchAction=function(t,e){if(!this._disposed&&(D(e)||(e={silent:!!e}),gk[t.type]&&this._model)){if(this[BC])return void this._pendingActions.push(t);var n=e.silent;tk.call(this,t,n);var i=e.flush;i?this._zr.flush():i!==!1&&Mm.browser.weChat&&this._throttledZrFlush(),ek.call(this,n),nk.call(this,n)}},n.prototype.updateLabelLayout=function(){yC.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},n.prototype.appendData=function(t){if(!this._disposed){var e=t.seriesIndex,n=this.getModel(),i=n.getSeriesByIndex(e);i.appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},n.internalField=function(){function t(t){t.clearColorPalette(),t.eachSeries(function(t){t.clearColorPalette()})}function n(t){var e=[],n=[],i=!1;if(t.eachComponent(function(t,r){var o=r.get("zlevel")||0,a=r.get("z")||0,s=r.getZLevelKey();i=i||!!s,("series"===t?n:e).push({zlevel:o,z:a,idx:r.componentIndex,type:t,key:s})}),i){var r,o,a=e.concat(n);rn(a,function(t,e){return t.zlevel===e.zlevel?t.z-e.z:t.zlevel-e.zlevel}),y(a,function(e){var n=t.getComponent(e.type,e.idx),i=e.zlevel,a=e.key;null!=r&&(i=Math.max(r,i)),a?(i===r&&a!==o&&i++,o=a):o&&(i===r&&i++,o=""),r=i,n.setZLevel(i)})}}function i(t){for(var e=[],n=t.currentStates,i=0;ie.get("hoverLayerThreshold")&&!Mm.node&&!Mm.worker&&e.eachSeries(function(e){if(!e.preventUsingHoverLayer){var n=t._chartsMap[e.__viewId];n.__alive&&n.eachRendered(function(t){t.states.emphasis&&(t.states.emphasis.hoverLayer=!0)})}})}function o(t,e){var n=t.get("blendMode")||null;e.eachRendered(function(t){t.isGroup||(t.style.blend=n)})}function a(t,e){if(!t.preventAutoZ){var n=t.get("z")||0,i=t.get("zlevel")||0;e.eachRendered(function(t){return s(t,n,i,-1/0),!0})}}function s(t,e,n,i){var r=t.getTextContent(),o=t.getTextGuideLine(),a=t.isGroup;if(a)for(var l=t.childrenRef(),u=0;u0?{duration:o,delay:n.get("delay"),easing:n.get("easing")}:null;e.eachRendered(function(t){if(t.states&&t.states.emphasis){if(us(t))return;if(t instanceof mw&&Va(t),t.__dirty){var e=t.prevStates;e&&t.useStates(e)}if(r){t.stateTransition=a;var n=t.getTextContent(),o=t.getTextGuideLine();n&&(n.stateTransition=a),o&&(o.stateTransition=a)}t.__dirty&&i(t)}})}jC=function(t){var e=t._scheduler;e.restorePipelines(t._model),e.prepareStageTasks(),ZC(t,!0),ZC(t,!1),e.plan()},ZC=function(t,e){function n(t){var n=t.__requireNewView;t.__requireNewView=!1;var u="_ec_"+t.id+"_"+t.type,h=!n&&a[u];if(!h){var c=Fr(t.type),p=e?yI.getClass(c.main,c.sub):_I.getClass(c.sub);h=new p,h.init(i,l),a[u]=h,o.push(h),s.add(h.group)}t.__viewId=h.__id=u,h.__alive=!0,h.__model=t,h.group.__ecComponentInfo={mainType:t.mainType,index:t.componentIndex},!e&&r.prepareView(h,t,i,l)}for(var i=t._model,r=t._scheduler,o=e?t._componentsViews:t._chartsViews,a=e?t._componentsMap:t._chartsMap,s=t._zr,l=t._api,u=0;u1){var u=s.shift();1===s.length&&(n[a]=s[0]),this._update&&this._update(u,o)}else 1===l?(n[a]=null,this._update&&this._update(s,o)):this._remove&&this._remove(o)}this._performRestAdd(r,n)},t.prototype._executeMultiple=function(){var t=this._old,e=this._new,n={},i={},r=[],o=[];this._initIndexMap(t,n,r,"_oldKeyGetter"),this._initIndexMap(e,i,o,"_newKeyGetter");for(var a=0;a1&&1===c)this._updateManyToOne&&this._updateManyToOne(u,l),i[s]=null;else if(1===h&&c>1)this._updateOneToMany&&this._updateOneToMany(u,l),i[s]=null;else if(1===h&&1===c)this._update&&this._update(u,l),i[s]=null;else if(h>1&&c>1)this._updateManyToMany&&this._updateManyToMany(u,l),i[s]=null;else if(h>1)for(var p=0;h>p;p++)this._remove&&this._remove(l[p]);else this._remove&&this._remove(l)}this._performRestAdd(o,i)},t.prototype._performRestAdd=function(t,e){for(var n=0;n1)for(var a=0;o>a;a++)this._add&&this._add(r[a]);else 1===o&&this._add&&this._add(r);e[i]=null}},t.prototype._initIndexMap=function(t,e,n,i){for(var r=this._diffModeMultiple,o=0;oo;o++){var s=void 0,l=void 0,u=void 0,h=this.dimensions[a];if(h&&h.storeDimIndex===o)s=e?h.name:null,l=h.type,u=h.ordinalMeta,a++;else{var c=this.getSourceDimension(o);c&&(s=e?c.name:null,l=c.type)}r.push({property:s,type:l,ordinalMeta:u}),!e||null==s||h&&h.isCalculationCoord||(i+=n?s.replace(/\`/g,"`1").replace(/\$/g,"`2"):s),i+="$",i+=Gk[l]||"f",u&&(i+=u.uid),i+="$"}var p=this.source,d=[p.seriesLayoutBy,p.startIndex,i].join("$$");return{dimensions:r,hash:d}},t.prototype.makeOutputDimensionNames=function(){for(var t=[],e=0,n=0;ea;a++){var s=a-i;this._nameList[a]=e[s],o&&Nk(this,a)}},t.prototype._updateOrdinalMeta=function(){for(var t=this._store,e=this.dimensions,n=0;n=e)){var n=this._store,i=n.getProvider();this._updateOrdinalMeta();var r=this._nameList,o=this._idList,a=i.getSource().sourceFormat,s=a===oT;if(s&&!i.pure)for(var l=[],u=t;e>u;u++){var h=i.getItem(u,l);if(!this.hasItemOption&&gr(h)&&(this.hasItemOption=!0),h){var c=h.name;null==r[u]&&null!=c&&(r[u]=Tr(c,null));var p=h.id;null==o[u]&&null!=p&&(o[u]=Tr(p,null))}}if(this._shouldMakeIdFromName())for(var u=t;e>u;u++)Nk(this,u);Ak(this)}},t.prototype.getApproximateExtent=function(t){return this._approximateExtent[t]||this._store.getDataExtent(this._getStoreDimIndex(t))},t.prototype.setApproximateExtent=function(t,e){e=this.getDimension(e),this._approximateExtent[e]=t.slice()},t.prototype.getCalculationInfo=function(t){return this._calculationInfo[t]},t.prototype.setCalculationInfo=function(t,e){Uk(t)?h(this._calculationInfo,t):this._calculationInfo[t]=e},t.prototype.getName=function(t){var e=this.getRawIndex(t),n=this._nameList[e];return null==n&&null!=this._nameDimIdx&&(n=Lk(this,this._nameDimIdx,e)),null==n&&(n=""),n},t.prototype._getCategory=function(t,e){var n=this._store.get(t,e),i=this._store.getOrdinalMeta(t);return i?i.categories[n]:n},t.prototype.getId=function(t){return Pk(this,this.getRawIndex(t))},t.prototype.count=function(){return this._store.count()},t.prototype.get=function(t,e){var n=this._store,i=this._dimInfos[t];return i?n.get(i.storeDimIndex,e):void 0},t.prototype.getByRawIndex=function(t,e){var n=this._store,i=this._dimInfos[t];return i?n.getByRawIndex(i.storeDimIndex,e):void 0},t.prototype.getIndices=function(){return this._store.getIndices()},t.prototype.getDataExtent=function(t){return this._store.getDataExtent(this._getStoreDimIndex(t))},t.prototype.getSum=function(t){return this._store.getSum(this._getStoreDimIndex(t))},t.prototype.getMedian=function(t){return this._store.getMedian(this._getStoreDimIndex(t))},t.prototype.getValues=function(t,e){var n=this,i=this._store;return M(t)?i.getValues(Xk(t,function(t){return n._getStoreDimIndex(t)}),e):i.getValues(t)},t.prototype.hasValue=function(t){for(var e=this._dimSummary.dataDimIndicesOnCoord,n=0,i=e.length;i>n;n++)if(isNaN(this._store.get(e[n],t)))return!1;return!0},t.prototype.indexOfName=function(t){for(var e=0,n=this._store.count();n>e;e++)if(this.getName(e)===t)return e;return-1},t.prototype.getRawIndex=function(t){return this._store.getRawIndex(t)},t.prototype.indexOfRawIndex=function(t){return this._store.indexOfRawIndex(t)},t.prototype.rawIndexOf=function(t,e){var n=t&&this._invertedIndicesMap[t],i=n[e];return null==i||isNaN(i)?jk:i},t.prototype.indicesOfNearest=function(t,e,n){return this._store.indicesOfNearest(this._getStoreDimIndex(t),e,n)},t.prototype.each=function(t,e,n){T(t)&&(n=e,e=t,t=[]);var i=n||this,r=Xk(Ok(t),this._getStoreDimIndex,this);this._store.each(r,i?Ym(e,i):e)},t.prototype.filterSelf=function(t,e,n){T(t)&&(n=e,e=t,t=[]);var i=n||this,r=Xk(Ok(t),this._getStoreDimIndex,this);return this._store=this._store.filter(r,i?Ym(e,i):e),this},t.prototype.selectRange=function(t){var e=this,n={},i=b(t),r=[];return y(i,function(i){var o=e._getStoreDimIndex(i);n[o]=t[i],r.push(o)}),this._store=this._store.selectRange(n),this},t.prototype.mapArray=function(t,e,n){T(t)&&(n=e,e=t,t=[]),n=n||this;var i=[];return this.each(t,function(){i.push(e&&e.apply(this,arguments))},n),i},t.prototype.map=function(t,e,n,i){var r=n||i||this,o=Xk(Ok(t),this._getStoreDimIndex,this),a=Ek(this);return a._store=this._store.map(o,r?Ym(e,r):e),a},t.prototype.modify=function(t,e,n,i){var r=n||i||this,o=Xk(Ok(t),this._getStoreDimIndex,this);this._store.modify(o,r?Ym(e,r):e)},t.prototype.downSample=function(t,e,n,i){var r=Ek(this);return r._store=this._store.downSample(this._getStoreDimIndex(t),e,n,i),r},t.prototype.lttbDownSample=function(t,e){var n=Ek(this);return n._store=this._store.lttbDownSample(this._getStoreDimIndex(t),e),n},t.prototype.getRawDataItem=function(t){return this._store.getRawDataItem(t)},t.prototype.getItemModel=function(t){var e=this.hostModel,n=this.getRawDataItem(t);return new MM(n,e,e&&e.ecModel)},t.prototype.diff=function(t){var e=this;return new Bk(t?t.getStore().getIndices():[],this.getStore().getIndices(),function(e){return Pk(t,e)},function(t){return Pk(e,t)})},t.prototype.getVisual=function(t){var e=this._visual;return e&&e[t]},t.prototype.setVisual=function(t,e){this._visual=this._visual||{},Uk(t)?h(this._visual,t):this._visual[t]=e},t.prototype.getItemVisual=function(t,e){var n=this._itemVisuals[t],i=n&&n[e];return null==i?this.getVisual(e):i},t.prototype.hasItemVisual=function(){return this._itemVisuals.length>0},t.prototype.ensureUniqueItemVisual=function(t,e){var n=this._itemVisuals,i=n[t];i||(i=n[t]={});var r=i[e];return null==r&&(r=this.getVisual(e),M(r)?r=r.slice():Uk(r)&&(r=h({},r)),i[e]=r),r},t.prototype.setItemVisual=function(t,e,n){var i=this._itemVisuals[t]||{};this._itemVisuals[t]=i,Uk(e)?h(i,e):i[e]=n},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(t,e){Uk(t)?h(this._layout,t):this._layout[t]=e},t.prototype.getLayout=function(t){return this._layout[t]},t.prototype.getItemLayout=function(t){return this._itemLayouts[t]},t.prototype.setItemLayout=function(t,e,n){this._itemLayouts[t]=n?h(this._itemLayouts[t]||{},e):e},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(t,e){var n=this.hostModel&&this.hostModel.seriesIndex;Nw(n,this.dataType,t,e),this._graphicEls[t]=e},t.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},t.prototype.eachItemGraphicEl=function(t,e){y(this._graphicEls,function(n,i){n&&t&&t.call(e,n,i)})},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:Xk(this.dimensions,this._getDimInfo,this),this.hostModel)),Rk(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(t,e){var n=this[t];T(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=n.apply(this,arguments);return e.apply(this,[t].concat(V(arguments)))})},t.internalField=function(){Ak=function(t){var e=t._invertedIndicesMap;y(e,function(n,i){var r=t._dimInfos[i],o=r.ordinalMeta,a=t._store;if(o){n=e[i]=new Yk(o.categories.length);for(var s=0;s1&&(s+="__ec__"+u),i[e]=s}}}(),t}(),Qk=function(){function t(t){this.coordSysDims=[],this.axisMap=Y(),this.categoryAxisMap=Y(),this.coordSysName=t}return t}(),Jk={cartesian2d:function(t,e,n,i){var r=t.getReferringComponents("xAxis",db).models[0],o=t.getReferringComponents("yAxis",db).models[0];e.coordSysDims=["x","y"],n.set("x",r),n.set("y",o),Fp(r)&&(i.set("x",r),e.firstCategoryDimIndex=0),Fp(o)&&(i.set("y",o),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,n,i){var r=t.getReferringComponents("singleAxis",db).models[0];e.coordSysDims=["single"],n.set("single",r),Fp(r)&&(i.set("single",r),e.firstCategoryDimIndex=0)},polar:function(t,e,n,i){var r=t.getReferringComponents("polar",db).models[0],o=r.findAxisModel("radiusAxis"),a=r.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],n.set("radius",o),n.set("angle",a),Fp(o)&&(i.set("radius",o),e.firstCategoryDimIndex=0),Fp(a)&&(i.set("angle",a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},geo:function(t,e){e.coordSysDims=["lng","lat"]},parallel:function(t,e,n,i){var r=t.ecModel,o=r.getComponent("parallel",t.get("parallelIndex")),a=e.coordSysDims=o.dimensions.slice();y(o.parallelAxisIndex,function(t,o){var s=r.getComponent("parallelAxis",t),l=a[o];n.set(l,s),Fp(s)&&(i.set(l,s),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=o))})}},tD=function(){function t(t){this._setting=t||{},this._extent=[1/0,-1/0]}return t.prototype.getSetting=function(t){return this._setting[t]},t.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},t.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)},t.prototype.isInExtentRange=function(t){return this._extent[0]<=t&&this._extent[1]>=t},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(t){this._isBlank=t},t}();jr(tD);var eD=0,nD=function(){function t(t){this.categories=t.categories||[],this._needCollect=t.needCollect,this._deduplication=t.deduplication,this.uid=++eD}return t.createByAxisModel=function(e){var n=e.option,i=n.data,r=i&&v(i,Zp);return new t({categories:r,needCollect:!r,deduplication:n.dedplication!==!1})},t.prototype.getOrdinal=function(t){return this._getOrCreateMap().get(t)},t.prototype.parseAndCollect=function(t){var e,n=this._needCollect;if(!I(t)&&!n)return t;if(n&&!this._deduplication)return e=this.categories.length,this.categories[e]=t,e;var i=this._getOrCreateMap();return e=i.get(t),null==e&&(n?(e=this.categories.length,this.categories[e]=t,i.set(t,e)):e=0/0),e},t.prototype._getOrCreateMap=function(){return this._map||(this._map=Y(this.categories))},t}(),iD=function(t){function n(e){var n=t.call(this,e)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new nD({})),M(i)&&(i=new nD({categories:v(i,function(t){return D(t)?t.value:t})})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return e(n,t),n.prototype.parse=function(t){return null==t?0/0:I(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},n.prototype.contain=function(t){return t=this.parse(t),nd(t,this._extent)&&null!=this._ordinalMeta.categories[t]},n.prototype.normalize=function(t){return t=this._getTickNumber(this.parse(t)),id(t,this._extent)},n.prototype.scale=function(t){return t=Math.round(rd(t,this._extent)),this.getRawOrdinalNumber(t)},n.prototype.getTicks=function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push({value:n}),n++;return t},n.prototype.getMinorTicks=function(){},n.prototype.setSortInfo=function(t){if(null==t)return void(this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null);for(var e=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],r=0,o=this._ordinalMeta.categories.length,a=Math.min(o,e.length);a>r;++r){var s=e[r];n[r]=s,i[s]=r}for(var l=0;o>r;++r){for(;null!=i[l];)l++;n.push(l),i[l]=r}},n.prototype._getTickNumber=function(t){var e=this._ticksByOrdinalNumber;return e&&t>=0&&t=0&&t=t},n.prototype.getOrdinalMeta=function(){return this._ordinalMeta},n.prototype.calcNiceTicks=function(){},n.prototype.calcNiceExtent=function(){},n.type="ordinal",n}(tD);tD.registerClass(iD);var rD=Wi,oD=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="interval",e._interval=0,e._intervalPrecision=2,e}return e(n,t),n.prototype.parse=function(t){return t},n.prototype.contain=function(t){return nd(t,this._extent)},n.prototype.normalize=function(t){return id(t,this._extent)},n.prototype.scale=function(t){return rd(t,this._extent)},n.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(e)||(n[1]=parseFloat(e))},n.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),this.setExtent(e[0],e[1])},n.prototype.getInterval=function(){return this._interval},n.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=Jp(t)},n.prototype.getTicks=function(t){var e=this._interval,n=this._extent,i=this._niceExtent,r=this._intervalPrecision,o=[];if(!e)return o;var a=1e4;n[0]a)return[];var l=o.length?o[o.length-1].value:i[1];return n[1]>l&&o.push(t?{value:rD(l+e,r)}:{value:n[1]}),o},n.prototype.getMinorTicks=function(t){for(var e=this.getTicks(!0),n=[],i=this.getExtent(),r=1;rs;){var c=rD(a.value+(s+1)*h);c>i[0]&&cr&&(r=-r,i.reverse());var o=$p(i,t,e,n);this._intervalPrecision=o.intervalPrecision,this._interval=o.interval,this._niceExtent=o.niceTickExtent}},n.prototype.calcNiceExtent=function(t){var e=this._extent;if(e[0]===e[1])if(0!==e[0]){var n=Math.abs(e[0]);t.fixMax?e[0]-=n/2:(e[1]+=n/2,e[0]-=n/2)}else e[1]=1;var i=e[1]-e[0];isFinite(i)||(e[0]=0,e[1]=1),this.calcNiceTicks(t.splitNumber,t.minInterval,t.maxInterval);var r=this._interval;t.fixMin||(e[0]=rD(Math.floor(e[0]/r)*r)),t.fixMax||(e[1]=rD(Math.ceil(e[1]/r)*r))},n.prototype.setNiceExtent=function(t,e){this._niceExtent=[t,e]},n.type="interval",n}(tD);tD.registerClass(oD);var aD="undefined"!=typeof Float32Array,sD=aD?Float32Array:Array,lD="__ec_stack_",uD=function(t,e,n,i){for(;i>n;){var r=n+i>>>1;t[r][1]n&&(this._approxInterval=n);var o=cD.length,a=Math.min(uD(cD,this._approxInterval,0,o),o-1);this._interval=cD[a][1],this._minLevelUnit=cD[Math.max(a-1,0)][0]},n.prototype.parse=function(t){return k(t)?t:+Ji(t)},n.prototype.contain=function(t){return nd(this.parse(t),this._extent)},n.prototype.normalize=function(t){return id(this.parse(t),this._extent)},n.prototype.scale=function(t){return rd(t,this._extent)},n.type="time",n}(oD),cD=[["second",RM],["minute",EM],["hour",NM],["quarter-day",6*NM],["half-day",12*NM],["day",1.2*zM],["half-week",3.5*zM],["week",7*zM],["month",31*zM],["quarter",95*zM],["half-year",BM/2],["year",BM]];tD.registerClass(hD);var pD=tD.prototype,dD=oD.prototype,fD=Wi,gD=Math.floor,yD=Math.ceil,vD=Math.pow,mD=Math.log,_D=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e.base=10,e._originalScale=new oD,e._interval=0,e}return e(n,t),n.prototype.getTicks=function(t){var e=this._originalScale,n=this._extent,i=e.getExtent(),r=dD.getTicks.call(this,t);return v(r,function(t){var e=t.value,r=Wi(vD(this.base,e));return r=e===n[0]&&this._fixMin?Id(r,i[0]):r,r=e===n[1]&&this._fixMax?Id(r,i[1]):r,{value:r}},this)},n.prototype.setExtent=function(t,e){var n=mD(this.base);t=mD(Math.max(0,t))/n,e=mD(Math.max(0,e))/n,dD.setExtent.call(this,t,e)},n.prototype.getExtent=function(){var t=this.base,e=pD.getExtent.call(this);e[0]=vD(t,e[0]),e[1]=vD(t,e[1]);var n=this._originalScale,i=n.getExtent();return this._fixMin&&(e[0]=Id(e[0],i[0])),this._fixMax&&(e[1]=Id(e[1],i[1])),e},n.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=mD(t[0])/mD(e),t[1]=mD(t[1])/mD(e),pD.unionExtent.call(this,t)},n.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},n.prototype.calcNiceTicks=function(t){t=t||10;var e=this._extent,n=e[1]-e[0];if(!(1/0===n||0>=n)){var i=tr(n),r=t/n*i;for(.5>=r&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var o=[Wi(yD(e[0]/i)*i),Wi(gD(e[1]/i)*i)];this._interval=i,this._niceExtent=o}},n.prototype.calcNiceExtent=function(t){dD.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},n.prototype.parse=function(t){return t},n.prototype.contain=function(t){return t=mD(t)/mD(this.base),nd(t,this._extent)},n.prototype.normalize=function(t){return t=mD(t)/mD(this.base),id(t,this._extent)},n.prototype.scale=function(t){return t=rd(t,this._extent),vD(this.base,t)},n.type="log",n}(tD),xD=_D.prototype;xD.getMinorTicks=dD.getMinorTicks,xD.getLabel=dD.getLabel,tD.registerClass(_D); +var bD=function(){function t(t,e,n){this._prepareParams(t,e,n)}return t.prototype._prepareParams=function(t,e,n){n[1]0&&s>0&&!l&&(a=0),0>a&&0>s&&!u&&(s=0));var c=this._determinedMin,p=this._determinedMax;return null!=c&&(a=c,l=!0),null!=p&&(s=p,u=!0),{min:a,max:s,minFixed:l,maxFixed:u,isBlank:h}},t.prototype.modifyDataMinMax=function(t,e){this[SD[t]]=e},t.prototype.setDeterminedMinMax=function(t,e){var n=wD[t];this[n]=e},t.prototype.freeze=function(){this.frozen=!0},t}(),wD={min:"_determinedMin",max:"_determinedMax"},SD={min:"_dataMin",max:"_dataMax"},MD=function(){function t(){}return t.prototype.getNeedCrossZero=function(){var t=this.option;return!t.scale},t.prototype.getCoordSysModel=function(){},t}(),TD={isDimensionStacked:Gp,enableDataStack:Vp,getStackedDimension:Wp},ID=(Object.freeze||Object)({createList:Hd,getLayoutRect:Fl,dataStack:TD,createScale:Gd,mixinAxisModelCommonMethods:Wd,getECData:Ew,createTextStyle:Ud,createDimensions:Op,createSymbol:hc,enableHoverEmphasis:Aa}),CD=[],kD={registerPreprocessor:lp,registerProcessor:up,registerPostInit:hp,registerPostUpdate:cp,registerUpdateLifecycle:pp,registerAction:dp,registerCoordinateSystem:fp,registerLayout:yp,registerVisual:vp,registerTransform:Dk,registerLoading:_p,registerMap:bp,registerImpl:Kc,PRIORITY:zC,ComponentModel:QM,ComponentView:yI,SeriesModel:gI,ChartView:_I,registerComponentModel:function(t){QM.registerClass(t)},registerComponentView:function(t){yI.registerClass(t)},registerSeriesModel:function(t){gI.registerClass(t)},registerChartView:function(t){_I.registerClass(t)},registerSubTypeDefaulter:function(t,e){QM.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){Fi(t,e)}},DD=1e-8,AD=[],PD=function(){function t(t){this.name=t}return t.prototype.setCenter=function(t){this._center=t},t.prototype.getCenter=function(){var t=this._center;return t||(t=this._center=this.calcCenter()),t},t}(),LD=function(){function t(t,e){this.type="polygon",this.exterior=t,this.interiors=e}return t}(),OD=function(){function t(t){this.type="linestring",this.points=t}return t}(),RD=function(t){function n(e,n,i){var r=t.call(this,e)||this;return r.type="geoJSON",r.geometries=n,r._center=i&&[i[0],i[1]],r}return e(n,t),n.prototype.calcCenter=function(){for(var t,e=this.geometries,n=0,i=0;in&&(t=r,n=a)}if(t)return Kd(t.exterior);var s=this.getBoundingRect();return[s.x+s.width/2,s.y+s.height/2]},n.prototype.getBoundingRect=function(t){var e=this._rect;if(e&&!t)return e;var n=[1/0,1/0],i=[-1/0,-1/0],r=this.geometries;return y(r,function(e){"polygon"===e.type?Zd(e.exterior,n,i,t):y(e.points,function(e){Zd(e,n,i,t)})}),isFinite(n[0])&&isFinite(n[1])&&isFinite(i[0])&&isFinite(i[1])||(n[0]=n[1]=i[0]=i[1]=0),e=new I_(n[0],n[1],i[0]-n[0],i[1]-n[1]),t||(this._rect=e),e},n.prototype.contain=function(t){var e=this.getBoundingRect(),n=this.geometries;if(!e.contain(t[0],t[1]))return!1;t:for(var i=0,r=n.length;r>i;i++){var o=n[i];if("polygon"===o.type){var a=o.exterior,s=o.interiors;if(qd(a,t[0],t[1])){for(var l=0;l<(s?s.length:0);l++)if(qd(s[l],t[0],t[1]))continue t;return!0}}}return!1},n.prototype.transformTo=function(t,e,n,i){var r=this.getBoundingRect(),o=r.width/r.height;n?i||(i=n/o):n=o*i;for(var a=new I_(t,e,n,i),s=r.calculateTransform(a),l=this.geometries,u=0;u=n&&i>=t},t.prototype.containData=function(t){return this.scale.contain(t)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(t){return qi(t||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(t,e){var n=this._extent;n[0]=t,n[1]=e},t.prototype.dataToCoord=function(t,e){var n=this._extent,i=this.scale;return t=i.normalize(t),this.onBand&&"ordinal"===i.type&&(n=n.slice(),yf(n,i.count())),Hi(t,HD,n,e)},t.prototype.coordToData=function(t,e){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&(n=n.slice(),yf(n,i.count()));var r=Hi(t,n,HD,e);return this.scale.scale(r)},t.prototype.pointToData=function(){},t.prototype.getTicksCoords=function(t){t=t||{};var e=t.tickModel||this.getTickModel(),n=nf(this,e),i=n.ticks,r=v(i,function(t){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(t):t),tickValue:t}},this),o=e.get("alignWithLabel");return vf(this,r,o,t.clamp),r},t.prototype.getMinorTicksCoords=function(){if("ordinal"===this.scale.type)return[];var t=this.model.getModel("minorTick"),e=t.get("splitNumber");e>0&&100>e||(e=5);var n=this.scale.getMinorTicks(e),i=v(n,function(t){return v(t,function(t){return{coord:this.dataToCoord(t),tickValue:t}},this)},this);return i},t.prototype.getViewLabels=function(){return ef(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var t=this._extent,e=this.scale.getExtent(),n=e[1]-e[0]+(this.onBand?1:0);0===n&&(n=1);var i=Math.abs(t[1]-t[0]);return Math.abs(i)/n},t.prototype.calculateCategoryInterval=function(){return pf(this)},t}(),WD=2*Math.PI,UD=sw.CMD,XD=["top","right","bottom","left"],YD=[],qD=new v_,jD=new v_,ZD=new v_,KD=new v_,$D=new v_,QD=[],JD=new v_,tA=["align","verticalAlign","width","height","fontSize"],eA=new Ux,nA=Pr(),iA=Pr(),rA=["x","y","rotation"],oA=function(){function t(){this._labelList=[],this._chartViewList=[]}return t.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},t.prototype._addLabel=function(t,e,n,i,r){var o=i.style,a=i.__hostTarget,s=a.textConfig||{},l=i.getComputedTransform(),u=i.getBoundingRect().plain();I_.applyTransform(u,u,l),l?eA.setLocalTransform(l):(eA.x=eA.y=eA.rotation=eA.originX=eA.originY=0,eA.scaleX=eA.scaleY=1);var h,c=i.__hostTarget;if(c){h=c.getBoundingRect().plain();var p=c.getComputedTransform();I_.applyTransform(h,h,p)}var d=h&&c.getTextGuideLine();this._labelList.push({label:i,labelLine:d,seriesModel:n,dataIndex:t,dataType:e,layoutOption:r,computedLayoutOption:null,rect:u,hostRect:h,priority:h?h.width*h.height:0,defaultAttr:{ignore:i.ignore,labelGuideIgnore:d&&d.ignore,x:eA.x,y:eA.y,scaleX:eA.scaleX,scaleY:eA.scaleY,rotation:eA.rotation,style:{x:o.x,y:o.y,align:o.align,verticalAlign:o.verticalAlign,width:o.width,height:o.height,fontSize:o.fontSize},cursor:i.cursor,attachedPos:s.position,attachedRot:s.rotation}})},t.prototype.addLabelsOfSeries=function(t){var e=this;this._chartViewList.push(t);var n=t.__model,i=n.get("labelLayout");(T(i)||b(i).length)&&t.group.traverse(function(t){if(t.ignore)return!0;var r=t.getTextContent(),o=Ew(t);r&&!r.disableLabelLayout&&e._addLabel(o.dataIndex,o.dataType,n,r,i)})},t.prototype.updateLayoutConfig=function(t){function e(t,e){return function(){kf(t,e)}}for(var n=t.getWidth(),i=t.getHeight(),r=0;r=0&&n.attr(r.oldLayoutSelect),p(h,"emphasis")>=0&&n.attr(r.oldLayoutEmphasis)),ss(n,l,e,s)}else if(n.attr(l),!dM(n).valueAnimation){var c=B(n.style.opacity,1);n.style.opacity=0,ls(n,{style:{opacity:c}},e,s)}if(r.oldLayout=l,n.states.select){var d=r.oldLayoutSelect={};Hf(d,l,rA),Hf(d,n.states.select,rA)}if(n.states.emphasis){var f=r.oldLayoutEmphasis={};Hf(f,l,rA),Hf(f,n.states.emphasis,rA)}$s(n,s,u,e,e)}if(i&&!i.ignore&&!i.invisible){var r=iA(i),o=r.oldLayout,g={points:i.shape.points};o?(i.attr({shape:o}),ss(i,{shape:g},e)):(i.setShape(g),i.style.strokePercent=0,ls(i,{style:{strokePercent:1}},e)),r.oldLayout=g}},t}(),aA=Pr();Xd(Gf);var sA=function(t){function n(e,n,i){var r=t.call(this)||this;r.motionBlur=!1,r.lastFrameAlpha=.7,r.dpr=1,r.virtual=!1,r.config={},r.incremental=!1,r.zlevel=0,r.maxRepaintRectCount=5,r.__dirty=!0,r.__firstTimePaint=!0,r.__used=!1,r.__drawIndex=0,r.__startIndex=0,r.__endIndex=0,r.__prevStartIndex=null,r.__prevEndIndex=null;var o;i=i||Ox,"string"==typeof e?o=Wf(e,n,i):D(e)&&(o=e,e=o.id),r.id=e,r.dom=o;var a=o.style;return a&&(Z(o),o.onselectstart=function(){return!1},a.padding="0",a.margin="0",a.borderWidth="0"),r.painter=n,r.dpr=i,r}return e(n,t),n.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},n.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},n.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},n.prototype.setUnpainted=function(){this.__firstTimePaint=!0},n.prototype.createBackBuffer=function(){var t=this.dpr;this.domBack=Wf("back-"+this.id,this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!==t&&this.ctxBack.scale(t,t)},n.prototype.createRepaintRects=function(t,e,n,i){function r(t){if(t.isFinite()&&!t.isZero())if(0===o.length){var e=new I_(0,0,0,0);e.copy(t),o.push(e)}else{for(var n=!1,i=1/0,r=0,u=0;ug&&(i=g,r=u)}}if(s&&(o[r].union(t),n=!0),!n){var e=new I_(0,0,0,0);e.copy(t),o.push(e)}s||(s=o.length>=a)}}if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;for(var o=[],a=this.maxRepaintRectCount,s=!1,l=new I_(0,0,0,0),u=this.__startIndex;uo;o++){var a=t[o];a.__inHover&&(n||(n=this._hoverlayer=this.getLayer(lA)),i||(i=n.ctx,i.save()),Hc(i,a,r,o===e-1))}i&&i.restore()}},t.prototype.getHoverLayer=function(){return this.getLayer(lA)},t.prototype.paintOne=function(t,e){Vc(t,e)},t.prototype._paintList=function(t,e,n,i){if(this._redrawId===i){n=n||!1,this._updateLayerStatus(t);var r=this._doPaintList(t,e,n),o=r.finished,a=r.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),a&&this._paintHoverList(t),o)this.eachLayer(function(t){t.afterBrush&&t.afterBrush()});else{var s=this;H_(function(){s._paintList(t,e,n,i)})}}},t.prototype._compositeManually=function(){var t=this.getLayer(uA).ctx,e=this._domRoot.width,n=this._domRoot.height;t.clearRect(0,0,e,n),this.eachBuiltinLayer(function(i){i.virtual&&t.drawImage(i.dom,0,0,e,n)})},t.prototype._doPaintList=function(t,e,n){for(var i=this,r=[],o=this._opts.useDirtyRect,a=0;a15)break}}n.prevElClipPaths&&l.restore()};if(c)if(0===c.length)m=s.__endIndex;else for(var x=p.dpr,b=0;b0&&t>i[0]){for(s=0;r-1>s&&!(i[s]t);s++);a=n[i[s]]}if(i.splice(s+1,0,t),n[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?o.insertBefore(e.dom,l.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.__painter=this}},t.prototype.eachLayer=function(t,e){for(var n=this._zlevelList,i=0;i0?hA:0),this._needsManuallyCompositing),h.__builtin__||a("ZLevel "+u+" has been used by unkown layer "+h.id),h!==s&&(h.__used=!0,h.__startIndex!==o&&(h.__dirty=!0),h.__startIndex=o,h.__drawIndex=h.incremental?-1:o,e(o),s=h),i.__dirty&N_&&!i.__inHover&&(h.__dirty=!0,h.incremental&&h.__drawIndex<0&&(h.__drawIndex=o))}e(o),this.eachBuiltinLayer(function(t){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)})},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,y(this._layers,function(t){t.setUnpainted()})},t.prototype.configLayer=function(t,e){if(e){var n=this._layerConfig;n[t]?l(n[t],e,!0):n[t]=e;for(var i=0;is;s++){var u=a[s];Hc(n,u,o,s===l-1)}return e.dom},t.prototype.getWidth=function(){return this._width},t.prototype.getHeight=function(){return this._height},t}(),dA=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="dataset",e}return e(n,t),n.prototype.init=function(e,n,i){t.prototype.init.call(this,e,n,i),this._sourceManager=new lI(this),sh(this)},n.prototype.mergeOption=function(e,n){t.prototype.mergeOption.call(this,e,n),sh(this)},n.prototype.optionUpdated=function(){this._sourceManager.dirty()},n.prototype.getSourceManager=function(){return this._sourceManager},n.type="dataset",n.defaultOption={seriesLayoutBy:cT},n}(QM),fA=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="dataset",e}return e(n,t),n.type="dataset",n}(yI);Xd([Yf,qf]),Xd(Gf);var gA={average:function(t){for(var e=0,n=0,i=0;ie&&(e=t[n]);return isFinite(e)?e:0/0},min:function(t){for(var e=1/0,n=0;nt&&(t=e),t},n.prototype.brushSelector=function(t,e,n){return n.rect(e.getItemLayout(t))},n.type="series.bar",n.dependencies=["grid","polar"],n.defaultOption=el(vA.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:"#212121"}},realtimeSort:!1}),n}(vA),_A=function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0}return t}(),xA=function(t){function n(e){var n=t.call(this,e)||this;return n.type="sausage",n}return e(n,t),n.prototype.getDefaultShape=function(){return new _A},n.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=Math.max(e.r0||0,0),o=Math.max(e.r,0),a=.5*(o-r),s=r+a,l=e.startAngle,u=e.endAngle,h=e.clockwise,c=2*Math.PI,p=h?c>u-l:c>l-u;p||(l=u-(h?c:-c));var d=Math.cos(l),f=Math.sin(l),g=Math.cos(u),y=Math.sin(u);p?(t.moveTo(d*r+n,f*r+i),t.arc(d*s+n,f*s+i,a,-Math.PI+l,l,!h)):t.moveTo(d*o+n,f*o+i),t.arc(n,i,o,l,u,!h),t.arc(g*s+n,y*s+i,a,u-2*Math.PI,u-Math.PI,!h),0!==r&&t.arc(n,i,r,u,l,h)},n}(mw),bA=Math.max,wA=Math.min,SA=function(t){function n(){var e=t.call(this)||this;return e.type=n.type,e._isFirstFrame=!0,e}return e(n,t),n.prototype.render=function(t,e,n,i){this._model=t,this._removeOnRenderedListener(n),this._updateDrawMode(t);var r=t.get("coordinateSystem");("cartesian2d"===r||"polar"===r)&&(this._progressiveEls=null,this._isLargeDraw?this._renderLarge(t,e,n):this._renderNormal(t,e,n,i))},n.prototype.incrementalPrepareRender=function(t){this._clear(),this._updateDrawMode(t),this._updateLargeClip(t)},n.prototype.incrementalRender=function(t,e){this._progressiveEls=[],this._incrementalRenderLarge(t,e)},n.prototype.eachRendered=function(t){Fs(this._progressiveEls||this.group,t)},n.prototype._updateDrawMode=function(t){var e=t.pipelineContext.large;(null==this._isLargeDraw||e!==this._isLargeDraw)&&(this._isLargeDraw=e,this._clear())},n.prototype._renderNormal=function(t,e,n,i){function r(t){var e=DA[u.type](s,t),n=yg(u,o,e);return n.useStyle(v.getItemStyle()),"cartesian2d"===u.type&&n.setShape("r",m),_[t]=n,n}var o,a=this.group,s=t.getData(),l=this._data,u=t.coordinateSystem,h=u.getBaseAxis();"cartesian2d"===u.type?o=h.isHorizontal():"polar"===u.type&&(o="angle"===h.dim);var c=t.isAnimationEnabled()?t:null,p=ag(t,u);p&&this._enableRealtimeSort(p,s,n);var d=t.get("clip",!0)||p,f=og(u,s);a.removeClipPath();var g=t.get("roundCap",!0),y=t.get("showBackground",!0),v=t.getModel("backgroundStyle"),m=v.get("borderRadius")||0,_=[],x=this._backgroundEls,b=i&&i.isInitSort,w=i&&"changeAxisOrder"===i.type;s.diff(l).add(function(e){var n=s.getItemModel(e),i=DA[u.type](s,e,n);if(y&&r(e),s.hasValue(e)&&kA[u.type](i)){var l=!1;d&&(l=MA[u.type](f,i));var v=TA[u.type](t,s,e,i,o,c,h.model,!1,g);p&&(v.forceLabelAnimation=!0),cg(v,s,e,n,i,t,o,"polar"===u.type),b?v.attr({shape:i}):p?sg(p,c,v,i,e,o,!1,!1):ls(v,{shape:i},t,e),s.setItemGraphicEl(e,v),a.add(v),v.ignore=l}}).update(function(e,n){var i=s.getItemModel(e),S=DA[u.type](s,e,i);if(y){var M=void 0;0===x.length?M=r(n):(M=x[n],M.useStyle(v.getItemStyle()),"cartesian2d"===u.type&&M.setShape("r",m),_[e]=M);var T=DA[u.type](s,e),I=gg(o,T,u);ss(M,{shape:I},c,e)}var C=l.getItemGraphicEl(n);if(!s.hasValue(e)||!kA[u.type](S))return void a.remove(C);var k=!1;if(d&&(k=MA[u.type](f,S),k&&a.remove(C)),C?ds(C):C=TA[u.type](t,s,e,S,o,c,h.model,!!C,g),p&&(C.forceLabelAnimation=!0),w){var D=C.getTextContent();if(D){var A=dM(D);null!=A.prevValue&&(A.prevValue=A.value)}}else cg(C,s,e,i,S,t,o,"polar"===u.type);b?C.attr({shape:S}):p?sg(p,c,C,S,e,o,!0,w):ss(C,{shape:S},t,e,null),s.setItemGraphicEl(e,C),C.ignore=k,a.add(C)}).remove(function(e){var n=l.getItemGraphicEl(e);n&&ps(n,t,e)}).execute();var S=this._backgroundGroup||(this._backgroundGroup=new Jx);S.removeAll();for(var M=0;M<_.length;++M)S.add(_[M]);a.add(S),this._backgroundEls=_,this._data=s},n.prototype._renderLarge=function(t){this._clear(),dg(t,this.group),this._updateLargeClip(t)},n.prototype._incrementalRenderLarge=function(t,e){this._removeBackground(),dg(e,this.group,this._progressiveEls,!0)},n.prototype._updateLargeClip=function(t){var e=t.get("clip",!0)&&$f(t.coordinateSystem,!1,t),n=this.group;e?n.setClipPath(e):n.removeClipPath()},n.prototype._enableRealtimeSort=function(t,e,n){var i=this;if(e.count()){var r=t.baseAxis;if(this._isFirstFrame)this._dispatchInitSort(e,t,n),this._isFirstFrame=!1;else{var o=function(t){var n=e.getItemGraphicEl(t),i=n&&n.shape;return i&&Math.abs(r.isHorizontal()?i.height:i.width)||0};this._onRendered=function(){i._updateSortWithinSameData(e,o,r,n) +},n.getZr().on("rendered",this._onRendered)}}},n.prototype._dataSort=function(t,e,n){var i=[];return t.each(t.mapDimension(e.dim),function(t,e){var r=n(e);r=null==r?0/0:r,i.push({dataIndex:e,mappedValue:r,ordinalNumber:t})}),i.sort(function(t,e){return e.mappedValue-t.mappedValue}),{ordinalNumbers:v(i,function(t){return t.ordinalNumber})}},n.prototype._isOrderChangedWithinSameData=function(t,e,n){for(var i=n.scale,r=t.mapDimension(n.dim),o=Number.MAX_VALUE,a=0,s=i.getOrdinalMeta().categories.length;s>a;++a){var l=t.rawIndexOf(r,i.getRawOrdinalNumber(a)),u=0>l?Number.MIN_VALUE:e(t.indexOfRawIndex(l));if(u>o)return!0;o=u}return!1},n.prototype._isOrderDifferentInView=function(t,e){for(var n=e.scale,i=n.getExtent(),r=Math.max(0,i[0]),o=Math.min(i[1],n.getOrdinalMeta().categories.length-1);o>=r;++r)if(t.ordinalNumbers[r]!==n.getRawOrdinalNumber(r))return!0},n.prototype._updateSortWithinSameData=function(t,e,n,i){if(this._isOrderChangedWithinSameData(t,e,n)){var r=this._dataSort(t,n,e);this._isOrderDifferentInView(r,n)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:n.dim+"Axis",axisId:n.index,sortInfo:r}))}},n.prototype._dispatchInitSort=function(t,e,n){var i=e.baseAxis,r=this._dataSort(t,i,function(n){return t.get(t.mapDimension(e.otherAxis.dim),n)});n.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.index,sortInfo:r})},n.prototype.remove=function(t,e){this._clear(this._model),this._removeOnRenderedListener(e)},n.prototype.dispose=function(t,e){this._removeOnRenderedListener(e)},n.prototype._removeOnRenderedListener=function(t){this._onRendered&&(t.getZr().off("rendered",this._onRendered),this._onRendered=null)},n.prototype._clear=function(t){var e=this.group,n=this._data;t&&t.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(e){ps(e,t,Ew(e).dataIndex)})):e.removeAll(),this._data=null,this._isFirstFrame=!0},n.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},n.type="bar",n}(_I),MA={cartesian2d:function(t,e){var n=e.width<0?-1:1,i=e.height<0?-1:1;0>n&&(e.x+=e.width,e.width=-e.width),0>i&&(e.y+=e.height,e.height=-e.height);var r=t.x+t.width,o=t.y+t.height,a=bA(e.x,t.x),s=wA(e.x+e.width,r),l=bA(e.y,t.y),u=wA(e.y+e.height,o),h=a>s,c=l>u;return e.x=h&&a>r?s:a,e.y=c&&l>o?u:l,e.width=h?0:s-a,e.height=c?0:u-l,0>n&&(e.x+=e.width,e.width=-e.width),0>i&&(e.y+=e.height,e.height=-e.height),h||c},polar:function(t,e){var n=e.r0<=e.r?1:-1;if(0>n){var i=e.r;e.r=e.r0,e.r0=i}var r=wA(e.r,t.r),o=bA(e.r0,t.r0);e.r=r,e.r0=o;var a=0>r-o;if(0>n){var i=e.r;e.r=e.r0,e.r0=i}return a}},TA={cartesian2d:function(t,e,n,i,r,o){var a=new Cw({shape:h({},i),z2:1});if(a.__dataIndex=n,a.name="item",o){var s=a.shape,l=r?"height":"width";s[l]=0}return a},polar:function(t,e,n,i,r,o,a,s,l){var u=!r&&l?xA:DS,h=new u({shape:i,z2:1});h.name="item";var c=hg(r);if(h.calculateTextPosition=eg(c,{isRoundCap:u===xA}),o){var p=h.shape,d=r?"r":"endAngle",f={};p[d]=r?0:i.startAngle,f[d]=i[d],(s?ss:ls)(h,{shape:f},o)}return h}},IA=["x","y","width","height"],CA=["cx","cy","r","startAngle","endAngle"],kA={cartesian2d:function(t){return!lg(t,IA)},polar:function(t){return!lg(t,CA)}},DA={cartesian2d:function(t,e,n){var i=t.getItemLayout(e),r=n?pg(n,i):0,o=i.width>0?1:-1,a=i.height>0?1:-1;return{x:i.x+o*r/2,y:i.y+a*r/2,width:i.width-o*r,height:i.height-a*r}},polar:function(t,e){var n=t.getItemLayout(e);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}}},AA=function(){function t(){}return t}(),PA=function(t){function n(e){var n=t.call(this,e)||this;return n.type="largeBar",n}return e(n,t),n.prototype.getDefaultShape=function(){return new AA},n.prototype.buildPath=function(t,e){for(var n=e.points,i=this.baseDimIdx,r=1-this.baseDimIdx,o=[],a=[],s=this.barWidth,l=0;l=0?n:null},30,!1);Xd(vg);var OA=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.hasSymbolVisual=!0,e}return e(n,t),n.prototype.getInitialData=function(){return Yp(null,this,{useEncodeDefaulter:!0})},n.prototype.getLegendIcon=function(t){var e=new Jx,n=hc("line",0,t.itemHeight/2,t.itemWidth,0,t.lineStyle.stroke,!1);e.add(n),n.setStyle(t.lineStyle);var i=this.getData().getVisual("symbol"),r=this.getData().getVisual("symbolRotate"),o="none"===i?"circle":i,a=.8*t.itemHeight,s=hc(o,(t.itemWidth-a)/2,(t.itemHeight-a)/2,a,a,t.itemStyle.fill);e.add(s),s.setStyle(t.itemStyle);var l="inherit"===t.iconRotate?r:t.iconRotate||0;return s.rotation=l*Math.PI/180,s.setOrigin([t.itemWidth/2,t.itemHeight/2]),o.indexOf("empty")>-1&&(s.style.stroke=s.style.fill,s.style.fill="#fff",s.style.lineWidth=2),e},n.type="series.line",n.dependencies=["grid","polar"],n.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},n}(gI),RA=function(t){function n(e,n,i,r){var o=t.call(this)||this;return o.updateData(e,n,i,r),o}return e(n,t),n.prototype._createSymbol=function(t,e,n,i,r){this.removeAll();var o=hc(t,-1,-1,2,2,null,r);o.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),o.drift=mg,this._symbolType=t,this.add(o)},n.prototype.stopSymbolAnimation=function(t){this.childAt(0).stopAnimation(null,t)},n.prototype.getSymbolType=function(){return this._symbolType},n.prototype.getSymbolPath=function(){return this.childAt(0)},n.prototype.highlight=function(){da(this.childAt(0))},n.prototype.downplay=function(){fa(this.childAt(0))},n.prototype.setZ=function(t,e){var n=this.childAt(0);n.zlevel=t,n.z=e},n.prototype.setDraggable=function(t,e){var n=this.childAt(0);n.draggable=t,n.cursor=!e&&t?"move":n.cursor},n.prototype.updateData=function(t,e,i,r){this.silent=!1;var o=t.getItemVisual(e,"symbol")||"circle",a=t.hostModel,s=n.getSymbolSize(t,e),l=o!==this._symbolType,u=r&&r.disableAnimation;if(l){var h=t.getItemVisual(e,"symbolKeepAspect");this._createSymbol(o,t,e,s,h)}else{var c=this.childAt(0);c.silent=!1;var p={scaleX:s[0]/2,scaleY:s[1]/2};u?c.attr(p):ss(c,p,a,e),ds(c)}if(this._updateCommon(t,e,s,i,r),l){var c=this.childAt(0);if(!u){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:c.style.opacity}};c.scaleX=c.scaleY=0,c.style.opacity=0,ls(c,p,a,e)}}u&&this.childAt(0).stopAnimation("leave")},n.prototype._updateCommon=function(t,e,n,i,r){function o(e){return C?t.getName(e):Jf(t,e)}var a,s,l,u,c,p,d,f,g,y=this.childAt(0),v=t.hostModel;if(i&&(a=i.emphasisItemStyle,s=i.blurItemStyle,l=i.selectItemStyle,u=i.focus,c=i.blurScope,d=i.labelStatesModels,f=i.hoverScale,g=i.cursorStyle,p=i.emphasisDisabled),!i||t.hasItemOption){var m=i&&i.itemModel?i.itemModel:t.getItemModel(e),_=m.getModel("emphasis");a=_.getModel("itemStyle").getItemStyle(),l=m.getModel(["select","itemStyle"]).getItemStyle(),s=m.getModel(["blur","itemStyle"]).getItemStyle(),u=_.get("focus"),c=_.get("blurScope"),p=_.get("disabled"),d=Ws(m),f=_.getShallow("scale"),g=m.getShallow("cursor")}var x=t.getItemVisual(e,"symbolRotate");y.attr("rotation",(x||0)*Math.PI/180||0);var b=pc(t.getItemVisual(e,"symbolOffset"),n);b&&(y.x=b[0],y.y=b[1]),g&&y.attr("cursor",g);var w=t.getItemVisual(e,"style"),S=w.fill;if(y instanceof Sw){var M=y.style;y.useStyle(h({image:M.image,x:M.x,y:M.y,width:M.width,height:M.height},w))}else y.useStyle(y.__isEmptyBrush?h({},w):w),y.style.decal=null,y.setColor(S,r&&r.symbolInnerColor),y.style.strokeNoScale=!0;var T=t.getItemVisual(e,"liftZ"),I=this._z2;null!=T?null==I&&(this._z2=y.z2,y.z2+=T):null!=I&&(y.z2=I,this._z2=null);var C=r&&r.useNameLabel;Gs(y,d,{labelFetcher:v,labelDataIndex:e,defaultText:o,inheritColor:S,defaultOpacity:w.opacity}),this._sizeX=n[0]/2,this._sizeY=n[1]/2;var k=y.ensureState("emphasis");k.style=a,y.ensureState("select").style=l,y.ensureState("blur").style=s;var D=null==f||f===!0?Math.max(1.1,3/this._sizeY):isFinite(f)&&f>0?+f:1;k.scaleX=this._sizeX*D,k.scaleY=this._sizeY*D,this.setSymbolScale(1),La(this,u,c,p)},n.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},n.prototype.fadeOut=function(t,e,n){var i=this.childAt(0),r=Ew(this).dataIndex,o=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var a=i.getTextContent();a&&hs(a,{style:{opacity:0}},e,{dataIndex:r,removeOpt:o,cb:function(){i.removeTextContent()}})}else i.removeTextContent();hs(i,{style:{opacity:0},scaleX:0,scaleY:0},e,{dataIndex:r,cb:t,removeOpt:o})},n.getSymbolSize=function(t,e){return cc(t.getItemVisual(e,"symbolSize"))},n}(Jx),EA=function(){function t(t){this.group=new Jx,this._SymbolCtor=t||RA}return t.prototype.updateData=function(t,e){this._progressiveEls=null,e=xg(e);var n=this.group,i=t.hostModel,r=this._data,o=this._SymbolCtor,a=e.disableAnimation,s=bg(t),l={disableAnimation:a},u=e.getSymbolPoint||function(e){return t.getItemLayout(e)};r||n.removeAll(),t.diff(r).add(function(i){var r=u(i);if(_g(t,r,i,e)){var a=new o(t,i,s,l);a.setPosition(r),t.setItemGraphicEl(i,a),n.add(a)}}).update(function(h,c){var p=r.getItemGraphicEl(c),d=u(h);if(!_g(t,d,h,e))return void n.remove(p);var f=t.getItemVisual(h,"symbol")||"circle",g=p&&p.getSymbolType&&p.getSymbolType();if(!p||g&&g!==f)n.remove(p),p=new o(t,h,s,l),p.setPosition(d);else{p.updateData(t,h,s,l);var y={x:d[0],y:d[1]};a?p.attr(y):ss(p,y,i)}n.add(p),t.setItemGraphicEl(h,p)}).remove(function(t){var e=r.getItemGraphicEl(t);e&&e.fadeOut(function(){n.remove(e)},i)}).execute(),this._getSymbolPoint=u,this._data=t},t.prototype.updateLayout=function(){var t=this,e=this._data;e&&e.eachItemGraphicEl(function(e,n){var i=t._getSymbolPoint(n);e.setPosition(i),e.markRedraw()})},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=bg(t),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e,n){function i(t){t.isGroup||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[],n=xg(n);for(var r=t.start;r0&&Cg(n[2*r-2],n[2*r-1]);r--);for(;r>i&&Cg(n[2*i],n[2*i+1]);i++);}for(;r>i;)i+=kg(t,n,i,r,r,1,e.smooth,e.smoothMonotone,e.connectNulls)+1},n.prototype.getPointOn=function(t,e){this.path||(this.createPathProxy(),this.buildPath(this.path,this.shape));for(var n,i,r=this.path,o=r.data,a=sw.CMD,s="x"===e,l=[],u=0;u=v&&v>=0){var m=s?(p-i)*v+i:(c-n)*v+n;return s?[t,m]:[m,t]}n=c,i=p;break;case a.C:c=o[u++],p=o[u++],d=o[u++],f=o[u++],g=o[u++],y=o[u++];var _=s?cn(n,c,d,g,t,l):cn(i,p,f,y,t,l);if(_>0)for(var x=0;_>x;x++){var b=l[x];if(1>=b&&b>=0){var m=s?un(i,p,f,y,b):un(n,c,d,g,b);return s?[t,m]:[m,t]}}n=g,i=y}}},n}(mw),VA=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n}(BA),HA=function(t){function n(e){var n=t.call(this,e)||this;return n.type="ec-polygon",n}return e(n,t),n.prototype.getDefaultShape=function(){return new VA},n.prototype.buildPath=function(t,e){var n=e.points,i=e.stackedOnPoints,r=0,o=n.length/2,a=e.smoothMonotone;if(e.connectNulls){for(;o>0&&Cg(n[2*o-2],n[2*o-1]);o--);for(;o>r&&Cg(n[2*r],n[2*r+1]);r++);}for(;o>r;){var s=kg(t,n,r,o,o,1,e.smooth,a,e.connectNulls);kg(t,i,r+s-1,s,o,-1,e.stackedOnSmooth,a,e.connectNulls),r+=s+1,t.closePath()}},n}(mw),GA=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.init=function(){var t=new Jx,e=new EA;this.group.add(e.group),this._symbolDraw=e,this._lineGroup=t},n.prototype.render=function(t,e,n){var i=this,r=t.coordinateSystem,o=this.group,a=t.getData(),s=t.getModel("lineStyle"),l=t.getModel("areaStyle"),u=a.getLayout("points")||[],h="polar"===r.type,p=this._coordSys,d=this._symbolDraw,f=this._polyline,g=this._polygon,y=this._lineGroup,v=t.get("animation"),m=!l.isEmpty(),_=l.get("origin"),x=wg(r,a,_),b=m&&Og(r,a,x),w=t.get("showSymbol"),S=t.get("connectNulls"),M=w&&!h&&zg(t,a,r),T=this._data;T&&T.eachItemGraphicEl(function(t,e){t.__temp&&(o.remove(t),T.setItemGraphicEl(e,null))}),w||d.remove(),o.add(y);var I,C=h?!1:t.get("step");r&&r.getArea&&t.get("clip",!0)&&(I=r.getArea(),null!=I.width?(I.x-=.1,I.y-=.1,I.width+=.2,I.height+=.2):I.r0&&(I.r0-=.5,I.r+=.5)),this._clipShapeForSymbol=I;var k=Ng(a,r,n)||a.getVisual("style")[a.getVisual("drawType")];if(f&&p.type===r.type&&C===this._step){m&&!g?g=this._newPolygon(u,b):g&&!m&&(y.remove(g),g=this._polygon=null),h||this._initOrUpdateEndLabel(t,r,Nl(k));var D=y.getClipPath();if(D){var A=Ug(this,r,!1,t);ls(D,{shape:A.shape},t)}else y.setClipPath(Ug(this,r,!0,t));w&&d.updateData(a,{isIgnore:M,clipShape:I,disableAnimation:!0,getSymbolPoint:function(t){return[u[2*t],u[2*t+1]]}}),Dg(this._stackedOnPoints,b)&&Dg(this._points,u)||(v?this._doUpdateAnimation(a,b,r,n,C,_,S):(C&&(u=Rg(u,r,C,S),b&&(b=Rg(b,r,C,S))),f.setShape({points:u}),g&&g.setShape({points:u,stackedOnPoints:b})))}else w&&d.updateData(a,{isIgnore:M,clipShape:I,disableAnimation:!0,getSymbolPoint:function(t){return[u[2*t],u[2*t+1]]}}),v&&this._initSymbolLabelAnimation(a,r,I),C&&(u=Rg(u,r,C,S),b&&(b=Rg(b,r,C,S))),f=this._newPolyline(u),m?g=this._newPolygon(u,b):g&&(y.remove(g),g=this._polygon=null),h||this._initOrUpdateEndLabel(t,r,Nl(k)),y.setClipPath(Ug(this,r,!0,t));var P=t.getModel("emphasis"),L=P.get("focus"),O=P.get("blurScope"),R=P.get("disabled");if(f.useStyle(c(s.getLineStyle(),{fill:"none",stroke:k,lineJoin:"bevel"})),Ra(f,t,"lineStyle"),f.style.lineWidth>0&&"bolder"===t.get(["emphasis","lineStyle","width"])){var E=f.getState("emphasis").style;E.lineWidth=+f.style.lineWidth+1}Ew(f).seriesIndex=t.seriesIndex,La(f,L,O,R);var N=Lg(t.get("smooth")),z=t.get("smoothMonotone");if(f.setShape({smooth:N,smoothMonotone:z,connectNulls:S}),g){var B=a.getCalculationInfo("stackedOnSeries"),F=0;g.useStyle(c(l.getAreaStyle(),{fill:k,opacity:.7,lineJoin:"bevel",decal:a.getVisual("style").decal})),B&&(F=Lg(B.get("smooth"))),g.setShape({smooth:N,stackedOnSmooth:F,smoothMonotone:z,connectNulls:S}),Ra(g,t,"areaStyle"),Ew(g).seriesIndex=t.seriesIndex,La(g,L,O,R)}var V=function(t){i._changePolyState(t)};a.eachItemGraphicEl(function(t){t&&(t.onHoverStateChange=V)}),this._polyline.onHoverStateChange=V,this._data=a,this._coordSys=r,this._stackedOnPoints=b,this._points=u,this._step=C,this._valueOrigin=_,t.get("triggerLineEvent")&&(this.packEventData(t,f),g&&this.packEventData(t,g))},n.prototype.packEventData=function(t,e){Ew(e).eventData={componentType:"series",componentSubType:"line",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"line"}},n.prototype.highlight=function(t,e,n,i){var r=t.getData(),o=Ar(r,i);if(this._changePolyState("emphasis"),!(o instanceof Array)&&null!=o&&o>=0){var a=r.getLayout("points"),s=r.getItemGraphicEl(o);if(!s){var l=a[2*o],u=a[2*o+1];if(isNaN(l)||isNaN(u))return;if(this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(l,u))return;var h=t.get("zlevel")||0,c=t.get("z")||0;s=new RA(r,o),s.x=l,s.y=u,s.setZ(h,c);var p=s.getSymbolPath().getTextContent();p&&(p.zlevel=h,p.z=c,p.z2=this._polyline.z2+1),s.__temp=!0,r.setItemGraphicEl(o,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else _I.prototype.highlight.call(this,t,e,n,i)},n.prototype.downplay=function(t,e,n,i){var r=t.getData(),o=Ar(r,i);if(this._changePolyState("normal"),null!=o&&o>=0){var a=r.getItemGraphicEl(o);a&&(a.__temp?(r.setItemGraphicEl(o,null),this.group.remove(a)):a.downplay())}else _I.prototype.downplay.call(this,t,e,n,i)},n.prototype._changePolyState=function(t){var e=this._polygon;ra(this._polyline,t),e&&ra(e,t)},n.prototype._newPolyline=function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new FA({shape:{points:t},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(e),this._polyline=e,e},n.prototype._newPolygon=function(t,e){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new HA({shape:{points:t,stackedOnPoints:e},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},n.prototype._initSymbolLabelAnimation=function(t,e,n){var i,r,o=e.getBaseAxis(),a=o.inverse;"cartesian2d"===e.type?(i=o.isHorizontal(),r=!1):"polar"===e.type&&(i="angle"===o.dim,r=!0);var s=t.hostModel,l=s.get("animationDuration");T(l)&&(l=l(null));var u=s.get("animationDelay")||0,h=T(u)?u(null):u;t.eachItemGraphicEl(function(t,o){var s=t;if(s){var c=[t.x,t.y],p=void 0,d=void 0,f=void 0;if(n)if(r){var g=n,y=e.pointToCoord(c);i?(p=g.startAngle,d=g.endAngle,f=-y[1]/180*Math.PI):(p=g.r0,d=g.r,f=y[0])}else{var v=n;i?(p=v.x,d=v.x+v.width,f=t.x):(p=v.y+v.height,d=v.y,f=t.y)}var m=d===p?0:(f-p)/(d-p);a&&(m=1-m);var _=T(u)?u(o):l*m+h,x=s.getSymbolPath(),b=x.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:_}),b&&b.animateFrom({style:{opacity:0}},{duration:300,delay:_}),x.disableLabelAnimation=!0}})},n.prototype._initOrUpdateEndLabel=function(t,e,n){var i=t.getModel("endLabel");if(Wg(t)){var r=t.getData(),o=this._polyline,a=r.getLayout("points");if(!a)return o.removeTextContent(),void(this._endLabel=null);var s=this._endLabel;s||(s=this._endLabel=new Pw({z2:200}),s.ignoreClip=!0,o.setTextContent(this._endLabel),o.disableLabelAnimation=!0);var l=Vg(a);l>=0&&(Gs(o,Ws(t,"endLabel"),{inheritColor:n,labelFetcher:t,labelDataIndex:l,defaultText:function(t,e,n){return null!=n?tg(r,n):Jf(r,t)},enableTextSetter:!0},Xg(i,e)),o.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},n.prototype._endLabelOnDuring=function(t,e,n,i,r,o,a){var s=this._endLabel,l=this._polyline;if(s){1>t&&null==i.originalX&&(i.originalX=s.x,i.originalY=s.y);var u=n.getLayout("points"),h=n.hostModel,c=h.get("connectNulls"),p=o.get("precision"),d=o.get("distance")||0,f=a.getBaseAxis(),g=f.isHorizontal(),y=f.inverse,v=e.shape,m=y?g?v.x:v.y+v.height:g?v.x+v.width:v.y,_=(g?d:0)*(y?-1:1),x=(g?0:-d)*(y?-1:1),b=g?"x":"y",w=Gg(u,m,b),S=w.range,M=S[1]-S[0],T=void 0;if(M>=1){if(M>1&&!c){var I=Hg(u,S[0]);s.attr({x:I[0]+_,y:I[1]+x}),r&&(T=h.getRawValue(S[0]))}else{var I=l.getPointOn(m,b);I&&s.attr({x:I[0]+_,y:I[1]+x});var C=h.getRawValue(S[0]),k=h.getRawValue(S[1]);r&&(T=Br(n,p,C,k,w.t))}i.lastFrameIndex=S[0]}else{var D=1===t||i.lastFrameIndex>0?S[0]:0,I=Hg(u,D);r&&(T=h.getRawValue(D)),s.attr({x:I[0]+_,y:I[1]+x})}r&&dM(s).setLabelText(T)}},n.prototype._doUpdateAnimation=function(t,e,n,i,r,o,a){var s=this._polyline,l=this._polygon,u=t.hostModel,h=Ig(this._data,t,this._stackedOnPoints,e,this._coordSys,n,this._valueOrigin,o),c=h.current,p=h.stackedOnCurrent,d=h.next,f=h.stackedOnNext;if(r&&(c=Rg(h.current,n,r,a),p=Rg(h.stackedOnCurrent,n,r,a),d=Rg(h.next,n,r,a),f=Rg(h.stackedOnNext,n,r,a)),Pg(c,d)>3e3||l&&Pg(p,f)>3e3)return s.stopAnimation(),s.setShape({points:d}),void(l&&(l.stopAnimation(),l.setShape({points:d,stackedOnPoints:f})));s.shape.__points=h.current,s.shape.points=c;var g={shape:{points:d}};h.current!==c&&(g.shape.__points=h.next),s.stopAnimation(),ss(s,g,u),l&&(l.setShape({points:c,stackedOnPoints:p}),l.stopAnimation(),ss(l,{shape:{stackedOnPoints:f}},u),s.shape.points!==l.shape.points&&(l.shape.points=s.shape.points));for(var y=[],v=h.status,m=0;me[1]&&e.reverse(),e},n.prototype.pointToData=function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},n.prototype.setCategorySortInfo=function(t){return"category"!==this.type?!1:(this.model.option.categorySortInfo=t,void this.scale.setSortInfo(t))},n}(GD),nP=Math.log,iP=function(){function t(t,e,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=JA,this._initCartesian(t,e,n),this.model=t}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(t,e){function n(t){var e,n=b(t),i=n.length;if(i){for(var r=[],o=i-1;o>=0;o--){var a=+n[o],s=t[a],l=s.model,u=s.scale;Kp(u)&&l.get("alignTicks")&&null==l.get("interval")?r.push(s):(Pd(u,l),Kp(u)&&(e=s))}r.length&&(e||(e=r.pop(),Pd(e.scale,e.model)),y(r,function(t){ty(t.scale,t.model,e.scale)}))}}var i=this._axesMap;this._updateScale(t,this.model),n(i.x),n(i.y);var r={};y(i.x,function(t){ny(i,"y",t,r)}),y(i.y,function(t){ny(i,"x",t,r)}),this.resize(this.model,e)},t.prototype.resize=function(t,e,n){function i(){y(s,function(t){var e=t.isHorizontal(),n=e?[0,a.width]:[0,a.height],i=t.inverse?1:0;t.setExtent(n[i],n[1-i]),ry(t,e?a.x:a.y)})}var r=t.getBoxLayoutParams(),o=!n&&t.get("containLabel"),a=Fl(r,{width:e.getWidth(),height:e.getHeight()});this._rect=a;var s=this._axesList;i(),o&&(y(s,function(t){if(!t.model.get(["axisLabel","inside"])){var e=Nd(t);if(e){var n=t.isHorizontal()?"height":"width",i=t.model.get(["axisLabel","margin"]);a[n]-=e[n]+i,"top"===t.position?a.y+=e.height+i:"left"===t.position&&(a.x+=e.width+i)}}}),i()),y(this._coordsList,function(t){t.calcAffineTransform()})},t.prototype.getAxis=function(t,e){var n=this._axesMap[t];return null!=n?n[e||0]:void 0},t.prototype.getAxes=function(){return this._axesList.slice()},t.prototype.getCartesian=function(t,e){if(null!=t&&null!=e){var n="x"+t+"y"+e;return this._coordsMap[n]}D(t)&&(e=t.yAxisIndex,t=t.xAxisIndex);for(var i=0,r=this._coordsList;i0?"top":"bottom",i="center"):Qi(o-rP)?(r=n>0?"bottom":"top",i="center"):(r="middle",i=o>0&&rP>o?n>0?"right":"left":n>0?"left":"right"),{rotation:o,textAlign:i,textVerticalAlign:r}},t.makeAxisEventDataBase=function(t){var e={componentType:t.mainType,componentIndex:t.componentIndex}; +return e[t.mainType+"Index"]=t.componentIndex,e},t.isLabelSilent=function(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)},t}(),aP={axisLine:function(t,e,n,i){var r=e.get(["axisLine","show"]);if("auto"===r&&t.handleAutoShown&&(r=t.handleAutoShown("axisLine")),r){var o=e.axis.getExtent(),a=i.transform,s=[o[0],0],l=[o[1],0],u=s[0]>l[0];a&&(ye(s,s,a),ye(l,l,a));var c=h({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),p=new BS({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});ws(p.shape,p.style.lineWidth),p.anid="line",n.add(p);var d=e.get(["axisLine","symbol"]);if(null!=d){var f=e.get(["axisLine","symbolSize"]);I(d)&&(d=[d,d]),(I(f)||k(f))&&(f=[f,f]);var g=pc(e.get(["axisLine","symbolOffset"])||0,f),v=f[0],m=f[1];y([{rotate:t.rotation+Math.PI/2,offset:g[0],r:0},{rotate:t.rotation-Math.PI/2,offset:g[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],function(e,i){if("none"!==d[i]&&null!=d[i]){var r=hc(d[i],-v/2,-m/2,v,m,c.stroke,!0),o=e.r+e.offset,a=u?l:s;r.attr({rotation:e.rotate,x:a[0]+o*Math.cos(t.rotation),y:a[1]-o*Math.sin(t.rotation),silent:!0,z2:11}),n.add(r)}})}}},axisTickLabel:function(t,e,n,i){var r=cy(n,i,e,t),o=dy(n,i,e,t);if(ay(e,o,r),py(n,i,e,t.tickDirection),e.get(["axisLabel","hideOverlap"])){var a=Rf(v(o,function(t){return{label:t,priority:t.z2,defaultAttr:{ignore:t.ignore}}}));Bf(a)}},axisName:function(t,e,n,i){var r=z(t.axisName,e.get("name"));if(r){var o,a=e.get("nameLocation"),s=t.nameDirection,l=e.getModel("nameTextStyle"),u=e.get("nameGap")||0,h=e.axis.getExtent(),c=h[0]>h[1]?-1:1,p=["start"===a?h[0]-c*u:"end"===a?h[1]+c*u:(h[0]+h[1])/2,uy(a)?t.labelOffset+s*u:0],d=e.get("nameRotate");null!=d&&(d=d*rP/180);var f;uy(a)?o=oP.innerTextLayout(t.rotation,null!=d?d:t.rotation,s):(o=oy(t.rotation,a,d||0,h),f=t.axisNameAvailableWidth,null!=f&&(f=Math.abs(f/Math.sin(o.rotation)),!isFinite(f)&&(f=null)));var g=l.getFont(),y=e.get("nameTruncate",!0)||{},v=y.ellipsis,m=z(t.nameTruncateMaxWidth,y.maxWidth,f),_=new Pw({x:p[0],y:p[1],rotation:o.rotation,silent:oP.isLabelSilent(e),style:Us(l,{text:r,font:g,overflow:"truncate",width:m,ellipsis:v,fill:l.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:l.get("align")||o.textAlign,verticalAlign:l.get("verticalAlign")||o.textVerticalAlign}),z2:1});if(zs({el:_,componentModel:e,itemName:r}),_.__fullText=r,_.anid="name",e.get("triggerEvent")){var x=oP.makeAxisEventDataBase(e);x.targetType="axisName",x.name=r,Ew(_).eventData=x}i.add(_),_.updateTransform(),n.add(_),_.decomposeTransform()}}},sP={},lP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.render=function(e,n,i){this.axisPointerClass&&xy(e),t.prototype.render.apply(this,arguments),this._doUpdateAxisPointerClass(e,i,!0)},n.prototype.updateAxisPointer=function(t,e,n){this._doUpdateAxisPointerClass(t,n,!1)},n.prototype.remove=function(t,e){var n=this._axisPointer;n&&n.remove(e)},n.prototype.dispose=function(e,n){this._disposeAxisPointer(n),t.prototype.dispose.apply(this,arguments)},n.prototype._doUpdateAxisPointerClass=function(t,e,i){var r=n.getAxisPointerClass(this.axisPointerClass);if(r){var o=wy(t);o?(this._axisPointer||(this._axisPointer=new r)).render(t,o,e,i):this._disposeAxisPointer(e)}},n.prototype._disposeAxisPointer=function(t){this._axisPointer&&this._axisPointer.dispose(t),this._axisPointer=null},n.registerAxisPointerClass=function(t,e){sP[t]=e},n.getAxisPointerClass=function(t){return t&&sP[t]},n.type="axis",n}(yI),uP=Pr(),hP=["axisLine","axisTickLabel","axisName"],cP=["splitArea","splitLine","minorSplitLine"],pP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.axisPointerClass="CartesianAxisPointer",e}return e(n,t),n.prototype.render=function(e,n,i,r){this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new Jx,this.group.add(this._axisGroup),e.get("show")){var a=e.getCoordSysModel(),s=$g(a,e),l=new oP(e,h({handleAutoShown:function(){for(var t=a.coordinateSystem.getCartesians(),n=0;n=0},n.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},n.type="legend.plain",n.dependencies=["series"],n.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},n}(QM),wP=S,SP=y,MP=Jx,TP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.newlineDisabled=!1,e}return e(n,t),n.prototype.init=function(){this.group.add(this._contentGroup=new MP),this.group.add(this._selectorGroup=new MP),this._isFirstRender=!0},n.prototype.getContentGroup=function(){return this._contentGroup},n.prototype.getSelectorGroup=function(){return this._selectorGroup},n.prototype.render=function(t,e,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var r=t.get("align"),o=t.get("orient");r&&"auto"!==r||(r="right"===t.get("left")&&"vertical"===o?"right":"left");var a=t.get("selector",!0),s=t.get("selectorPosition",!0);!a||s&&"auto"!==s||(s="horizontal"===o?"end":"start"),this.renderInner(r,t,e,n,a,o,s);var l=t.getBoxLayoutParams(),u={width:n.getWidth(),height:n.getHeight()},h=t.get("padding"),p=Fl(l,u,h),d=this.layoutInner(t,r,p,i,a,s),f=Fl(c({width:d.width,height:d.height},l),u,h);this.group.x=f.x-d.x,this.group.y=f.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=Dy(d,t))}},n.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},n.prototype.renderInner=function(t,e,n,i,r,o,a){var s=this.getContentGroup(),l=Y(),u=e.get("selectedMode"),c=[];n.eachRawSeries(function(t){!t.get("legendHoverLink")&&c.push(t.id)}),SP(e.getData(),function(r,o){var a=r.get("name");if(!this.newlineDisabled&&(""===a||"\n"===a)){var p=new MP;return p.newline=!0,void s.add(p)}var d=n.getSeriesByName(a)[0];if(!l.get(a))if(d){var f=d.getData(),g=f.getVisual("legendLineStyle")||{},y=f.getVisual("legendIcon"),v=f.getVisual("style"),m=this._createItem(d,a,o,r,e,t,g,v,y,u,i);m.on("click",wP(Ly,a,null,i,c)).on("mouseover",wP(Ry,d.name,null,i,c)).on("mouseout",wP(Ey,d.name,null,i,c)),l.set(a,!0)}else n.eachRawSeries(function(n){if(!l.get(a)&&n.legendVisualProvider){var s=n.legendVisualProvider;if(!s.containName(a))return;var p=s.indexOfName(a),d=s.getItemVisual(p,"style"),f=s.getItemVisual(p,"legendIcon"),g=Rn(d.fill);g&&0===g[3]&&(g[3]=.2,d=h(h({},d),{fill:Wn(g,"rgba")}));var y=this._createItem(n,a,o,r,e,t,{},d,f,u,i);y.on("click",wP(Ly,null,a,i,c)).on("mouseover",wP(Ry,null,a,i,c)).on("mouseout",wP(Ey,null,a,i,c)),l.set(a,!0)}},this)},this),r&&this._createSelector(r,e,i,o,a)},n.prototype._createSelector=function(t,e,n){var i=this.getSelectorGroup();SP(t,function(t){var r=t.type,o=new Pw({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===r?"legendAllSelect":"legendInverseSelect"})}});i.add(o);var a=e.getModel("selectorLabel"),s=e.getModel(["emphasis","selectorLabel"]);Gs(o,{normal:a,emphasis:s},{defaultText:t.title}),Aa(o)})},n.prototype._createItem=function(t,e,n,i,r,o,a,s,l,u,h){var c=t.visualDrawType,p=r.get("itemWidth"),d=r.get("itemHeight"),f=r.isSelected(e),g=i.get("symbolRotate"),y=i.get("symbolKeepAspect"),v=i.get("icon");l=v||l||"roundRect";var m=Ay(l,i,a,s,c,f,h),_=new MP,x=i.getModel("textStyle");if(!T(t.getLegendIcon)||v&&"inherit"!==v){var b="inherit"===v&&t.getData().getVisual("symbol")?"inherit"===g?t.getData().getVisual("symbolRotate"):g:0;_.add(Py({itemWidth:p,itemHeight:d,icon:l,iconRotate:b,itemStyle:m.itemStyle,lineStyle:m.lineStyle,symbolKeepAspect:y}))}else _.add(t.getLegendIcon({itemWidth:p,itemHeight:d,icon:l,iconRotate:g,itemStyle:m.itemStyle,lineStyle:m.lineStyle,symbolKeepAspect:y}));var w="left"===o?p+5:-5,S=o,M=r.get("formatter"),C=e;I(M)&&M?C=M.replace("{name}",null!=e?e:""):T(M)&&(C=M(e));var k=i.get("inactiveColor");_.add(new Pw({style:Us(x,{text:C,x:w,y:d/2,fill:f?x.getTextColor():k,align:S,verticalAlign:"middle"})}));var D=new Cw({shape:_.getBoundingRect(),invisible:!0}),A=i.getModel("tooltip");return A.get("show")&&zs({el:D,componentModel:r,itemName:e,itemTooltipOption:A.option}),_.add(D),_.eachChild(function(t){t.silent=!0}),D.silent=!u,this.getContentGroup().add(_),Aa(_),_.__legendDataIndex=n,_},n.prototype.layoutInner=function(t,e,n,i,r,o){var a=this.getContentGroup(),s=this.getSelectorGroup();KM(t.get("orient"),a,t.get("itemGap"),n.width,n.height);var l=a.getBoundingRect(),u=[-l.x,-l.y];if(s.markRedraw(),a.markRedraw(),r){KM("horizontal",s,t.get("selectorItemGap",!0));var h=s.getBoundingRect(),c=[-h.x,-h.y],p=t.get("selectorButtonGap",!0),d=t.getOrient().index,f=0===d?"width":"height",g=0===d?"height":"width",y=0===d?"y":"x";"end"===o?c[d]+=l[f]+p:u[d]+=h[f]+p,c[1-d]+=l[g]/2-h[g]/2,s.x=c[0],s.y=c[1],a.x=u[0],a.y=u[1];var v={x:0,y:0};return v[f]=l[f]+p+h[f],v[g]=Math.max(l[g],h[g]),v[y]=Math.min(0,h[y]+c[1-d]),v}return a.x=u[0],a.y=u[1],this.group.getBoundingRect()},n.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},n.type="legend.plain",n}(yI),IP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.setScrollDataIndex=function(t){this.option.scrollDataIndex=t},n.prototype.init=function(e,n,i){var r=Gl(e);t.prototype.init.call(this,e,n,i),Vy(this,e,r)},n.prototype.mergeOption=function(e,n){t.prototype.mergeOption.call(this,e,n),Vy(this,this.option,e)},n.type="legend.scroll",n.defaultOption=el(bP.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),n}(bP),CP=Jx,kP=["width","height"],DP=["x","y"],AP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.newlineDisabled=!0,e._currentIndex=0,e}return e(n,t),n.prototype.init=function(){t.prototype.init.call(this),this.group.add(this._containerGroup=new CP),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new CP)},n.prototype.resetInner=function(){t.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},n.prototype.renderInner=function(e,n,i,r,o,a,s){function l(t,e){var i=t+"DataIndex",o=Ls(n.get("pageIcons",!0)[n.getOrient().name][e],{onclick:Ym(u._pageGo,u,i,n,r)},{x:-p[0]/2,y:-p[1]/2,width:p[0],height:p[1]});o.name=t,h.add(o)}var u=this;t.prototype.renderInner.call(this,e,n,i,r,o,a,s);var h=this._controllerGroup,c=n.get("pageIconSize",!0),p=M(c)?c:[c,c];l("pagePrev",0);var d=n.getModel("pageTextStyle");h.add(new Pw({name:"pageText",style:{text:"xx/xx",fill:d.getTextColor(),font:d.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),l("pageNext",1)},n.prototype.layoutInner=function(t,e,n,i,r,o){var a=this.getSelectorGroup(),l=t.getOrient().index,u=kP[l],h=DP[l],c=kP[1-l],p=DP[1-l];r&&KM("horizontal",a,t.get("selectorItemGap",!0));var d=t.get("selectorButtonGap",!0),f=a.getBoundingRect(),g=[-f.x,-f.y],y=s(n);r&&(y[u]=n[u]-f[u]-d);var v=this._layoutContentAndController(t,i,y,l,u,c,p,h);if(r){if("end"===o)g[l]+=v[u]+d;else{var m=f[u]+d;g[l]-=m,v[h]-=m}v[u]+=f[u]+d,g[1-l]+=v[p]+v[c]/2-f[c]/2,v[c]=Math.max(v[c],f[c]),v[p]=Math.min(v[p],f[p]+g[1-l]),a.x=g[0],a.y=g[1],a.markRedraw()}return v},n.prototype._layoutContentAndController=function(t,e,n,i,r,o,a,s){var l=this.getContentGroup(),u=this._containerGroup,h=this._controllerGroup;KM(t.get("orient"),l,t.get("itemGap"),i?n.width:null,i?null:n.height),KM("horizontal",h,t.get("pageButtonItemGap",!0));var c=l.getBoundingRect(),p=h.getBoundingRect(),d=this._showController=c[r]>n[r],f=[-c.x,-c.y];e||(f[i]=l[s]);var g=[0,0],y=[-p.x,-p.y],v=B(t.get("pageButtonGap",!0),t.get("itemGap",!0));if(d){var m=t.get("pageButtonPosition",!0);"end"===m?y[i]+=n[r]-p[r]:g[i]+=p[r]+v}y[1-i]+=c[o]/2-p[o]/2,l.setPosition(f),u.setPosition(g),h.setPosition(y);var _={x:0,y:0};if(_[r]=d?n[r]:c[r],_[o]=Math.max(c[o],p[o]),_[a]=Math.min(0,p[a]+y[1-i]),u.__rectSize=n[r],d){var x={x:0,y:0};x[r]=Math.max(n[r]-p[r]-v,0),x[o]=_[o],u.setClipPath(new Cw({shape:x})),u.__rectSize=x[r]}else h.eachChild(function(t){t.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(t);return null!=b.pageIndex&&ss(l,{x:b.contentPosition[0],y:b.contentPosition[1]},d?t:null),this._updatePageInfoView(t,b),_},n.prototype._pageGo=function(t,e,n){var i=this._getPageInfo(e)[t];null!=i&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:e.id})},n.prototype._updatePageInfoView=function(t,e){var n=this._controllerGroup;y(["pagePrev","pageNext"],function(i){var r=i+"DataIndex",o=null!=e[r],a=n.childOfName(i);a&&(a.setStyle("fill",o?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),a.cursor=o?"pointer":"default")});var i=n.childOfName("pageText"),r=t.get("pageFormatter"),o=e.pageIndex,a=null!=o?o+1:0,s=e.pageCount;i&&r&&i.setStyle("text",I(r)?r.replace("{current}",null==a?"":a+"").replace("{total}",null==s?"":s+""):r({current:a,total:s}))},n.prototype._getPageInfo=function(t){function e(t){if(t){var e=t.getBoundingRect(),n=e[l]+t[l];return{s:n,e:n+e[s],i:t.__legendDataIndex}}}function n(t,e){return t.e>=e&&t.s<=e+o}var i=t.get("scrollDataIndex",!0),r=this.getContentGroup(),o=this._containerGroup.__rectSize,a=t.getOrient().index,s=kP[a],l=DP[a],u=this._findTargetItemIndex(i),h=r.children(),c=h[u],p=h.length,d=p?1:0,f={contentPosition:[r.x,r.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!c)return f;var g=e(c);f.contentPosition[a]=-g.s;for(var y=u+1,v=g,m=g,_=null;p>=y;++y)_=e(h[y]),(!_&&m.e>v.s+o||_&&!n(_,v.s))&&(v=m.i>v.i?m:_,v&&(null==f.pageNextDataIndex&&(f.pageNextDataIndex=v.i),++f.pageCount)),m=_;for(var y=u-1,v=g,m=g,_=null;y>=-1;--y)_=e(h[y]),_&&n(m,_.s)||!(v.ia)return!0;if(o){var s=by(t).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>a}return!1}return n===!0},t.prototype.makeElOption=function(){},t.prototype.createPointerEl=function(t,e){var n=e.pointer;if(n){var i=PP(t).pointerEl=new lM[n.type](LP(e.pointer));t.add(i)}},t.prototype.createLabelEl=function(t,e,n,i){if(e.label){var r=PP(t).labelEl=new Pw(LP(e.label));t.add(r),Xy(r,i)}},t.prototype.updatePointerEl=function(t,e,n){var i=PP(t).pointerEl;i&&e.pointer&&(i.setStyle(e.pointer.style),n(i,{shape:e.pointer.shape}))},t.prototype.updateLabelEl=function(t,e,n,i){var r=PP(t).labelEl;r&&(r.setStyle(e.label.style),n(r,{x:e.label.x,y:e.label.y}),Xy(r,i))},t.prototype._renderHandle=function(t){if(!this._dragging&&this.updateHandleTransform){var e=this._axisPointerModel,n=this._api.getZr(),i=this._handle,r=e.getModel("handle"),o=e.get("status");if(!r.get("show")||!o||"hide"===o)return i&&n.remove(i),void(this._handle=null);var a;this._handle||(a=!0,i=this._handle=Ls(r.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){d_(t.event)},onmousedown:OP(this._onHandleDragMove,this,0,0),drift:OP(this._onHandleDragMove,this),ondragend:OP(this._onHandleDragEnd,this)}),n.add(i)),qy(i,e,!1),i.setStyle(r.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=r.get("size");M(s)||(s=[s,s]),i.scaleX=s[0]/2,i.scaleY=s[1]/2,Wh(this,"_doDispatchAxisPointer",r.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,a)}},t.prototype._moveHandleToValue=function(t,e){Wy(this._axisPointerModel,!e&&this._moveAnimation,this._handle,Yy(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(t,e){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(Yy(n),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(Yy(i)),PP(n).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){var t=this._handle;if(t){var e=this._payloadInfo,n=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:n.axis.dim,axisIndex:n.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){this._dragging=!1;var t=this._handle;if(t){var e=this._axisPointerModel.get("value");this._moveHandleToValue(e),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),n=this._group,i=this._handle;e&&n&&(this._lastGraphicKey=null,n&&e.remove(n),i&&e.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),Uh(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(t,e,n){return n=n||0,{x:t[n],y:t[1-n],width:e[n],height:e[1-n]}},t}(),EP=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.makeElOption=function(t,e,n,i,r){var o=n.axis,a=o.grid,s=i.get("type"),l=nv(a,o).getOtherAxis(o).getGlobalExtent(),u=o.toGlobalCoord(o.dataToCoord(e,!0));if(s&&"none"!==s){var h=jy(i),c=NP[s](o,u,l);c.style=h,t.graphicKey=c.type,t.pointer=c}var p=$g(a.model,n);Jy(e,t,p,n,i,r)},n.prototype.getHandleTransform=function(t,e,n){var i=$g(e.axis.grid.model,e,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var r=Qy(e.axis,t,i);return{x:r[0],y:r[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},n.prototype.updateHandleTransform=function(t,e,n){var i=n.axis,r=i.grid,o=i.getGlobalExtent(!0),a=nv(r,i).getOtherAxis(i).getGlobalExtent(),s="x"===i.dim?0:1,l=[t.x,t.y];l[s]+=e[s],l[s]=Math.min(o[1],l[s]),l[s]=Math.max(o[0],l[s]);var u=(a[1]+a[0])/2,h=[u,u];h[s]=l[s];var c=[{verticalAlign:"middle"},{align:"center"}];return{x:l[0],y:l[1],rotation:t.rotation,cursorPoint:h,tooltipOption:c[s]}},n}(RP),NP={line:function(t,e,n){var i=tv([e,n[0]],[e,n[1]],iv(t));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(t,e,n){var i=Math.max(1,t.getBandWidth()),r=n[1]-n[0];return{type:"Rect",shape:ev([e-i/2,n[0]],[i,r],iv(t))}}},zP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.type="axisPointer",n.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},n}(QM),BP=Pr(),FP=y,VP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.render=function(t,e,n){var i=e.getComponent("tooltip"),r=t.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";rv("axisPointer",n,function(t,e,n){"none"!==r&&("leave"===t||r.indexOf(t)>=0)&&n({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})})},n.prototype.remove=function(t,e){hv("axisPointer",e)},n.prototype.dispose=function(t,e){hv("axisPointer",e)},n.type="axisPointer",n}(yI),HP=Pr(),GP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.type="tooltip",n.dependencies=["axisPointer"],n.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},n}(QM),WP=Tv(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),UP=Tv(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),XP=Iv(UP,"transition"),YP=Iv(WP,"transform"),qP="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+(Mm.transform3dSupported?"will-change:transform;":""),jP=function(){function t(t,e,n){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._firstShow=!0,this._longHide=!0,Mm.wxa)return null;var i=document.createElement("div");i.domBelongToZr=!0,this.el=i;var r=this._zr=e.getZr(),o=this._appendToBody=n&&n.appendToBody;Rv(this._styleCoord,r,o,e.getWidth()/2,e.getHeight()/2),o?document.body.appendChild(i):t.appendChild(i),this._container=t;var a=this;i.onmouseenter=function(){a._enterable&&(clearTimeout(a._hideTimeout),a._show=!0),a._inContent=!0},i.onmousemove=function(t){if(t=t||window.event,!a._enterable){var e=r.handler,n=r.painter.getViewportRoot();Ae(n,t,!0),e.dispatch("mousemove",t)}},i.onmouseleave=function(){a._inContent=!1,a._enterable&&a._show&&a.hideLater(a._hideDelay)}}return t.prototype.update=function(t){var e=this._container,n=Cv(e,"position"),i=e.style;"absolute"!==i.position&&"absolute"!==n&&(i.position="relative");var r=t.get("alwaysShowContent");r&&this._moveIfResized(),this.el.className=t.get("className")||""},t.prototype.show=function(t,e){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,i=n.style,r=this._styleCoord;n.innerHTML?i.cssText=qP+Ov(t,!this._firstShow,this._longHide)+Pv(r[0],r[1],!0)+("border-color:"+Nl(e)+";")+(t.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):i.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},t.prototype.setContent=function(t,e,n,i,r){var o=this.el;if(null==t)return void(o.innerHTML="");var a="";if(I(r)&&"item"===n.get("trigger")&&!Mv(n)&&(a=Dv(n,i,r)),I(t))o.innerHTML=t+a;else if(t){o.innerHTML="",M(t)||(t=[t]);for(var s=0;s=0?this._tryShow(n,i):"leave"===t&&this._hide(i))},this))},n.prototype._keepShow=function(){var t=this._tooltipModel,e=this._ecModel,n=this._api,i=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==i&&"click"!==i){var r=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&r.manuallyShowTip(t,e,n,{x:r._lastX,y:r._lastY,dataByCoordSys:r._lastDataByCoordSys})})}},n.prototype.manuallyShowTip=function(t,e,n,i){if(i.from!==this.uid&&!Mm.node&&n.getDom()){var r=Fv(i,n);this._ticket="";var o=i.dataByCoordSys,a=Uv(i,e,n);if(a){var s=a.el.getBoundingRect().clone();s.applyTransform(a.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:a.el,position:i.position,positionDefault:"bottom"},r)}else if(i.tooltip&&null!=i.x&&null!=i.y){var l=KP;l.x=i.x,l.y=i.y,l.update(),Ew(l).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:l},r)}else if(o)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:o,tooltipOption:i.tooltipOption},r);else if(null!=i.seriesIndex){if(this._manuallyAxisShowTip(t,e,n,i))return;var u=cv(i,e),h=u.point[0],c=u.point[1];null!=h&&null!=c&&this._tryShow({offsetX:h,offsetY:c,target:u.el,position:i.position,positionDefault:"bottom"},r)}else null!=i.x&&null!=i.y&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},r))}},n.prototype.manuallyHideTip=function(t,e,n,i){var r=this._tooltipContent;!this._alwaysShowContent&&this._tooltipModel&&r.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(Fv(i,n))},n.prototype._manuallyAxisShowTip=function(t,e,n,i){var r=i.seriesIndex,o=i.dataIndex,a=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=r&&null!=o&&null!=a){var s=e.getSeriesByIndex(r);if(s){var l=s.getData(),u=Bv([l.getItemModel(o),s,(s.coordinateSystem||{}).model],this._tooltipModel);if("axis"===u.get("trigger"))return n.dispatchAction({type:"updateAxisPointer",seriesIndex:r,dataIndex:o,position:i.position}),!0}}},n.prototype._tryShow=function(t,e){var n=t.target,i=this._tooltipModel;if(i){this._lastX=t.offsetX,this._lastY=t.offsetY;var r=t.dataByCoordSys;if(r&&r.length)this._showAxisTooltip(r,t);else if(n){this._lastDataByCoordSys=null;var o,a;lc(n,function(t){return null!=Ew(t).dataIndex?(o=t,!0):null!=Ew(t).tooltipConfig?(a=t,!0):void 0},!0),o?this._showSeriesItemTooltip(t,o,e):a?this._showComponentItemTooltip(t,a,e):this._hide(e)}else this._lastDataByCoordSys=null,this._hide(e)}},n.prototype._showOrMove=function(t,e){var n=t.get("showDelay");e=Ym(e,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(e,n):e()},n.prototype._showAxisTooltip=function(t,e){var n=this._ecModel,i=this._tooltipModel,r=[e.offsetX,e.offsetY],o=Bv([e.tooltipOption],i),a=this._renderMode,s=[],l=ch("section",{blocks:[],noHeader:!0}),u=[],c=new pI;y(t,function(t){y(t.dataByAxis,function(t){var e=n.getComponent(t.axisDim+"Axis",t.axisIndex),r=t.value;if(e&&null!=r){var o=$y(r,e.axis,n,t.seriesDataIndices,t.valueLabelOpt),p=ch("section",{header:o,noHeader:!W(o),sortBlocks:!0,blocks:[]});l.blocks.push(p),y(t.seriesDataIndices,function(l){var d=n.getSeriesByIndex(l.seriesIndex),f=l.dataIndexInside,g=d.getDataParams(f);if(!(g.dataIndex<0)){g.axisDim=t.axisDim,g.axisIndex=t.axisIndex,g.axisType=t.axisType,g.axisId=t.axisId,g.axisValue=Ed(e.axis,{value:r}),g.axisValueLabel=o,g.marker=c.makeTooltipMarker("item",Nl(g.color),a);var y=Xu(d.formatTooltip(f,!0,null)),v=y.frag;if(v){var m=Bv([d],i).get("valueFormatter");p.blocks.push(m?h({valueFormatter:m},v):v)}y.text&&u.push(y.text),s.push(g)}})}})}),l.blocks.reverse(),u.reverse();var p=e.position,d=o.get("order"),f=vh(l,c,a,d,n.get("useUTC"),o.get("textStyle"));f&&u.unshift(f);var g="richText"===a?"\n\n":"
            ",v=u.join(g);this._showOrMove(o,function(){this._updateContentNotChangedOnAxis(t,s)?this._updatePosition(o,p,r[0],r[1],this._tooltipContent,s):this._showTooltipContent(o,v,s,Math.random()+"",r[0],r[1],p,null,c)})},n.prototype._showSeriesItemTooltip=function(t,e,n){var i=this._ecModel,r=Ew(e),o=r.seriesIndex,a=i.getSeriesByIndex(o),s=r.dataModel||a,l=r.dataIndex,u=r.dataType,c=s.getData(u),p=this._renderMode,d=t.positionDefault,f=Bv([c.getItemModel(l),s,a&&(a.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),g=f.get("trigger");if(null==g||"item"===g){var y=s.getDataParams(l,u),v=new pI;y.marker=v.makeTooltipMarker("item",Nl(y.color),p);var m=Xu(s.formatTooltip(l,!1,u)),_=f.get("order"),x=f.get("valueFormatter"),b=m.frag,w=b?vh(x?h({valueFormatter:x},b):b,v,p,_,i.get("useUTC"),f.get("textStyle")):m.text,S="item_"+s.name+"_"+l;this._showOrMove(f,function(){this._showTooltipContent(f,w,y,S,t.offsetX,t.offsetY,t.position,t.target,v)}),n({type:"showTip",dataIndexInside:l,dataIndex:c.getRawIndex(l),seriesIndex:o,from:this.uid})}},n.prototype._showComponentItemTooltip=function(t,e,n){var i=Ew(e),r=i.tooltipConfig,o=r.option||{};if(I(o)){var a=o;o={content:a,formatter:a}}var l=[o],u=this._ecModel.getComponent(i.componentMainType,i.componentIndex);u&&l.push(u),l.push({formatter:o.content});var h=t.positionDefault,c=Bv(l,this._tooltipModel,h?{position:h}:null),p=c.get("content"),d=Math.random()+"",f=new pI;this._showOrMove(c,function(){var n=s(c.get("formatterParams")||{});this._showTooltipContent(c,p,n,d,t.offsetX,t.offsetY,t.position,e,f)}),n({type:"showTip",from:this.uid})},n.prototype._showTooltipContent=function(t,e,n,i,r,o,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent;u.setEnterable(t.get("enterable"));var h=t.get("formatter");a=a||t.get("position");var c=e,p=this._getNearestPoint([r,o],n,t.get("trigger"),t.get("borderColor")),d=p.color;if(h)if(I(h)){var f=t.ecModel.get("useUTC"),g=M(n)?n[0]:n,y=g&&g.axisType&&g.axisType.indexOf("time")>=0;c=h,y&&(c=hl(g.axisValue,c,f)),c=Ll(c,n,!0)}else if(T(h)){var v=Ym(function(e,i){e===this._ticket&&(u.setContent(i,l,t,d,a),this._updatePosition(t,a,r,o,u,n,s))},this);this._ticket=i,c=h(n,i,v)}else c=h;u.setContent(c,l,t,d,a),u.show(t,d),this._updatePosition(t,a,r,o,u,n,s)}},n.prototype._getNearestPoint=function(t,e,n,i){return"axis"===n||M(e)?{color:i||("html"===this._renderMode?"#fff":"none")}:M(e)?void 0:{color:i||e.color||e.borderColor}},n.prototype._updatePosition=function(t,e,n,i,r,o,a){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=r.getSize(),h=t.get("align"),c=t.get("verticalAlign"),p=a&&a.getBoundingRect().clone();if(a&&p.applyTransform(a.transform),T(e)&&(e=e([n,i],o,r.el,p,{viewSize:[s,l],contentSize:u.slice()})),M(e))n=Gi(e[0],s),i=Gi(e[1],l);else if(D(e)){var d=e;d.width=u[0],d.height=u[1];var f=Fl(d,{width:s,height:l});n=f.x,i=f.y,h=null,c=null}else if(I(e)&&a){var g=Gv(e,p,u,t.get("borderWidth"));n=g[0],i=g[1]}else{var g=Vv(n,i,r,s,l,h?null:20,c?null:20);n=g[0],i=g[1]}if(h&&(n-=Wv(h)?u[0]/2:"right"===h?u[0]:0),c&&(i-=Wv(c)?u[1]/2:"bottom"===c?u[1]:0),Mv(t)){var g=Hv(n,i,r,s,l);n=g[0],i=g[1]}r.moveTo(n,i)},n.prototype._updateContentNotChangedOnAxis=function(t,e){var n=this._lastDataByCoordSys,i=this._cbParamsList,r=!!n&&n.length===t.length;return r&&y(n,function(n,o){var a=n.dataByAxis||[],s=t[o]||{},l=s.dataByAxis||[];r=r&&a.length===l.length,r&&y(a,function(t,n){var o=l[n]||{},a=t.seriesDataIndices||[],s=o.seriesDataIndices||[];r=r&&t.value===o.value&&t.axisType===o.axisType&&t.axisId===o.axisId&&a.length===s.length,r&&y(a,function(t,e){var n=s[e];r=r&&t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex}),i&&y(t.seriesDataIndices,function(t){var n=t.seriesIndex,o=e[n],a=i[n];o&&a&&a.data!==o.data&&(r=!1)})})}),this._lastDataByCoordSys=t,this._cbParamsList=e,!!r},n.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},n.prototype.dispose=function(t,e){!Mm.node&&e.getDom()&&(Uh(this,"_updatePosition"),this._tooltipContent.dispose(),hv("itemTooltip",e))},n.type="tooltip",n}(yI);Xd(Xv);var QP=Pr(),JP=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e.createdBySelf=!1,e}return e(n,t),n.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n),this._mergeOption(t,n,!1,!0)},n.prototype.isAnimationEnabled=function(){if(Mm.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},n.prototype.mergeOption=function(t,e){this._mergeOption(t,e,!1,!1)},n.prototype._mergeOption=function(t,e,n,i){var r=this.mainType;n||e.eachSeries(function(t){var n=t.get(this.mainType,!0),o=QP(t)[r];return n&&n.data?(o?o._mergeOption(n,e,!0):(i&&qv(n),y(n.data,function(t){t instanceof Array?(qv(t[0]),qv(t[1])):qv(t)}),o=this.createMarkerModelFromSeries(n,this,e),h(o,{mainType:this.mainType,seriesIndex:t.seriesIndex,name:t.name,createdBySelf:!0}),o.__hostSeries=t),void(QP(t)[r]=o)):void(QP(t)[r]=null)},this)},n.prototype.formatTooltip=function(t){var e=this.getData(),n=this.getRawValue(t),i=e.getName(t);return ch("section",{header:this.name,blocks:[ch("nameValue",{name:i,value:n,noName:!i,noValue:null==n})]})},n.prototype.getData=function(){return this._data},n.prototype.setData=function(t){this._data=t},n.getMarkerModelFromSeries=function(t,e){return QP(t)[e]},n.type="marker",n.dependencies=["series","grid","polar","geo"],n}(QM);f(JP,jT.prototype);var tL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.createMarkerModelFromSeries=function(t,e,i){return new n(t,e,i)},n.type="markPoint",n.defaultOption={z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{show:!0,position:"inside"},itemStyle:{borderWidth:2},emphasis:{label:{show:!0}}},n}(JP),eL={min:S(Kv,"min"),max:S(Kv,"max"),average:S(Kv,"average"),median:S(Kv,"median")},nL=Pr(),iL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.init=function(){this.markerGroupMap=Y()},n.prototype.render=function(t,e,n){var i=this,r=this.markerGroupMap;r.each(function(t){nL(t).keep=!1}),e.eachSeries(function(t){var r=JP.getMarkerModelFromSeries(t,i.type);r&&i.renderSeries(t,r,e,n)}),r.each(function(t){!nL(t).keep&&i.group.remove(t.group)})},n.prototype.markKeep=function(t){nL(t).keep=!0},n.prototype.toggleBlurSeries=function(t,e){var n=this;y(t,function(t){var i=JP.getMarkerModelFromSeries(t,n.type);if(i){var r=i.getData();r.eachItemGraphicEl(function(t){t&&(e?ga(t):ya(t))})}})},n.type="marker",n}(yI),rL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.updateTransform=function(t,e,n){e.eachSeries(function(t){var e=JP.getMarkerModelFromSeries(t,"markPoint");e&&(im(e.getData(),t,n),this.markerGroupMap.get(t.id).updateLayout())},this)},n.prototype.renderSeries=function(t,e,n,i){var r=t.coordinateSystem,o=t.id,a=t.getData(),s=this.markerGroupMap,l=s.get(o)||s.set(o,new EA),u=rm(r,t,e);e.setData(u),im(e.getData(),t,i),u.each(function(t){var n=u.getItemModel(t),i=n.getShallow("symbol"),r=n.getShallow("symbolSize"),o=n.getShallow("symbolRotate"),s=n.getShallow("symbolOffset"),l=n.getShallow("symbolKeepAspect");if(T(i)||T(r)||T(o)||T(s)){var h=e.getRawValue(t),c=e.getDataParams(t);T(i)&&(i=i(h,c)),T(r)&&(r=r(h,c)),T(o)&&(o=o(h,c)),T(s)&&(s=s(h,c))}var p=n.getModel("itemStyle").getItemStyle(),d=oc(a,"color");p.fill||(p.fill=d),u.setItemVisual(t,{symbol:i,symbolSize:r,symbolRotate:o,symbolOffset:s,symbolKeepAspect:l,style:p})}),l.updateData(u),this.group.add(l.group),u.eachItemGraphicEl(function(t){t.traverse(function(t){Ew(t).dataModel=e})}),this.markKeep(l),l.group.silent=e.get("silent")||t.get("silent")},n.type="markPoint",n}(iL);Xd(om);var oL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.createMarkerModelFromSeries=function(t,e,i){return new n(t,e,i)},n.type="markLine",n.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},n}(JP),aL=BS.prototype,sL=HS.prototype,lL=function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return t}(),uL=(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n}(lL),function(t){function n(e){var n=t.call(this,e)||this;return n.type="ec-line",n}return e(n,t),n.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},n.prototype.getDefaultShape=function(){return new lL},n.prototype.buildPath=function(t,e){am(e)?aL.buildPath.call(this,t,e):sL.buildPath.call(this,t,e)},n.prototype.pointAt=function(t){return am(this.shape)?aL.pointAt.call(this,t):sL.pointAt.call(this,t)},n.prototype.tangentAt=function(t){var e=this.shape,n=am(e)?[e.x2-e.x1,e.y2-e.y1]:sL.tangentAt.call(this,t);return ce(n,n)},n}(mw)),hL=["fromSymbol","toSymbol"],cL=function(t){function n(e,n,i){var r=t.call(this)||this;return r._createLine(e,n,i),r}return e(n,t),n.prototype._createLine=function(t,e,n){var i=t.hostModel,r=t.getItemLayout(e),o=um(r);o.shape.percent=0,ls(o,{shape:{percent:1}},i,e),this.add(o),y(hL,function(n){var i=lm(n,t,e);this.add(i),this[sm(n)]=t.getItemVisual(e,n)},this),this._updateCommonStl(t,e,n)},n.prototype.updateData=function(t,e,n){var i=t.hostModel,r=this.childOfName("line"),o=t.getItemLayout(e),a={shape:{}};hm(a.shape,o),ss(r,a,i,e),y(hL,function(n){var i=t.getItemVisual(e,n),r=sm(n);if(this[r]!==i){this.remove(this.childOfName(n));var o=lm(n,t,e);this.add(o)}this[r]=i},this),this._updateCommonStl(t,e,n)},n.prototype.getLinePath=function(){return this.childAt(0)},n.prototype._updateCommonStl=function(t,e,n){var i=t.hostModel,r=this.childOfName("line"),o=n&&n.emphasisLineStyle,a=n&&n.blurLineStyle,s=n&&n.selectLineStyle,l=n&&n.labelStatesModels,u=n&&n.emphasisDisabled,h=n&&n.focus,c=n&&n.blurScope;if(!n||t.hasItemOption){var p=t.getItemModel(e),d=p.getModel("emphasis");o=d.getModel("lineStyle").getLineStyle(),a=p.getModel(["blur","lineStyle"]).getLineStyle(),s=p.getModel(["select","lineStyle"]).getLineStyle(),u=d.get("disabled"),h=d.get("focus"),c=d.get("blurScope"),l=Ws(p)}var f=t.getItemVisual(e,"style"),g=f.stroke;r.useStyle(f),r.style.fill=null,r.style.strokeNoScale=!0,r.ensureState("emphasis").style=o,r.ensureState("blur").style=a,r.ensureState("select").style=s,y(hL,function(t){var e=this.childOfName(t);if(e){e.setColor(g),e.style.opacity=f.opacity;for(var n=0;n0&&(_[0]=-_[0],_[1]=-_[1]);var b=m[0]<0?-1:1;if("start"!==r.__position&&"end"!==r.__position){var w=-Math.atan2(m[1],m[0]);h[0].8?"left":c[0]<-.8?"right":"center",d=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";break;case"start":r.x=-c[0]*g+u[0],r.y=-c[1]*y+u[1],p=c[0]>.8?"right":c[0]<-.8?"left":"center",d=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":r.x=g*b+u[0],r.y=u[1]+S,p=m[0]<0?"right":"left",r.originX=-g*b,r.originY=-S;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":r.x=x[0],r.y=x[1]+S,p="center",r.originY=-S;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":r.x=-g*b+h[0],r.y=h[1]+S,p=m[0]>=0?"right":"left",r.originX=g*b,r.originY=-S}r.scaleX=r.scaleY=o,r.setStyle({verticalAlign:r.__verticalAlign||d,align:r.__align||p})}}}},n}(Jx),pL=function(){function t(t){this.group=new Jx,this._LineCtor=t||cL}return t.prototype.updateData=function(t){var e=this;this._progressiveEls=null;var n=this,i=n.group,r=n._lineData;n._lineData=t,r||i.removeAll();var o=pm(t);t.diff(r).add(function(n){e._doAdd(t,n,o)}).update(function(n,i){e._doUpdate(r,t,i,n,o)}).remove(function(t){i.remove(r.getItemGraphicEl(t))}).execute()},t.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(e,n){e.updateLayout(t,n)},this)},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=pm(t),this._lineData=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e){function n(t){t.isGroup||cm(t)||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[];for(var i=t.start;i=0&&k(c)&&(c=+c.toFixed(Math.min(m,20))),y.coord[f]=v.coord[f]=c,r=[y,v,{type:a,valueIndex:i.valueIndex,value:c}]}else r=[]}var _=[$v(t,r[0]),$v(t,r[1]),h({},r[2])];return _[2].type=_[2].type||null,l(_[2],_[0]),l(_[2],_[1]),_},gL=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=n.type,e}return e(n,t),n.prototype.updateTransform=function(t,e,n){e.eachSeries(function(t){var e=JP.getMarkerModelFromSeries(t,"markLine");if(e){var i=e.getData(),r=dL(e).from,o=dL(e).to;r.each(function(e){mm(r,e,!0,t,n),mm(o,e,!1,t,n)}),i.each(function(t){i.setItemLayout(t,[r.getItemLayout(t),o.getItemLayout(t)])}),this.markerGroupMap.get(t.id).updateLayout()}},this)},n.prototype.renderSeries=function(t,e,n,i){function r(e,n,r){var o=e.getItemModel(n);mm(e,n,r,t,i);var a=o.getModel("itemStyle").getItemStyle();null==a.fill&&(a.fill=oc(s,"color")),e.setItemVisual(n,{symbolKeepAspect:o.get("symbolKeepAspect"),symbolOffset:B(o.get("symbolOffset",!0),v[r?0:1]),symbolRotate:B(o.get("symbolRotate",!0),y[r?0:1]),symbolSize:B(o.get("symbolSize"),g[r?0:1]),symbol:B(o.get("symbol",!0),f[r?0:1]),style:a})}var o=t.coordinateSystem,a=t.id,s=t.getData(),l=this.markerGroupMap,u=l.get(a)||l.set(a,new pL);this.group.add(u.group);var h=_m(o,t,e),c=h.from,p=h.to,d=h.line;dL(e).from=c,dL(e).to=p,e.setData(d);var f=e.get("symbol"),g=e.get("symbolSize"),y=e.get("symbolRotate"),v=e.get("symbolOffset");M(f)||(f=[f,f]),M(g)||(g=[g,g]),M(y)||(y=[y,y]),M(v)||(v=[v,v]),h.from.each(function(t){r(c,t,!0),r(p,t,!1)}),d.each(function(t){var e=d.getItemModel(t).getModel("lineStyle").getLineStyle();d.setItemLayout(t,[c.getItemLayout(t),p.getItemLayout(t)]),null==e.stroke&&(e.stroke=c.getItemVisual(t,"style").fill),d.setItemVisual(t,{fromSymbolKeepAspect:c.getItemVisual(t,"symbolKeepAspect"),fromSymbolOffset:c.getItemVisual(t,"symbolOffset"),fromSymbolRotate:c.getItemVisual(t,"symbolRotate"),fromSymbolSize:c.getItemVisual(t,"symbolSize"),fromSymbol:c.getItemVisual(t,"symbol"),toSymbolKeepAspect:p.getItemVisual(t,"symbolKeepAspect"),toSymbolOffset:p.getItemVisual(t,"symbolOffset"),toSymbolRotate:p.getItemVisual(t,"symbolRotate"),toSymbolSize:p.getItemVisual(t,"symbolSize"),toSymbol:p.getItemVisual(t,"symbol"),style:e})}),u.updateData(d),h.line.eachItemGraphicEl(function(t){Ew(t).dataModel=e,t.traverse(function(t){Ew(t).dataModel=e})}),this.markKeep(u),u.group.silent=e.get("silent")||t.get("silent")},n.type="markLine",n}(iL);Xd(xm),t.version=_C,t.dependencies=xC,t.PRIORITY=zC,t.init=ep,t.connect=np,t.disConnect=ip,t.disconnect=Ck,t.dispose=rp,t.getInstanceByDom=op,t.getInstanceById=ap,t.registerTheme=sp,t.registerPreprocessor=lp,t.registerProcessor=up,t.registerPostInit=hp,t.registerPostUpdate=cp,t.registerUpdateLifecycle=pp,t.registerAction=dp,t.registerCoordinateSystem=fp,t.getCoordinateSystemDimensions=gp,t.registerLayout=yp,t.registerVisual=vp,t.registerLoading=_p,t.setCanvasCreator=xp,t.registerMap=bp,t.getMap=wp,t.registerTransform=Dk,t.dataTool=zk,t.registerLocale=nl,t.zrender=rb,t.matrix=y_,t.vector=e_,t.zrUtil=Km,t.color=lx,t.helper=ID,t.number=ED,t.time=ND,t.graphic=zD,t.format=BD,t.util=FD,t.List=$k,t.ComponentModel=QM,t.ComponentView=yI,t.SeriesModel=gI,t.ChartView=_I,t.extendComponentModel=mf,t.extendComponentView=_f,t.extendSeriesModel=xf,t.extendChartView=bf,t.throttle=Gh,t.use=Xd,t.setPlatformAPI=r,t.parseGeoJSON=tf,t.parseGeoJson=tf,t.env=Mm,t.Model=MM,t.Axis=GD,t.innerDrawElementOnCanvas=Vc}); \ No newline at end of file diff --git a/ESPController/web_src/lang_de.js b/ESPController/web_src/lang_de.js index 607110de..ee31c4bf 100644 --- a/ESPController/web_src/lang_de.js +++ b/ESPController/web_src/lang_de.js @@ -79,9 +79,11 @@ $("#rf4").text("Relaisstatus"); //Emergency Stop -$("label[for='rule1value']").text("Not Stop"); +$("label[for='rule0value']").text("Not Stop"); //Internal BMS error -$("label[for='rule2value']").text("Interner BMS Fehler"); +$("label[for='rule1value']").text("Interner BMS Fehler"); +//Current monitoring over current (Amps) +$("label[for='rule2value']").text("Stromüberwachung Überstrom (A)"); //Individual cell over voltage (mV) $("label[for='rule3value']").text("Zellenüberspannung (mV)"); //Cell under voltage (mV) @@ -94,14 +96,20 @@ $("label[for='rule6value']").text("Modul Untertemperatur (intern)"); $("label[for='rule7value']").text("Zellen Übertemperatur (extern)"); //Cell under temperature (external) $("label[for='rule8value']").text("Zellen Untertemperatur (extern)"); -//Pack over voltage (mV) -$("label[for='rule9value']").text("Paket Überspannung (mV)"); -//Pack under voltage (mV) -$("label[for='rule10value']").text("Paket Unterspannung (mV)"); +//Bank over voltage (mV) +$("label[for='rule9value']").text("Überspannung des Strommonitors (mV)"); +//Bank under voltage (mV) +$("label[for='rule10value']").text("Stromwächter unter Spannung (mV)"); +//Bank over voltage (mV) +$("label[for='rule11value'").text("Paket Überspannung (mV)"); +//Bank under voltage (mV) +$("label[for='rule12value'").text("Paket Unterspannung (mV)"); +//Bank range/deviation (mV) +$("label[for='rule13value'").text("Bankbereich/Varianz (mV)"); //Timer 2 -$("label[for='rule11value']").text("Timer 2"); +$("label[for='rule14value']").text("Timer 2"); //Timer 1 -$("label[for='rule12value']").text("Timer 1"); +$("label[for='rule15value']").text("Timer 1"); //Relay default $("label[for='defaultvalue']").text("Relais Grundeinstellung"); //Relay type diff --git a/ESPController/web_src/lang_en.js b/ESPController/web_src/lang_en.js index f8a36c73..90bb2a70 100644 --- a/ESPController/web_src/lang_en.js +++ b/ESPController/web_src/lang_en.js @@ -10,4 +10,36 @@ web interface, press F12, click the CONSOLE tab and enter the Javascript command dumpTextElementsForLanguageTranslation() This will output all the text elements it can find in the HTML for you to edit -*/ \ No newline at end of file +*/ +//Emergency Stop +$("label[for='rule0value']").text("Emergency stop"); +//Internal BMS error +$("label[for='rule1value']").text("Internal BMS error"); +//Current monitoring over current (Amps) +$("label[for='rule2value']").text("Current monitoring over current (Amps)"); +//Individual cell over voltage (mV) +$("label[for='rule3value']").text("Individual cell over voltage (mV)"); +//Cell under voltage (mV) +$("label[for='rule4value']").text("Cell under voltage (mV)"); +//Module over temperature (internal) °C +$("label[for='rule5value']").text("Module over temperature (internal) °C"); +//Module under temperature (internal) +$("label[for='rule6value']").text("Module under temperature (internal) °C"); +//Cell over temperature (external) +$("label[for='rule7value']").text("Cell over temperature (external) °C"); +//Cell under temperature (external) +$("label[for='rule8value']").text("Cell under temperature (external) °C"); +//Bank over voltage (mV) +$("label[for='rule9value']").text("Current monitor over voltage (mV)"); +//Bank under voltage (mV) +$("label[for='rule10value']").text("Current monitor under voltage (mV)"); +//Bank over voltage (mV) +$("label[for='rule11value']").text("Bank over voltage (mV)"); +//Bank under voltage (mV) +$("label[for='rule12value']").text("Bank under voltage (mV)"); +//Bank range/deviation (mV) +$("label[for='rule13value']").text("Bank range/deviation (mV)"); +//Timer 2 +$("label[for='rule14value']").text("Timer 2"); +//Timer 1 +$("label[for='rule15value']").text("Timer 1"); diff --git a/ESPController/web_src/lang_es.js b/ESPController/web_src/lang_es.js index ce57ec08..53bbf2e2 100644 --- a/ESPController/web_src/lang_es.js +++ b/ESPController/web_src/lang_es.js @@ -75,14 +75,14 @@ $("#rf4").text("Estado del relé"); //Emergency Stop -$("label[for='rule1value']").text("Parada de emergencia"); +$("label[for='rule0value']").text("Parada de emergencia"); //Internal BMS error= -$("label[for='rule2value']").text("Error interno de BMS"); +$("label[for='rule1value']").text("Error interno de BMS"); //Individual cell over voltage (mV) $("label[for='rule3value']").text("Celda individual por encima de voltaje (mV)"); //Cell under voltage (mV) $("label[for='rule4value']").text("Celda individual por debajo de voltaje (mV)"); -//Module over temperature (internal) °C = +//Module over temperature (internal) °C $("label[for='rule5value']").text("Modulo por encima de temperatua (interna) °C"); //Module under temperature (internal) $("label[for='rule6value']").text("Modulo por debajo de temperatua (interna) °C"); @@ -90,14 +90,17 @@ $("label[for='rule6value']").text("Modulo por debajo de temperatua (interna) °C $("label[for='rule7value']").text("Celda por encima de temperatua (externa) °C"); //Cell under temperature (external) $("label[for='rule8value']").text("Celda por debajo de temperatua (externa) °C"); -//Pack over voltage (mV) +//Bank over voltage (mV) $("label[for='rule9value']").text("Paquete por encima de voltaje (mV)"); -//Pack under voltage (mV) -$("label[for='rule10value']").text("Paquete por debajo de voltaje (mV)"); +//Bank under voltage (mV) +//Bank over voltage (mV) +$("label[for='rule11value']").text("Paquete por debajo de voltaje (mV)"); +//Bank under voltage (mV) +//Bank range/deviation (mV) //Timer 2 -$("label[for='rule11value']").text("Temporizador 2"); +$("label[for='rule14value']").text("Temporizador 2"); //Timer 1 -$("label[for='rule12value']").text("Temporizador 1"); +$("label[for='rule15value']").text("Temporizador 1"); //Relay default $("label[for='defaultvalue']").text("Configuracion Relé"); //Relay type = diff --git a/ESPController/web_src/lang_fr.js b/ESPController/web_src/lang_fr.js index 74229de8..0b56789b 100644 --- a/ESPController/web_src/lang_fr.js +++ b/ESPController/web_src/lang_fr.js @@ -84,9 +84,9 @@ $("#rf4").text("Etat relais"); //Emergency Stop $("label[for='rule0value']").text("Arret d'urgence"); -//Internal BMS error= +//Internal BMS error $("label[for='rule1value']").text("Erreur interne BMS"); -//overcuerrent +//Current monitoring over current (Amps) $("label[for='rule2value']").text("Surintensité vu par le moniteur de courant (A)"); //Individual cell over voltage (mV) $("label[for='rule3value']").text("Seuil de surtension cellule individuelle (mV)"); @@ -100,17 +100,20 @@ $("label[for='rule6value']").text("PCB Soustemperature °C"); $("label[for='rule7value']").text("Cellule Surtemperature (Ext) °C"); //Cell under temperature (external) $("label[for='rule8value']").text("Cellule Soustemperature (Ext) °C"); -//Pack over voltage (mV) +//Bank over voltage (mV) $("label[for='rule9value']").text("Surtention chaîne (mV)"); -//Pack under voltage (mV) +//Bank under voltage (mV) $("label[for='rule10value']").text("Soustention chaîne (mV)"); +//Bank over voltage (mV) +//Bank under voltage (mV) +//Bank range/deviation (mV) //Timer 2 -$("label[for='rule11value']").text("Tempo 2"); +$("label[for='rule14value']").text("Tempo 2"); //Timer 1 -$("label[for='rule12value']").text("Tempo 1"); +$("label[for='rule15value']").text("Tempo 1"); //Relay default $("label[for='defaultvalue']").text("Défault relais"); -//Relay type = +//Relay type $("label[for='relaytype']").text("Type de Relais"); diff --git a/ESPController/web_src/lang_hr.js b/ESPController/web_src/lang_hr.js index 4d4bdff0..e92b5b15 100644 --- a/ESPController/web_src/lang_hr.js +++ b/ESPController/web_src/lang_hr.js @@ -79,9 +79,10 @@ $("#rf4").text("Status releja"); //Emergency Stop -$("label[for='rule1value']").text("Not Stop"); +$("label[for='rule0value']").text("Not Stop"); //Internal BMS error -$("label[for='rule2value']").text("Greška unutrašnjeg BMSa"); +$("label[for='rule1value']").text("Greška unutrašnjeg BMSa"); +//Current monitoring over current (Amps) //Individual cell over voltage (mV) $("label[for='rule3value']").text("Prenapon pojedine čelije (mV)"); //Cell under voltage (mV) @@ -94,14 +95,17 @@ $("label[for='rule6value']").text("Podtemperatura modula (unutarnji)"); $("label[for='rule7value']").text("Prekomjerna temperatura čelije (vanjski)"); //Cell under temperature (external) $("label[for='rule8value']").text("Podtemperatura čelije (vanjski)"); -//Pack over voltage (mV) -$("label[for='rule9value']").text("Prenapon bloka (mV)"); -//Pack under voltage (mV) -$("label[for='rule10value']").text("Podnapon bloka (mV)"); +//Bank over voltage (mV) +//Bank under voltage (mV) +//Bank over voltage (mV) +$("label[for='rule11value']").text("Prenapon bloka (mV)"); +//Bank under voltage (mV) +$("label[for='rule12value']").text("Podnapon bloka (mV)"); +//Bank range/deviation (mV) //Timer 2 -$("label[for='rule11value']").text("Vremenski brojač 2"); +$("label[for='rule14value']").text("Vremenski brojač 2"); //Timer 1 -$("label[for='rule12value']").text("Vremenski brojač 1"); +$("label[for='rule15value']").text("Vremenski brojač 1"); //Relay default $("label[for='defaultvalue']").text("Defaultni relej"); //Relay type diff --git a/ESPController/web_src/lang_nl.js b/ESPController/web_src/lang_nl.js index c6b96633..68438ede 100644 --- a/ESPController/web_src/lang_nl.js +++ b/ESPController/web_src/lang_nl.js @@ -60,7 +60,7 @@ $("#rt2").text("Regels worden gevalueerd van laag naar hoog (van onder naar bove //Rules are triggered when the relevant value meets or exceeds the 'trigger' value. The rule will only disable when the value then passes the 'reset' value. This can help prevent relay clatter and rules firing on/off rapidly. $("#rt3").text("Regels worden actief wanneer de waarde boven de alarmwaarde gaat en wordt pas terug inactief wanneer de waarde onder de herstelwaarde gaat. Dit vermijdt onstabiele regelingen."); //'Timer 1' and 'Timer 2' rules allow timed operation, this rule is active when the number of minutes past midnight has been reached, for instance setting 'Timer 1' trigger to 495 and reset to 555 would switch on at 8:15am and off at 9:15am. This only works if connected to internet for regular time updates. -$("#rt4").text("De regels 'Timer 1' und 'Timer 2' laten een tijdsturing toe, de regel is actiev wanneer het aantal minuten na middernacht is bereikt. Bijvoorbeeld Timer 1 alarmwaarde 495 en herstelwaarde 555 zou activeren om 08:15 en deactiveren om 21:15. Deze regel werkt enkel als er internetverbinding is (NTP). "); +$("#rt4").text("De regels 'Timer 1' en 'Timer 2' laten een tijdsturing toe, de regel is actief wanneer het aantal minuten na middernacht is bereikt. Bijvoorbeeld Timer 1 alarmwaarde 495 en herstelwaarde 555 zou activeren om 08:15 en deactiveren om 21:15. Deze regel werkt enkel als er internetverbinding is (NTP). "); //Minutes since midnight now is: $("#rt5").text("Tijd na middernacht in minuten: "); //Emergency stop is triggered by connector J1, once triggered controller needs to be reset to disable. @@ -78,9 +78,10 @@ $("#rf4").text("Relaisstatus"); //Emergency Stop -$("label[for='rule1value']").text("Noodstop"); +$("label[for='rule0value']").text("Noodstop"); //Internal BMS error -$("label[for='rule2value']").text("Interne BMS fout"); +$("label[for='rule1value']").text("Interne BMS fout"); +//Current monitoring over current (Amps) //Individual cell over voltage (mV) $("label[for='rule3value']").text("Celoverspannig (mV)"); //Cell under voltage (mV) @@ -93,14 +94,17 @@ $("label[for='rule6value']").text("Minimale moduletemperatuur (intern)"); $("label[for='rule7value']").text("Maximale celtemperatuur (extern)"); //Cell under temperature (external) $("label[for='rule8value']").text("Minimale celtemperatuur (extern)"); -//Pack over voltage (mV) -$("label[for='rule9value']").text("Maximale batterijspanning (mV)"); -//Pack under voltage (mV) -$("label[for='rule10value']").text("Minimale batterijspanning (mV)"); +//Bank over voltage (mV) +//Bank under voltage (mV) +//Bank over voltage (mV) +$("label[for='rule11value']").text("Maximale batterijspanning (mV)"); +//Bank under voltage (mV) +$("label[for='rule12value']").text("Minimale batterijspanning (mV)"); +//Bank range/deviation (mV) //Timer 2 -$("label[for='rule11value']").text("Timer 2"); +$("label[for='rule14value']").text("Timer 2"); //Timer 1 -$("label[for='rule12value']").text("Timer 1"); +$("label[for='rule15value']").text("Timer 1"); //Relay default $("label[for='defaultvalue']").text("Standaardwaarde relais"); //Relay type @@ -120,7 +124,7 @@ $("#received > span.x.t").text("Paketten ontvangen:"); $("#roundtrip > span.x.t").text("Roundtrip (ms):"); //Integration -$("#ip1").text("Intagratie"); +$("#ip1").text("Integratie"); //For security, you will need to re-enter the password for the service(s) you want to enable or modify, before you save. $("#ip2").text("Paswoorden moeten opnieuw ingegeven worden voor de service(s) die geactiveerd of gewijzigd worden."); //After changes are made, the controller will need to be rebooted, do this manually. diff --git a/ESPController/web_src/lang_pt.js b/ESPController/web_src/lang_pt.js index 91818069..05482d29 100644 --- a/ESPController/web_src/lang_pt.js +++ b/ESPController/web_src/lang_pt.js @@ -75,9 +75,10 @@ $("#rf4").text("Estado do relé"); //Emergency Stop -$("label[for='rule1value']").text("Paragem de emergência"); +$("label[for='rule0value']").text("Paragem de emergência"); //Internal BMS error= -$("label[for='rule2value']").text("Erro interno do BMS"); +$("label[for='rule1value']").text("Erro interno do BMS"); +//Current monitoring over current (Amps) //Individual cell over voltage (mV) $("label[for='rule3value']").text("Sobretensão de célula individual (mV)"); //Cell under voltage (mV) @@ -90,14 +91,17 @@ $("label[for='rule6value']").text("Módulo abaixo da temperatura (interna) °C") $("label[for='rule7value']").text("Célula acima da temperatura (externa) °C"); //Cell under temperature (external) $("label[for='rule8value']").text("Célula abaixo da temperatura (externa) °C"); -//Pack over voltage (mV) +//Bank over voltage (mV) $("label[for='rule9value']").text("Sobretensão do conjunto (mV)"); -//Pack under voltage (mV) +//Bank under voltage (mV) $("label[for='rule10value']").text("Subtensão do conjunto (mV)"); +//Bank over voltage (mV) +//Bank under voltage (mV) +//Bank range/deviation (mV) //Timer 2 -$("label[for='rule11value']").text("Temporizador 2"); +$("label[for='rule14value']").text("Temporizador 2"); //Timer 1 -$("label[for='rule12value']").text("Temporizador 1"); +$("label[for='rule15value']").text("Temporizador 1"); //Relay default $("label[for='defaultvalue']").text("Configuração por defeito do Relé"); //Relay type = diff --git a/ESPController/web_src/lang_ru.js b/ESPController/web_src/lang_ru.js index f4fb30e5..d731f00f 100644 --- a/ESPController/web_src/lang_ru.js +++ b/ESPController/web_src/lang_ru.js @@ -1,204 +1,302 @@ -// This file is for Russian language translation -// https://www.w3schools.com/tags/ref_language_codes.asp - -$("#genericwarning").text("Предупреждение контроллера "); -$("#warning1").text("Предупреждение: Напряжение байпаса модуля отличается от глобальной настройки"); -$("#warning2").text("Предупреждение: Температура байпаса модуля отличается от глобальной настройки"); -$("#warning3").text("Предупреждение: Модули имеют разные версии кода, что может привести к нестабильности"); -$("#warning4").text("Внимание: Модули имеют смешанные версии оборудования/плат"); -$("#warning5").text("Предупреждение: Ведение журнала включено, но SD-карта не установлена/не найдена"); -$("#warning6").text("Некоторые функции отключены, пока включен режим программирования AVR"); -$("#warning7").text("Веб-страница не синхронизирована с контроллером, обновите веб-страницу (F5)"); -$("#sdcardmissing").text("SD-карта не установлена"); -$("#error1").text("Контроллер испытывает трудности с подключением к модулям мониторинга"); -$("#error2").text("Контроллер нашел модули, но настроен для ."); -$("#error3").text("Контроллер настроен на использование большего количества модулей, чем он может выдержать."); -$("#error4").text("Ожидание ответа модулей"); -$("#error5").text("Модуль вернул НУЛЕВОЕ значение напряжения, проверьте конфигурацию"); -$("#error6").text("У контроллера закончилась память."); -$("#error7").text("Аварийная Остановка"); -$("#iperror").text("Не удается связаться с контроллером для обновления статуса."); -$("#genericerror").text("Ошибка контроллера"); -$("#jslibrary").text("Библиотека Javascript не загружена правильно, пожалуйста, обновите страницу."); -$("#saveerror").text("Не удалось сохранить настройки."); -$("label[for='ModuleId'").text("Идентификатор модуля"); -$("label[for='Version'").text("Версия модуля"); -$("label[for='BypassOverTempShutdown'").text("Байпас по температуре"); -$("label[for='BypassThresholdmV'").text("Порог байпаса мВ"); -$("label[for='Calib'").text("Калибровочный множитель"); -$("label[for='ActualVoltage'").text("Калькулятор - Фактическое измеренное напряжение"); -$("label[for='ExtBCoef'").text("Внешняя температура BCoef"); -$("label[for='IntBCoef'").text("Внутренняя температура BCoef"); -$("label[for='LoadRes'").text("Сопротивление нагрузке"); -$("label[for='mVPerADC'").text("мВ на считывание АЦП"); -$("label[for='g1'").text("Байпас по температуре"); -$("label[for='g2'").text("Порог байпаса мВ"); -$("label[for='mqttEnabled'").text("Включить"); -$("label[for='mqttTopic'").text("Топик"); -$("label[for='mqttServer'").text("Сервер"); -$("label[for='mqttPort'").text("Порт"); -$("label[for='mqttUsername'").text("Логин"); -$("label[for='mqttPassword'").text("Пароль"); -$("label[for='influxEnabled'").text("Включить"); -$("label[for='influxServer'").text("Сервер"); -$("label[for='influxPort'").text("Порт"); -$("label[for='influxDatabase'").text("Имя базы данных"); -$("label[for='influxUsername'").text("Логин"); -$("label[for='influxPassword'").text("Пароль"); -$("label[for='rule1value'").text("Аварийная Остановка"); -$("label[for='rule2value'").text("Внутренняя ошибка BMS"); -$("label[for='rule3value'").text("Перенапряжение отдельной ячейки (мВ)"); -$("label[for='rule4value'").text("Ячейка под напряжением (мВ)"); -$("label[for='rule5value'").text("Модуль перегрет (внутренний) °C"); -$("label[for='rule6value'").text("Модуль при температуре (внутренней) °C"); -$("label[for='rule7value'").text("Температура ячейки выше (внешней) °C"); -$("label[for='rule8value'").text("Ячейка при температуре (внешней) °C"); -$("label[for='rule9value'").text("Сборка перенапряжение (мВ)"); -$("label[for='rule10value'").text("Сборка под напряжением (мВ)"); -$("label[for='rule11value'").text("Таймер 2"); -$("label[for='rule12value'").text("Таймер 1"); -$("label[for='defaultvalue'").text("Реле по умолчанию"); -$("label[for='relaytype'").text("Тип реле"); -$("label[for='CurrentMonEnabled'").text("Включить"); -$("label[for='modbusAddress'").text("Адрес Modbus"); -$("label[for='rs485baudrate'").text("Baud rate"); -$("label[for='rs485databit'").text("Биты данных"); -$("label[for='rs485parity'").text("Биты данных"); -$("label[for='rs485stopbit'").text("Стоп-биты"); -$("label[for='shuntmaxcur'").text("Максимальный ток шунта"); -$("label[for='shuntmv'").text("Выходное напряжение шунта (мВ)"); -$("label[for='cmvalid'").text("Допустимые значения?"); -$("label[for='cmtimestampage'").text("Последнее сообщение (миллисекунды)"); -$("label[for='cmwatchdog'").text("Watchdog счетчик"); -$("label[for='cmtemperature'").text("Температура штампа °C"); -$("label[for='cmactualshuntmv'").text("Фактическое значение мВ шунта"); -$("label[for='cmcurrentlsb'").text("Текущий размер LSB"); -$("label[for='cmresistance'").text("Сопротивление шунта"); -$("label[for='cmmodel'").text("Модель датчика"); -$("label[for='cmfirmwarev'").text("Версия прошивки"); -$("label[for='cmfirmwaredate'").text("Дата прошивки"); -$("label[for='cmRelayState'").text("Состояние реле"); -$("label[for='cmTemperatureOverLimit'").text("Температура превышает предельную"); -$("label[for='cmCurrentOverLimit'").text("Превышение предельного тока"); -$("label[for='cmCurrentUnderLimit'").text("Ток ниже предела"); -$("label[for='cmVoltageOverLimit'").text("Превышение предельного напряжения"); -$("label[for='cmVoltageUnderLimit'").text("Напряжение ниже предела"); -$("label[for='cmPowerOverLimit'").text("Мощность сверх предела"); -$("label[for='cmcalibration'").text("Калибровка"); -$("label[for='cmtemplimit'").text("Температурный предел"); -$("label[for='cmundervlimit'").text("Под пределом напряжения"); -$("label[for='cmovervlimit'").text("Предел перенапряжения"); -$("label[for='cmoverclimit'").text("Превышение лимита по току"); -$("label[for='cmunderclimit'").text("Под текущим лимитом"); -$("label[for='cmoverplimit'").text("Превышение предельной мощности"); -$("label[for='cmtempcoeff'").text("Температурный коэффициент ppm/°C"); -$("label[for='TempCompEnabled'").text("Включен температурный коэффициент"); -$("label[for='cmTMPOL'").text("Триггер реле: Температура"); -$("label[for='cmCURROL'").text("Триггер реле: Ток превышен"); -$("label[for='cmCURRUL'").text("Триггер реле: Ток под"); -$("label[for='cmVOLTOL'").text("Реле срабатывает: Напряжение превышает"); -$("label[for='cmVOLTUL'").text("Триггер реле: Напряжение ниже"); -$("label[for='cmPOL'").text("Триггер реле: Мощность"); -$("label[for='totalSeriesModules'").text("Количество ячеек серии (например, 8 сек)"); -$("label[for='totalBanks'").text("Количество параллельных банков (например, 2P)"); -$("label[for='NTPServer'").text("Сервер NTP"); -$("label[for='NTPZoneHour'").text("Часовой пояс (час)"); -$("label[for='NTPZoneMin'").text("Часовой пояс (минута)"); -$("label[for='NTPDST'").text("Переход На Летнее Время Включен"); -$("label[for='Language'").text("Язык"); -$("label[for='VoltageHigh'").text("Шкала напряжения графика (высокая)"); -$("label[for='VoltageLow'").text("Шкала напряжения графика (низкая)"); -$("label[for='loggingEnabled'").text("Ведение журнала на SD-карте включено"); -$("label[for='loggingFreq'").text("Частота регистрации данных ячейки (секунды)"); -$("#ap4").text("Помните, что этот продукт бесплатен для личного использования, если вы хотите регулярно делать пожертвования для поддержания функций и улучшений, используйте ссылку Patreon ниже.Даже просто кофе / пиво в месяц имеет значение.Спасибо!"); -$("#ap6").text("Это продукт / решение для DIY, поэтому не используйте его для критически важных систем безопасности или в любой ситуации, когда может возникнуть риск для жизни."); -$("#ap7").text("Гарантии нет, она может работать не так, как ожидалось, или вообще не работать."); -$("#ap8").text("Использование этого проекта осуществляется исключительно на ваш собственный риск.Это может быть связано с электрическим напряжением, которое может убить - если вы сомневаетесь, обратитесь за помощью."); -$("#ap8a").text("Использование этого проекта может не соответствовать местным законам или нормативным актам - если вы сомневаетесь, обратитесь за помощью."); -$("#ap10").text("Эта работа лицензирована в соответствии с лицензией Creative Commons Attribution - некоммерческой - ShareAlike 2.0 Великобритания: Англия и Уэльс."); -$("#hn").text("Имя хоста: "); -$("#sdk").text("Версия SDK: "); -$("#mfheap").text("Мин свободная память: "); -$("#fheap").text("Свободная память: "); -$("#heapz").text("Размер чипа: "); -$("#gc1").text("Настройте все модули для использования следующих параметров: "); -$("#ip2").text("В целях безопасности перед сохранением вам потребуется повторно ввести пароль для служб, которые вы хотите включить или изменить."); -$("#ip3").text("После внесения изменений контроллер необходимо будет перезагрузить, сделайте это вручную."); -$("#rt1").text("DIYBMS поддерживает релейные модули для безопасного отключения зарядных устройств, контакторов или потребителей. Правила позволяют вам настраивать ретрансляторы для вашей ситуации."); -$("#rt2").text("Правила обрабатываются от самого низкого приоритета до самого высокого(снизу вверх).Управляйте реле с помощью опций. Значение \"X\" означает, что вам все равно/оставьте значение, определенное правилами с более низким приоритетом."); -$("#rt3").text("Правила срабатывают, когда соответствующее значение соответствует или превышает значение \"триггера\". Правило будет отключено только тогда, когда значение затем передаст значение \"сброс\". Это может помочь предотвратить грохот реле и быстрое включение / выключение правил."); -$("#rt4").text("Правила \"Таймер 1\" и \"Таймер 2\" допускают работу по времени, это правило активно, когда достигнуто количество минут после полуночи, например, установка триггера \"Таймер 1\" на 495 и сброс до 555 включится в 8: 15 утра и выключится в 9: 15 утра. Это работает только при подключении к Интернету для регулярных обновлений времени."); -$("#rt5").text("Минут с полуночи сейчас: "); -$("#rt6").text("Аварийная остановка запускается разъемом J1, после срабатывания контроллер необходимо сбросить, чтобы отключить."); -$("#b1").text("Настройте подключение MODBUS к текущему монитору, используя приведенные ниже настройки."); -$("#b2").text("Параметры конфигурации интерфейса RS485. Связь осуществляется в полудуплексном режиме."); -$("#b3").text("Убедитесь, что текущие параметры шунта соответствуют спецификации для вашего конкретного шунтирующего резистора."); -$("#b4").text("Текущий монитор использует максимальную шкалу 40,96 мВ, поэтому шунтирующие напряжения по сравнению с этим будут пропорционально уменьшены."); -$("#b5").text("Если вы хотите использовать релейное управление на мониторе шунтирования, задайте параметры здесь. Обычно вам не нужно изменять значение калибровки."); -$("#b6").text("Ограничение по току предназначено для использования при разрядке аккумулятора, при зарядке используется ограничение по току, поэтому могут использоваться различные ограничения по току разряда / заряда."); -$("#b7").text("Температурный предел зависит от температуры кристалла микросхемы, которая может не соответствовать температуре шунта. Поддерживается только положительный температурный коэффициент."); -$("#b8").text("Триггеры реле определяют, какие правила используются для перевода реле в замкнутое состояние."); -$("#mb2").text("DIYBMS поддерживает в общей сложности до 100 модулей. Эти модули могут быть разделены на банки для поддержки параллельных конфигураций."); -$("#mb3").text("Пример: У вас есть 16 ячеек, настроенных как 8 последовательно и 2 параллельно(8S2P)."); -$("#b9").text("Время устанавливается через NTP, если ваш контроллер не подключен к Интернету. Правила, основанные на времени, будут неверными. Это автоматически не исправляется для перехода на летнее время."); -$("#b10").text("Время сейчас "); -$("#b11").text("Контроллер может программировать модули и устройства, используя файлы ниже. Не подключайте устройство для программирования до включения режима программирования."); -$("#sdcardmissing").text("SD-карта не установлена"); -$("#b12").text("Данные ячейки и выходные состояния могут храниться в виде файлов журнала с помощью SD-карты."); -$("#voltage0 span .x").text("Напряжение 0:3,87 В"); -$("#range0 span .x").text("Диапазон 0:0 мВ"); -$("#voltage1 span .x").text("Напряжение 1:"); -$("#range1 span .x").text("Диапазон 1:"); -$("#voltage2 span .x").text("Напряжение 2:"); -$("#range2 span .x").text("Диапазон 2:"); -$("#voltage3 span .x").text("Напряжение 3:"); -$("#range3 span .x").text("Диапазон 3:"); -$("#voltage4 span .x").text("Напряжение 4:"); -$("#range4 span .x").text("Диапазон 4:"); -$("#voltage5 span .x").text("Напряжение 5:"); -$("#range5 span .x").text("Диапазон 5:"); -$("#voltage6 span .x").text("Напряжение 6:"); -$("#range6 span .x").text("Диапазон 6:"); -$("#voltage7 span .x").text("Напряжение 7:"); -$("#range7 span .x").text("Диапазон 7:"); -$("#voltage8 span .x").text("Напряжение 8:"); -$("#range8 span .x").text("Диапазон 8:"); -$("#voltage9 span .x").text("Напряжение 9:"); -$("#range9 span .x").text("Диапазон 9:"); -$("#voltage10 span .x").text("Напряжение 10:"); -$("#range10 span .x").text("Диапазон 10:"); -$("#voltage11 span .x").text("Напряжение 11:"); -$("#range11 span .x").text("Диапазон 11:"); -$("#voltage12 span .x").text("Напряжение 12:"); -$("#range12 span .x").text("Диапазон 12:"); -$("#voltage13 span .x").text("Напряжение 13:"); -$("#range13 span .x").text("Диапазон 13:"); -$("#voltage14 span .x").text("Напряжение 14:"); -$("#range14 span .x").text("Диапазон 14:"); -$("#voltage15 span .x").text("Напряжение 15:"); -$("#range15 span .x").text("Диапазон 15:"); -$("#current span .x").text("Текущий:"); -$("#shuntv span .x").text("Напряжение шунта:"); -$("#power span .x").text("Мощность:"); -$("#amphout span .x").text("Ah выход:"); -$("#amphin span .x").text("Ah вход:"); -$("#oos span .x").text("O.O.S ошибки:"); -$("#badcrc span .x").text("CRC ошибки:"); -$("#ignored span .x").text("Игнорируемые запросы:"); -$("#sent span .x").text("Отправленные пакеты:"); -$("#received span .x").text("Пакеты, записанные:"); -$("#roundtrip span .x").text("Прохождение в оба конца (мс):"); -$("#uptime span .x").text("Время работы:"); -$("#integration").text("Интеграция"); -$("#currentmonitor").text("Монитор тока diyBMS"); -$("#storage").text("Хранилище"); -$("#avrprogrammer").text("Программатор AVR"); -$("#about").text("Об"); -$("#home").text("Домой"); +$("#home").text("Домой"); $("#modules").text("Модули"); $("#settings").text("Настройки"); $("#rules").text("Правила"); $("#more").text("Больше"); -$("#view2d").text("2D"); -$("#view3d").text("3D"); -$("#b13").text("Видеоролики YouTube об установке и настройке"); +$("#integration").text("Интеграция"); +$("#currentmonitor").text("diyBMS - токовый шунт"); +$("#storage").text("Хранилище"); +$("#avrprogrammer").text("AVR программатор"); +$("#about").text("Инфо"); +$("#modulesPage > h1").text("Модули"); +$("#globalConfig > h2").text("Общая конфигурация"); +$("#globalConfig > p").text("Конфигурация модуля"); +$("#mpBank").text("Ячейка"); +$("#mpModule").text("Модуль"); +$("#mpVoltage").text("Напряжение"); +$("#mpvmin").text("V. минимум"); +$("#mptint").text("Внутренняя температура °C"); +$("#mptext").text("Внешний датчик температуры °C"); +$("#mpbypass").text("Байпас %"); +$("#mpbpc").text("Поврежденные пакеты"); +$("#mppktr").text("Полученные посылки"); +$("#mpbal").text("Балансировка (mAh)"); +$("#error1").text("У контроллера возникли проблемы со связью с модулем."); +$("#error3").text("Контроллер сконфигурирован с разными поддерживаемыми модулями."); +$("#error4").text("Ожидание ответа от модуля.."); +$("#error5").text("Модуль зарегистрировал 0 вольт, пожалуйста, проверьте конфигурацию."); +$("#error6").text("В контроллере недостаточно места для хранения."); +$("#error7").text("Аварийная остановка"); +$("#iperror").text("Связь с контроллером для обновления статуса невозможна."); +$("#jslibrary").text("Библиотека JavaScript была загружена неправильно, пожалуйста, обновите страницу."); +$("#saveerror").text("Настройки не были сохранены."); +$("#savesuccess").text("Сохраненные настройки"); +$("#warning1").text("Внимание: байпасное напряжение модуля отличается от глобальной настройки"); +$("#warning2").text("Внимание: температура байпаса модуля отличается от глобальной настройки"); +$("#warning3").text("Внимание: модули имеют разные версии программного обеспечения, что может привести к нестабильности"); +$("#warning4").text("Внимание: модули имеют разные версии оборудования"); +$("#warning5").text("Внимание: логирование активировано, SD-карта не найдена"); +$("#warning6").text("Внимание: некоторые функции отключены в режиме программирования AVR"); +$("label[for='NTPServer']").text("NTP Сервер"); +$("label[for='NTPZoneHour']").text("Часовой пояс (Часы)"); +$("#rt1").text("DIYBMS поддерживает реле для безопасного переключения зарядных устройств, контакторов и потребителей. Приведенные ниже правила позволяют вам настроить их для вашей ситуации"); +$("#rt2").text("Правила оцениваются от низкого к высокому (снизу вверх). Управляйте реле с помощью опций. X означает игнорирование значения нижних строк"); +$("#rt3").text("Правила становятся активными, когда значение превышает значение тревоги, и снова становятся неактивными, только когда значение становится ниже значения восстановления. Это позволяет избежать нестабильных договоренностей."); +$("#rt4").text("Правила 'Таймер 1' и 'Таймер 2' позволяют регулировать время, правило становится активным, когда достигается количество минут после полуночи. Например, таймер 1 активирует значение тревоги 495 и сбрасывает значение 555 в 08:15 и деактивирует в 21: 15. Это правило работает только при наличии подключения к Интернету (NTP)."); +$("#rt5").text("Время после полуночи в минутах:"); +$("#rt6").text("Аварийная остановка активируется через разъем J1, после активации контроллер должен быть сброшен"); +$("#rf1").text("Правило"); +$("#rf2").text("Значение сигнала тревоги"); +$("#rf3").text("Значение сброса"); +$("#rf4").text("Состояние реле"); +$("label[for='rule1value']").text("Аварийная остановка"); +//Internal BMS error +$("label[for='rule1value']").text("Внутренняя ошибка BMS"); +//Individual cell over voltage (mV) +$("label[for='rule3value']").text("Перенапряжение отдельной ячейки (мВ)"); +//Cell under voltage (mV) +$("label[for='rule4value']").text("Пониженное напряжение ячейки (мВ)"); +//Module over temperature (internal) °C +$("label[for='rule5value']").text("Максимальная температура модуля (внутренняя) °C"); +//Module under temperature (internal) +$("label[for='rule6value']").text("Минимальная температура модуля (внутреняя)"); +//Cell over temperature (external) +$("label[for='rule7value']").text("Максимальная температура ячейки (внешняя)"); +//Cell under temperature (external) +$("label[for='rule8value']").text("Минимальная температура ячейки (внешняя)"); +//Bank over voltage (mV) +$("label[for='rule9value']").text("Максимальное напряжение батареи (мВ)"); +//Bank under voltage (mV) +$("label[for='rule10value']").text("Минимальное напряжение батареи (мВ)"); +//Bank over voltage (mV) +//Bank under voltage (mV) +//Bank range/deviation (mV) +//Timer 2 +$("label[for='rule14value']").text("Таймер 2"); +//Timer 1 +$("label[for='rule15value']").text("Таймер 1"); +$("label[for='defaultvalue']").text("Реле по умолчанию"); +$("label[for='relaytype']").text("Тип реле"); +$("label[for='g1']").text("Максимальная температура байпаса"); +$("label[for='g2']").text("Предельное значение байпаса mV"); +$("#sent > span.x.t").text("Отправленные пакеты:"); +$("#received > span.x.t").text("Полученные пакеты:"); +$("#roundtrip > span.x.t").text("Туда и обратно (ms):"); +$("#uptime > span.x.t").text("Время работы"); +$("#qlen > span.x.t").text("Отправка Q длина:"); +$("#ip1").text("Интеграция"); +$("#ip2").text("Пароли должны быть введены повторно для активируемых или изменяемых сервисов."); +$("#ip3").text("После сохранения настроек контроллер необходимо перезапустить вручную"); +$("#ip4").text("URI должен быть похож на mqtt://192.168.0.26:1833"); +$("label[for='mqttEnabled']").text("Включить"); +$("label[for='mqttTopic']").text("Топик"); +$("label[for='mqttUri']").text("URI"); +$("label[for='mqttPort']").text("Порт"); +$("label[for='mqttUsername']").text("Логин"); +$("label[for='mqttPassword']").text("Пароль"); +$("#in2").text("API Версии 2.X"); +$("#ap4").text("Помните, что это бесплатный продукт для личного использования. Чтобы помочь проекту расти и развиваться, вы всегда можете поддержать его по ссылке Patreon ниже, даже небольшое пожертвование имеет большое значение. Спасибо!"); +$("#ap5").text("Предупреждение"); +$("#ap6").text("Это самодельный продукт / решение, не используйте его в критически важных системах безопасности или в ситуации, когда это может быть опасно для жизни."); +$("#ap7").text("Никаких гарантий не дается, он может не соответствовать ожиданиям или вообще не работать"); +$("#ap8").text("Использование этого проекта осуществляется исключительно на ваш страх и риск. Это может быть связано с электрическим напряжением, которое может привести к смерти - если вы сомневаетесь, обратитесь за помощью."); +$("#ap8a").text("Использование этого проекта может не соответствовать местному законодательству - если вы сомневаетесь, обратитесь за консультацией к профессионалу."); +$("#mb1").text("Модули и банки"); +$("#mb2").text("DIYBMS поддерживает в общей сложности до 100 модулей. Эти модули могут быть разделены на разные банки для параллельной конфигурации"); +$("#mb3").text("Например: вы настроили 16 ячеек, 8 последовательно и 2 параллельно (8S2P).."); +$("#mb4").text("Только аппаратный модуль версии 4.4 или новее поддерживает более высокую скорость передачи данных. Вам нужно будет перезагрузить контроллер вручную, если вы измените скорость, а также убедиться, что все модули используют правильную прошивку."); +$("#globalSettingsButton").text("Сохранить настройки"); +$("#diybmsCurrentMonitorPage > h1").text("Контроль тока и напряжения diyBMS"); +$("#diybmsCurrentMonitorPage > div:nth-child(2) > h2").text("Подключение"); +$("#b1").text("Настройте подключение MODBUS к контролю тока, используя приведенные ниже настройки."); +$("#b14").text("Устройство PZEM-017 использует 9600,8,None,2"); +$("label[for='CurrentMonDev']").text("Устройство"); +$("label[for='modbusAddress']").text("Modbus адрес"); +$("#b2").text("Параметры конфигурации для интерфейса RS485. Связь осуществляется в полудуплексном режиме."); +$("label[for='rs485baudrate']").text("Скорость передачи в бодах"); +$("label[for='rs485databit']").text("Биты данных"); +$("label[for='rs485parity']").text("Биты данных"); +$("label[for='rs485stopbit']").text("Стоп биты"); +$("#avrprogPage > h1").text("AVR Программатор"); +$("#aboutPage > h1").text("Об"); +$("#power > span.x.t").text("Мощность"); +$("#shuntv > span.x.t").text("Шунт В"); +$("#current > span.x.t").text("Ток"); +$("#range0 > span.x.t").text("Разница:0"); +$("#b11").text("Емкость батареи и напряжение заряда / остаточный ток используются для расчета состояния заряда батареи SOC."); +$("#error2").text("Контроллер нашел"); +$("#missingmodule1").text("модули, но настроен для"); +$("#missingmodule2").text("."); +$("#genericerror").text("Ошибка контроллера"); +$("#genericwarning").text("Предупреждение контроллера"); +$("#warning7").text("Веб-страница не синхронизирована с контроллером, обновите веб-страницу (F5)"); +$("#amphout > span.x.t").text("Ач выход:"); +$("#amphin > span.x.t").text("Ач вход:"); +$("#oos > span.x.t").text("O.O.S ошибок:"); +$("#badcrc > span.x.t").text("CRC ошибок:"); +$("#ignored > span.x.t").text("Проигнорированные запросы:"); +$("#canfail > span.x.t").text("CAN ошибки:"); +$("#cansent > span.x.t").text("CAN отправлено:"); +$("#canrecd > span.x.t").text("CAN получено:"); +$("#graphOptions > span.x.t").text("График:"); +$("#settingConfig > h2").text("Настройка модуля"); +$("#settingsForm > div > button").text("Сохранить"); +$("#ap1").text("Прошивка и Печатная плата"); +$("#ap2").text("Видео"); +$("#ap9").text("Лицензия"); +$("#b3").text("Убедитесь, что текущие параметры шунта соответствуют техническим характеристикам вашего конкретного шунтирующего резистора."); +$("#b4").text("Монитор тока DIYBMS использует максимальную шкалу 40,96 мВ, поэтому шунтирующие напряжения, превышающие эту шкалу, будут пропорционально уменьшены."); +$("#b15").text("PZEM-017 использует шунты напряжением 75 мВ, состояние заряда и аварийные сигналы на этом устройстве не поддерживаются. Поддерживаются только шунты 50, 100, 200, 300А."); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(2) > label").text("Выходное напряжение шунта (мВ)"); +$("#RS485Form > div > button").text("Сохранить"); +$("#diybmsCurrentMonitorForm1 > div > button").text("Сохранить"); +$("#currentmonbasic > h2").text("Базовые настройки"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(3) > label").text("Емкость аккумулятора (Ач)"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(4) > label").text("Напряжение полного заряда"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(5) > label").text("Остаточный ток (Ампер)"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(6) > label").text("КПД заряда %"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(7) > label").text("Допустимые значения?"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(8) > label").text("Последнее сообщение (миллисекунды)"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(9) > label").text("Watchdog-счетчик"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(10) > label").text("Температура ядра процессора"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(11) > label").text("Значение тока шунта мВ"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(12) > label").text("Текущий размер LSB"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(13) > label").text("Сопротивление шунта"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(14) > label").text("Модель датчика"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(15) > label").text("Версия прошивки"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(16) > label").text("Дата прошивки"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(17) > label").text("Состояние реле"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(18) > label").text("Температура выше предельной"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(19) > label").text("Ток выше предела"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(20) > label").text("Ток ниже предела"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(21) > label").text("Напряжение выше предела"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(22) > label").text("Напряжение ниже предельного"); +$("#diybmsCurrentMonitorForm2 > div > div:nth-child(23) > label").text("Мощность выше предела"); +$("#diybmsCurrentMonitorForm2 > div > button:nth-child(24)").text("Сохранить"); +$("#currentmonrefresh").text("Обновить"); +$("#currentmonadvanced > h2").text("Расширенные настройки"); +$("#victronForm1 > div > div:nth-child(1) > table > thead > tr > th:nth-child(1)").text("Когда?"); +$("#victronForm1 > div > div:nth-child(1) > table > thead > tr > th:nth-child(2)").text("Предельное напряжение заряда (CVL)"); +$("#victronForm1 > div > div:nth-child(1) > table > thead > tr > th:nth-child(3)").text("Предельный ток заряда (CCL)"); +$("#victronForm1 > div > div:nth-child(1) > table > thead > tr > th:nth-child(4)").text("Предельный ток разряда (DCL)"); +$("#victronForm1 > div > div:nth-child(1) > table > tbody > tr:nth-child(1) > td:nth-child(1)").text("По умолчанию"); +$("#victronForm1 > div > div:nth-child(1) > table > tbody > tr:nth-child(2) > td:nth-child(1)").text("Балансировка"); +$("#victronForm1 > div > div:nth-child(1) > table > tbody > tr:nth-child(3) > td:nth-child(1)").text("Ошибка"); +$("#victronForm1 > div > div:nth-child(2) > label").text("Включить связь CANBUS BMS с устройствами Victron"); +$("#victronForm1 > div > button").text("Сохранить"); +$("#b5").text("Если вы хотите использовать управление реле на шунтирующем мониторе, установите параметры здесь. Обычно вам не нужно изменять значение калибровки."); +$("#b6").text("Ограничение по току предназначено для использования при разрядке аккумулятора, при зарядке используется ограничение по току, поэтому можно использовать разные ограничения по току разряда / заряда."); +$("#b7").text("Температурный предел зависит от температуры матрицы микросхемы, которая может не совпадать с температурой шунта. Поддерживается только положительный температурный коэффициент."); +$("#b8").text("Триггеры реле определяют, какие правила используются для перевода реле в замкнутое состояние."); +$("#diybmsCurrentMonitorForm3 > div > div:nth-child(1) > label").text("Калибровка"); +$("#diybmsCurrentMonitorForm3 > div > div:nth-child(2) > label").text("Температурный предел"); +$("#diybmsCurrentMonitorForm3 > div > div:nth-child(3) > label").text("Предел пониженного напряжения"); +$("#diybmsCurrentMonitorForm3 > div > div:nth-child(4) > label").text("Предел перенапряжения"); +$("#diybmsCurrentMonitorForm3 > div > div:nth-child(5) > label").text("Превышение предела тока"); +$("#diybmsCurrentMonitorForm3 > div > div:nth-child(6) > label").text("Пониженный предел тока"); +$("#diybmsCurrentMonitorForm3 > div > div:nth-child(7) > label").text("Превышение предела мощности"); +$("#diybmsCurrentMonitorForm3 > div > div:nth-child(8) > label").text("Температурный коэффициент ppm"); +$("#diybmsCurrentMonitorForm3 > div > button").text("Сохранить"); +$("#b10").text("Настройки реле контроля тока и Температурного коэффициента"); +$("#diybmsCurrentMonitorForm4 > div > div:nth-child(1) > label").text("Температурный коэффициент включен"); +$("#diybmsCurrentMonitorForm4 > div > div:nth-child(2) > label").text("Срабатывание реле: Температура"); +$("#diybmsCurrentMonitorForm4 > div > div:nth-child(3) > label").text("Срабатывание реле: Превышение тока"); +$("#diybmsCurrentMonitorForm4 > div > div:nth-child(4) > label").text("Срабатывание реле: Ток пониженный"); +$("#diybmsCurrentMonitorForm4 > div > div:nth-child(5) > label").text("Срабатывание реле: Превышение напряжения"); +$("#diybmsCurrentMonitorForm4 > div > div:nth-child(6) > label").text("Срабатывание реле: Напряжение пониженное"); +$("#diybmsCurrentMonitorForm4 > div > div:nth-child(7) > label").text("Срабатывание реле: Мощность"); +$("#diybmsCurrentMonitorForm4 > div > button").text("Сохранить"); +$("label[for='CurrentMonEnabled']").text("Активировать"); +$("label[for='shuntmaxcur']").text("Максимальный ток шунтирования"); +$("label[for='totalSeriesModules']").text("Количество последовательных ячеек (например, 8S)"); +$("label[for='totalBanks']").text("Количество параллельных банок (например, 2P)"); +$("label[for='baudrate']").text("Скорость связи"); +$("label[for='interpacketgap']").text("Межпакетный разрыв (мс)"); +$("label[for='NTPDST']").text("Переход на летнее время"); +$("label[for='NTPZoneMin']").text("Часовой пояс (минута)"); +$("label[for='Language']").text("Язык"); +$("label[for='VoltageHigh']").text("Шкала напряжения графика (высокая)"); +$("label[for='VoltageLow']").text("Шкала напряжения графика (низкая)"); +$("label[for='ModuleId']").text("Идентификатор модуля"); +$("label[for='Version']").text("Версия модуля"); +$("label[for='BypassOverTempShutdown']").text("шунт превышение температуры"); +$("label[for='BypassThresholdmV']").text("Порог шунта, мВ"); +$("label[for='Calib']").text("Калибровочный множитель"); +$("label[for='ActualVoltage']").text("Калькулятор - Фактическое измеренное напряжение"); +$("#CalculateCalibration").text("Вычислить"); +$("label[for='ExtBCoef']").text("Коэффициент внешней температуры"); +$("label[for='IntBCoef']").text("Коэффициент внутренней температуры"); +$("label[for='LoadRes']").text("Сопротивление нагрузки"); +$("label[for='mVPerADC']").text("мВ на показания АЦП"); +$("#rulesPage > h1").text("Правила"); +$("#settingsPage > h1").text("Настройки"); +$("#settingsPage > div:nth-child(3) > h2").text("Протокол сетевого времени"); +$("#b9").text("Время устанавливается через NTP, если ваш контроллер не подключен к Интернету. Правила, основанные на времени, будут неверными. Это не приводит к автоматической корректировке перехода на летнее время."); +$("#banksForm > div > button").text("Сохранить"); +$("#ntpForm > div > button").text("Сохранить"); +$("#settingsPage > div:nth-child(4) > h2").text("Отображение"); +$("#displaySettingForm > div > button").text("Сохранить"); +$("#settingsPage > div:nth-child(5) > h2").text("Сброс счетчика"); +$("#resetCountersForm > div > button").text("Сброс счетчика"); +$("#settingsPage > div:nth-child(6) > h2").text("Перезапуск контроллера"); +$("#restartControllerForm > div > button").text("Перезапуск контроллера"); +$("label[for='rule0value']").text("Аварийная остановка"); +$("#in4").text("Поддерживается только HTTP, для локальных серверов используется IP-адрес, а не доменное имя."); +$("#in5").text("Версия API 1.X"); +$("#in7").text("Чтобы это сработало, используйте имя пользователя и пароль v1 в качестве токена в формате"); +$("#in7 > i").text("Логин:Пароль"); +$("#in8").text("Организация не используется, просто установите значение слова организация."); +$("#in9").text("URL-адрес такой же, как и в приведенном выше примере версии v2."); +$("#influxForm > div > div:nth-child(1) > label").text("Включить"); +$("#mqttForm > div > button").text("Сохранить"); +$("#influxForm > div > div:nth-child(2) > label").text("Частота логгирования (секунды)"); +$("#influxForm > div > div:nth-child(3) > label").text("URL-адрес API записи InfluxDB"); +$("#influxForm > div > div:nth-child(4) > label").text("Токен аутентификации API"); +$("#influxForm > div > div:nth-child(5) > label").text("Influx DB 2 идентификатор организации"); +$("#influxForm > div > div:nth-child(6) > label").text("Имя корзины или базы данных"); +$("#influxForm > div > button").text("Сохранить"); +$("#avrprogPage > div > ol > li:nth-child(1)").text("Включить режим программирования, это остановит регистрацию SD-карты и реакцию сенсорного экрана TFT."); +$("#b11 > strong").text("Не подключать"); +$("#avrprogPage > div > p:nth-child(2)").text("Инструкции:"); +$("#avrprogPage > div > ol > li:nth-child(2)").text("Выберите соответствующий файл для программирования"); +$("#avrprogPage > div > ol > li:nth-child(3)").text("Прочитайте предупреждения"); +$("#avrprogPage > div > ol > li:nth-child(4)").text("Подсоедините/подключите программируемое устройство к разъему ISP на контроллере"); +$("#avrprogPage > div > ol > li:nth-child(5)").text("Выберите Прошивка."); +$("#avrprogPage > div > ol > li:nth-child(6)").text("По завершении извлеките устройство"); +$("#avrprogPage > div > ol > li:nth-child(7)").text("Запрограммируйте другие устройства по мере необходимости"); +$("#avrprogPage > div > ol > li:nth-child(8)").text("Отключите режим программирования"); +$("#AVRProgEnable").text("Вкл режим прошивки"); +$("#AVRProgDisable").text("Выкл режим прошивки"); +$("#avrprogconfirm > ul > li:nth-child(1)").text("Перед программированием убедитесь, что вы отсоединили все кабели питания и связи от модуля/устройства."); +$("#avrprogconfirm > ul > li:nth-child(2)").text("Подключите модуль к порту ISP на контроллере с помощью ленточного кабеля или адаптера, убедитесь, что выемка выровнена с выводом 1 на модуле."); +$("#avrprogconfirm > ul > li:nth-child(3)").text("Нажмите Прошивка, чтобы начать программирование"); +$("#avrprogconfirm > ul > li:nth-child(4)").text("Отсоедините кабель, как только программирование будет завершено"); +$("#ProgAVR").text("Прошивка"); +$("#ProgAVRCancel").text("Отмена"); +$("#storagePage > h1").text("Хранилище"); +$("#storagePage > div:nth-child(2) > h2").text("SD-Карта"); +$("#sdcardmissing").text("SD-карта не установлена/ в настоящее время доступна"); +$("#unmount").text("Отключить"); +$("#mount").text("Подключить"); +$("#savewifi").text("Сохранить WIFI"); +$("#saveconfig").text("Сохранить Конфигурацию"); +$("#sdcardfiles > li:nth-child(1) > button").text("Восстановить"); +$("#sdcardfiles > li:nth-child(2) > button").text("Восстановить"); +$("#sdcardfiles > li:nth-child(3) > button").text("Восстановить"); +$("#storagePage > div:nth-child(3) > h2").text("Флэш-память"); +$("#storagePage > div:nth-child(4) > h2").text("Логгирование"); +$("#storagePage > div:nth-child(4) > p").text("Данные ячейки и выходные состояния могут храниться в виде файлов журнала с помощью SD-карты."); +$("#loggingForm > div > div:nth-child(1) > label").text("Ведение журнала на SD-карте включить"); +$("#loggingForm > div > div:nth-child(2) > label").text("Частота регистрации данных ячейки (секунды)"); +$("#loggingForm > div > button").text("Сохранить"); +$("#v0").text("Victron CANBUS интеграция"); +$("#v1").text("Эта функция позволяет diyBMS предоставлять данные о батарее и BMS устройствам Victron GX, используя протокол Victron CAN BMS."); +$("#v2").text("Не забудьте установить ограничительные резисторы на соединениях CAN L/H. Для этой цели на контроллере перемычка JP1 может быть припаяна закрытой."); +$("#v3").text("diyBMS будет посылать сигналы тревоги на устройство Victron на основе правил для низких / высоких напряжений и температур."); +$("#v4").text("Это позволяет устройствам Victron работать в режиме управления распределенным напряжением и током DVCC (опция)."); +$("#victroncanbusPage > div:nth-child(2) > div:nth-child(5) > p").text("Этими параметрами можно управлять:"); +$("#victroncanbusPage > div:nth-child(2) > div:nth-child(5) > ul > li:nth-child(1)").text("Предельное напряжение заряда (VL): максимальное напряжение заряда, которое в данный момент принимает аккумулятор."); +$("#victroncanbusPage > div:nth-child(2) > div:nth-child(5) > ul > li:nth-child(2)").text("Предельный ток заряда (CCL): максимальный ток заряда, требуемый аккумулятором."); +$("#victroncanbusPage > div:nth-child(2) > div:nth-child(5) > ul > li:nth-child(3)").text("Предельный ток разряда (DCL): максимальный ток разряда, требуемый батареей."); +$("#victroncanbusPage > div:nth-child(2) > div:nth-child(6) > p").text("Неправильное использование этих настроек может привести к разрядке аккумулятора и причинению вреда!"); +$("#victroncanbusPage > div:nth-child(2) > div:nth-child(6) > p(1)").text("Интеграция Victron в настоящее время находится на ЭКСПЕРИМЕНТАЛЬНОЙ стадии, пожалуйста, сообщайте о проблемах"); diff --git a/ESPController/web_src/pagecode.js b/ESPController/web_src/pagecode.js index acbe4a2f..aa403fb6 100644 --- a/ESPController/web_src/pagecode.js +++ b/ESPController/web_src/pagecode.js @@ -8,10 +8,13 @@ const INTERNALRULENUMBER = { ModuleUnderTemperatureInternal: 6, IndividualcellovertemperatureExternal: 7, IndividualcellundertemperatureExternal: 8, - PackOverVoltage: 9, - PackUnderVoltage: 10, - Timer2: 11, - Timer1: 12 + CurrentMonitorOverVoltage: 9, + CurrentMonitorUnderVoltage: 10, + BankOverVoltage: 11, + BankUnderVoltage: 12, + BankRange: 13, + Timer2: 14, + Timer1: 15 } Object.freeze(INTERNALRULENUMBER); @@ -41,17 +44,206 @@ const INTERNALERRORCODE = Object.freeze(INTERNALERRORCODE); +// TILE_IDS holds an array of the statistic panels on the page +// this array drives the ability to toggle visibility +// DO NOT MODIFY THE ORDER/SEQUENCE - ADD NEW ITEMS AT THE END/USE EMPTY STRINGS +// IF YOU NEED TO DELETE - REPLACE VALUE WITH null +// THEY ARE ARRANGED IN SUB-ARRAY OF 16 ITEMS - CORRESPONDING TO A 16 BIT UNSIGNED VALUE +// PAD ARRAYS TO 16 ITEMS +const TILE_IDS = [ + ["voltage0", "range0", "voltage1", "range1", "voltage2", "range2", "voltage3", "range3", "voltage4", "range4", "voltage5", "range5", "voltage6", "range6", "voltage7", "range7"], + ["voltage8", "range8", "voltage9", "range9", "voltage10", "range10", "voltage11", "range11", "voltage12", "range12", "voltage13", "range13", "voltage14", "range14", "voltage15", "range15"], + ["soc", "current", "shuntv", "power", "amphout", "amphin", "damphout", "damphin", "oos", "badcrc", "ignored", "canfail", "sent", "received", "roundtrip", "uptime"], + ["qlen", "cansent", "canrecd", "dyncvolt", "dynccurr", "graphOptions", "time100", "time20", "time10", "celltemp", null, null, null, null, null, null] +]; +Object.freeze(TILE_IDS); + +var tileconfig = []; + +var timer_postTileVisibiltity = null; + +function upload_file() { + + let data = document.getElementById("uploadfile_sel").files[0]; + xhr = new XMLHttpRequest(); + xhr.open("POST", "/uploadfile", true); + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhr.onreadystatechange = function () { + if (xhr.readyState === XMLHttpRequest.DONE) { + var status = xhr.status; + if (status >= 200 && status < 400) { + //Refresh the storage page + $("#storage").trigger("click"); + $.notify("File upload success", { autoHide: true, globalPosition: 'top right', className: 'success' }); + } else { + $.notify("File upload failed", { autoHide: true, globalPosition: 'top right', className: 'error' }); + } + $("#progress").hide(); + } + }; + xhr.send(data); + return false; + +} + +function upload_firmware() { + $("#progress").show(); + $("#status_div").text("Upload in progress"); + let data = document.getElementById("file_sel").files[0]; + xhr = new XMLHttpRequest(); + xhr.open("POST", "/ota", true); + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhr.upload.addEventListener("progress", function (event) { + if (event.lengthComputable) { + document.getElementById("progress").style.width = (event.loaded / event.total) * 100 + "%"; + } + }); + xhr.onreadystatechange = function () { + if (xhr.readyState === XMLHttpRequest.DONE) { + var status = xhr.status; + if (status >= 200 && status < 400) { + $("#status_div").text("Upload accepted. BMS will reboot."); + } else { + $("#status_div").text("Upload rejected!"); + } + $("#progress").hide(); + } + }; + xhr.send(data); + return false; +} + + +function CalculateChargeCurrent(value1, value2, highestCellVoltage, maximumchargecurrent, kneemv, cellmaxmv) { + if (highestCellVoltage < kneemv) { + // Voltage is below the knee voltage, so use full current + return maximumchargecurrent; + } + + var knee_voltage = 0 / 100.0; + var at_knee = Math.pow(value1, knee_voltage * Math.pow(knee_voltage, value2)); + + var target_cell_voltage = (cellmaxmv - kneemv) / 100.0; + var at_target_cell_voltage = Math.pow(value1, target_cell_voltage * Math.pow(target_cell_voltage, value2)); + + var actual_cell_voltage = (highestCellVoltage - kneemv) / 100.0; + var at_actual_cell_voltage = Math.pow(value1, actual_cell_voltage * Math.pow(actual_cell_voltage, value2)); + + var percent = 1 - (at_actual_cell_voltage / at_knee) / at_target_cell_voltage; + + if (percent < 0.01) { + percent = 0.01; + } + + return Math.min(maximumchargecurrent, (maximumchargecurrent * percent)); +} + +function DrawChargingGraph() { + + + var xaxisvalues = []; + var yaxisvalues = []; + + const chargecurrent = parseFloat($("#chargecurrent").val()); + const cellminmv = parseInt($("#cellminmv").val()); + const cellmaxmv = parseInt($("#cellmaxmv").val()); + const kneemv = parseInt($("#kneemv").val()); + const cellmaxspikemv = parseInt($("#cellmaxspikemv").val()); + + const value1 = parseFloat($("#cur_val1").val()); + const value2 = parseFloat($("#cur_val2").val()); + + for (let voltage = cellminmv; voltage <= cellmaxspikemv; voltage += 5) { + xaxisvalues.push(voltage); + yaxisvalues.push(CalculateChargeCurrent(value1, value2, voltage, chargecurrent, kneemv, cellmaxmv)); + } + + /* + if (window.g3 != null) { + window.g3.dispose(); + window.g3 = null; + } + */ + if (window.g3 == null) { + window.g3 = echarts.init(document.getElementById('graph3')) + + var option; + + option = { + + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross', + label: { + backgroundColor: '#6a7985' + } + } + }, + grid: { + left: '2%', + right: '2%', + bottom: '2%', + containLabel: true + }, + xAxis: [ + { + type: 'category', + boundaryGap: false, + data: xaxisvalues, + axisLabel: { + fontSize: '12', + fontFamily: 'monospace', + formatter: '{value}mV', + color: '#ffffff' + } + } + ], + yAxis: [ + { + type: 'value', + axisLabel: { + fontSize: '12', + fontFamily: 'monospace', + formatter: '{value}A', + color: '#ffffff' + }, + splitNumber: 10 + } + ], + series: [ + { + name: 'Current', + type: 'line', + areaStyle: {}, + data: yaxisvalues + } + ] + }; + + option && window.g3.setOption(option); + } else { + //Update the values + window.g3.setOption({ + xAxis: { data: xaxisvalues }, + series: { data: yaxisvalues } + }); + + } +} + function switchPage(newPage) { $(".page").hide(); $(newPage).show(); $("#myNav").height("0%"); } + function identifyModule(button, cellid) { $.getJSON("/api/identifyModule", { c: cellid }, function (data) { }).fail(function () { $("#iperror").show(); }); } -function restoreconfig(filename) { - let isConfirmed = confirm("Are you sure you wish to restore '"+filename+"' configuration file?"); +function restoreconfig(location, filename) { + let isConfirmed = confirm("Are you sure you wish to restore '" + filename + "' configuration file?"); if (isConfirmed) { @@ -60,9 +252,10 @@ function restoreconfig(filename) { $.ajax({ type: 'POST', url: '/post/restoreconfig', - data: $.param({ filename: filename }), + data: $.param({ flashram: location, filename: filename }), success: function (data) { - location.reload(); + showSuccess(); + alert("Restore complete, you should now reboot the controller."); }, error: function (data) { showFailure(); @@ -92,8 +285,6 @@ function refreshCurrentMonitorValues() { $("#cmtemperature").val(data.temperature); $("#cmwatchdog").val(data.watchdog); - $("#cmactualshuntmv").val(data.actualshuntmv); - $("#cmcurrentlsb").val(data.currentlsb); $("#cmresistance").val(data.resistance); $("#cmcalibration").val(data.calibration); @@ -159,6 +350,102 @@ function refreshCurrentMonitorValues() { } +// Show and hide tiles based on bit pattern in tileconfig array +function refreshVisibleTiles() { + for (i = 0; i < TILE_IDS.length; i++) { + var tc = TILE_IDS[i]; + var value = tileconfig[i]; + for (var a = tc.length - 1; a >= 0; a--) { + var visible = (value & 1) == 1 ? true : false; + value = value >>> 1; + if (tc[a] != null && tc[a] != undefined && tc[a] != "") { + var obj = $("#" + tc[a]); + if (visible) { + //Only show if we have not force hidden it + if (obj.hasClass(".hide") == false) { + obj.addClass("vistile").show(); + } + } else { + obj.hide(); + } + } + } + } +} + + +//Determine which tiles are visible and store config on controller +//as bitmap pattern +function postTileVisibiltity() { + $(".stat.vistile.hide").removeClass("vistile"); + + var newconfig = []; + for (var index = 0; index < tileconfig.length; index++) { + newconfig.push(0); + } + + for (var i = 0; i < TILE_IDS.length; i++) { + var tc = TILE_IDS[i]; + var value = 0; + var v = 0x8000; + for (var a = 0; a < tc.length; a++) { + if (tc[a] != null && tc[a] != undefined && tc[a] != "") { + if ($("#" + tc[a]).hasClass("vistile")) { + value = value | v; + } + } + //Right shift onto next item + v = v >>> 1; + } + newconfig[i] = value; + } + + var diff = false; + for (var index = 0; index < tileconfig.length; index++) { + if (tileconfig[index] != newconfig[index]) { + tileconfig[index] = newconfig[index]; + diff = true; + } + } + + if (diff) { + $.ajax({ + type: 'POST', + url: '/post/visibletiles', + //This is crappy, but ESP isn't great at handling POST array values + data: $.param({ v0: tileconfig[0], v1: tileconfig[1], v2: tileconfig[2], v3: tileconfig[3], v4: tileconfig[4] }), + success: function (data) { + //refresh if needed + if ($('#home').hasClass('active')) { + refreshVisibleTiles(); + } + }, + error: function (data) { + showFailure(); + }, + }); + } + +} + + +function loadVisibleTileData() { + //Only refresh if array is empty + if (tileconfig.length == 0) { + + $.getJSON("/api/tileconfig", + function (data) { + for (i = 0; i < data.tileconfig.values.length; i++) { + tileconfig[i] = data.tileconfig.values[i]; + } + refreshVisibleTiles(); + }).fail( + function () { $.notify("Request failed", { autoHide: true, globalPosition: 'top right', className: 'error' }); } + ); + } +} + + function showFailure() { $.notify($("#saveerror").text(), { className: 'error', autoHideDelay: 15000 }); } @@ -190,11 +477,10 @@ function currentmonitorSubmitForm(form) { }); } + function avrProgrammingStatsUpdate(attempts) { $.getJSON("/api/avrstatus", function (data) { - console.log(data); - if (data.inprogress == 0) { //Finished or aborted with error, update display $("#avrinfo").empty(); @@ -315,27 +601,33 @@ function queryBMS() { var tempext = []; var pwm = []; - var minVoltage = DEFAULT_GRAPH_MIN_VOLTAGE; - var maxVoltage = DEFAULT_GRAPH_MAX_VOLTAGE; + var minVoltage = DEFAULT_GRAPH_MIN_VOLTAGE / 1000.0; + var maxVoltage = DEFAULT_GRAPH_MAX_VOLTAGE / 1000.0; + + var minExtTemp = 999; + var maxExtTemp = -999; var bankNumber = 0; var cellsInBank = 0; - // Need one color for each pack, could make it colourful I suppose :-) + // Need one color for each bank, could make it colourful I suppose :-) const colours = [ - '#55a1ea', '#33628f', '#55a1ea', '#33628f', - '#55a1ea', '#33628f', '#55a1ea', '#33628f', - '#55a1ea', '#33628f', '#55a1ea', '#33628f', - '#55a1ea', '#33628f', '#55a1ea', '#33628f', + '#55a1ea', '#33628f', '#498FD0', '#6D8EA0', + '#55a1ea', '#33628f', '#498FD0', '#6D8EA0', + '#55a1ea', '#33628f', '#498FD0', '#6D8EA0', + '#55a1ea', '#33628f', '#498FD0', '#6D8EA0', ] const red = '#B44247' + const highestCell = '#8c265d' + const lowestCell = '#b6a016' + var markLineData = []; markLineData.push({ name: 'avg', type: 'average', lineStyle: { color: '#ddd', width: 2, type: 'dotted', opacity: 0.3 }, label: { distance: [10, 0], position: 'start', color: "#eeeeee", textBorderColor: '#313131', textBorderWidth: 2 } }); - markLineData.push({ name: 'min', type: 'min', lineStyle: { color: '#ddd', width: 2, type: 'dotted', opacity: 0.3 }, label: { distance: [10, 0], position: 'start', color: "#eeeeee", textBorderColor: '#313131', textBorderWidth: 2 } }); - markLineData.push({ name: 'max', type: 'max', lineStyle: { color: '#ddd', width: 2, type: 'dotted', opacity: 0.3 }, label: { distance: [10, 0], position: 'start', color: "#eeeeee", textBorderColor: '#313131', textBorderWidth: 2 } }); + //markLineData.push({ name: 'min', type: 'min', lineStyle: { color: '#ddd', width: 2, type: 'dotted', opacity: 0.3 }, label: { distance: [10, 0], position: 'start', color: "#eeeeee", textBorderColor: '#313131', textBorderWidth: 2 } }); + //markLineData.push({ name: 'max', type: 'max', lineStyle: { color: '#ddd', width: 2, type: 'dotted', opacity: 0.3 }, label: { distance: [10, 0], position: 'start', color: "#eeeeee", textBorderColor: '#313131', textBorderWidth: 2 } }); var xAxis = 0; for (let index = 0; index < jsondata.banks; index++) { @@ -344,13 +636,39 @@ function queryBMS() { } if (jsondata.voltages) { + //Clone array of voltages + tempArray = []; + for (i = 0; i < jsondata.voltages.length; i++) { + tempArray[i] = jsondata.voltages[i]; + } + + //Split voltages into banks + sorted_voltages = []; + for (i = 0; i < jsondata.banks; i++) { + unsorted = tempArray.splice(0, jsondata.seriesmodules); + sorted_voltages.push(unsorted.sort()); + } + for (let i = 0; i < jsondata.voltages.length; i++) { labels.push(bankNumber + "/" + i); // Make different banks different colours (stripes) var stdcolor = colours[bankNumber]; + + var color = stdcolor; + + //Highlight lowest cell voltage in this bank + if (jsondata.voltages[i] === sorted_voltages[bankNumber][0]) { + color = lowestCell; + } + //Highlight highest cell voltage in this bank + if (jsondata.voltages[i] === sorted_voltages[bankNumber][jsondata.seriesmodules - 1]) { + color = highestCell; + } // Red - var color = jsondata.bypass[i] == 1 ? red : stdcolor; + if (jsondata.bypass[i] === 1) { + color = red; + } var v = (parseFloat(jsondata.voltages[i]) / 1000.0); voltages.push({ value: v, itemStyle: { color: color } }); @@ -378,7 +696,19 @@ function queryBMS() { color = jsondata.bypasshot[i] == 1 ? red : stdcolor; tempint.push({ value: jsondata.inttemp[i], itemStyle: { color: color } }); - tempext.push({ value: (jsondata.exttemp[i] == -40 ? 0 : jsondata.exttemp[i]), itemStyle: { color: stdcolor } }); + var exttemp = (jsondata.exttemp[i] == -40 ? 0 : jsondata.exttemp[i]); + tempext.push({ value: exttemp, itemStyle: { color: stdcolor } }); + + if (jsondata.exttemp[i] != null) { + if (exttemp > maxExtTemp) { + maxExtTemp = exttemp; + } + if (exttemp < minExtTemp) { + minExtTemp = exttemp; + } + } + + pwm.push({ value: jsondata.bypasspwm[i] == 0 ? null : Math.trunc(jsondata.bypasspwm[i] / 255 * 100) }); } } @@ -387,6 +717,7 @@ function queryBMS() { if (minVoltage < 2.5) { minVoltage = 0; } if (jsondata) { + /* if (jsondata.badcrc != 0) { $("#badcrc").show(); } if (jsondata.ignored != 0) { $("#ignored").show(); } if (jsondata.sent != 0) { $("#sent").show(); } @@ -397,6 +728,7 @@ function queryBMS() { if (jsondata.can_sent != 0) { $("#cansent").show(); } if (jsondata.can_rec != 0) { $("#canrecd").show(); } if (jsondata.qlen != 0) { $("#qlen").show(); } + */ $("#badcrc .v").html(jsondata.badcrc); $("#ignored .v").html(jsondata.ignored); @@ -408,8 +740,12 @@ function queryBMS() { $("#cansent .v").html(jsondata.can_sent); $("#canrecd .v").html(jsondata.can_rec); $("#qlen .v").html(jsondata.qlen); - - $("#uptime .v").html(secondsToHms(jsondata.uptime)); $("#uptime").show(); + $("#uptime .v").html(secondsToHms(jsondata.uptime)); + if (minExtTemp == 999 || maxExtTemp == -999) { + $("#celltemp .v").html(""); + } else { + $("#celltemp .v").html(minExtTemp + "/" + maxExtTemp + "°C"); + } if (jsondata.activerules == 0) { $("#activerules").hide(); @@ -417,82 +753,78 @@ function queryBMS() { $("#activerules").html(jsondata.activerules); $("#activerules").show(400); } + + if (jsondata.dyncv) { + $("#dyncvolt .v").html(parseFloat(jsondata.dyncv / 10).toFixed(2) + "V"); + } else { $("#dyncvolt .v").html(""); } + if (jsondata.dyncc) { + $("#dynccurr .v").html(parseFloat(jsondata.dyncc / 10).toFixed(2) + "A"); + } else { $("#dynccurr .v").html(""); } + } if (jsondata.bankv) { for (var bankNumber = 0; bankNumber < jsondata.bankv.length; bankNumber++) { $("#voltage" + bankNumber + " .v").html((parseFloat(jsondata.bankv[bankNumber]) / 1000.0).toFixed(2) + "V"); $("#range" + bankNumber + " .v").html(jsondata.voltrange[bankNumber] + "mV"); - $("#voltage" + bankNumber).show(); - $("#range" + bankNumber).show(); - //$("#bank" + (bankNumber )).show(); + $("#voltage" + bankNumber).removeClass("hide"); + $("#range" + bankNumber).removeClass("hide"); } for (var bankNumber = jsondata.bankv.length; bankNumber < MAXIMUM_NUMBER_OF_BANKS; bankNumber++) { - //$("#bank" + (bankNumber )).hide(); - $("#voltage" + bankNumber).hide(); - $("#range" + bankNumber).hide(); + $("#voltage" + bankNumber).hide().addClass("hide"); + $("#range" + bankNumber).hide().addClass("hide"); } } if (jsondata.sec) { if (!XSS_KEY.endsWith(jsondata.sec)) { - if ($("#warning7").data("notify") == undefined) { - $("#warning7").data("notify", 1); - $.notify($("#warning7").text(), { autoHide: false, globalPosition: 'top left', className: 'error' }); + if ($("#warningXSS").data("notify") == undefined) { + $("#warningXSS").data("notify", 1); + $.notify($("#warningXSS").text(), { autoHide: false, globalPosition: 'top left', className: 'error' }); } } } if (jsondata.current) { if (jsondata.current[0] == null) { - $("#current").hide(); - $("#shuntv").hide(); - $("#soc").hide(); - $("#amphout").hide(); - $("#amphin").hide(); - $("#power").hide(); + $("#current .v").html(""); + $("#shuntv .v").html(""); + $("#soc .v").html(""); + $("#power .v").html(""); + $("#amphout .v").html(""); + $("#amphin .v").html(""); + $("#damphout .v").html(""); + $("#damphin .v").html(""); + $("#time100 .v").html(""); + $("#time10 .v").html(""); + $("#time20 .v").html(""); } else { var data = jsondata.current[0]; - $("#current .v").html(parseFloat(data.c).toFixed(2) + "A"); - $("#current").show(); - $("#shuntv .v").html(parseFloat(data.v).toFixed(2) + "V"); - $("#shuntv").show(); - - if (data.soc != 0) { - $("#soc .v").html(parseFloat(data.soc).toFixed(2) + "%"); - $("#soc").show(); - } else { - $("#soc").hide(); - } - + $("#soc .v").html(parseFloat(data.soc).toFixed(2) + "%"); $("#power .v").html(parseFloat(data.p) + "W"); - $("#power").show(); - - if (data.mahout != 0) { - $("#amphout .v").html((parseFloat(data.mahout) / 1000).toFixed(3)); - $("#amphout").show(); - } else { - $("#amphout").hide(); - } - - if (data.mahin != 0) { - $("#amphin .v").html((parseFloat(data.mahin) / 1000).toFixed(3)); - $("#amphin").show(); - } else { - $("#amphin").hide(); - } + $("#amphout .v").html((parseFloat(data.mahout) / 1000).toFixed(3)); + $("#amphin .v").html((parseFloat(data.mahin) / 1000).toFixed(3)); + $("#damphout .v").html((parseFloat(data.dmahout) / 1000).toFixed(3)); + $("#damphin .v").html((parseFloat(data.dmahin) / 1000).toFixed(3)); + + if (data.time100 > 0) { + $("#time100 .v").html(secondsToHms(data.time100)); + } else { $("#time100 .v").html("∞"); } + if (data.time20 > 0) { + $("#time20 .v").html(secondsToHms(data.time20)); + } else { $("#time20 .v").html("∞"); } + if (data.time10 > 0) { + $("#time10 .v").html(secondsToHms(data.time10)); + } else { $("#time10 .v").html("∞"); } } } - - - - //Needs increasing when more warnings are added + //Loop size needs increasing when more warnings are added if (jsondata.warnings) { - for (let warning = 1; warning <= 6; warning++) { + for (let warning = 1; warning <= 9; warning++) { if (jsondata.warnings.includes(warning)) { //Once a warning has triggered, hide it from showing in the future if ($("#warning" + warning).data("notify") == undefined) { @@ -500,9 +832,14 @@ function queryBMS() { $.notify($("#warning" + warning).text(), { autoHideDelay: 15000, globalPosition: 'top left', className: 'warn' }); } } - //else { - //$("#warning" + warning).hide(); - //} + } + + //Allow charge/discharge warnings to reappear + if (jsondata.warnings.includes(7) == false) { + $("#warning7").removeData("notify"); + } + if (jsondata.warnings.includes(8) == false) { + $("#warning8").removeData("notify"); } } @@ -589,10 +926,8 @@ function queryBMS() { // specify chart configuration item and data var option = { tooltip: { - show: true, - axisPointer: { - type: 'cross', - label: { + show: true, axisPointer: { + type: 'cross', label: { backgroundColor: '#6a7985' } } @@ -601,31 +936,18 @@ function queryBMS() { show: false }, xAxis: [{ - gridIndex: 0, - type: 'category', - axisLine: { + gridIndex: 0, type: 'category', axisLine: { lineStyle: { color: '#c1bdbd' } } }, { - gridIndex: 1, - type: 'category', - axisLine: { - lineStyle: { - color: '#c1bdbd' - } + gridIndex: 1, type: 'category', axisLine: { + lineStyle: { color: '#c1bdbd' } } }], yAxis: [{ - id: 0, - gridIndex: 0, - name: 'Volts', - type: 'value', - min: 2.5, - max: 4.5, - interval: 0.25, - position: 'left', + id: 0, gridIndex: 0, name: 'Volts', type: 'value', min: 2.5, max: 4.5, interval: 0.25, position: 'left', axisLine: { lineStyle: { color: '#c1bdbd' @@ -639,13 +961,8 @@ function queryBMS() { }, { id: 1, - gridIndex: 0, - name: 'Bypass', - type: 'value', - min: 0, - max: 100, - interval: 10, - position: 'right', + gridIndex: 0, name: 'Bypass', type: 'value', min: 0, + max: 100, interval: 10, position: 'right', axisLabel: { formatter: '{value}%' }, splitLine: { show: false }, axisLine: { lineStyle: { type: 'dotted', color: '#c1bdbd' } }, @@ -659,13 +976,9 @@ function queryBMS() { interval: 10, position: 'left', axisLine: { - lineStyle: { - color: '#c1bdbd' - } + lineStyle: { color: '#c1bdbd' } }, - axisLabel: { - formatter: '{value}°C' - } + axisLabel: { formatter: '{value}°C' } }], series: [ { @@ -674,26 +987,13 @@ function queryBMS() { yAxisIndex: 0, type: 'bar', data: [], - markLine: { - silent: true, - symbol: 'none', - - data: markLineData + silent: true, symbol: 'none', data: markLineData }, itemStyle: { color: '#55a1ea', barBorderRadius: [8, 8, 0, 0] }, label: { normal: { - show: true, - position: 'insideBottom', - distance: 10, - align: 'left', - verticalAlign: 'middle', - rotate: 90, - formatter: '{c}V', - fontSize: 24, - color: '#eeeeee', - fontFamily: 'Fira Code' + show: true, position: 'insideBottom', distance: 10, align: 'left', verticalAlign: 'middle', rotate: 90, formatter: '{c}V', fontSize: 24, color: '#eeeeee', fontFamily: 'Share Tech Mono' } } }, { @@ -704,23 +1004,14 @@ function queryBMS() { data: [], label: { normal: { - show: true, - position: 'bottom', - distance: 5, - formatter: '{c}V', - fontSize: 14, - color: '#eeeeee', - fontFamily: 'Fira Code' + show: true, position: 'bottom', distance: 5, formatter: '{c}V', fontSize: 14, color: '#eeeeee', fontFamily: 'Share Tech Mono' } }, symbolSize: 16, symbol: ['circle'], itemStyle: { normal: { - color: "#c1bdbd", - lineStyle: { - color: 'transparent' - } + color: "#c1bdbd", lineStyle: { color: 'transparent' } } } } @@ -732,23 +1023,14 @@ function queryBMS() { data: [], label: { normal: { - show: true, - position: 'top', - distance: 5, - formatter: '{c}V', - fontSize: 14, - color: '#c1bdbd', - fontFamily: 'Fira Code' + show: true, position: 'top', distance: 5, formatter: '{c}V', fontSize: 14, color: '#c1bdbd', fontFamily: 'Share Tech Mono' } }, symbolSize: 16, symbol: ['arrow'], itemStyle: { normal: { - color: "#c1bdbd", - lineStyle: { - color: 'transparent' - } + color: "#c1bdbd", lineStyle: { color: 'transparent' } } } } @@ -761,13 +1043,7 @@ function queryBMS() { data: [], label: { normal: { - show: true, - position: 'right', - distance: 5, - formatter: '{c}%', - fontSize: 14, - color: '#f0e400', - fontFamily: 'Fira Code' + show: true, position: 'right', distance: 5, formatter: '{c}%', fontSize: 14, color: '#f0e400', fontFamily: 'Share Tech Mono' } }, symbolSize: 16, @@ -782,21 +1058,13 @@ function queryBMS() { type: 'bar', data: [], itemStyle: { - color: '#55a1ea', - barBorderRadius: [8, 8, 0, 0] + color: '#55a1ea', barBorderRadius: [8, 8, 0, 0] }, label: { normal: { - show: true, - position: 'insideBottom', - distance: 8, - align: 'left', - verticalAlign: 'middle', - rotate: 90, - formatter: '{c}°C', - fontSize: 20, - color: '#eeeeee', - fontFamily: 'Fira Code' + show: true, position: 'insideBottom', distance: 8, + align: 'left', verticalAlign: 'middle', + rotate: 90, formatter: '{c}°C', fontSize: 20, color: '#eeeeee', fontFamily: 'Share Tech Mono' } } } @@ -808,21 +1076,13 @@ function queryBMS() { type: 'bar', data: [], itemStyle: { - color: '#55a1ea', - barBorderRadius: [8, 8, 0, 0] + color: '#55a1ea', barBorderRadius: [8, 8, 0, 0] }, label: { normal: { - show: true, - position: 'insideBottom', - distance: 8, - align: 'left', - verticalAlign: 'middle', - rotate: 90, - formatter: '{c}°C', - fontSize: 20, - color: '#eeeeee', - fontFamily: 'Fira Code' + show: true, position: 'insideBottom', distance: 8, + align: 'left', verticalAlign: 'middle', rotate: 90, + formatter: '{c}°C', fontSize: 20, color: '#eeeeee', fontFamily: 'Share Tech Mono' } } @@ -830,16 +1090,10 @@ function queryBMS() { ], grid: [ { - containLabel: false, - left: '4%', - right: '4%', - bottom: '30%' + containLabel: false, left: '4%', right: '4%', bottom: '30%' }, { - containLabel: false, - left: '4%', - right: '4%', - top: '76%' + containLabel: false, left: '4%', right: '4%', top: '76%' }] }; @@ -951,7 +1205,9 @@ function queryBMS() { $("#homePage").css({ opacity: 1.0 }); $("#loading").hide(); //Call again in a few seconds - setTimeout(queryBMS, 4000); + setTimeout(queryBMS, 3500); + + loadVisibleTileData(); }).fail(function () { $("#iperror").show(); @@ -968,14 +1224,16 @@ $(window).on('resize', function () { if (g2 != null && g2 != undefined && $('#homePage').is(':visible')) { g2.resize(); } }); - - - $(function () { $("#loading").show(); $("#avrprogconfirm").hide(); $(".stat").hide(); + if (Graph3DAvailable == true) { + //Re-show this as pagecode would have hidden it + $("#graphOptions").show(); + } + $("#more").on("click" , function (e) { e.preventDefault(); @@ -991,14 +1249,21 @@ $(function () { //Populate all the setting rules with relay select lists $.each($(".settings table tbody tr td:empty"), function (index, value) { $.each([1, 2, 3, 4], function (index1, relay) { - $(value).append(''); + $(value).append(''); }); } ); - $("#labelMaxModules").text(MAXIMUM_NUMBER_OF_SERIES_MODULES); - + $(".rule").on("change", function () { + var origv = $(this).attr("data-origv") + if (origv !== this.value) { + $(this).addClass("modified"); + } else { + $(this).removeClass("modified"); + } + }); + $("#labelMaxModules").text(MAXIMUM_NUMBER_OF_SERIES_MODULES); for (var n = 1; n <= MAXIMUM_NUMBER_OF_SERIES_MODULES; n++) { $("#totalSeriesModules").append('') } @@ -1011,8 +1276,6 @@ $(function () { $("#range" + n).hide(); } - - $("#graph1").show(); $("#graph2").hide(); $("#graphOptions a").click(function (event) { @@ -1027,8 +1290,6 @@ $(function () { $(window).trigger('resize'); }); - - $('#CalculateCalibration').click(function () { var currentReading = parseFloat($("#modulesRows > tr.selected > td:nth-child(3)").text()); var currentCalib = parseFloat($("#Calib").val()); @@ -1041,7 +1302,27 @@ $(function () { $("#home").click(function () { $(".header-right a").removeClass("active"); $(this).addClass("active"); + $(".graphs").show(); + $("#graph1").show(); + $("#graph2").hide(); + $("#info .stat").not(".vistile").hide(); + $("#info .vistile").not(".hide").show(); switchPage("#homePage"); + g1.resize(); + refreshVisibleTiles(); + return true; + }); + + $("#tiles").click(function () { + $(".header-right a").removeClass("active"); + $(this).addClass("active"); + //Use the home page for the grid, but hide graphs + switchPage("#homePage"); + $(".graphs").hide(); + $("#graph1").hide(); + $("#graph2").hide(); + //Show all statistic panels (which are not forced hidden) + $("#info .stat").not(".hide").show(); return true; }); @@ -1086,8 +1367,6 @@ $(function () { return true; }); - - $("#settings").click(function () { $(".header-right a").removeClass("active"); $(this).addClass("active"); @@ -1095,8 +1374,8 @@ $(function () { $("#banksForm").hide(); $("#settingsPage").show(); - $("#VoltageHigh").val(DEFAULT_GRAPH_MAX_VOLTAGE.toFixed(2)); - $("#VoltageLow").val(DEFAULT_GRAPH_MIN_VOLTAGE.toFixed(2)); + $("#VoltageHigh").val(DEFAULT_GRAPH_MAX_VOLTAGE); + $("#VoltageLow").val(DEFAULT_GRAPH_MIN_VOLTAGE); switchPage("#settingsPage"); @@ -1135,41 +1414,32 @@ $(function () { return true; }); - - $("#rules").click(function () { - $(".header-right a").removeClass("active"); - $(this).addClass("active"); - - $("#rulesForm").hide(); - - switchPage("#rulesPage"); - + function loadRelayRules() { $.getJSON("/api/rules", function (data) { //Rules have loaded + $("#minutesnow").html(data.timenow); //Default relay settings $.each(data.relaydefault, function (index2, value2) { var relay_value = "X"; if (value2 === true) { relay_value = "On"; } if (value2 === false) { relay_value = "Off"; } - $("#defaultrelay" + (index2 + 1)).val(relay_value); + $("#defaultrelay" + (index2 + 1)).val(relay_value).attr("data-origv", relay_value).removeClass("modified"); }); //Default relay settings $.each(data.relaytype, function (index2, value2) { - $("#relaytype" + (index2 + 1)).val(value2); + $("#relaytype" + (index2 + 1)).val(value2).attr("data-origv", value2).removeClass("modified"); }); - $("#minutesnow").html(data.timenow); - - //Loop through each rule updating the page var i = 1; var allrules = $(".settings table tbody tr td label"); $.each(data.rules, function (index, value) { - $("#rule" + (index) + "value").val(value.value); - $("#rule" + (index) + "hysteresis").val(value.hysteresis); + $("#rule" + (index) + "value").val(value.value).attr("data-origv", value.value).removeClass("modified"); + + $("#rule" + (index) + "hyst").val(value.hysteresis).attr("data-origv", value.hysteresis).removeClass("modified"); //Highlight rules which are active if (value.triggered) { @@ -1185,7 +1455,7 @@ $(function () { if (value2 === true) { relay_value = "On"; } if (value2 === false) { relay_value = "Off"; } - $("#rule" + (index) + "relay" + (index2 + 1)).val(relay_value); + $("#rule" + (index) + "relay" + (index2 + 1)).val(relay_value).attr("data-origv", relay_value).removeClass("modified"); }); }); @@ -1202,9 +1472,19 @@ $(function () { } $("#rulesForm").show(); - }).fail(function () { $.notify("Request failed", { autoHide: true, globalPosition: 'top right', className: 'error' }); } + }).fail(function () { $.notify("Read request failed", { autoHide: true, globalPosition: 'top right', className: 'error' }); } ); + } + $("#rules").click(function () { + $(".header-right a").removeClass("active"); + $(this).addClass("active"); + + $("#rulesForm").hide(); + + switchPage("#rulesPage"); + + loadRelayRules(); return true; }); @@ -1229,26 +1509,7 @@ $(function () { return true; }); - $("#victroncanbus").click(function () { - $(".header-right a").removeClass("active"); - $(this).addClass("active"); - $.getJSON("/api/victron", - function (data) { - $("#VictronEnabled").prop("checked", data.victron.enabled); - - for (let index = 0; index < data.victron.cvl.length; index++) { - $("#cvl" + index).val((data.victron.cvl[index] / 10).toFixed(2)); - $("#ccl" + index).val((data.victron.ccl[index] / 10).toFixed(2)); - $("#dcl" + index).val((data.victron.dcl[index] / 10).toFixed(2)); - } - - switchPage("#victroncanbusPage"); - }).fail(function () { $.notify("Request failed", { autoHide: true, globalPosition: 'top right', className: 'error' }); } - ); - - return true; - }); $("#currentmonrefresh").click(function (e) { @@ -1369,7 +1630,7 @@ $(function () { $("#ProgAVR").prop('disabled', true).css({ opacity: 0.25 }); $("#ProgAVRCancel").prop('disabled', true).css({ opacity: 0.25 }); //Allow warning to trigger again - $("#warning7").removeData("notify"); + $("#warningXSS").removeData("notify"); }) .fail(function (data) { $("#avrinfo").html("Failed"); @@ -1443,6 +1704,13 @@ $(function () { return true; }); + $("#utility").click(function () { + $(".header-right a").removeClass("active"); + $(this).addClass("active"); + switchPage("#utilityPage"); + + $("#setsoc").val(75.5); + }); $("#avrprogrammer").click(function () { $(".header-right a").removeClass("active"); @@ -1495,7 +1763,53 @@ $(function () { }); + $("#charging").click(function () { + $(".header-right a").removeClass("active"); + $(this).addClass("active"); + switchPage("#chargingPage"); + $.getJSON("/api/chargeconfig", + function (data) { + + $("#canbusprotocol").val(data.chargeconfig.canbusprotocol); + $("#nominalbatcap").val(data.chargeconfig.nominalbatcap); + + $("#chargevolt").val((data.chargeconfig.chargevolt / 10.0).toFixed(1)); + $("#chargecurrent").val((data.chargeconfig.chargecurrent / 10.0).toFixed(1)); + $("#dischargecurrent").val((data.chargeconfig.dischargecurrent / 10.0).toFixed(1)); + $("#dischargevolt").val((data.chargeconfig.dischargevolt / 10.0).toFixed(1)); + + $("#cellminmv").val(data.chargeconfig.cellminmv); + $("#cellmaxmv").val(data.chargeconfig.cellmaxmv); + $("#kneemv").val(data.chargeconfig.kneemv); + $("#sensitivity").val((data.chargeconfig.sensitivity / 10.0).toFixed(1)); + + $("#cur_val1").val((data.chargeconfig.cur_val1 / 10.0).toFixed(1)); + $("#cur_val2").val((data.chargeconfig.cur_val2 / 10.0).toFixed(1)); + + $("#cellmaxspikemv").val(data.chargeconfig.cellmaxspikemv); + + $("#chargetemplow").val(data.chargeconfig.chargetemplow); + $("#chargetemphigh").val(data.chargeconfig.chargetemphigh); + $("#dischargetemplow").val(data.chargeconfig.dischargetemplow); + $("#dischargetemphigh").val(data.chargeconfig.dischargetemphigh); + + + $("#stopchargebalance").prop("checked", data.chargeconfig.stopchargebalance); + $("#socoverride").prop("checked", data.chargeconfig.socoverride); + $("#socforcelow").prop("checked", data.chargeconfig.socforcelow); + $("#dynamiccharge").prop("checked", data.chargeconfig.dynamiccharge); + $("#preventcharging").prop("checked", data.chargeconfig.preventcharging); + $("#preventdischarge").prop("checked", data.chargeconfig.preventdischarge); + + DrawChargingGraph(); + }).fail(function () { + $.notify("Request failed", { autoHide: true, globalPosition: 'top right', className: 'error' }); + } + ); + + return true; + }); $("#storage").click(function () { $(".header-right a").removeClass("active"); $(this).addClass("active"); @@ -1526,11 +1840,11 @@ $(function () { if (data.storage.sdcard.files) { $.each(data.storage.sdcard.files, function (index, value) { if (value != null) { - link="" + value + ""; - if (value.startsWith("backup_config_")) { - link+=""; + link = "" + value + ""; + if (value.endsWith(".json") && value.startsWith("backup_config_")) { + link += ""; } - $("#sdcardfiles").append("
          • "+link+"
          • "); + $("#sdcardfiles").append("
          • " + link + "
          • "); } }); } @@ -1547,7 +1861,11 @@ $(function () { if (data.storage.flash.files) { $.each(data.storage.flash.files, function (index, value) { if (value != null) { - $("#flashfiles").append("
          • " + value + "
          • "); + link = "" + value + ""; + if (value.endsWith(".json") && (value.startsWith("cfg_") || value.startsWith("upld_"))) { + link += ""; + } + $("#flashfiles").append("
          • " + link + "
          • "); } }); } @@ -1577,6 +1895,23 @@ $(function () { }); }); + $("#rulesForm").unbind('submit').submit(function (e) { + e.preventDefault(); + $.ajax({ + type: $(this).attr('method'), + url: $(this).attr('action'), + // Filter to only elements which have changed + data: $("#rulesForm input.rule.modified, #rulesForm select.rule.modified").serialize(), + success: function (data) { + showSuccess(); + //Force reload of values to refresh the input boxes/attributes + loadRelayRules(); + }, + error: function (data) { + showFailure(); + }, + }); + }); $("#diybmsCurrentMonitorForm2").unbind('submit').submit(function (e) { e.preventDefault(); @@ -1595,12 +1930,6 @@ $(function () { currentmonitorSubmitForm(this); }); - /* - $("#victronForm1").unbind('submit').submit(function (e) { - e.preventDefault(); - }); - */ - $("#globalSettingsForm").unbind('submit').submit(function (e) { e.preventDefault(); @@ -1702,8 +2031,69 @@ $(function () { $(this).removeClass("hover"); }); + $(".stat").click(function () { + if ($(this).hasClass("vistile") == false && $(this).hasClass(".hide") == false) { + $(this).addClass("vistile"); + } else { + $(this).removeClass("vistile"); + } + + clearTimeout(timer_postTileVisibiltity); + timer_postTileVisibiltity = setTimeout(postTileVisibiltity, 3500); + }); + + $("#file_sel").change(function () { upload_firmware(); }); + $("#uploadfw").click(function () { $("#file_sel").click(); }); + + $("#uploadfile").click(function () { $("#uploadfile_sel").click(); }); + $("#uploadfile_sel").change(function () { upload_file(); }); + + $("#progress").hide(); + $("#homePage").show(); + + //Redraw graph if one of the values changes (and focus lost) + $("#chargecurrent") + .add("#cellminmv") + .add("#cellmaxmv") + .add("#kneemv") + .add("#cellmaxspikemv") + .add("#cur_val1") + .add("#cur_val2").focusout(function () { + DrawChargingGraph(); + }); + + $("#chargecurrent") + .add("#cellminmv") + .add("#cellmaxmv") + .add("#kneemv") + .add("#cellmaxspikemv") + .add("#cur_val1") + .add("#cur_val2").change(function () { + DrawChargingGraph(); + }); + + //On page ready queryBMS(); + + + //Automatically open correct sub-page based on hash + var hash = $(location).attr('hash'); + switch (hash) { + case "#tiles": + case "#modules": + case "#rules": + case "#settings": + case "#charging": + case "#integration": + case "#currentmonitor": + case "#storage": + case "#avrprogrammer": + case "#utility": + $(hash).click(); + break; + } + }); // end $(function () diff --git a/ESPController/web_src/softap.htm b/ESPController/web_src/softap.htm deleted file mode 100644 index 65376222..00000000 --- a/ESPController/web_src/softap.htm +++ /dev/null @@ -1,44 +0,0 @@ - - - -DIYBMS WIFI Configuration - - - - -
            -

            DIY BMS v4

            -

            WiFi Setup

            -

            Select local WIFI to connect to:

            -
            -
            - - -
            -
            - - -
            -
            -
            - -
            -
            -
            - - \ No newline at end of file diff --git a/ESPController/web_src/style.css b/ESPController/web_src/style.css index fc6ece27..6533cb31 100644 --- a/ESPController/web_src/style.css +++ b/ESPController/web_src/style.css @@ -1,196 +1,105 @@ -@viewport { width: device-width ; zoom: 1.0 ;} +@import "https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap"; *{box-sizing:border-box} -body{margin:0;font-family:Arial,Helvetica,sans-serif;font-size:12pt;} -h2 {margin:0;} -p {margin-block-start: 1em; margin-block-end:0;} -.header{overflow:hidden;padding:20px 10px} +body,html{height:100%} +body{margin:0;font-family:Arial,Helvetica,sans-serif;font-size:12pt;background-color:#000;color:#e8e8e8;background-image:linear-gradient(to bottom,#212121,#272727,#2e2e2e,#343434,#3b3b3b,#393939,#363636,#343434,#282828,#1d1d1d,#121212,#000)} +h2{margin:0} +p{margin-block-start:1em;margin-block-end:0} +.header{overflow:hidden;padding:5px 5px} .header a{float:left;text-align:center;padding:12px;text-decoration:none;font-size:18px;line-height:25px;border-radius:4px} .header a.logo{font-size:25px;font-weight:700} .header-right{float:right} -.logocontainer{float:left;width:191px;height:52px;} - -.flexgrid {width:100%;display:flex;flex-wrap:wrap;justify-content:left;} -.flexgrid > div {flex:1;} -.info {width:100%;padding:4px;display:flex;flex-wrap:wrap;justify-content:center;} -.info > div {flex:1;} - -.info .stat {border:dotted 2px #808080;padding:2px;margin:2px;max-width:175px;min-width:95px;} -.info .stat .x {display:block;width:100%;text-align:right;} -.info .stat .t {font-size:10pt;color:#c1bdbd;} -.info .stat .v {font-size:22pt;font-family: 'Fira Code', monospace;font-weight:bold;color: #55a1ea;} -.stat.hover {border:solid 2px #55a1ea; } - -.graphs {height:670px;width:99%;} -.ct-series-a .ct-bar {stroke-width:25px;} -button {border-radius:6px;color:white;background-color:#1e90ff;font-family:Arial,Helvetica,sans-serif;font-weight:bold;border:solid 1px transparent;text-align:center;text-decoration:none;display:inline-block;font-size:14px;min-width:40pt;padding:6px;margin:1px;} -button.small { font-size:65%pt;padding:1px;border-radius: 4px;} -form > div > div {padding-bottom:4px;padding-top:4px;} -form label {width:220px;display:inline-block;text-align:right;font-size:smaller;} -form input {width:100px;display:inline-block;padding-left:5px;padding-right:5px;margin-left:5px;font-family: 'Fira Code', monospace;} -form input[type='input'] {width:225px;} - -input[type='close'] {width:150pt;padding:10px;} -button[type='submit'] {width:175pt;padding:10px;} - -button:hover {background-color: #0066cc;} -button:focus {border-color: white;} - -.error {padding:10px;display:none; width:100%;} -.success {padding:10px;display:none; width:100%;} -.warning {padding:10px;display:none; width:100%;} -.page {clear:both; width:100%; display:none;margin-top:5px;} -.page .region {float:left;padding:8px;margin-right:8px;width:45%;margin-bottom:8px;min-height:245px;} -#modulesTable { width:100%; border-collapse: collapse; } -#modulesTable tbody tr td {font-family: 'Fira Code', monospace;text-align:right;} -#modulesTable thead tr th {text-align:right;} -#loading {width:64px;position:absolute;height:64px;margin-left: auto;margin-right: auto;padding: 0;top:50%;left:50%;} - -@media screen and (max-width:1024px){ - .page .region {width:98%;} - .header a {float:none;padding:6px;font-size:14px;line-height:20px;} - .graphs {height:475px;width:99%;} - .info .stat .t {font-size:8pt;} - .info .stat .v { font-size:12pt;} - form label {width:160px;} - form input[type='input'] {width:175px;} - - #modulesTable .hide {display:none;} - #modulesTable .rows span {min-width:65px;} - #modulesTable .rows button {margin-left:2px;} - #modulesTable .th span {min-width:65px} - - .logo{width:75px;height:20px;} - .logocontainer {width:80px;height:28px;} -} - -/* Blue style */ -body{background-color: white;} -.header{background-color:#d4f0fb} -.header a{color:#000;} -.header a:hover{background-color:#ddd;color:#000} -.header a.active{background-color:#1e90ff;color:#fff} -.ct-series-a .ct-bar {stroke:blue;} -.error {color:#D8000C;background-color:#FFBABA;} -.warning {color:#000000;background-color:#ff9933;} -.success {color:#000000;background-color:#49BE3B;} -.triggered {background-color:#FFBABA;} - - -/* Dark colours -#525252, #414141, #313131, #ca3e47 -*/ -body{background-color: #313131;color:#e8e8e8;} -a {color:#e8e8e8;font-weight:bold;} -a:visited {color:#e8e8e8;font-weight:bold;} -.header{background-color:#414141} -.error {color:#414141;background-color:#ca3e47;} - - -#ExternalIO {color:#414141;background-color:#ca3e47;} - -.success {color:#414141;background-color:#44913b;} -.warning {color:#414141;background-color:#dc7b1a;} -.header a{color:#c1bdbd;} +.header{background-color:transparent} +.header a{color:#c1bdbd} .header a:hover{background-color:#c1bdbd;color:#414141} .header a.active{background-color:#525252;color:#c1bdbd} - - - -.ct-series-a .ct-bar {stroke:#525252;} - -.triggered {background-color:rgb(68, 145, 59);} -.disablerule {text-decoration: line-through; background-color: #525252;} -.page .region {background-color:#525252;} - - -.page .region.wide {width:98%;} - -.hidden {visibility: hidden;} -.rule input { width:100px; } -th {font-family:Arial,Helvetica,sans-serif;text-align:center;font-size:14px;} -.relayset select { min-width:50px; } -.settings label { min-width:285px;width:auto;} - -.warnicon { float:left; margin-right:8px;} -#avrprogconfirm { border: solid 4px #313131; padding: 16px 8px 25px 8px; } - - -.overlay { - height: 0%; - width: 100%; - position: fixed; - z-index: 1; - left: 0; - top: 0; - background-color: rgb(0,0,0); - background-color: rgba(0,0,0, 0.8); - overflow-x: hidden; - transition: 0.6s; -} - -.overlay-content { - position: relative; - top: 25%; - width: 100%; - text-align: center; - margin-top: 30px; -} - -.overlay a { - padding: 8px; - text-decoration: none; - font-size: 36px; - color: #818181; - display: block; - transition: 0.3s; -} - -.overlay a:hover, .overlay a:focus { - color: #f1f1f1; -} - -.overlay .closebtn { - position: absolute; - top: 20px; - right: 45px; - font-size: 60px; +.logocontainer{float:left;width:191px;height:52px} +.flexgrid{width:100%;display:flex;flex-wrap:wrap;justify-content:left} +.flexgrid>div{flex:1} +.info{width:100%;padding:4px;display:flex;flex-wrap:wrap;justify-content:center} +.info>div{flex:1} +.info .stat{border:solid 2px #404040;padding:2px;margin:2px;max-width:175px} +.info .stat .x{display:block;width:100%;text-align:right} +.info .stat .t{font-size:10pt;color:#c1bdbd} +.info .stat .v{font-size:22pt;font-family:'Share Tech Mono',monospace;font-weight:700;color:#55a1ea} +.stat.hover{border:solid 2px #55a1ea!important} +.info .vistile{border:dotted 2px #848484} +.graphs{height:670px;width:99%} +.ct-series-a .ct-bar{stroke-width:25px} +button{border-radius:6px;color:#fff;background-color:#1e90ff;font-family:Arial,Helvetica,sans-serif;font-weight:700;border:solid 1px transparent;text-align:center;text-decoration:none;display:inline-block;font-size:14px;min-width:40pt;padding:6px;margin:1px} +button.small{font-size:65%pt;padding:1px;border-radius:4px} +form>div>div{padding-bottom:4px;padding-top:4px} +form label{width:220px;display:inline-block;text-align:right;font-size:smaller} +form input{width:100px;display:inline-block;padding-left:5px;padding-right:5px;margin-left:5px;font-family:'Share Tech Mono',monospace} +form input[type='input']{width:225px} +input.modified,select.modified{border-color:#49BE3B;border-style:dashed;border-width:2px} +input[type='close']{width:150pt;padding:10px} +button[type='submit']{width:175pt;padding:10px} +button:hover{background-color:#06c} +button:focus{border-color:#fff} +.error{padding:10px;display:none;width:100%} +.success{padding:10px;display:none;width:100%} +.warning{padding:10px;display:none;width:100%} +.page{clear:both;width:100%;display:none;margin-top:5px} +.page .region{float:left;padding:8px;margin-right:8px;width:45%;margin-bottom:8px;min-height:240px} +#modulesTable{width:100%;border-collapse:collapse} +#modulesTable tbody tr td{font-family:'Share Tech Mono',monospace;text-align:right} +#modulesTable thead tr th{text-align:right} +#loading{width:64px;position:absolute;height:64px;margin-left:auto;margin-right:auto;padding:0;top:50%;left:50%} + +@media screen and (max-width:1024px) { +.page .region{width:98%} +.header a{float:none;padding:6px;font-size:14px;line-height:20px} +.graphs{height:475px;width:99%} +.info .stat .t{font-size:8pt} +.info .stat .v{font-size:12pt} +form label{width:160px} +form input[type='input']{width:175px} +#modulesTable .hide{display:none} +#modulesTable .rows span{min-width:65px} +#modulesTable .rows button{margin-left:2px} +#modulesTable .th span{min-width:65px} +.logo{width:75px;height:20px} +.logocontainer{width:80px;height:28px} +.settings label{min-width:auto!important} } -/* When the height of the screen is less than 450 pixels, change the font-size of the links and position the close button again, so they don't overlap */ +.ct-series-a .ct-bar{stroke:blue} +.error{color:#D8000C;background-color:#FFBABA} +.warning{color:#000;background-color:#f93} +.success{color:#000;background-color:#49BE3B} +a{color:#e8e8e8;font-weight:700} +a:visited{color:#e8e8e8;font-weight:700} +.error{color:#414141;background-color:#ca3e47} +#ExternalIO{color:#414141;background-color:#ca3e47} +.success{color:#414141;background-color:#44913b} +.warning{color:#414141;background-color:#dc7b1a} +.ct-series-a .ct-bar{stroke:#525252} +.triggered{background-color:#529624} +.disablerule{text-decoration:line-through;background-color:#525252} +.page .region{background-color:#525252} +.page .region.wide{width:98%} +.hidden{visibility:hidden} +.rule input{width:100px} +th{font-family:Arial,Helvetica,sans-serif;text-align:center;font-size:14px} +.relayset select{min-width:50px} +.settings label{min-width:285px;width:auto} +.warnicon{float:left;margin-right:8px} +#avrprogconfirm{border:solid 4px #313131;padding:16px 8px 25px} +.overlay{height:0;width:100%;position:fixed;z-index:1;left:0;top:0;background-color:#000;background-color:rgba(0,0,0,0.8);overflow-x:hidden;transition:.6s} +.overlay-content{position:relative;top:25%;width:100%;text-align:center;margin-top:30px} +.overlay a{padding:8px;text-decoration:none;font-size:36px;color:#818181;display:block;transition:.3s} +.overlay a:hover,.overlay a:focus{color:#f1f1f1} +.overlay .closebtn{position:absolute;top:20px;right:45px;font-size:60px} @media screen and (max-height: 450px) { - .overlay a {font-size: 20px} - .overlay .closebtn { - font-size: 40px; - top: 15px; - right: 35px; - } -} - -#avrprogconfirm ul {padding-left:68px;} - -form input:read-only { - background-color: transparent; - color: white; - border: solid 1px #808080; -} - -.notify-container { - position: relative; - display: inline-block; - margin-top: 0px; -} - -.notify-bubble { - position: absolute; - top: -2px; - right: -2px; - padding: 2px 5px 2px 5px; - background-color: #1e90ff; - color: white; - font-size: 0.85em; - border-radius: 50%; - box-shadow: 2px 2px 2px gray; - display: none; +.overlay a{font-size:20px} +.overlay .closebtn{font-size:40px;top:15px;right:35px} } +#avrprogconfirm ul{padding-left:68px} +form input:read-only{background-color:transparent;color:#fff;border:solid 1px gray} +.notify-container{position:relative;display:inline-block;margin-top:0} +.notify-bubble{position:absolute;top:-2px;right:-2px;padding:2px 5px;background-color:#1e90ff;color:#fff;font-size:.85em;border-radius:50%;box-shadow:2px 2px 2px gray;display:none;font-family:'Share Tech Mono',monospace} +.progress{margin:15px auto;max-width:500px;height:30px} +.progress .progress__bar{height:100%;width:1%;border-radius:15px;background:repeating-linear-gradient(135deg,#336ffc,#036ffc 15px,#1163cf 15px,#1163cf 30px)} +.status{font-weight:700;font-size:30px} \ No newline at end of file